[gradsusr] Problem with fwrite and CTL file
Mubashar Dogar
mubashardogar at gmail.com
Wed Sep 1 17:30:21 EDT 2010
Dear Doug,
Thanks a lot. Your idea works.
Regards,
Mubashar
Message: 3
Date: Tue, 31 Aug 2010 16:34:41 +0100
From: "Clark, Douglas B" <dbcl at ceh.ac.uk>
Subject: Re: [gradsusr] Problem with fwrite and CTL file
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
<40829B0E077C1145A6DE44D39B3830A91B31A6EFC1 at nerckwmb1.ad.nerc.ac.uk>
Content-Type: text/plain; charset="us-ascii"
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-0001.html
------------------------------
Message: 4
Date: Tue, 31 Aug 2010 12:03:19 -0400
From: Stephen McMillan <smcmillan at planalytics.com>
Subject: Re: [gradsusr] Problem with fwrite and CTL file
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
<AANLkTik9O0TcX0gb88GjZidL8k6MNQ7q3WRsUAVS++At at mail.gmail.com<AANLkTik9O0TcX0gb88GjZidL8k6MNQ7q3WRsUAVS%2B%2BAt at mail.gmail.com>
>
Content-Type: text/plain; charset=ISO-8859-1
Mubashar,
Adding to Doug's comments, I noticed you initialized t at 5. Does
that correspond to your initial January timestep?
Stephen Mc
On Tue, Aug 31, 2010 at 11:18 AM, Mubashar Dogar
<mubashardogar at gmail.com> wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20100902/93142ab5/attachment.html
More information about the gradsusr
mailing list