From ff65b1699b07d4ebc5682e9750077633915b8f16 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Fri, 22 Nov 2019 01:14:21 -0500 Subject: [PATCH 1/2] remove 0.15 deprecations --- xarray/core/dataarray.py | 16 +--------------- xarray/core/dataset.py | 16 ++-------------- 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/xarray/core/dataarray.py b/xarray/core/dataarray.py index c92fcb956b1..3c198ae63a0 100644 --- a/xarray/core/dataarray.py +++ b/xarray/core/dataarray.py @@ -279,8 +279,6 @@ def __init__( dims: Union[Hashable, Sequence[Hashable], None] = None, name: Hashable = None, attrs: Mapping = None, - # deprecated parameters - encoding=None, # internal parameters indexes: Dict[Hashable, pd.Index] = None, fastpath: bool = False, @@ -325,20 +323,10 @@ def __init__( Attributes to assign to the new instance. By default, an empty attribute dictionary is initialized. """ - if encoding is not None: - warnings.warn( - "The `encoding` argument to `DataArray` is deprecated, and . " - "will be removed in 0.15. " - "Instead, specify the encoding when writing to disk or " - "set the `encoding` attribute directly.", - FutureWarning, - stacklevel=2, - ) if fastpath: variable = data assert dims is None assert attrs is None - assert encoding is None else: # try to fill in arguments from data if they weren't supplied if coords is None: @@ -360,13 +348,11 @@ def __init__( name = getattr(data, "name", None) if attrs is None and not isinstance(data, PANDAS_TYPES): attrs = getattr(data, "attrs", None) - if encoding is None: - encoding = getattr(data, "encoding", None) data = _check_data_shape(data, coords, dims) data = as_compatible_data(data) coords, dims = _infer_coords_and_dims(data.shape, coords, dims) - variable = Variable(dims, data, attrs, encoding, fastpath=True) + variable = Variable(dims, data, attrs, fastpath=True) # These fully describe a DataArray self._variable = variable diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py index 206f2f55b3c..3da7e4a4ea1 100644 --- a/xarray/core/dataset.py +++ b/xarray/core/dataset.py @@ -72,8 +72,8 @@ Default, Frozen, SortedKeysDict, - _default, _check_inplace, + _default, decode_numpy_dict_values, either_dict_or_kwargs, hashable, @@ -451,7 +451,6 @@ def __init__( data_vars: Mapping[Hashable, Any] = None, coords: Mapping[Hashable, Any] = None, attrs: Mapping[Hashable, Any] = None, - compat=None, ): """To load data from a file or file-like object, use the `open_dataset` function. @@ -501,18 +500,7 @@ def __init__( attrs : dict-like, optional Global attributes to save on this dataset. - compat : deprecated """ - if compat is not None: - warnings.warn( - "The `compat` argument to Dataset is deprecated and will be " - "removed in 0.15." - "Instead, use `merge` to control how variables are combined", - FutureWarning, - stacklevel=2, - ) - else: - compat = "broadcast_equals" # TODO(shoyer): expose indexes as a public argument in __init__ @@ -532,7 +520,7 @@ def __init__( coords = coords.variables variables, coord_names, dims, indexes = merge_data_and_coords( - data_vars, coords, compat=compat + data_vars, coords, compat="broadcast_equals" ) self._attrs = dict(attrs) if attrs is not None else None From 20076b14e787752311f9ed500827e1ec26b080a0 Mon Sep 17 00:00:00 2001 From: Maximilian Roos Date: Sat, 23 Nov 2019 15:14:09 -0500 Subject: [PATCH 2/2] whatsnew --- doc/whats-new.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/whats-new.rst b/doc/whats-new.rst index f1c3f59d2e3..65b75304619 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -22,6 +22,11 @@ v0.15.0 (unreleased) Breaking changes ~~~~~~~~~~~~~~~~ +- Remove ``compat`` and ``encoding`` kwargs from ``DataArray``, which + have been deprecated since 0.12. (:pull:`3650`). + Instead, specify the encoding when writing to disk or set + the ``encoding`` attribute directly. + By `Maximilian Roos `_ New Features ~~~~~~~~~~~~