Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump versions #5258

Merged
merged 4 commits into from
May 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ci/requirements/py37-min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,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`).
Expand Down
38 changes: 0 additions & 38 deletions xarray/core/dask_array_compat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import warnings
from distutils.version import LooseVersion
from typing import Iterable

import numpy as np

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 1 addition & 3 deletions xarray/core/nanops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion xarray/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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")
Expand Down
22 changes: 11 additions & 11 deletions xarray/tests/test_cftimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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"),
[
Expand All @@ -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."""
Expand All @@ -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):
Expand All @@ -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",
[
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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"):
Expand Down Expand Up @@ -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",
[
Expand Down