Project

General

Profile

Question on reordering monthly means

Added by Holly Ayres over 4 years ago

Hello,

I am not sure if there is a way to do this or a script I could write using CDO, but hopefully someone can at least point me in the right direction.

I need to create a 14 month average from 280 years of monthly data (3480 time steps in this original file). The end result would ideally be in the form of-

A,M,J,J,A,S,O,N,D,J,F,M,A,M (14 time steps). (From averaging, the last A,M would be the same as the first A,M which simplifies the problem a little).

Doing a monthly mean (ymonmean) always gives me a January to December output, but I cannot find a way to reorder this.

How would I do an April-March output rather than a January-December output (I have tried to use seltimestep 4/3591 but this still gives me the J-D output, I have also tried timesort but could not find much on the correct usage of this)? I was thinking I could then do some kind of merge of files to add on the last two months?

Is there a way to get the desired result in a simple way that I am somehow just not thinking about?

Thank you,
Holly


Replies (2)

RE: Question on reordering monthly means - Added by Karin Meier-Fleischer over 4 years ago

Hi Holly,

a mixed time axis makes sense for you?

cdo -selmon,4/12 -ymonmean tas_day_MPI-ESM-LR_rcp45_r1i1p1_20060101-20091231.nc month_4_12.nc 
cdo -selmon,1/5 -ymonmean tas_day_MPI-ESM-LR_rcp45_r1i1p1_20060101-20091231.nc month_1_5.nc
cdo -O cat month_4_12.nc month_1_5.nc outfile.nc
cdo sinfo outfile.nc
    -1 :       Date     Time   Level Gridsize    Miss :     Minimum        Mean     Maximum : Parameter ID
     1 : 2009-04-30 12:00:00       2    18432       0 :      210.23      278.44      309.47 : -1            
     2 : 2009-05-31 12:00:00       2    18432       0 :      207.28      280.13      314.12 : -1            
     3 : 2009-06-30 12:00:00       2    18432       0 :      207.82      281.09      317.02 : -1            
     4 : 2009-07-31 12:00:00       2    18432       0 :      205.65      281.41      316.79 : -1            
     5 : 2009-08-31 12:00:00       2    18432       0 :      205.63      281.12      316.82 : -1            
     6 : 2009-09-30 12:00:00       2    18432       0 :      205.05      280.16      312.79 : -1            
     7 : 2009-10-31 12:00:00       2    18432       0 :      210.55      278.84      308.13 : -1            
     8 : 2009-11-30 12:00:00       2    18432       0 :      221.13      277.81      307.79 : -1            
     9 : 2009-12-31 12:00:00       2    18432       0 :      230.93      277.35      307.53 : -1            
    10 : 2009-01-31 12:00:00       2    18432       0 :      231.21      277.05      307.33 : -1            
    11 : 2009-02-28 12:00:00       2    18432       0 :      224.92      276.80      307.02 : -1            
    12 : 2009-03-31 12:00:00       2    18432       0 :      216.87      277.32      306.34 : -1            
    13 : 2009-04-30 12:00:00       2    18432       0 :      210.23      278.44      309.47 : -1            
    14 : 2009-05-31 12:00:00       2    18432       0 :      207.28      280.13      314.12 : -1            
cdo info: Processed 258048 values from 1 variable over 14 timesteps [0.01s 22MB]

-Karin

RE: Question on reordering monthly means - Added by Holly Ayres over 4 years ago

Hi Karin,

This is perfect, thank you!

Holly

    (1-2/2)