fwrite, multiple variables, multiple levels, multiple times
Mark
gemark at GEORGE2.AS.NTU.EDU.TW
Mon May 2 04:14:06 EDT 2005
Hi Dorita
It's very easy to fwrite.
I think the better way is that make your fwrite file as GrADS default.
It means that the data dimention should be x,y,x,var,time.
So, your gs file should look like this:
*********************************************************
'set fwrite output.bin'
'set gxout fwrite'
starttime=1 *<-- remember change it for your data
endtime=100 *<-- remember change it for your data
startlevel=1 *<-- remember change it for your data
endlevel=20 *<-- remember change it for your data
tt=starttime
while(tt<=endtime)
'set t 'tt
level=startlevel
while(level=endlevel)
'd var1(z='level')'
level=level+1
endwhile
level=startlevel
while(level=endlevel)
'd var2(z='level')'
level=level+1
endwhile
* and repeat these 5 lines for more variables
tt=tt+1
endwhile
'disable fwrite'
********************************************************
And remeber write variable lines in your ctl as:
var1 20 0 description of variable1
var2 20 0 description of variable2
...........................
...........................
I wish this example can help you some.
Mark
> Dear users,
>
> I am trying to create a *.dat file using fwrite. I succeeded to write a
> single variable at two vertical levels and one time frame, and to display
> it properly with the help of a proper *.ctl file.
> I want to create a multiple-variable multiple-level multiple-time *.dat
> file. I know how to write the proper *.ctl file.
> I do not know how to write the variables into the *.dat file properly.
> What should be the fwrite order? For each time frame I should write each
> variable at all vertical levels? Or should I write each variable at each
> vertical level and then the next vertical level? In other words, I have 3
> while loops here, how should they be ordered?
>
> Thanks a lot for your help.
>
> Dorita
More information about the gradsusr
mailing list