integer FUNCTION bmf_get2(name,time1,time2,hgrid,vgrid,array,imin,imax,jmin,jmax,kmin,kmax) &
result(error)
ARGUMENTS
| name |
Name of the variable to be retrieved |
character(len=4) |
I |
| time1,time2 |
Timestamps yyyymmdd hhmmsscc |
integer |
I |
| hgrid,vgrid |
Horizontal and vertical grid tag |
integer |
I |
| array |
Array of the variable to be retrieved |
All supported types |
I/O |
| [ijk]min,[ijk]max |
Dimension of the array |
integer |
I |
DESCRIPTION
Routine that puts in the appropriate array the data retrieved by bmf_gobe
or bmf_blocgobe.
The array must be shaped by following those rules: ( imin:imax , jmin:jmax ,
kmin:kmax ) where
imin <= 1 < ni <= imax
jmin <= 1 < nj <= jmax
kmin <= 1 < nk <= kmax,
ni,nj,nk are the attributes of the corresponding field (see bmf_write)
Then, it is possible to... (here, a,b >=0):
- ...write a field of size (1:nx,1:ny,1:nz) with bmf_write and to
retrieve it with bmf_get2 in a larger array
- .. write a field of (1-a : nx+a , 1:ny , 1:nz ) with bmf_write (call
bmf_write with ni = nx + 2a, istart=1, iend=nx+2a) and to read it in an
array of (minx: maxx , miny:maxy , minz,maxz ) where minx <=1-a
<=nx +2a <= maxx (call bmf_get2 with imin=minx+a , imax= maxx+a)
- ... write a field of (1+a : nx-b,1:ny,1:nz) (obviously we have 1+a
< nx -b) with a standard call to bmf_write. We read the field in an
array of (minx: maxx , miny:maxy , minz,maxz ) with a normal call to
bmf_get2.
EXAMPLE
call bmf_init
length=bmf_gobe(filename)
! NOTE for performance purpose, it would be better here to call a subroutine
! using "length" for dimensionning the arrays if the catalog
! is read often. DO NOT FORGET to deallocate those arrays
allocate(ni(length),nj(length,nk(length))
allocate(dtyp(length),hgrid(length),vgrid(length))
allocate(nom(length),time1(length),time2(length))
allocate(ndata(length),scrap(length))
call bmf_catalog(nom,ni,scrap,scrap,nj,scrap,scrap,nk, &
scrap,scrap,time1,time2,hgrid,vgrid,dtyp,scrap,ndata)
trouve=.false.
do i=1,length
if(nom(i).eq.'HUMI') then
trouve=.true.
allocate(humi(ni(i),nj(i),nk(i)))
endif
if(trouve) exit
enddo
err = bmf_get2('HUMI',time1(ivar),time2(ivar), &
hgrid(ivar),vgrid(ivar),humi,1,ni(ivar),1,nj(ivar),1,nk(ivar))
call bmf_clear
deallocate(ni,nj,nk,dtyp,hgrid,vgrid,time1,time2,nom,ndata,scrap)
SEE ALSO
BMF_*
Author: Luc Corbeil, February 24 2003, 13h22
Return to RPN Librairies home page