Project

General

Profile

Select season, average over 5 days

Added by Nathanael Harwood over 5 years ago

Posting after an entire afternoon of searching this website -

I have daily data 1979-2018. I want to chain: select season from multi-year (e.g. DJF from 1979-2018) and then create 5-day time slices (mean of 5 day intervals) from that (e.g. 1-5 = 1st timestep, 6-10 = 2nd timestep and so forth)

How would one go about this? n.b. I'm not looking for running means, so 'ydrunmean' is probably not the one. Can provide the data if required.

Many thanks


Replies (4)

RE: Select season, average over 5 days - Added by Karin Meier-Fleischer over 5 years ago

Hi Nathanael,

to select the season use the select operator and to compute the mean of 5 days use the timselmean operator (see documentation):

cdo -timselmean,5 -select,season=DJF infile outfile

-Karin

RE: Select season, average over 5 days - Added by Nathanael Harwood over 5 years ago

Hi Karin - thanks, that's incredibly helpful!

The 'time_bnds' which is created messes up my R code unfortunately, is there any way in cdo to have the new time intervals in the 'time' variable that was in the .nc file to begin with? (i.e. not to have the time_bnds var)

Many thanks,

Nathanael

RE: Select season, average over 5 days - Added by Karin Meier-Fleischer over 5 years ago

I found a way to remove the time_bnds variable and attribute but its not really how it should be done, I think.

cdo -settime,12:00:00 -timselmean,5 -select,season=DJF infile outfile

-Karin

RE: Select season, average over 5 days - Added by Nathanael Harwood over 5 years ago

Thanks Karin,

I understand what you mean - I will try and keep the time_bnds variable as it makes sense to.

Much appreciated!

Nathanael

    (1-4/4)