Skip to content

Commit

Permalink
Fix coord_categorisation.add_weekday (#4139)
Browse files Browse the repository at this point in the history
* fix add_weekday

* fix black link
  • Loading branch information
rcomer authored May 17, 2021
1 parent 252e73f commit 036fc16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/developers_guide/contributing_code_formatting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ linted according to our ``.flake8`` configuration file. Note that,
for each ``.pre-commit-config.yaml`` git hook.

Additionally, you may wish to enable ``black`` for your preferred
`editor/IDE <https://black.readthedocs.io/en/stable/editor_integration.html#editor-integration>`_.
`editor/IDE <https://black.readthedocs.io/en/stable/integrations/editors.html>`_.

With the ``pre-commit`` configured, the output of performing a ``git commit``
will look similar to::
Expand Down
9 changes: 3 additions & 6 deletions lib/iris/coord_categorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -103,14 +103,11 @@ 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)


# --------------------------------------------
Expand Down

0 comments on commit 036fc16

Please sign in to comment.