Calculating Seasonal Averages When Time Is Just A Float

Help
John
2013-11-26
2013-11-26
  • John
    John
    2013-11-26

    I have monthly climate data where the time dimension is a float (days since 1950-01-01). Right now I'm calculating seasonal averages (DJF, MAM, JJA, SON) by calculating monthly averages first, like this:

    ncra -d time,11,,12 in.nc dec.nc
    ncra -d time,0,,12 in.nc jan.nc
    ncra -d time,1,,12 in.nc feb.nc

    and then I average dec.nc, jan.nc, feb.nc together.

    Is there a way to do this in a single step, by telling ncra to look at DJF, then skip 9 months ahead, and repeat? I recall seeing an example where the time dimension was specified using a wildcard to match certain months, but the type of the time dimension was a string. In my case it's a float.

    Thanks.

     
    Last edit: John 2013-11-26
  • Charlie Zender
    Charlie Zender
    2013-11-26

    Hi John,

    Yes, NCO provides an easier way, namely the "duration" feature:

    ncra -d time,11,,12,3 in.nc out.nc

    TADA! All done.

    http://nco.sf.net/nco.html#drn

    cz

     
  • John
    John
    2013-11-26

    Thanks! Hadn't see that option (because we're using < version 4.2.1). Will update!