Handling of run dates when using XIOS

Hello, newbie here.
I’m using CROCO with XIOS (detached mode). This implies the compiler key USE_CALENDAR.

I am trying to understand how run dates are configured in CROCO.

My aim is to configure a particular run period (e.g. 01-Jan-2020 to 01-Mar-2020) and I want the resulting netCDF file to contain a CF-compliant date axis that represents exactly these dates.

Some questions about the settings in croco.in:

  • I have defined run_start_date and run_end_date, do I need to set NTIMES as well? If yes, why? Surely one defines the other unambiguously.
  • what’s the meaning of start_date if I have already set run_start_date?
  • Why is origin_date required in the croco.in file when running with XIOS? AFAIK this should be defined in iodef.xml as <context id="xios" time_origin="1950-01-01 00:00:00" > ?

Can anyone help me to understand how to achieve a consistent handling of dates.


Hello Fred,

When using USE_CALENDAR, NTIMES is set automatically (see https://croco-ocean.gitlabpages.inria.fr/croco_doc/tutos/tutos.08.run.html)

  • Start date (use key START_DATE) was used before the introduction of USE_CALENDAR:

  • Without XIOS it just put the start_date (in croco.in) in the global Netcdf attributes for information (i agree it’s not really used)

  • With XIOS it set the origin of the time axis with origin_date (in croco.in)

For better clarity you should remove both start_date and origin_date keywords from your croco.in

Concerning XIOS, i think you dont need to put time_origin in context anymore.



Thank you for your response,

But the code has different ideas unfortunately. If start_date is missing in croco.in I get an error. But it’s fine with a bogus value of 00/00/0000 00:00:00

I realise that it’s possibly too much to get XIOS to work at this stage (I’m just starting out with CROCO), so I turned it off for now. However the date handling without XIOS is just as confusing and doesn’t seem to work.

Obviously for realistic runs I want to use USE_CALENDAR. So I use this setting in croco.in

01/01/2020 00:00:00
01/02/2020 00:00:00
00/00/0000 00:00:00
01/01/1950 00:00:00

But the resulting croco_his.nc file has this time axis:

double time(time) ;
        time:long_name = "time since initialization" ;
        time:units = "seconds since 1900-01-01" ;
        time:field = "time, scalar, series" ;
        time:standard_name = "time" ;
        time:axis = "T" ;

Where does this 1900-01-01 date come from? I was expecting 1950 in the time:units attribute resulting from the origin_date setting in croco.in. And BTW the first value of time variable is 0, so this would be interpreted as 0 seconds from 1900-01-01, which is a long way off the intended 01/01/2020 00:00:00.

I am still confused, and the documentation doesn’t really explain how to do this.

How can I get CROCO to actually use a proper calendar in the netcdf output?


I compared the croco.log of a XIOS and non-XIOS run and noticed that there is a compilation key START_DATE which is activated when XIOS is defined.
With #undef START_DATE one can indeed leave out the start_date in the namelist.