[Thread Prev][Thread Next][Index]

Re: [ferret_users] DJF composite from daily data

Hi All,

i have never heard about TAX* functions, so i succeed in finding a solution for this problem with creating a monthly mask then using mod function.
!First i created a monthly axis for the period of 1961-1990 (30 years*12 months). Note that your daily data should be on a proper daily time-axis.

let start_year=1961
let nyears=30
let indicesm=l[l=1:`nyears*12+1`]
let monthm=mod(indicesm-1,12)+1
let yearm=start_year + int((indicesm-1)/12)
def ax/un=days/t0=1-jan-1900/ed truemonth=days1900(yearm,monthm,1)

let precipmonth=precip[gt=truemonth@sum]
!precip is on a daily axis, while precipmonth is on the defined monthly axis. In the case of precipitation we have monthly-summed data

!With the mod function we create a mask for all the Decembers, Januarys and Februarys.
let month=l[gt=precipmonth]
let DJF = if (mod(month,12) le 2) OR (mod(month,12) le 8) then 1

!Now we need to place this mask onto our data on a monthly axis.
let winterprecip=precipmonth*DJF

If we want individual months, we need to create the mask for DEC, JAN and FEB also. Then average in time.
Now I see that my solution wasnt really for the problem, though i post it.

Cheers, Peter

On Tue, Apr 7, 2009 at 11:24 PM, Ansley Manke <ansley.b.manke@xxxxxxxx> wrote:
Hi all,
After an exchange outside the list, here are some ideas for this question -- it follows along the lines of the FAQ about making a seasonal mask that we referred to before: How can I create a seasonal mask?

That FAQ was written before we had the TAX* functions such as TAX_jday. This function makes the solution easier.  For a seasonl average centered on January, we want to define a variable that contains the day-of-year for the time axis, and make from that a mask where the two parts are "if jday GE Dec_1st"  OR "if jday LE Feb_28th".  So we'll make two masks, one for December and one for January-February, and add the two masks.

As in the FAQ, I'll use reynolds_sst, which you can access as an OPeNDAP dataset:
yes? use "http://ferret.pmel.noaa.gov/thredds/dodsC/data/PMEL/reynolds_sst_wk.nc"
yes? let year_days = tax_jday(t[gt=wsst], t[gt=wsst])

   ! Define the two parts of the mask.  We're going to add  them, so use ELSE 0
yes? let daily_mask_a = if year_days ge 335 then 1 else 0
yes? let daily_mask_b = if year_days le 58 then 1 else 0

   ! Here is the mask: 1 if day-of-year corresponds to December or Jan-Feb.
   ! ( Note that this doesn't takeleap years into account!)
yes? let daily_mask = if (daily_mask_a + daily_mask_b) GT 0 THEN (daily_mask_a + daily_mask_b)
! Check what we've done with a line plot
yes? plot/t=1-jan-1982:1-jan-1985 wsst[x=300:350@ave,y=-20:20@ave]
yes? let/units="`wssw,return=units`" wsst_djf = wsst * daily_mask
yes? plot/over  wsst_djf[x=300:350@ave,y=-20:20@ave]
The question was also how to save the result as a yearly series.  We can define a yearly time axis, centered in the  middle of January for the time range of the data, and regrid the masked data to this time axis with the @AVE transformation. The result is the average for each season, one per year.
yes? define axis/t=16-jan-1982:16-jan-2001:1/units=year tyear
yes? let/units="`wssw,return=units`"/title="DJF seasonal average" wsst_djf_year = wsst_djf[gt=tyear@AVE]

yes? save/clobber/file=out_file.nc wsst_djf_year

jaya kumar A wrote:
Dear ferret users,
I have a daily data from 1950 to  2007, all data represented in one descriptor file, i want to make DJF( 90 time records) composite of pure IOD years. from this 57 years
I will be grateful to your help
thanks in advance
with regards
Junior Research Fellow,
Theoretical Studies Division
IITM, Pune-8

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement