Writing to GrADS using Fortran
Sestak, Dr. Michael
michael.sestak at FNMOC.NAVY.MIL
Wed Apr 20 16:57:46 EDT 2005
To explain:
Since grads data is read in the order x,y,z,variable,time and from Fortran,
files are usually written as one x,y grid per record, a dataset which varies
only in variables and time would be written as
record 1 = variable1 for x=1,y=1,z=1,t=1
record 2 = variable2 for x=1,y=1,z=1,t=1
record 3 = variable1 for x=1,y=1,z=1,t=2
record 4 = variable2 for x=1,y=1,z=1,t=2
record 5 = variable1 for x=1,y=1,z=1,t=3
record 6 = variable2 for x=1,y=1,z=1,t=3
and so on, one value (4 bytes) per record.
If you write everything in the same order, but as a single record 4 bytes *
2 variables * 109 times long, that should work also. Your version writes
all the times for one variable, then all the times for another variable, but
grads reads all the variables for one time, then all the variables for the
next time and so on.
-----Original Message-----
From: Eric DeWeaver [mailto:deweaver at AOS.WISC.EDU]
Sent: Wednesday, April 20, 2005 11:36 AM
To: GRADSUSR at LIST.CINECA.IT
Subject: Re: Writing to GrADS using Fortran
Hi Ed,
You have recl=4*109, but I think you should have recl=4.
With recl=4*109 you put
write(14, rec=i) ie(itime)
and the Fortran code will write one single precision real number, followed
by (I think) 108 zeros to fill out the direct access record. So in grads
you should see ie(1), followed by 108 zero values, followed by data1(1).
Good luck,
Eric DeWeaver
On Wed, 20 Apr 2005, Ed Blanchard wrote:
> Hi Mark, thanks for your reply, unfortunately I am not getting any
results.
>
> I change the fortran code to
>
>
open(14,file='scatter.grd',form='unformatted',status='new',access='direct',r
ecl=4*109)
> do itime=1, 109
> write(14,rec=1+2*(itime-1)) IE(itime)
> write(14,rec=2+2*(itime-1)) data1(3,itime+391)
> enddo
> close(14)
>
> with the following .ctl file
>
> DSET scatter.grd
> TITLE HGT
> UNDEF -99
> TDEF 109 LINEAR 1aug90 1mo
> XDEF 1 LINEAR 1 1
> YDEF 1 LINEAR 1 1
> ZDEF 1 LINEAR 1 1
>
> VARS 2
> IE 1 99 HT data
> data1 1 99 HT data
> ENDVARS
>
> when plotting the data, it only shows IE(1), all others IE(2 to 109) and
> data1(1 to 109) are still 0. Any ideas?
>
> Ed
>
More information about the gradsusr
mailing list