[Thread Prev][Thread Next][Index]

Re: [ferret_users] axis and average 'problems'



Hi Izidine -
The average is computed as a weighted average: The sum of the data at the grid location times the size of the grid box in which it lies, divided by the sum of the lengths of the grid boxes.

If you look at the documentation for all of the transformation, @AVE, @DIN, etc., you'll see this:
See the General Information on transformations for important details about this transformation.
That link leads to a section about the details of specifying the region over which transformations are to be computed. For @AVE, we've added another note (and maybe we should do that for the rest of the transformations, as this question comes up a lot).
 In particular, note the discussion about specifying the averaging interval in world coordinates, e.g. longitude, meters, time as in var[x=3.4:4.6@AVE] versus specifying the interval using indices, as in var[I=4:12@AVE]. When the interval is expressed in world coordinates, the weighting is done using partial grid boxes at the edges of the interval. If the interval is expressed using indices, the entire grid cells contribute to the weights.
For your question, this means that

  PR_rg[l=1:3@ave]

is the average of the data from January 1 through March 31; but
 
    PR_rg[T="15-JAN-1981":"15-MAR-1981"@ave]

is the average of the partial grid cells from January 15 to March 15.  The data in January and March are included in the average, each weighted by half a grid cell.

Ansley

On 11/19/2011 6:07 AM, Izidine Pinto wrote:
Dear ferret users

This might be  basic but I'm having problems.
I have a file which I would like to define a time axis, select a time/rergin of interest and average.

 sh d
     currently SET data sets:
    1>AFRICA_GPCC_CTL_GPCC5_MM_50km_1981-2009_pr.nc  (default)
 name     title                             I         J         K         L
 LON      longitude                        1:194     1:201     ...       ...
 LAT      latitude                         1:194     1:201     ...       ...
 TIME                                      ...       ...       ...       1:349
       (invalid coordinate axis)
 PR       Precipitation                    1:194     1:201     ...       1:349

yes? sh axis time

 name       axis              # pts   start                end
 TIME                         349 r   1                    349
   Axis span (to cell edges) = 349
yes? show data/attr
(time)                 DOUBLE    units           CHAR        30   T       days since 1950-01-01 00:00:00
                                 calendar        CHAR        8    T       standard
                                 orig_file_axnameCHAR        4    F       time

This is how I defined the axis
yes? DEFINE AXIS/T="15-JAN-1981:00:00":"15-DEC-2009:00:00":1/T0=01-JAN-1950:00:00:00/units=months/calendar=360_day/modulo tmonth
yes? DEFINE AXIS/X=-24.64:60.28:0.44/UNIT=DEGREE xlong
yes? DEFINE AXIS/Y=-45.64:42.24:0.44/UNIT=DEGREE ylat
yes? DEFINE GRID/X=xlong/Y=ylat/T=tmonth newgrid
yes? let PR_rg=PR[d=1,g=newgrid@asn]

For example the results of
PR_rg[l=1:3@ave]
and
PR_rg[T="15-JAN-1981":"15-MAR-1981"@ave]

are different.
Could anyone help me to understand why is this happening? And what would be the limit of  T equal to L.

Thanks in advance.



--

Izidine S. Pinto



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement