From e8bd8665e8fd762031c2d9c87987d21e113e41cc Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Fri, 12 Jun 2020 15:04:18 +0000 Subject: [PATCH] Recommend installing cftime when time decoding fails. (#4134) --- xarray/coding/times.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xarray/coding/times.py b/xarray/coding/times.py index d923f1ad088..dafa8ca03b1 100644 --- a/xarray/coding/times.py +++ b/xarray/coding/times.py @@ -80,8 +80,9 @@ def _decode_cf_datetime_dtype(data, units, calendar, use_cftime): "the default calendar" if calendar is None else "calendar %r" % calendar ) msg = ( - "unable to decode time units %r with %s. Try " - "opening your dataset with decode_times=False." % (units, calendar_msg) + f"unable to decode time units {units!r} with {calendar_msg!r}. Try " + "opening your dataset with decode_times=False or installing cftime " + "if it is not installed." ) raise ValueError(msg) else: