Project

General

Profile

How to set HadGEM calendar to standard?

Added by Antonio Beltran about 1 year ago

Hello everyone,

I want to know if there is a way with CDO, to change the calendar of a NetCDF file (climate projections) of the HadGEM model. The HadGEM model has a “360_day” calendar where every year has 360 days (conceptualized as 12 months of 30 days each).

I really appreciate any help you can provide.
Antonio


Replies (17)

RE: How to set HadGEM calendar to standard? - Added by Estanislao Gavilan about 1 year ago

Hi Antonio,

Did you try the command setcalendar (see Documentation 2.6.4)?

setcalendar,standard infile outfile

I have never used this command before, so I recommend to check the results afterwards.

Regards,

Estanislao

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

Hi Estanislao,

Unfortunately, I have already tried this but since you have to add days (with interpolation?), this command doesn't work... Thank you..

Antonio

RE: How to set HadGEM calendar to standard? - Added by Estanislao Gavilan about 1 year ago

Hi Antonio,

What do you mean that you have to add days? I would expect that cdo automatically uses linear interpolation to fill the gaps between 30 and 1 -and removes the days from february.

Estanislao

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

I thought the same but it didn't work when I tried it.

RE: How to set HadGEM calendar to standard? - Added by Estanislao Gavilan about 1 year ago

Hi Antonio,

I have just downloaded a dummy file from the cmip6 website, and tried this command. I am not sure if this is a bug. If you take a close look cdo removes the days in February, but it does not add the 31 day in January. This happens with every calendar (standard, gregorian..). Lets wait for Uwe or Ralph. They might know if this is a bug or not.

PS: There is a work around with NCL. Karin explained it
https://code.mpimet.mpg.de/boards/2/topics/6335?r=6359#message-6359

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

I just did the same with dummy data from CORDEX (using C3S platform), and I got the same results as you (fixed February but not the other months). Thanks for the effort! Let's wait for CDO team to help us.

Antonio

RE: How to set HadGEM calendar to standard? - Added by Ralf Mueller about 1 year ago

hi Antonio!

Can you please update our input? this seems to be very specific to the input and since it can have other side effect, the file is needed for further analysys.

cheers
ralf

RE: How to set HadGEM calendar to standard? - Added by Uwe Schulzweida about 1 year ago

setcalendar only sets the calendar attribute. This is useful if this attribute is missing or wrong. The number of time steps and the datavalues are not changed. I will make it a little clearer in the documentation.

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

Of course,

Here is the dummy data just for 4 months (due to size limitation). However, keep in mind that the same happened with Estanislao's data and with the previous data that I had from CORDEX and I don't still have them. You can also find attached a screenshot of the data info.

Here is the command that I used that gave me the wrong result:
cdo setcalendar,standard tas_EUR-11_MOHC-HadGEM2-ES_rcp45_r1i1p1_CLMcom-CCLM4-8-17_v1_day_20060101-20101230.nc test_hadgem.nc

Thank you in advance for the effort.

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

However is it possible to change the number of time steps and the data values with another command with cdo?

Thanks

RE: How to set HadGEM calendar to standard? - Added by Uwe Schulzweida about 1 year ago

I would remove the 29 + 30 february, change the calendar to standard and then interpolate the dataset with inttime:

cdo inttime,2006-01-01,12:00:00,1day -setcalendar,standard -delete,dom=29feb,30feb dummy_short.nc result

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

If I understand correctly, this will make all the Februaries (even the leap years) with 28 days and it will not change the 31 issue with the respective months that have 31 days (e.g. January). Is that correct?

RE: How to set HadGEM calendar to standard? - Added by Estanislao Gavilan about 1 year ago

amazing command Uwe! Antonio try to use that command, it should work. The inttime is the one that interpolates the missing 31 days (and the leap years). Note that inttime is set from 2006 with a time step of 1 day. You will have to do several variations depending on the year. Also, this command interpolates, thus the 31 of December of the last year will not appear because cdo cannot extrapolate. You will need to include the January of the next year if you want that day.

Ralph is it possible to add this example to the tutorial about time interpolation? I think it is really useful and it is not straight forward.

Regards,

Estanislao

RE: How to set HadGEM calendar to standard? - Added by Antonio Beltran about 1 year ago

Indeed it is very useful, however, I want to have a standard calendar without any day missing (so I want also 31/12). Additionally, if I understand correctly this command does not consider leap years, so if I want to apply it for let's say 60 years, I will have missing days again, unless I process every year separately. Am I correct? Sorry, for all these questions but I already have data for other variables (standard calendar) and I want all my data to be in exactly the same timesteps to further use them in a hydrological model...

Antonio

RE: How to set HadGEM calendar to standard? - Added by Estanislao Gavilan about 1 year ago

that command considers as well leap years. About the the 31 of december, you just need to download an extra month. You can always remove it later using the command selyear. For instance, you download the data from 2006-01-01 to 2070-02-01. Then

cdo selyear,2006/2069 inttime,2006-01-01,12:00:00,1day -setcalendar,standard -delete,dom=29feb,30feb data-2006010112000-2070020112000.nc result.nc

RE: How to set HadGEM calendar to standard? - Added by Ralf Mueller about 1 year ago

There is no operator in CDO to do that automatically as far as I know. It depends on how you want to handle your dates precicely

RE: How to set HadGEM calendar to standard? - Added by Emre Salkım about 1 year ago

Dear Uwe and Estanislao,

Thank you very much for the solution as it works like a charm. I guess we all agree that adding 31/12 is a little painful but it's nothing compared to how long I have been looking for this solution.

Regards,

Emre

    (1-17/17)