[Thread Prev][Thread Next][Index]

Of possible interest to ferret users



On Apr 28,  2:19pm, Grigory Monterey wrote:
> >> I try to read in ferret binary file generated in FORTRAN as follows:
> >>    DIMENSION U(10,10),V(10,10)
> >>    ...
> >>    OPEN (UNIT=80,FILE='FILENAME',FORM='UNFORMATTED'...)
> >>    WRITE(80) U,V
>
> >Now, here is ferret code that will read the file and do just what you want:
> >
> >define axis/x=1:10:1 x10                                ! same x axis
> >define axis/y=1:10:1 y10                                ! same y axis
> >define axis/z=1:2:1 z2                                  ! Notice new z axis
> >define grid/x=x10/y=y10/z=z2 g10x10                     ! 3D grid defined
> >file/var=uv/grid=g10x10/columns=200/format=unf filename ! 1 var for both
> >let u=uv[k=1]                                           ! Here's your old u
> >let v=uv[k=2]                                           ! Here's your old v
> >vector/len=1./xskip=1/yskip=1 u,v                       ! Same vector
command
> >
>
> It would be helpfull if you send me a generalization of your
> example to the case of three-dimensional velocity field, e.g.
>
>       DIMENSION U(360,180,33), V(360,180,33)
> ...
>       OPEN (UNIT=80,FILE='FILENAME',FORM='UNFORMATTED'...)
>       WRITE(80) U,V
>
> The ferret task would be to plot (U,V) vector field at a specified level.

Hi Grigory, you sent this message just to me but I am also going to post it to
the ferret listserver since I think many people would be interested in the
answer.

The trick I suggested above for the 2-d data set isn't as appropriate for what
you want to do. Instead I suggest using symbolic links. For example:

Assume you have the file "FILENAME" written as above with 2 variables
dimensioned 360x180x33. In unix, make 2 (or 1) symbolic link(s)

ln -s FILENAME u.dat
ln -s FILENAME v.dat

You really only need one of these (giving you the original file and the
symbolic link file - but I think the 2 links is cleaner). Now you have the
following if you do a list:

-rw-r--r--    1 markv    coaps    17107208 Apr 29 10:07 FILENAME
lrwxr-xr-x    1 markv    coaps          8 Apr 29 10:19 u.dat -> FILENAME
lrwxr-xr-x    1 markv    coaps          8 Apr 29 10:19 v.dat -> FILENAME

Start ferret

yes? define axis/x=1:360:1 myx
yes? define axis/y=1:180:1 myy
yes? define axis/z=1:33:1 myz
yes? define grid/x=myx/y=myy/z=myz myg   ! DEFINE GRID HOWEVER YOU LIKE
yes? file/var=U/grid=myg/format=stream/skip=1       u.dat
yes? file/var=V/grid=myg/format=stream/skip=2138401 v.dat

The skip=1 for u.dat skips the record length, the skip for v.dat skips over the
record length (1) and the u record (360*180*33, total=360*180*33+1). Now you
can simply refer to u[d=1], and v[d=2]

Mark

-- 
-------------------------------------------------------------------------------

	      Mark Verschell (verschell@coaps.fsu.edu)
	      Center for Ocean and Atmospheric Prediction Studies
	      Florida State University
              2035 E. Paul Dirac Drive
              R.M. Johnson Bldg. - Suite 200
	      Tallahassee, FL  32306-3041
	      (904) 644-6532              (904) 644-4841 (fax)


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement