Creating seasonal masks
How can I create a seasonalmask?
One of the easiest ways to create a seasonal mask is to use the MOD() function to convert the underlying units of your data's time axis into the number of those units elapsed during a year. Use the ncdump program with the "-h" flag to get detailed information on your data's time axis. In the case of a daily timeseries, as in Reynolds SST, you might have:
use reynolds_sst_wk let year_days = mod(t[gt=wsst],365.2425)
Note: If your time origin is not at a year boundary your definition may have to subtract in order to get the correct number of elapsed units since year begin.
Note: If you're more comfortable with dates, you canget the Julian day number for any given date with
define axis/T0=1-jan-0000/T=1-jan-0000:31-dec-0000:1/unit=day tjday let TJ = T[gt=tjday]
then, for example,
can be used as an expression for the Julian day number of 15-MARas in
yes? say The Ides of March is Julian day `TJ[t=15-mar]` The Ides of March is Julian day 74
The limitation of this is that the Julian day calculation will not regard Feb as a 28.2425 day month. Rather it will be either a 28 or a 29 day month, depending upon the year (0000 is a leap year - use 0001 for a non-leap year)
Here's the journal script that produced the graphic above
! A journal script demonstrating one way to create ! a seasonal mask. ! ! First use ncdump to see what the units and T0 ! for the reynolds time axis are ! ! > ncdump -h reynolds_sst_wk.cdf ! ! REYNOLDS_T:units = "DAY since 0000-12-30 00:00:00" ; ! REYNOLDS_T:time_origin = "30-DEC-0000" ; ! ! Now create a variable that has values of day number ! but that is defined on a grid with the reynolds time axis. use reynolds_sst_wk let year_days = mod(t[gt=wsst],365.2425) ! Now create a mask which has a value of 1 only for days ! 60 to 151 (March to May). ! All other days will be flagged as missing values. let daily_mask_a = IF year_days gt 59 then 1 let daily_mask_b = IF year_days lt 152 then 1 let daily_mask = daily_mask_a * daily_mask_b ! Use one definition of springiness for the spring and ! another for the rest of the year. let spring = fsst + 10 let rest = fsst - 10 let/title="liklihood of spring" springiness = IF daily_mask THEN spring ELSE rest ! Set the desired region and plot the result set region/x=180:270/y=10s:0n/t=15-jan-1985:15-jan-2000 fill/transpose springiness[y=@ave]