Skip to content

Commit e8bd866

Browse files
authored
Recommend installing cftime when time decoding fails. (#4134)
1 parent 48fbee0 commit e8bd866

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

xarray/coding/times.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,9 @@ def _decode_cf_datetime_dtype(data, units, calendar, use_cftime):
8080
"the default calendar" if calendar is None else "calendar %r" % calendar
8181
)
8282
msg = (
83-
"unable to decode time units %r with %s. Try "
84-
"opening your dataset with decode_times=False." % (units, calendar_msg)
83+
f"unable to decode time units {units!r} with {calendar_msg!r}. Try "
84+
"opening your dataset with decode_times=False or installing cftime "
85+
"if it is not installed."
8586
)
8687
raise ValueError(msg)
8788
else:

0 commit comments

Comments
 (0)