[Thread Prev][Thread Next][Index]

Re: [ferret_users] mm/day to mm/month



Hi Peter,
I think that Russel's first suggestion is the best idea. If your original axis is not in units of days, then you just need to define a correct Gregorian-calendar monthly axis that does have units of days, put your data onto that axis, and use the tbox pseudo-variable to convert your data to values in units of mm/month

You can define a monthly calendar axis following the example in the DEFINE AXIS/EDGES section of the User Guide - the index entry is "axis, monthly, defining" at http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/DEFINE#_VPINDEXENTRY_1312

That example makes a monthly axis from 1950 to 1970, so you'd just need to adjust that range, and then use Ferret regridding to put your data onto that axis, and then the tbox pseudo-variable from the axis truemonth is what you want to use to
LET  precip_1 = precip[gt=truemonth]
LET/units="mm/month" precip_mm_month = precip_1*tbox[gt=truemonth]
Ansley

Peter Szabo wrote:
Dear Russel,

The units of my time axis arent in days, so the pseudo variable is not working.

yes? sh axis/l=1:2 time
 name       axis              # pts   start                end
 TIME      TIME               360 r   15-JAN-1961 12:00    16-DEC-1990 08:06
T0 = 15-JAN-1961 12:00:00
   Axis span (to cell edges) = 360
 
       L     T                   TBOX      TBOXLO                TSTEP (months)
       1>  15-JAN-1961 12:00:00  1         31-DEC-1960 06:45:27  0
       2>  14-FEB-1961 22:29:06  1         30-JAN-1961 17:14:33  1

I created the new variables to define the number of days in each month, but i realized that February 1961 has 29 days, which is false.


On Fri, May 22, 2009 at 2:46 AM, Russell Fiedler <russell.fiedler@xxxxxxxx> wrote:

Peter,

If the data is on a monthly grid multiply by the tbox pseudo variable
associated with the data (if the units are days).

let precip_mm_month = precip*tbox[gt=precip]

alternatively create a new variable

 let    YEAR =INT((L-1)/12)
 let    MON = MOD(L-1,12)+1
let    DAYS_IN_MONTH = DAYS1900(YEAR[L=@shf:1],MON[l=@shf:1],1)-DAYS1900
(YEAR,MON,1)

let precip_mm_month = precip*days_in_month[gt=precip@asn]




On Thursday 21 May 2009 19:58, you wrote:
> Dear Users,
>
> i have monthly precipitation data set (360 time slices) in format of
> mm/day. It's on a gregorian calendar and i would like to have the data
> values in mm/month. I know, i should multiple the fields by 28/29/30/31. Is
> there a good solution to do that instead of a REPEAT command?
>
> Thanks, Peter


[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement