From 1138ed6007da75ddbda3d64663cabb74678b8d79 Mon Sep 17 00:00:00 2001 From: Lars Barring Date: Sat, 30 Oct 2021 11:37:00 +0200 Subject: [PATCH] Map gregorian calendar to standard calendar (not the other way around) --- cf_units/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cf_units/__init__.py b/cf_units/__init__.py index d45bd671..4964db84 100644 --- a/cf_units/__init__.py +++ b/cf_units/__init__.py @@ -130,7 +130,7 @@ #: Where calendars have multiple names, we map the alias to the #: definitive form. CALENDAR_ALIASES = { - CALENDAR_STANDARD: CALENDAR_GREGORIAN, + CALENDAR_GREGORIAN: CALENDAR_STANDARD, CALENDAR_NO_LEAP: CALENDAR_365_DAY, CALENDAR_ALL_LEAP: CALENDAR_366_DAY, } @@ -830,7 +830,7 @@ def __init__(self, unit, calendar=None): raise value_error from None if _OP_SINCE in unit.lower(): if calendar is None: - calendar_ = CALENDAR_GREGORIAN + calendar_ = CALENDAR_STANDARD elif isinstance(calendar, (str,)): calendar_ = calendar.lower() if calendar_ in CALENDAR_ALIASES: @@ -1815,7 +1815,7 @@ def convert(self, value, other, ctype=FLOAT64, inplace=False): # gregorian calendar as it handles these and udunits does not. if ( self.is_time_reference() - and self.calendar != CALENDAR_GREGORIAN + and self.calendar != CALENDAR_STANDARD ): result_datetimes = cftime.num2date( result, self.cftime_unit, self.calendar