From 5c063c0c71ae2f1cb2acabb51c107be09755a41a Mon Sep 17 00:00:00 2001 From: Martin Yeo Date: Wed, 2 Jun 2021 11:00:22 +0100 Subject: [PATCH] Fix add_weekday. --- lib/iris/coord_categorisation.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/iris/coord_categorisation.py b/lib/iris/coord_categorisation.py index d299cbeaa4..72019b4b87 100644 --- a/lib/iris/coord_categorisation.py +++ b/lib/iris/coord_categorisation.py @@ -93,7 +93,7 @@ def vectorised_fn(*args): # Private "helper" function def _pt_date(coord, time): """ - Return the date of a time-coordinate point. + Return the datetime of a time-coordinate point. Args: @@ -103,14 +103,12 @@ def _pt_date(coord, time): value of a coordinate point Returns: - datetime.date + cftime.datetime + """ # NOTE: All of the currently defined categorisation functions are # calendar operations on Time coordinates. - # - All these currently depend on Unit::num2date, which is deprecated (!!) - # - We will want to do better, when we sort out our own Calendars. - # - For now, just make sure these all call through this one function. - return coord.units.num2date(time) + return coord.units.num2date(time, only_use_cftime_datetimes=True) # --------------------------------------------