Skip to content

Commit

Permalink
Switched use of datetime.weekday() to datetime.dayofwk. (SciTools#3687)
Browse files Browse the repository at this point in the history
  • Loading branch information
trexfeathers authored and bjlittle committed Jun 25, 2020
1 parent 7ef61b1 commit 8e50398
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/iris/coord_categorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def add_day_of_year(cube, coord, name="day_of_year"):
def add_weekday_number(cube, coord, name="weekday_number"):
"""Add a categorical weekday coordinate, values 0..6 [0=Monday]."""
add_categorised_coord(
cube, name, coord, lambda coord, x: _pt_date(coord, x).weekday()
cube, name, coord, lambda coord, x: _pt_date(coord, x).dayofwk
)


Expand All @@ -192,7 +192,7 @@ def add_weekday_fullname(cube, coord, name="weekday_fullname"):
cube,
name,
coord,
lambda coord, x: calendar.day_name[_pt_date(coord, x).weekday()],
lambda coord, x: calendar.day_name[_pt_date(coord, x).dayofwk],
units="no_unit",
)

Expand All @@ -203,7 +203,7 @@ def add_weekday(cube, coord, name="weekday"):
cube,
name,
coord,
lambda coord, x: calendar.day_abbr[_pt_date(coord, x).weekday()],
lambda coord, x: calendar.day_abbr[_pt_date(coord, x).dayofwk],
units="no_unit",
)

Expand Down

0 comments on commit 8e50398

Please sign in to comment.