From 8101b8da8fcd7aba0624093983e12baa246229a0 Mon Sep 17 00:00:00 2001 From: keewis Date: Wed, 5 May 2021 14:25:29 +0200 Subject: [PATCH] Bump versions (#5258) --- ci/requirements/py37-min-all-deps.yml | 12 ++++----- doc/whats-new.rst | 13 +++++++++ xarray/core/dask_array_compat.py | 38 --------------------------- xarray/core/nanops.py | 4 +-- xarray/tests/__init__.py | 1 - xarray/tests/test_cftimeindex.py | 22 ++++++++-------- 6 files changed, 31 insertions(+), 59 deletions(-) diff --git a/ci/requirements/py37-min-all-deps.yml b/ci/requirements/py37-min-all-deps.yml index 7d04f431935..7743a086db0 100644 --- a/ci/requirements/py37-min-all-deps.yml +++ b/ci/requirements/py37-min-all-deps.yml @@ -8,27 +8,27 @@ dependencies: # When upgrading python, numpy, or pandas, must also change # doc/installing.rst and setup.py. - python=3.7 - - boto3=1.12 + - boto3=1.13 - bottleneck=1.3 - cartopy=0.17 - cdms2=3.1 - cfgrib=0.9 - - cftime=1.0 + - cftime=1.1 - coveralls - - dask=2.11 - - distributed=2.11 + - dask=2.15 + - distributed=2.15 - h5netcdf=0.8 - h5py=2.10 - hdf5=1.10 - hypothesis - iris=2.4 - lxml=4.5 # Optional dep of pydap - - matplotlib-base=3.1 + - matplotlib-base=3.2 - nc-time-axis=1.2 # netcdf follows a 1.major.minor[.patch] convention (see https://github.com/Unidata/netcdf4-python/issues/1090) # bumping the netCDF4 version is currently blocked by #4491 - netcdf4=1.5.3 - - numba=0.48 + - numba=0.49 - numpy=1.17 - pandas=1.0 # - pint # See py37-min-nep18.yml diff --git a/doc/whats-new.rst b/doc/whats-new.rst index a9398ff5493..78790bc3daa 100644 --- a/doc/whats-new.rst +++ b/doc/whats-new.rst @@ -108,6 +108,19 @@ New Features Breaking changes ~~~~~~~~~~~~~~~~ +- The minimum versions of some dependencies were changed: + + ============ ====== ==== + Package Old New + ============ ====== ==== + boto3 1.12 1.13 + cftime 1.0 1.1 + dask 2.11 2.15 + distributed 2.11 2.15 + matplotlib 3.1 3.2 + numba 0.48 0.49 + ============ ====== ==== + - :py:func:`open_dataset` and :py:func:`open_dataarray` now accept only the first argument as positional, all others need to be passed are keyword arguments. This is part of the refactor to support external backends (:issue:`4309`, :pull:`4989`). diff --git a/xarray/core/dask_array_compat.py b/xarray/core/dask_array_compat.py index db70d16fecc..9f24590af8e 100644 --- a/xarray/core/dask_array_compat.py +++ b/xarray/core/dask_array_compat.py @@ -1,6 +1,5 @@ import warnings from distutils.version import LooseVersion -from typing import Iterable import numpy as np @@ -58,43 +57,6 @@ def pad(array, pad_width, mode="constant", **kwargs): return padded -if LooseVersion(dask_version) > LooseVersion("2.9.0"): - nanmedian = da.nanmedian -else: - - def nanmedian(a, axis=None, keepdims=False): - """ - This works by automatically chunking the reduced axes to a single chunk - and then calling ``numpy.nanmedian`` function across the remaining dimensions - """ - - if axis is None: - raise NotImplementedError( - "The da.nanmedian function only works along an axis. " - "The full algorithm is difficult to do in parallel" - ) - - if not isinstance(axis, Iterable): - axis = (axis,) - - axis = [ax + a.ndim if ax < 0 else ax for ax in axis] - - a = a.rechunk({ax: -1 if ax in axis else "auto" for ax in range(a.ndim)}) - - result = da.map_blocks( - np.nanmedian, - a, - axis=axis, - keepdims=keepdims, - drop_axis=axis if not keepdims else None, - chunks=[1 if ax in axis else c for ax, c in enumerate(a.chunks)] - if keepdims - else None, - ) - - return result - - if LooseVersion(dask_version) > LooseVersion("2.30.0"): ensure_minimum_chunksize = da.overlap.ensure_minimum_chunksize else: diff --git a/xarray/core/nanops.py b/xarray/core/nanops.py index 00889dbc913..48106bff289 100644 --- a/xarray/core/nanops.py +++ b/xarray/core/nanops.py @@ -155,9 +155,7 @@ def nanmedian(a, axis=None, out=None): # possibly blow memory if axis is not None and len(np.atleast_1d(axis)) == a.ndim: axis = None - return _dask_or_eager_func( - "nanmedian", dask_module=dask_array_compat, eager_module=nputils - )(a, axis=axis) + return _dask_or_eager_func("nanmedian", eager_module=nputils)(a, axis=axis) def _nanvar_object(value, axis=None, ddof=0, keepdims=False, **kwargs): diff --git a/xarray/tests/__init__.py b/xarray/tests/__init__.py index e414ff0ed0e..2797db3cf8b 100644 --- a/xarray/tests/__init__.py +++ b/xarray/tests/__init__.py @@ -69,7 +69,6 @@ def LooseVersion(vstring): has_pynio, requires_pynio = _importorskip("Nio") has_pseudonetcdf, requires_pseudonetcdf = _importorskip("PseudoNetCDF") has_cftime, requires_cftime = _importorskip("cftime") -has_cftime_1_1_0, requires_cftime_1_1_0 = _importorskip("cftime", minversion="1.1.0.0") has_cftime_1_4_1, requires_cftime_1_4_1 = _importorskip("cftime", minversion="1.4.1") has_dask, requires_dask = _importorskip("dask") has_bottleneck, requires_bottleneck = _importorskip("bottleneck") diff --git a/xarray/tests/test_cftimeindex.py b/xarray/tests/test_cftimeindex.py index 29e26d1bb3b..8dee364a08a 100644 --- a/xarray/tests/test_cftimeindex.py +++ b/xarray/tests/test_cftimeindex.py @@ -16,7 +16,7 @@ ) from xarray.tests import assert_array_equal, assert_identical -from . import requires_cftime, requires_cftime_1_1_0 +from . import requires_cftime from .test_coding_times import ( _ALL_CALENDARS, _NON_STANDARD_CALENDARS, @@ -244,7 +244,7 @@ def test_cftimeindex_dayofweek_accessor(index): assert_array_equal(result, expected) -@requires_cftime_1_1_0 +@requires_cftime def test_cftimeindex_days_in_month_accessor(index): result = index.days_in_month expected = [date.daysinmonth for date in index] @@ -916,7 +916,7 @@ def test_cftimeindex_calendar_property(calendar, expected): assert index.calendar == expected -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize( ("calendar", "expected"), [ @@ -936,7 +936,7 @@ def test_cftimeindex_calendar_repr(calendar, expected): assert "2000-01-01 00:00:00, 2000-01-02 00:00:00" in repr_str -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize("periods", [2, 40]) def test_cftimeindex_periods_repr(periods): """Test that cftimeindex has periods property in repr.""" @@ -945,7 +945,7 @@ def test_cftimeindex_periods_repr(periods): assert f" length={periods}" in repr_str -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize("calendar", ["noleap", "360_day", "standard"]) @pytest.mark.parametrize("freq", ["D", "H"]) def test_cftimeindex_freq_in_repr(freq, calendar): @@ -955,7 +955,7 @@ def test_cftimeindex_freq_in_repr(freq, calendar): assert f", freq='{freq}'" in repr_str -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize( "periods,expected", [ @@ -995,7 +995,7 @@ def test_cftimeindex_repr_formatting(periods, expected): assert expected == repr(index) -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize("display_width", [40, 80, 100]) @pytest.mark.parametrize("periods", [2, 3, 4, 100, 101]) def test_cftimeindex_repr_formatting_width(periods, display_width): @@ -1013,7 +1013,7 @@ def test_cftimeindex_repr_formatting_width(periods, display_width): assert s[:len_intro_str] == " " * len_intro_str -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize("periods", [22, 50, 100]) def test_cftimeindex_repr_101_shorter(periods): index_101 = xr.cftime_range(start="2000", periods=101) @@ -1187,7 +1187,7 @@ def test_asi8_distant_date(): np.testing.assert_array_equal(result, expected) -@requires_cftime_1_1_0 +@requires_cftime def test_infer_freq_valid_types(): cf_indx = xr.cftime_range("2000-01-01", periods=3, freq="D") assert xr.infer_freq(cf_indx) == "D" @@ -1202,7 +1202,7 @@ def test_infer_freq_valid_types(): assert xr.infer_freq(xr.DataArray(pd_td_indx)) == "D" -@requires_cftime_1_1_0 +@requires_cftime def test_infer_freq_invalid_inputs(): # Non-datetime DataArray with pytest.raises(ValueError, match="must contain datetime-like objects"): @@ -1231,7 +1231,7 @@ def test_infer_freq_invalid_inputs(): assert xr.infer_freq(indx[np.array([0, 1, 3])]) is None -@requires_cftime_1_1_0 +@requires_cftime @pytest.mark.parametrize( "freq", [