[Thread Prev][Thread Next][Index]

Re: [ferret_users] saving subregions



Hi Peter,
You're right. Ferret makes decisions about what points to include in any operation in terms of the grid cells rather than the coordinate points, so in this case as you found, requesting 31-MAR-23:59 returns the nearest coordinate value. This is because a computation that asks for a range of T="1-MAR-1997:00:00":"31-MAR-1997:23:59" will use a portion of the grid cells on each end, extending out to the time you specified. If we were doing, say, an averaging operation, it is most accurate to include the hours that lie before the end of March 31 even though they belong to the grid cell of the coordinate point at hour 1 of April 1.

The LIST command uses that logic, and gets all the coordinate points of data that are included in the resulting region. You want to limit the listing to a specific range, not larger than 31-MAR-1997:23:59.  Here's one way to do that using the TAX_MONTH function:
yes? show function tax_month
TAX_MONTH(A,B)
    Returns months of time axis coordinate values
    A: time steps to convert
    B: variable with reference time axis


yes? ! Get the time coordinate values for the range we want,
yes? ! and the corresponding L index values
yes? LET t1 = t[gt=var, t="1-MAR-1997:00:00"]
yes? LET tn = t[gt=var, t="31-MAR-1997:23:59"]
yes? LET L1 = L[gt=var, t="1-MAR-1997:00:00"]
yes? LET Ln = L[gt=var, t="31-MAR-1997:23:59"]

yes? IF `tax_month(t1, t[gt=var]) LT 3` THEN LET L1 = L1 + 1
yes? IF `tax_month(tn, t[gt=var]) GT 3` THEN LET Ln = Ln - 1
yes? LIST/L=`L1`:`Ln` var




peter hoor wrote:
Dear Ferreters,

I have a data set consisting of regularly 5hrly spaced data over a whole year 
and want to save data of a subregion (e.g. march). 
When using e.g 
SET REGION/T="1-MAR-1997:00:00":"31-MAR-1997:23:59" 
to select a variable over the desired range, the resulting exported netcdf 
file ends one point after 31-MAR (at 01-APR-1997 :01:00).

My feeling is that the next neighbours of the desired boundaries are used 
instead of the exact limits. 
(e.g. for the upper limit of the example above: 
1-APR 01:00 is closer to 31-MAR-23:59 than the last point in March at 
31-MAR 22:00).

Is there a way to force ferret to use exact subregions without extending the 
limits (I want to keep the original time axis)?

Best,
Peter
  

[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement