Project

General

Profile

extract date range from a daily file of multiple years (CDO)

Added by Brian Menounos about 11 years ago

Hello -

Is there a way to extract date range (i.e. 15 Aug - 31 Dec) for each year in the file (say the file contains daily data for a 40 yr period)?

Thanks - I couldn't seem to figure out how to do this with seldate. Apologies if this is documented (or described elsewhere).


Replies (3)

RE: extract date range from a daily file of multiple years (CDO) - Added by Jaison-Thomas Ambadan about 11 years ago

Hi,

try "outputkey" operator,

e.g.

cdo -outputkey,time ifile > ofile

OR

cdo -outputkey,time,value ifile > ofile

Cheers,
J

RE: extract date range from a daily file of multiple years (CDO) - Added by Jaison-Thomas Ambadan about 11 years ago

Hi again,

I forgot to mention: you could combine "outputkey" it with "seldate" operator

Cheers,
J

RE: extract date range from a daily file of multiple years (CDO) - Added by Brian Menounos about 11 years ago

Thanks to Jaison for providing a good way to do this (using a series of operators).

... for example if you want to select 15 Aug to 31 Dec for all years:
cdo -mergetime -selday,15/30 -selmon,8 ifile.nc \
-selmon,9,10,11,12 ifile.nc ofile.nc

    (1-3/3)