Although standard and Gregorian calendars are equivalent, when plotting time series, we need the two strings to compare. To facilitate this, we should add two new functions cal2std and cal2greg that make it easy to change the calendar name. This has to be done by making a new cordinate and deleting the old one.
I don't think you need to create a new coordinate, just replace the units on your existing coordinate. Does this work?
tcoord = cube.coord('time')
tcoord.units = cf_units.Unit(tcoord.units.origin, calendar='gregorian')
Thanks. I'll rethink this. Probably not a code change as you say. Do we have an appropriate place to stick "useful bits of Iris code"? FWIW, we might also want to note that there are 2 other aliases in the CF definition noleap or 365_day and all_leap or 366_day
would it be worth making a section in "Iris examples" for this type of thing?
FWIW in cf-units 2 we introduced calendar aliases so that Gregorian is standard.
>>> import cf_units
>>> cf_units.__version__
'2.0.1'
>>> a = cf_units.Unit('days since 2000-01-01', calendar='standard')
>>> b = cf_units.Unit('days since 2000-01-01', calendar='gregorian')
>>> a == b
True
>>> a
Unit('days since 2000-01-01', calendar='gregorian')
>>> b
Unit('days since 2000-01-01', calendar='gregorian')
cf-units 2 is part of the Iris 2.1 release, and will be rolling out to an organisation near you soon 馃槈. Even sooner if you make use of "experimental" type software environments 馃槈
would it be worth making a section in "Iris examples" for this type of thing?
This isn't really something that documents that well. Truth is it would be best documented in somewhere like StackOverflow where it would be optimally indexed by Google.
Thanks for raising @nhsavage, and thanks for answering @rcomer!
I eventually found this and it was super useful. If any of you want to answer, here's a stack overflow question https://stackoverflow.com/q/52702433/10473080
Most helpful comment
FWIW in cf-units 2 we introduced calendar aliases so that Gregorian is standard.
cf-units 2 is part of the Iris 2.1 release, and will be rolling out to an organisation near you soon 馃槈. Even sooner if you make use of "experimental" type software environments 馃槈
This isn't really something that documents that well. Truth is it would be best documented in somewhere like StackOverflow where it would be optimally indexed by Google.
Thanks for raising @nhsavage, and thanks for answering @rcomer!