[Thread Prev][Thread Next][Index]

Re: Reading Fortran data files



Hello, 
  Another similiar question in the following:
     parameter(mi=72,mj=45,msea=5)
      real map1(mi,mj)
       open(1,form='unformatted',file='data.dat',access='direct',recl=mi*mj)

       do is=1,msea
        write(1,rel=is)  map1
      enddo

   How can read this data.dat using ferret? I try it sometimes, but i failed.
   By the way, I can read the above data.dat using Matlab, using fread(fp1,[72,45],'float32'). But I must using ferret to read it for graphic output.


   ---------------------------------------------
  Wang WeiQiang
  LED, South China Sea Institute of Oceanology
  Chinese Academy of Sciences
  164 West Xingang Rd., Guangzhou 510301
  P. R. China
--------------------------------------------   


----- Original Message ----- 
From: "Aiguo Dai" <adai@ucar.edu>
To: <ferret_users@ferret.wrc.noaa.gov>
Sent: Friday, July 20, 2001 2:08 AM
Subject: Reading Fortran data files


> Try this again:
> > Hello,
> >
> > I was trying to read Fortran 77 files similar to the following one:
> >
> >       parameter(mi=72,mj=45,msea=5)
> >       real map1(mi,mj),map2(mi,mj),map3(mi,mj)
> >
> >       open(1,form='unformatted',file='data.dat')
> >
> >        do is=1,msea
> >         write(1)map1,map2,map3
> >        enddo
> >
> > using Ferret scripts:
> >
> > def axis/x=180W:180E/npoint=72/unit="degrees_east" lon
> > def axis/y=90S:90N/npoint=45/unit="degrees_north" lat
> > def axis/t=1:5:1 time
> > def grid/x=lon/y=lat/t=time g5x4
> > file/format=unformatted/var=amp,pha,avg/col=9720/grid=g5x4 data.dat
> > !
> > set var/bad=-99999. amp
> > set var/bad=-99999. pha
> >
> > However, the maps for amp[l=1], ..., amp[l=5], and pha are incorrect.
> >
> > Any suggestions would be appreciated for reading this types of data
> > files (also for cases with only map1 and map2 written). Thanks lot.
> >
> > -Aiguo Dai, NCAR, Boulder, CO


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement