Skip to content

Commit 089b777

Browse files
committed
review actions
1 parent bf9e18a commit 089b777

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

xarray/coding/times.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@ def decode_cf_timedelta(num_timedeltas, units):
180180
"""Given an array of numeric timedeltas in netCDF format, convert it into a
181181
numpy timedelta64[ns] array.
182182
"""
183-
warnings.warn('Decoding timedeltas been deprecated and '
184-
'will be removed in xarray v??.',
185-
FutureWarning, stacklevel=2)
186183
num_timedeltas = np.asarray(num_timedeltas)
187184
units = _netcdf_to_numpy_timeunit(units)
188185

@@ -365,12 +362,10 @@ def encode(self, variable, name=None):
365362
data, units = encode_cf_timedelta(
366363
data, encoding.pop('units', None))
367364
safe_setitem(attrs, 'units', units, name=name)
365+
368366
return Variable(dims, data, attrs, encoding)
369367

370368
def decode(self, variable, name=None):
371-
warnings.warn('Decoding timedeltas been deprecated and '
372-
'will be removed in xarray v??.',
373-
FutureWarning, stacklevel=2)
374369
dims, data, attrs, encoding = unpack_for_decoding(variable)
375370

376371
if 'units' in attrs and attrs['units'] in TIME_UNITS:

xarray/conventions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,16 @@ def decode_cf_variable(name, var, concat_characters=True, mask_and_scale=True,
294294
variables.CFScaleOffsetCoder()]:
295295
var = coder.decode(var, name=name)
296296

297-
enable_future_time_unit_decoding = OPTIONS['enable_future_time_unit_decoding']
297+
enable_future_time_unit_decoding = OPTIONS[
298+
'enable_future_time_unit_decoding']
298299
if decode_times:
299300
if enable_future_time_unit_decoding:
300301
coder = times.CFDatetimeCoder()
301302
var = coder.decode(var, name=name)
302303
else:
304+
warnings.warn('Decoding timedeltas been deprecated and '
305+
'will be removed in xarray v011.',
306+
FutureWarning, stacklevel=2)
303307
for coder in [times.CFTimedeltaCoder(),
304308
times.CFDatetimeCoder()]:
305309
var = coder.decode(var, name=name)

0 commit comments

Comments
 (0)