Skip to content
forked from pydata/xarray

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into propagate-attrs
Browse files Browse the repository at this point in the history
* upstream/master: (34 commits)
  Fix bug in computing means of cftime.datetime arrays (pydata#4344)
  fix some str accessor inconsistencies (pydata#4339)
  pin matplotlib in ci/requirements/doc.yml (pydata#4340)
  Clarify drop_vars return value. (pydata#4244)
  Support explicitly setting a dimension order with to_dataframe() (pydata#4333)
  Increase support window of all dependencies (pydata#4296)
  Implement interp for interpolating between chunks of data (dask) (pydata#4155)
  Add @mathause to current core developers. (pydata#4335)
  install sphinx-autosummary-accessors from conda-forge (pydata#4332)
  Use sphinx-accessors-autosummary (pydata#4323)
  ndrolling fixes (pydata#4329)
  DOC: fix typo argmin -> argmax in DataArray.argmax docstring (pydata#4327)
  pin sphinx to 3.1(pydata#4326)
  nd-rolling (pydata#4219)
  Implicit dask import 4164 (pydata#4318)
  allow customizing the inline repr of a duck array (pydata#4248)
  silence the known docs CI issues (pydata#4316)
  enh: fixed pydata#4302 (pydata#4315)
  Remove all unused and warn-raising methods from AbstractDataStore (pydata#4310)
  Fix map_blocks example (pydata#4305)
  ...
  • Loading branch information
dcherian committed Aug 15, 2020
2 parents ad75394 + 26547d1 commit b86623c
Show file tree
Hide file tree
Showing 48 changed files with 1,221 additions and 645 deletions.
38 changes: 19 additions & 19 deletions HOW_TO_RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# How to issue an xarray release in 17 easy steps
# How to issue an xarray release in 20 easy steps

Time required: about an hour.

Expand All @@ -23,9 +23,9 @@ upstream https://github.com/pydata/xarray (push)
git log v{0.X.Y-1}.. --format=%aN | sort -u | perl -pe 's/\n/$1, /'
```
Add these into `whats-new.rst` somewhere :)
2. Write a release summary: ~50 words describing the high level features. This
3. Write a release summary: ~50 words describing the high level features. This
will be used in the release emails, tweets, GitHub release notes, etc.
3. Look over whats-new.rst and the docs. Make sure "What's New" is complete
4. Look over whats-new.rst and the docs. Make sure "What's New" is complete
(check the date!) and add the release summary at the top.
Things to watch out for:
- Important new features should be highlighted towards the top.
Expand All @@ -34,46 +34,46 @@ upstream https://github.com/pydata/xarray (push)
due to a bad merge. Check for these before a release by using git diff,
e.g., `git diff v{0.X.Y-1} whats-new.rst` where {0.X.Y-1} is the previous
release.
4. If possible, open a PR with the release summary and whatsnew changes.
4. After merging, again ensure your master branch is synced to upstream:
5. If possible, open a PR with the release summary and whatsnew changes.
6. After merging, again ensure your master branch is synced to upstream:
```sh
git pull upstream master
```
4. If you have any doubts, run the full test suite one final time!
7. If you have any doubts, run the full test suite one final time!
```sh
pytest
```
5. Check that the ReadTheDocs build is passing.
6. On the master branch, commit the release in git:
8. Check that the ReadTheDocs build is passing.
9. On the master branch, commit the release in git:
```s
git commit -am 'Release v{0.X.Y}'
```
7. Tag the release:
10. Tag the release:
```sh
git tag -a v{0.X.Y} -m 'v{0.X.Y}'
```
8. Build source and binary wheels for PyPI:
11. Build source and binary wheels for PyPI:
```sh
git clean -xdf # this deletes all uncommitted changes!
python setup.py bdist_wheel sdist
```
9. Use twine to check the package build:
12. Use twine to check the package build:
```sh
twine check dist/xarray-{0.X.Y}*
```
10. Use twine to register and upload the release on PyPI. Be careful, you can't
13. Use twine to register and upload the release on PyPI. Be careful, you can't
take this back!
```sh
twine upload dist/xarray-{0.X.Y}*
```
You will need to be listed as a package owner at
https://pypi.python.org/pypi/xarray for this to work.
11. Push your changes to master:
14. Push your changes to master:
```sh
git push upstream master
git push upstream --tags
```
12. Update the stable branch (used by ReadTheDocs) and switch back to master:
15. Update the stable branch (used by ReadTheDocs) and switch back to master:
```sh
git checkout stable
git rebase master
Expand All @@ -83,7 +83,7 @@ upstream https://github.com/pydata/xarray (push)
It's OK to force push to 'stable' if necessary. (We also update the stable
branch with `git cherry-pick` for documentation only fixes that apply the
current released version.)
13. Add a section for the next release {0.X.Y+1} to doc/whats-new.rst:
16. Add a section for the next release {0.X.Y+1} to doc/whats-new.rst:
```
.. _whats-new.{0.X.Y+1}:
Expand All @@ -109,19 +109,19 @@ upstream https://github.com/pydata/xarray (push)
Internal Changes
~~~~~~~~~~~~~~~~
```
14. Commit your changes and push to master again:
17. Commit your changes and push to master again:
```sh
git commit -am 'New whatsnew section'
git push upstream master
```
You're done pushing to master!
15. Issue the release on GitHub. Click on "Draft a new release" at
18. Issue the release on GitHub. Click on "Draft a new release" at
https://github.com/pydata/xarray/releases. Type in the version number
and paste the release summary in the notes.
16. Update the docs. Login to https://readthedocs.org/projects/xray/versions/
19. Update the docs. Login to https://readthedocs.org/projects/xray/versions/
and switch your new release tag (at the bottom) from "Inactive" to "Active".
It should now build automatically.
17. Issue the release announcement to mailing lists & Twitter. For bug fix releases, I
20. Issue the release announcement to mailing lists & Twitter. For bug fix releases, I
usually only email [email protected]. For major/feature releases, I will email a broader
list (no more than once every 3-6 months):
- [email protected]
Expand Down
23 changes: 20 additions & 3 deletions ci/min_deps_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,21 @@
"pytest-env",
}

POLICY_MONTHS = {"python": 42, "numpy": 24, "pandas": 12, "scipy": 12}
POLICY_MONTHS_DEFAULT = 6

POLICY_MONTHS = {"python": 42, "numpy": 24, "setuptools": 42}
POLICY_MONTHS_DEFAULT = 12
POLICY_OVERRIDE = {
# dask < 2.9 has trouble with nan-reductions
# TODO remove this special case and the matching note in installing.rst
# after January 2021.
"dask": (2, 9),
"distributed": (2, 9),
# setuptools-scm doesn't work with setuptools < 36.7 (Nov 2017).
# The conda metadata is malformed for setuptools < 38.4 (Jan 2018)
# (it's missing a timestamp which prevents this tool from working).
# TODO remove this special case and the matching note in installing.rst
# after July 2021.
"setuptools": (38, 4),
}
has_errors = False


Expand Down Expand Up @@ -151,6 +163,11 @@ def process_pkg(
policy_minor = minor
policy_published_actual = published

try:
policy_major, policy_minor = POLICY_OVERRIDE[pkg]
except KeyError:
pass

if (req_major, req_minor) < (policy_major, policy_minor):
status = "<"
elif (req_major, req_minor) > (policy_major, policy_minor):
Expand Down
8 changes: 6 additions & 2 deletions ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ dependencies:
- ipython
- iris>=2.3
- jupyter_client
- matplotlib-base=3.3.0
- nbsphinx
- netcdf4>=1.5
- numba
- numpy>=1.17
- pandas>=1.0
# FIXME https://github.com/pydata/xarray/issues/4287
# - pandas>=1.0
- pandas=1.0
- rasterio>=1.1
- seaborn
- setuptools
- sphinx>=2.3
- sphinx=3.1
- sphinx_rtd_theme>=0.4
- sphinx-autosummary-accessors
- zarr>=2.4
2 changes: 1 addition & 1 deletion ci/requirements/py36-bare-minimum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ dependencies:
- pytest-env
- numpy=1.15
- pandas=0.25
- setuptools=41.2
- setuptools=38.4
2 changes: 1 addition & 1 deletion ci/requirements/py36-min-all-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies:
- rasterio=1.0
- scipy=1.3
- seaborn=0.9
- setuptools=41.2
- setuptools=38.4
# - sparse # See py36-min-nep18.yml
- toolz=0.10
- zarr=2.3
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements/py36-min-nep18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ dependencies:
- pytest
- pytest-cov
- pytest-env
- scipy=1.2
- setuptools=41.2
- scipy=1.3
- setuptools=38.4
- sparse=0.8
28 changes: 0 additions & 28 deletions doc/api-hidden.rst
Original file line number Diff line number Diff line change
Expand Up @@ -665,13 +665,10 @@
backends.NetCDF4DataStore.encode
backends.NetCDF4DataStore.encode_attribute
backends.NetCDF4DataStore.encode_variable
backends.NetCDF4DataStore.get
backends.NetCDF4DataStore.get_attrs
backends.NetCDF4DataStore.get_dimensions
backends.NetCDF4DataStore.get_encoding
backends.NetCDF4DataStore.get_variables
backends.NetCDF4DataStore.items
backends.NetCDF4DataStore.keys
backends.NetCDF4DataStore.load
backends.NetCDF4DataStore.open
backends.NetCDF4DataStore.open_store_variable
Expand All @@ -685,27 +682,20 @@
backends.NetCDF4DataStore.store
backends.NetCDF4DataStore.store_dataset
backends.NetCDF4DataStore.sync
backends.NetCDF4DataStore.values
backends.NetCDF4DataStore.attrs
backends.NetCDF4DataStore.autoclose
backends.NetCDF4DataStore.dimensions
backends.NetCDF4DataStore.ds
backends.NetCDF4DataStore.format
backends.NetCDF4DataStore.is_remote
backends.NetCDF4DataStore.lock
backends.NetCDF4DataStore.variables

backends.H5NetCDFStore.close
backends.H5NetCDFStore.encode
backends.H5NetCDFStore.encode_attribute
backends.H5NetCDFStore.encode_variable
backends.H5NetCDFStore.get
backends.H5NetCDFStore.get_attrs
backends.H5NetCDFStore.get_dimensions
backends.H5NetCDFStore.get_encoding
backends.H5NetCDFStore.get_variables
backends.H5NetCDFStore.items
backends.H5NetCDFStore.keys
backends.H5NetCDFStore.load
backends.H5NetCDFStore.open_store_variable
backends.H5NetCDFStore.prepare_variable
Expand All @@ -718,39 +708,25 @@
backends.H5NetCDFStore.store
backends.H5NetCDFStore.store_dataset
backends.H5NetCDFStore.sync
backends.H5NetCDFStore.values
backends.H5NetCDFStore.attrs
backends.H5NetCDFStore.dimensions
backends.H5NetCDFStore.ds
backends.H5NetCDFStore.variables

backends.PydapDataStore.close
backends.PydapDataStore.get
backends.PydapDataStore.get_attrs
backends.PydapDataStore.get_dimensions
backends.PydapDataStore.get_encoding
backends.PydapDataStore.get_variables
backends.PydapDataStore.items
backends.PydapDataStore.keys
backends.PydapDataStore.load
backends.PydapDataStore.open
backends.PydapDataStore.open_store_variable
backends.PydapDataStore.values
backends.PydapDataStore.attrs
backends.PydapDataStore.dimensions
backends.PydapDataStore.variables

backends.ScipyDataStore.close
backends.ScipyDataStore.encode
backends.ScipyDataStore.encode_attribute
backends.ScipyDataStore.encode_variable
backends.ScipyDataStore.get
backends.ScipyDataStore.get_attrs
backends.ScipyDataStore.get_dimensions
backends.ScipyDataStore.get_encoding
backends.ScipyDataStore.get_variables
backends.ScipyDataStore.items
backends.ScipyDataStore.keys
backends.ScipyDataStore.load
backends.ScipyDataStore.open_store_variable
backends.ScipyDataStore.prepare_variable
Expand All @@ -763,11 +739,7 @@
backends.ScipyDataStore.store
backends.ScipyDataStore.store_dataset
backends.ScipyDataStore.sync
backends.ScipyDataStore.values
backends.ScipyDataStore.attrs
backends.ScipyDataStore.dimensions
backends.ScipyDataStore.ds
backends.ScipyDataStore.variables

backends.FileManager.acquire
backends.FileManager.acquire_context
Expand Down
4 changes: 3 additions & 1 deletion doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,9 @@ Universal functions
With recent versions of numpy, dask and xarray, NumPy ufuncs are now
supported directly on all xarray and dask objects. This obviates the need
for the ``xarray.ufuncs`` module, which should not be used for new code
unless compatibility with versions of NumPy prior to v1.13 is required.
unless compatibility with versions of NumPy prior to v1.13 is
required. They will be removed once support for NumPy prior to
v1.17 is dropped.

These functions are copied from NumPy, but extended to work on NumPy arrays,
dask arrays and all xarray objects. You can find them in the ``xarray.ufuncs``
Expand Down
15 changes: 11 additions & 4 deletions doc/computation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,16 @@ a value when aggregating:
r = arr.rolling(y=3, center=True, min_periods=2)
r.mean()
From version 0.17, xarray supports multidimensional rolling,

.. ipython:: python
r = arr.rolling(x=2, y=3, min_periods=2)
r.mean()
.. tip::

Note that rolling window aggregations are faster and use less memory when bottleneck_ is installed. This only applies to numpy-backed xarray objects.
Note that rolling window aggregations are faster and use less memory when bottleneck_ is installed. This only applies to numpy-backed xarray objects with 1d-rolling.

.. _bottleneck: https://github.com/pydata/bottleneck/

Expand Down Expand Up @@ -227,9 +234,9 @@ windowed rolling, convolution, short-time FFT etc.
.. ipython:: python
# rolling with 2-point stride
rolling_da = r.construct("window_dim", stride=2)
rolling_da = r.construct(x="x_win", y="y_win", stride=2)
rolling_da
rolling_da.mean("window_dim", skipna=False)
rolling_da.mean(["x_win", "y_win"], skipna=False)
Because the ``DataArray`` given by ``r.construct('window_dim')`` is a view
of the original array, it is memory efficient.
Expand All @@ -238,7 +245,7 @@ You can also use ``construct`` to compute a weighted rolling sum:
.. ipython:: python
weight = xr.DataArray([0.25, 0.5, 0.25], dims=["window"])
arr.rolling(y=3).construct("window").dot(weight)
arr.rolling(y=3).construct(y="window").dot(weight)
.. note::
numpy's Nan-aggregation functions such as ``nansum`` copy the original array.
Expand Down
Loading

0 comments on commit b86623c

Please sign in to comment.