Project

General

Profile

Select the same months for each years

Added by Bérénice Ferrand almost 2 years ago

Hi,

I wanted to create time series with only specific months for each years. I explain : I want the months from April to September for the years 1850 to 2014.

I try with this function "cdo.selmonth", but when I plot my figure It seems that I have the other months. So I don't understand what this function gave me.

This is what I used :

cdo.selmonth('04,09', input=infile, output="mrros_1850-2014.nc")

And this is what I obtained :


Replies (9)

RE: Select the same months for each years - Added by Karin Meier-Fleischer almost 2 years ago

Hi Bérénice,

if I use your command with my dummy data I get what I expect, only the data of the months April and September. To select the months April to September you have to change the call to

cdo.selmonth('04/09', input=infile, output="mrros_1850-2014.nc")

RE: Select the same months for each years - Added by Bérénice Ferrand almost 2 years ago

Thanks Karin !

I have an other question, I want select the months from November to January of the next years.

cdo.selmonth('11/01', input=infile, output="mrros_1850-2014.nc")

How to be sure that is it January of the next years and not the January month of the same years ?

Thanks for your answer.

RE: Select the same months for each years - Added by Karin Meier-Fleischer almost 2 years ago

If you know the start and the end date you can select the timesteps in between.

In the case that you want to extract the months November to January it is better to use selmonth,11,12,1 instead of selmonth,11/01.

For example
startdate is 2000-11-01 and enddate is 2005-01-31

cdo.seldate('2000-11-01,2005-01-31', input='-selmonth,11,12,1 '+infile, output='mrros_1850-2014.nc')

RE: Select the same months for each years - Added by Bérénice Ferrand almost 2 years ago

I try to adapt the code to my data and to what I want. I do not understand but I does not work, I have this :

CDOException: (returncode:1) cdo    seldate (Warning): Using a non-thread-safe NetCDF4/HDF5 library in a multi-threaded environment may lead to erroneous results! cdo    seldate (Warning): Use a thread-safe NetCDF4/HDF5 library or the CDO option to avoid such errors. Error (cdf_get_vara_float): NetCDF: HDF error Error (cdf_enddef): NetCDF: HDF error

RE: Select the same months for each years - Added by Bérénice Ferrand almost 2 years ago

To skip this problem I try to do :

cdo.seldate('1850-11-01,2014-01-31', input=infile, output="mrros_1850-2014_0.nc")
cdo.selmonth('11,12,01', input="mrros_1850-2014_0.nc", output="mrros_1850-2014.nc")

I don't know if the result will be correct but it seems to work. I have to check if my data are correct.

RE: Select the same months for each years - Added by Karin Meier-Fleischer almost 2 years ago

The problem is that your output file contains January of the first year and November, December of the last year (see 'cdo info mrros_1850-2014.nc).

Can you try something like that

cdo.select('startdate=1850-11-01,enddate=2014-01-31', input='-select,season=NDJ '+infile, output='oo3.nc')

RE: Select the same months for each years - Added by Bérénice Ferrand almost 2 years ago

It doesn't work, but maybe it is my fault, maybe there is something that I do wrong.
I have this error message this time :

CDOException: (returncode:1) Error (cdf_put_vara_double): NetCDF: Numeric conversion not representable

I tried different stuff but I always same problem.

RE: Select the same months for each years - Added by Karin Meier-Fleischer almost 2 years ago

Which CDO version are you using (cdo -V)? Maybe you can update to a newer version.

RE: Select the same months for each years - Added by Karin Meier-Fleischer almost 2 years ago

Last try would be to use the option '-b F64' or '-b F32' due to the error from above (NetCDF: Numeric conversion not representable).
Can you upload the data file?

    (1-9/9)