BMF

(BMF_get, OBSOLETE)



integer FUNCTION bmf_get(nom,time1,time2,i4,r4,r8,imin,imax,jmin,jmax,kmin,kmax) &
result(error)

ARGUMENTS

i4 , r4 ou r8 will be considered as array of shape ( imin:imax , jmin:jmax , kmin:kmax )

DESCRIPTION

Routine that puts in the appropriate array the data retrieved by bmf_gobe. The use of dummy arguments for unneeded arrays is possible if "dtyp" is known in advance.

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):

  1. ...write a field of size (1:nx,1:ny,1:nz) with bmf_write and to retrieve it with bmf_get in a larger array
  2. .. 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_get with imin=minx+a , imax= maxx+a)
  3. ... 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_get.



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))
   allocate(nj(length))
   allocate(nk(length))
   allocate(dtyp(length))
   allocate(nom(length))
   allocate(time1(length))
   allocate(time2(length))
   allocate(ndata(length))
   allocate(scrap(length))
   call bmf_catalog(nom,ni,scrap,scrap,nj,scrap,scrap,nk, &
                      scrap,scrap,time1,time2,scrap,scrap,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)))
          ivar=i
      endif
      if(trouve) exit
   enddo
! We know that HUMI is an array of float, therefore we use -1
! for i4 and r8 since they will not be used
   err = bmf_get('HUMI',time1(ivar),time2(ivar),-1,humi,-1,1,ni(ivar),1,nj(ivar),1,nk(ivar))
   call bmf_clear   
   deallocate(ni)
   deallocate(nj)
   deallocate(nk)
   deallocate(dtyp)
   deallocate(nom)
   deallocate(time1)
   deallocate(time2)
   deallocate(ndata)
   deallocate(scrap)


SEE ALSO

BMF_*


Author: Luc Corbeil, April 6 2001, 12h45


Return to RPN Librairies home page