Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar attribute in outputs should be proleptic_gregorian #20

Open
aidanheerdegen opened this issue Jun 25, 2024 · 2 comments
Open

Calendar attribute in outputs should be proleptic_gregorian #20

aidanheerdegen opened this issue Jun 25, 2024 · 2 comments

Comments

@aidanheerdegen
Copy link
Member

The gregorian calendar option for MOM5 implements a proleptic_gregorian calendar

function leap_year_gregorian_int(year)
logical :: leap_year_gregorian_int
integer, intent(in) :: year
leap_year_gregorian_int = mod(year,4) == 0
leap_year_gregorian_int = leap_year_gregorian_int .and. .not.mod(year,100) == 0
leap_year_gregorian_int = leap_year_gregorian_int .or. mod(year,400) == 0
end function leap_year_gregorian_int

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: COSIMA/access-om2#117

@aidanheerdegen
Copy link
Member Author

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:

calendar = get_calendar_type()
CALL mpp_write_meta(file_unit, id_time_axis, 'calendar_type', cval=TRIM(valid_calendar_types(calendar)))
CALL mpp_write_meta(file_unit, id_time_axis, 'calendar', cval=TRIM(valid_calendar_types(calendar)))

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:

valid_calendar_types = 'GREGORIAN '

@aidanheerdegen
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant