[Thread Prev][Thread Next][Index]

Re: [ferret_users] Calculation of monthly mean

Hi Trina,
You can absolutely do this in Ferret. It's done using a regridding operation. You open the dataset with daily data, then define your desired monthly time axis, and regrid the data to the new axis.  Defining the correct time axis with units of months takes some care, but here is the basic idea:
yes? set data my_data  !   (giving the dataset name)

yes? !Define a monthly axis. More on this below

yes? DEFINE AXIS/T=16-jan-1930:16-dec-1979:1/UNITS=months  tmonth 

yes? ! Then if the variable in the dataset is, say SST,
yes? LET sst_month = sst[gt=tmonth@AVE]

And that's it.  Ferret takes care of reconciling the coordinates on the two time axes, and does the average for the whole variable.  When you plot sst_month, or save it to a file, it'll be on the monthly axis. Look at the "regridding transformations" for more on what the different methods are for doing the regridding.  I've shown averaging above.  The standard time axes in Ferret include leap years, as well as the adjustments to leap year once a century, and so forth.  If your daily data includes leap days, you don't need to do anything special to handle that.  If your data started in July 1930, the above would still work fine; there would just be some missing data at the start of the series.

Now, the problem with using a unit of "months" of course is that calendar months are not the same length.  This means that the axis we defined above, which just divides each year into 12 equal sections, is probably not what you want. In the Users Guide, there's an index entry "axis, monthly, defining".  The idea is that we'll give a definition which specifies the edges of grid cells at the start of each month. Taking that example and changing it to make a 50 year axis:
yes? ! Define a 50 year monthly axis starting in Jan 1930
yes? LET start_year = 1930
yes? LET nyears = 50
yes? LET indices = L[L=1:`nyears*12`]
yes? LET month = MOD(indices-1,12)+1
yes? LET year = start_year + INT((indices-1)/12)
yes? DEFINE AXIS/UNITS=days/T0=1-jan-1900/EDGES truemonth = DAYS1900(year,month,1)
and the regridding we did above would be
yes? LET sst_month = sst[gt=truemonth@AVE]


Somebody please inform me of the steps required for monthly mean calculation from .grd
data-daily data over >50 years. Is it even possible by ferret? I mean I can do jan but
how do I adjust feb and others for leap years?


Trina Bose


[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement