"define" values are different. why?

Mary Jo Nath Mary-Jo.Nath at NOAA.GOV
Thu Jun 14 12:29:10 EDT 2007


Hi,

I wasn't able to find anything on the board regarding this issue. Maybe
someone can explain why do I get different values in the script (below)
for the defined variable "a" & "b" ? ("b" and "c" are the same and
correct.)  I would expect a = b = c regardless of how I access the
values of those variables.

Below is the full script and the results. The data file is attached if
anyone would like to run the script on their machine . If you get
different results, please let me know.

(I'm using Config: v1.9b4 32-bit little-endian on a Linux workstation. I
get the same results, though, using older versions 1.7beta9 and 1.8SL10.)

 I think this is occurring because of this data's grid, where X=1 is
longitude 1.25E instead of 0E. By default GrADS maps "set lon 0 360"
into "X = 0.5 to 144.5", so however "define" works, GrADS returns  the
proper value for "a" if "set x 30" is done first, but doesn't return the
expected value if you do
"d a(x=30)". Variables "b" and "c" work because I explicitly "set x 1
144" or "set lon 1.25 358.75" (which correspond to X=1 and X=144 ).

When I ran a similar script using NCEP data which starts at Lon = 0., I
didn't have this problem.

Thanks,
Mary Jo

SCRIPT:

sdfopen model.slp.nc
set lat 0
q dims
define a=slp
set x 1 144
q dims
define b=slp
set lon 1.25 358.75
q dims
define c=slp
set x 30
d a
d b
d c
d a(x=30)
d b(x=30)
d c(x=30)
d a-b
d a(x=30)-b(x=30)
d a-c
d a(x=30)-c(x=30)
d b-c
d b(x=30)-c(x=30)


RESULTS:

*sdfopen /net2/mjn/model.slp.nc*
Scanning self-describing file:  /net2/mjn/model.slp.nc
SDF file /net2/mjn/model.slp.nc is open as file 1
LON set to 0 360
LAT set to -89.4944 89.4944
LEV set to 0 0
Time values set: 1870:1:16:12 1870:1:16:12
*set lat 0*
LAT set to 1.01124 1.01124
*q dims*
Default file number is: 1
X is varying   Lon = 0 to 360   X = 0.5 to 144.5
Y is fixed     Lat = 1.01124  Y = 46
Z is fixed     Lev = 0  Z = 1
T is fixed     Time = 12Z16JAN1870  T = 1
*define a=slp*
Define memory allocation size = 584 bytes
*set x 1 144*
LON set to 1.25 358.75
*q dims*
Default file number is: 1
X is varying   Lon = 1.25 to 358.75   X = 1 to 144
Y is fixed     Lat = 1.01124  Y = 46
Z is fixed     Lev = 0  Z = 1
T is fixed     Time = 12Z16JAN1870  T = 1
*define b=slp*
Define memory allocation size = 576 bytes
*set lon 1.25 358.75*
LON set to 1.25 358.75
*q dims*
Default file number is: 1
X is varying   Lon = 1.25 to 358.75   X = 1 to 144
Y is fixed     Lat = 1.01124  Y = 46
Z is fixed     Lev = 0  Z = 1
T is fixed     Time = 12Z16JAN1870  T = 1
*define c=slp*
Define memory allocation size = 576 bytes
*set x 30*
LON set to 73.75 73.75
*d a*
Result value = 1010.45
*d b*
Result value = 1010.45
*d c*
Result value = 1010.45
*d a(x=30)*
Result value = 1010.57   /<==== ????/
*d b(x=30)*
Result value = 1010.45
*d c(x=30)*
Result value = 1010.45
*d a-b*
Result value = 0
*d a(x=30)-b(x=30)*
Result value = 0.122498  /<==== a != b/
*d a-c*
*Result value = 0
d a(x=30)-c(x=30)*
Result value = 0.122498  /<=== a != c/
*d b-c*
Result value = 0
*d b(x=30)-c(x=30*)
Result value = 0
EOF EXECuting test_script
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20070614/0a4ac424/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: model.slp.nc
Type: application/x-netcdf
Size: 55928 bytes
Desc: not available
Url : http://gradsusr.org/pipermail/gradsusr/attachments/20070614/0a4ac424/attachment.nc 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test_script
Url: http://gradsusr.org/pipermail/gradsusr/attachments/20070614/0a4ac424/attachment.pl 


More information about the gradsusr mailing list