A bug in asum() ? (sorry, this email is right)
Mying
mying at CITIZ.NET
Tue Sep 4 00:12:46 EDT 2007
Dear Stokes,
Thanks very much.
------------------
Mying
2007-09-04
-------------------------------------------------------------
发件人:Diane Stokes
发送日期:2007-09-03 23:25:06
收件人:GRADSUSR at LIST.CINECA.IT
抄送:
主题:Re: A bug in asum() ? (sorry, this email is right)
Mying,
From the Usage Notes for asum:
"The asum function always does its average to the exact boundaries
specified, in world coordinates. If the boundaries specified via the
dimension expressions do not fall on grid boundaries, then the boundary
values are weighted appropriately in the sum."
So, if you use lon/lat to define the limits in asum and specify the
center of a grid box as a corner point, only 1/4 of that grid box gets
included in the sum.
Because of the way your grid is defined, your statement
d asum(sst,lon=10,lon=12,lat=0,lat=2)
yields:
27.95*0.25 + 28.19*0.25 = 14.035
(There are only two terms because two grid boxes were undefined).
From the 2nd Usage Note in the online doc, when using x & y in asum,
the full grid box is included. Also, when using asumg, the full grid
box is included. So, with those two methods you get:
27.95 + 28.19 = 56.14
Diane
Mying wrote:
> Dear all,
>
> I found it in our forum about GrADS ( in chinese,
> http://bbs.lasg.ac.cn/cgi-bin/forum/topic.cgi?forum=3&topic=6583
> <http://bbs.lasg.ac.cn/cgi-bin/forum/topic.cgi?forum=3&topic=6583> )
>
> Is there a bug in asum ? ( I got same results in version 1.8sl11, x-win32)
>
> ~~~~~~ test result ~~~~~~data: "NOAA Extended Reconstructed SST V2"~~~
> ga-> q dims
> Default file number is: 1
> X is varying Lon = 10 to 12 X = 6 to 7
> Y is varying Lat = 0 to 2 Y = 45 to 46
> Z is fixed Lev = 0 Z = 1
> T is fixed Time = 00Z01JAN1854 T = 1
> ga-> d sst
> gxstart=0, gxstop=2, gystart=0, gystop=2.
> gzstart=0, gzstop=1, gtstart=0, gtstop=1.
> Printing Grid -- 4 Values -- Undef = 32767
> 27.95 32767 28.19 32767
> ga-> d asum(sst,x=6,x=7,y=45,y=46)
> gxstart=0, gxstop=4, gystart=0, gystop=4.
> gzstart=0, gzstop=1, gtstart=0, gtstop=1.
> Printing Grid -- 1 Values -- Undef = 32767
> 56.14
> ga-> d asum(sst,lon=10,lon=12,lat=0,lat=2)
> gxstart=0, gxstop=2, gystart=0, gystop=2.
> gzstart=0, gzstop=1, gtstart=0, gtstop=1.
> Printing Grid -- 1 Values -- Undef = 32767
> 14.035
> ga-> d aave(sst,lon=10,lon=12,lat=0,lat=2)
> gxstart=0, gxstop=2, gystart=0, gystop=2.
> gzstart=0, gzstop=1, gtstart=0, gtstop=1.
> Printing Grid -- 1 Values -- Undef = 32767
> 28.07
> ga-> d asumg(sst,lon=10,lon=12,lat=0,lat=2)
> gxstart=0, gxstop=2, gystart=0, gystop=2.
> gzstart=0, gzstop=1, gtstart=0, gtstop=1.
> Printing Grid -- 1 Values -- Undef = 32767
> 56.14
>
> ~~~~~~~~~~~~~~~~~~~
>
> thanks
>
> ------------------------------------------------------------------------
> Mying
> 2007-09-03
>
--
Diane Stokes
Environmental Modeling Center
National Weather Service/NOAA
More information about the gradsusr
mailing list