You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By incidence I noticed that various "strange" datetimes are accepted:
fromcf_unitsimportUnitunit_str= [
("days since 1582-1010", "standard", "Error: generally malformed"),
("days since 1582-10-10", "standard", "Warning: date in Julian/Gregorian gap"),
("days since 1582-10-10", "julian", "Perfectly fine"),
("days since 1582-10-10", "proleptic_gregorian", "Perfectly fine"),
("days since haywire", "standard", "Captured error"),
("days since epoch", "standard", "Perfectly fine"),
("days since 0-0-0", "standard", "Error: wrong month/day"),
("days since 0-0-0", "julian", "Error: wrong month/day"),
("days since 0-0-0", "proleptic_gregorian", "Error: wrong month/day"),
("days since 0-1-1", "standard", "Warning: deprecated 'climatology' indicator"),
("days since 0-1-1", "julian", "Warning: deprecated 'climatology' indicator"),
("days since 0-1-1", "proleptic_gregorian", "Perfectly fine"),
("days since -1-1-1", "standard", "Error: negative year"),
("days since -1-1-1", "julian", "Error: negative year"),
("days since -1-1-1", "proleptic_gregorian", "Perfectly fine"),
]
forsinunit_str:
try:
u=Unit(s[0], calendar=s[1])
exceptValueErrorase:
u=str(e)
print(f"({s[0]}, {s[1]} ---> {u} : {s[2]}")
(dayssince1582-1010, standard--->dayssince1582-1010 : Error: generallymalformed
(dayssince1582-10-10, standard--->dayssince1582-10-10 : Warning: dateinJulian/Gregoriangap
(dayssince1582-10-10, julian--->dayssince1582-10-10 : Perfectlyfine
(dayssince1582-10-10, proleptic_gregorian--->dayssince1582-10-10 : Perfectlyfine
(dayssincehaywire, standard---> [UT_SUCCESS] Failedtoparseunit"days since haywire" : Capturederror
(dayssinceepoch, standard--->dayssince1970-01-0100:00:00 : Perfectlyfine
(dayssince0-0-0, standard--->dayssince0-0-0 : Error: wrongmonth/day
(dayssince0-0-0, julian--->dayssince0-0-0 : Error: wrongmonth/day
(dayssince0-0-0, proleptic_gregorian--->dayssince0-0-0 : Error: wrongmonth/day
(dayssince0-1-1, standard--->dayssince0-1-1 : Warning: deprecated'climatology'indicator
(dayssince0-1-1, julian--->dayssince0-1-1 : Warning: deprecated'climatology'indicator
(dayssince0-1-1, proleptic_gregorian--->dayssince0-1-1 : Perfectlyfine
(dayssince-1-1-1, standard--->dayssince-1-1-1 : Error: negativeyear
(dayssince-1-1-1, julian--->dayssince-1-1-1 : Error: negativeyear
(dayssince-1-1-1, proleptic_gregorian--->dayssince-1-1-1 : Perfectlyfine
Expected Behaviour
Expected -- or suggested -- behaviour is indicated to the right of each line. These suggestions generally follow CF 1.9, which do not allow negative years for standard and julian calendars (either in the time coordinate or in the unit string), which is different from cftime. If scitools wants to be more permissive negative years could instead result in a warning that this does not conform to CF.
The text was updated successfully, but these errors were encountered:
🐛 Bug Report
By incidence I noticed that various "strange" datetimes are accepted:
Expected Behaviour
Expected -- or suggested -- behaviour is indicated to the right of each line. These suggestions generally follow CF 1.9, which do not allow negative years for
standard
andjulian
calendars (either in the time coordinate or in the unit string), which is different fromcftime
. If scitools wants to be more permissive negative years could instead result in a warning that this does not conform to CF.The text was updated successfully, but these errors were encountered: