[Thread Prev][Thread Next][Index]

Re: Reading Fortran data files



Here is my example: It works for me.
    
open(30,file='/disk7/bhuang/scratch/byh/zav/adItYZ.dat'
     &       ,form='unformatted'
     1       ,recl=jdim*kdim*4,access='direct')
      write(nu,rec=1) vyzg
      write(nu,rec=2) vyzp
      write(nu,rec=3) vyza
file/format=stream/grid=yzgrid/var=arrT,arr2,arr3/col=3240
    adItYZ.dat

(1) jdim=74, kdim=45, 4=wordlength depend on computer
(2) please note the write style: I have three
sentences insteady of one.

Cheers.
--- Aiguo Dai <adai@cgd.ucar.edu> wrote:
> Thanks for reply to my message. Your suggestion
> still doesnot work
> (note the original file is sequential access):
> 
> ! Read Fortran binary (sequential) files:
> 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=stream/grid=g5x4/var=amp,pha,avg/col=3240
> "/data/pcm/adai/sfcWind/sfcT-diCycle-4sea76-97.r5x4"
> !file/format=unf/var=amp,pha/col=6480/grid=g5x4
> "/data/pcm/adai/sfcWind/sfcT-sdCycle-4sea76-97.r5x4"
> !
> !set reg/x=180W:180E/y=90S:90N
> !set reg/x=1:72/y=1:45
> set var/bad=-99999. amp
> set var/bad=-99999. pha
> quit
> yes? shade amp[l=1]
>  **ERROR: Can't open file
> sfcT-diCycle-4sea76-97.r5x4 for reading
> 
> 
> 
>  Aiguo Dai                                    email:
> adai@ucar.edu
>  Climate & Global Dynamics Division           phone:
> 303-497-1357
>  National Center for Atmospheric Research     FAX  :
> 303-497-2699
>  P.O. Box 3000, 1850 Table Mesa Drive
>  Boulder, CO  80307
>  homepage: http://www.cgd.ucar.edu/cas/adai/
> 
> 
> 
> On Thu, 19 Jul 2001, Boyin Huang wrote:
> 
> >
> > --- Aiguo Dai <adai@ucar.edu> wrote:
> > > 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
> >
> > Try
> >
>
file/format=stream/grid=g5x4/var=amp,pha,avg/col=3240
> > datafile
> >
> > It should work.
> >
> > Please let me know if problem maintains.
> >
> > Boyin Huang
> >
> > > 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
> >
> >
> > =====
> > Boyin Huang, Massachusetts Institute of
> Technology, Room 54-1721, 77 Mass. Ave., Cambridge,
> MA-02139, bhuang@wind.mit.edu, Tel. 617-253-5935
> (O), 781-485-0234(H), fax 617-253-6208
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Get personalized email addresses from Yahoo! Mail
> > http://personal.mail.yahoo.com/
> >
> 


=====
Boyin Huang, Massachusetts Institute of Technology, Room 54-1721, 77 Mass. Ave., Cambridge, MA-02139, bhuang@wind.mit.edu, Tel. 617-253-5935 (O), 781-485-0234(H), fax 617-253-6208

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement