[Thread Prev][Thread Next][Index]

Re: [ferret_users] Re: How to extract DJF average time series from a monthly time series?



Hi Steeven,
Thank you for writing with your solution. The only thing to be careful of here, is that it assumes that the incoming data starts in January. This is very often true, but not always!    To make this into a general script, you could use the TAX_MONTH function to check on the month of the first timestep (and at least issue a warning if the first month is not 1)

-Ansley

On 10/12/2010 11:50 PM, "STEEVEN PAUL" "YERRAGUNTLA" wrote:
Dear ferreters,
          I could find the answer to my question from few threads in Archives.  I got major help from the the following thread  http://www.pmel.noaa.gov/maillists/tmap/ferret_users/fu_2009/msg00211.html and thanks to Peter.

The ferret script as follows

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

!Now we need to place this mask onto our data on a monthly axis.
let wintersst=sst[d=1]*DJF
list/x=60/y=15  wintersst

!club the DJF values together

let sst_compr = COMPRESSL(wintersst)
list/x=60/y=15  sst_compr

 ! 1870-2010 --> 140 years --> 140*3=420 data points
     ! we need to average this data points in pairs of 3 to find the
     !  seasonal mean. Easy way is to use two abstract axes, one
     !  with 33 points (ranging from 1-420) and another one with
     !  11 points (ranging from 2-419) and regrid using @AVE.

!defining to abstract axes one to put the data on the time axis another is to average the DJF months

define axis/t=1:420:1 t420
let sst_djf_all = sst_compr[gt=t420@ASN]
list/x=60/y=15 sst_djf_all

define axis/t=2:419:3 t11
let sst_djf_av = sst_djf_all[gt=t11@AVE]

define axis/t=1870:2010:1/units=years tyear
let sst_djf = sst_djf_av[gt=tyear@ASN]
list/x=60/y=15 sst_djf

set var/title="DJF sesonal mean SST"/units="degC" sst_djf

!saving the extracted data to a ncfile for future purpose

sp rm -f sst_djf_mean.nc
save/file=sst_djf_mean.nc/append sst_djf

------------------------------- END OF THE SCRIPT ---------------------------------------------------





On Mon, Oct 11, 2010 at 6:42 PM, steeven paul yerraguntla <steevenpaul@xxxxxxxxx> wrote:
Dear ferreters,
       I want to extract the DJF months time series in the following format.
       15-dec-1980
       15-jan-1981
       15-feb-1981
       15-dec-1981
       15-jan-1982
       15-feb-1982
             ----
         and so on
I tried to follow the examples in archives, provided by Jaison Kurian and Ansley which are for extracting JJA months and i could not get time series for DJF months though making some changes to the scripts. Hope someone will help me in this connection.    Ansley's  Scripts as follows
--------------       -----------------            ---------------------------------------           ------------------------------------------

use monthly_navy_winds
let nmon = `uwnd,return=Lend`
let tt = t[t=1:`nmon`]
let june = if mod(tt,12) ge 6 then tt
let june_aug = if mod(june,12) le 8 then june
list june_aug

! The number of summer months.
let nja = `june_aug[t=@ngd]`

let just_summer = compressl(june_aug)
list just_summer[L=1:`nja`]

! Now sample the Lth point of uwnd for the summer months
let uwnd_jja = samplel(uwnd,just_summer[l=1:`nja`])

! Define a calendar axis containing these months.
def axis/t0="`uwnd,return=t0`"/units="months" tsummer = just_summer[l=1:`nja`]

! Put the sampled summer data on the calendar axis
let uwnd_summer = uwnd_jja[gt=tsummer@asn]
list/x=180/y=0 uwnd_summer

--------------------------------------------------------------- end of script --------------------------------------------------------------------------------------------------

Thanks in advance,


 

--
Steeven Paul Y
Research Fellow
NIO RC Vizag
176 Lawsons Bay Colony
Visakhapatnam - 530017



--
Steeven Paul Y
Research Fellow
NIO RC Vizag
176 Lawsons Bay Colony
Visakhapatnam - 530017

[Thread Prev][Thread Next][Index]

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

Privacy Policy | Disclaimer | Accessibility Statement