[gradsusr] Problem with fwrite and CTL file

Clark, Douglas B dbcl at ceh.ac.uk
Tue Aug 31 11:34:41 EDT 2010


Mubashar,

Is the file you wrote the correct size? (e.g. use 'ls -l' on unix)
I think you might find that it is slightly larger than expected because, I think, GrADS might repeat data around 0degE because of the way it sets the dimensions for a default global plot.
Use 'q dims' to see what the x grid cords are before the fwrite step. You might get something like "0 to 144" rather than the "1 to 144" you might expect. Then either explicitly add 'set x 1 144' in your script, or rewrite your final ctl file to have (say) 145 x points.

I'm guessing all this because I have made similar mistakes in the past!

Doug


From: gradsusr-bounces at gradsusr.org [mailto:gradsusr-bounces at gradsusr.org] On Behalf Of Mubashar Dogar
Sent: 31 August 2010 16:19
To: gradsusr at gradsusr.org
Subject: [gradsusr] Problem with fwrite and CTL file

Dear GrADS Users,

I have downloaded ECMWF (ERA40) data for surface temperature at 2.5 by 2.5 resolution for years 1958-2001. My intention was to see the trend for the month of January only. So I extracted all the Januaries between 1958-2001 in a binary/dat file by using the following commands in GrADS. When I tried to open this file by making a CTL (choosing the same x & y dimentions) and display January of any one year, the spatial picture is not the same as if I display the same January in original data file. Could you please help me?

Here is the script to create a binary/dat file
'reinit'
'open EraT2M.ctl'
'set gxout fwrite'
'set fwrite January.dat'
t=5
*tmax=6
tmax=532
while(t<=tmax)
'set t 't
'd no2tsfc-273.15'
t=t+12
endwhile
'disable fwrite'
'reinit'

Here is the control file to open the above January.dat file
DSET    january.dat
TITLE     Sample Data Set
UNDEF    -9.999E33
*OPTIONS    big_endian
OPTIONS   little_endian
*OPTIONS   template
xdef 144 linear 0 2.5
ydef 73 linear -90 2.5
ZDEF      1 LINEAR 1 1
TDEF     44 LINEAR 1JAN1958 1mon
VARS      1
no2tsfc 0  99  Surface Temperature_2m
ENDVARS


Regards,

Mubashar
-- 
This message (and any attachments) is for the recipient only NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100831/9a2723c0/attachment-0003.html 


More information about the gradsusr mailing list