ACCESS-NRI / MOM5

The Modular Ocean Model
https://mom-ocean.github.io/
GNU Lesser General Public License v3.0
1 stars 0 forks source link

Calendar attribute in outputs should be proleptic_gregorian #20

Open aidanheerdegen opened 6 days ago

aidanheerdegen commented 6 days ago

The gregorian calendar option for MOM5 implements a proleptic_gregorian calendar

https://github.com/ACCESS-NRI/MOM5/blob/baaf7ed1baf4543bc821d97402a94792b4044ac4/src/shared/time_manager/time_manager.F90#L2799-L2807

whereas the CF conventions state that a gregorian calendar attribute is mixed Julian/Gregorian, and a proleptic Gregorian must have the attribute proleptic_gregorian.

https://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/build/ch04s04.html

Original issue is here: https://github.com/COSIMA/access-om2/issues/117

aidanheerdegen commented 6 days ago

A simple fix would be to change this line

https://github.com/mom-ocean/FMS/blob/3bd24800ed3cd8b0eb26643afdecf88e10641beb/time_manager/time_manager.F90#L1564

to

valid_calendar_types = 'PROLEPTIC_GREGORIAN'

as this is the function that is called when the time attributes are written:

https://github.com/ACCESS-NRI/MOM5/blob/baaf7ed1baf4543bc821d97402a94792b4044ac4/src/shared/diag_manager/diag_output.F90#L353-L355

Which results in a netCDF variable definition like so:

        double time(time) ;
                time:long_name = "time" ;
                time:units = "days since 0001-01-01 00:00:00" ;
                time:cartesian_axis = "T" ;
                time:calendar_type = "GREGORIAN" ;
                time:calendar = "GREGORIAN" ;
                time:bounds = "time_bounds" ;

Note that this line appears in the MOM5 source here due to FMS being included as a subtree:

https://github.com/ACCESS-NRI/MOM5/blob/baaf7ed1baf4543bc821d97402a94792b4044ac4/src/shared/time_manager/time_manager.F90#L3256

aidanheerdegen commented 6 days ago

Made an issue on the mom-ocean repo. Should close this once that fix is merged and synced to this fork.