Skip to content

Commit

Permalink
Merge branch 'main' into fix/dask_indexing
Browse files Browse the repository at this point in the history
* main: (34 commits)
  Explicit indexes (pydata#5692)
  Remove test_rasterio_vrt_network (pydata#6371)
  Allow write_empty_chunks to be set in Zarr encoding (pydata#6348)
  Add new tutorial video (pydata#6353)
  Revert "explicitly install `ipython_genutils` (pydata#6350)" (pydata#6361)
  [pre-commit.ci] pre-commit autoupdate (pydata#6357)
  Run pyupgrade on core/groupby (pydata#6351)
  Generate reductions for DataArray, Dataset, GroupBy and Resample (pydata#5950)
  explicitly install `ipython_genutils` (pydata#6350)
  Bump actions/setup-python from 2 to 3 (pydata#6338)
  Bump actions/checkout from 2 to 3 (pydata#6337)
  In documentation on adding a new backend, add missing import and tweak headings (pydata#6330)
  Lengthen underline, correct spelling, and reword (pydata#6326)
  quantile: use skipna=None (pydata#6303)
  New whatsnew section
  v2022.03.0 release notes (pydata#6319)
  fix typos (using codespell) (pydata#6316)
  Add General issue template (pydata#6314)
  Disable CI runs on forks (pydata#6315)
  Enable running sphinx-build on Windows (pydata#6237)
  ...
  • Loading branch information
dcherian committed Mar 18, 2022
2 parents b7c382b + 3ead17e commit 46a4b16
Show file tree
Hide file tree
Showing 92 changed files with 8,986 additions and 3,884 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bugreport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ body:
Bug reports that follow these guidelines are easier to diagnose, and so are often handled much more quickly.
This will be automatically formatted into code, so no need for markdown backticks.
render: python
render: Python

- type: textarea
id: log-output
attributes:
label: Relevant log output
description: Please copy and paste any relevant output. This will be automatically formatted into code, so no need for markdown backticks.
render: python
render: Python

- type: textarea
id: extra
Expand Down
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/misc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Issue
description: General Issue or discussion topic. For usage questions, please follow the "Usage question" link
labels: ["needs triage"]
body:
- type: markdown
attributes:
value: |
Please describe your issue here.
- type: textarea
id: issue-description
attributes:
label: What is your issue?
description: |
Thank you for filing an issue! Please give us further information on how we can help you.
placeholder: Please describe your issue.
validations:
required: true
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
# We need the full repo to avoid this issue
# https://github.com/actions/checkout/issues/23
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0

Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1.1
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
"py39-flaky",
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.

Expand Down Expand Up @@ -119,12 +119,13 @@ jobs:
doctest:
name: Doctests
runs-on: "ubuntu-latest"
if: needs.detect-ci-trigger.outputs.triggered == 'false'
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -161,7 +162,7 @@ jobs:
shell: bash -l {0}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: conda-incubator/setup-miniconda@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1.1
Expand All @@ -44,7 +44,7 @@ jobs:
# Bookend python versions
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set environment variables
Expand Down Expand Up @@ -115,6 +115,7 @@ jobs:
event_file:
name: "Event File"
runs-on: ubuntu-latest
if: github.repository == 'pydata/xarray'
steps:
- name: Upload
uses: actions/upload-artifact@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pypi-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'pydata/xarray'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: 3.8
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
needs: build-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
name: Install Python
with:
python-version: 3.8
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/upstream-dev-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
outputs:
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: xarray-contrib/ci-trigger@v1.1
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
outputs:
artifacts_availability: ${{ steps.status.outputs.ARTIFACTS_AVAILABLE }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -110,8 +110,8 @@ jobs:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: "3.x"
- uses: actions/download-artifact@v2
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ __pycache__
.hypothesis/

# temp files from docs build
doc/*.nc
doc/auto_gallery
doc/example.nc
doc/rasm.zarr
doc/savefig

# C extensions
Expand Down Expand Up @@ -72,4 +73,3 @@ xarray/tests/data/*.grib.*.idx
Icon*

.ipynb_checkpoints
doc/rasm.zarr
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
rev: v2.31.1
hooks:
- id: pyupgrade
args:
Expand All @@ -45,7 +45,7 @@ repos:
# - id: velin
# args: ["--write", "--compact"]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
rev: v0.940
hooks:
- id: mypy
# Copied from setup.cfg
Expand Down
2 changes: 1 addition & 1 deletion HOW_TO_RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ upstream https://github.com/pydata/xarray (push)

## Note on version numbering

As of 2022.02.0, we utilize the [CALVER](https://calver.org/) version system.
As of 2022.03.0, we utilize the [CALVER](https://calver.org/) version system.
Specifically, we have adopted the pattern `YYYY.MM.X`, where `YYYY` is a 4-digit
year (e.g. `2022`), `MM` is a 2-digit zero-padded month (e.g. `01` for January), and `X` is the release number (starting at zero at the start of each month and incremented once for each additional release).
1 change: 1 addition & 0 deletions ci/requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies:
- pytest
- pytest-cov
- pytest-env
- pytest-github-actions-annotate-failures
- pytest-xdist
- rasterio
- scipy
Expand Down
1 change: 1 addition & 0 deletions doc/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Dataset contents
Dataset.swap_dims
Dataset.expand_dims
Dataset.drop_vars
Dataset.drop_duplicates
Dataset.drop_dims
Dataset.set_coords
Dataset.reset_coords
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
print("python exec:", sys.executable)
print("sys.path:", sys.path)

if "conda" in sys.executable:
if "CONDA_DEFAULT_ENV" in os.environ or "conda" in sys.executable:
print("conda environment:")
subprocess.run(["conda", "list"])
subprocess.run([os.environ.get("CONDA_EXE", "conda"), "list"])
else:
print("pip environment:")
subprocess.run([sys.executable, "-m", "pip", "list"])
Expand Down
4 changes: 2 additions & 2 deletions doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,13 @@ Some other important things to know about the docs:
.. ipython:: python
x = 2
x ** 3
x**3
will be rendered as::

In [1]: x = 2

In [2]: x ** 3
In [2]: x**3
Out[2]: 8

Almost all code examples in the docs are run (and the output saved) during the
Expand Down
1 change: 1 addition & 0 deletions doc/ecosystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Geosciences
- `climpred <https://climpred.readthedocs.io>`_: Analysis of ensemble forecast models for climate prediction.
- `geocube <https://corteva.github.io/geocube>`_: Tool to convert geopandas vector data into rasterized xarray data.
- `GeoWombat <https://github.com/jgrss/geowombat>`_: Utilities for analysis of remotely sensed and gridded raster data at scale (easily tame Landsat, Sentinel, Quickbird, and PlanetScope).
- `gsw-xarray <https://github.com/DocOtak/gsw-xarray>`_: a wrapper around `gsw <https://teos-10.github.io/GSW-Python>`_ that adds CF compliant attributes when possible, units, name.
- `infinite-diff <https://github.com/spencerahill/infinite-diff>`_: xarray-based finite-differencing, focused on gridded climate/meteorology data
- `marc_analysis <https://github.com/darothen/marc_analysis>`_: Analysis package for CESM/MARC experiments and output.
- `MetPy <https://unidata.github.io/MetPy/dev/index.html>`_: A collection of tools in Python for reading, visualizing, and performing calculations with weather data.
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/ROMS_ocean_model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"ds = xr.tutorial.open_dataset(\"ROMS_example.nc\", chunks={\"ocean_time\": 1})\n",
"\n",
"# This is a way to turn on chunking and lazy evaluation. Opening with mfdataset, or\n",
"# setting the chunking in the open_dataset would also achive this.\n",
"# setting the chunking in the open_dataset would also achieve this.\n",
"ds"
]
},
Expand Down
2 changes: 1 addition & 1 deletion doc/gallery/plot_colorbar_center.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
ax4.set_title("Celsius: center=False")
ax4.set_ylabel("")

# Mke it nice
# Make it nice
plt.tight_layout()
plt.show()
4 changes: 3 additions & 1 deletion doc/getting-started-guide/quick-overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ You can directly read and write xarray objects to disk using :py:meth:`~xarray.D
.. ipython:: python
ds.to_netcdf("example.nc")
xr.open_dataset("example.nc")
reopened = xr.open_dataset("example.nc")
reopened
.. ipython:: python
:suppress:
import os
reopened.close()
os.remove("example.nc")
Expand Down
24 changes: 16 additions & 8 deletions doc/internals/how-to-add-new-backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ Xarray :py:meth:`~xarray.open_dataset`, and returns a boolean.

Decoders
^^^^^^^^

The decoders implement specific operations to transform data from on-disk
representation to Xarray representation.

Expand Down Expand Up @@ -199,6 +200,11 @@ performs the inverse transformation.

In the following an example on how to use the coders ``decode`` method:

.. ipython:: python
:suppress:
import xarray as xr
.. ipython:: python
var = xr.Variable(
Expand Down Expand Up @@ -239,7 +245,7 @@ interface only the boolean keywords related to the supported decoders.
.. _RST backend_registration:

How to register a backend
+++++++++++++++++++++++++++
+++++++++++++++++++++++++

Define a new entrypoint in your ``setup.py`` (or ``setup.cfg``) with:

Expand Down Expand Up @@ -273,15 +279,16 @@ If you are using `Poetry <https://python-poetry.org/>`_ for your build system, y

.. code-block:: toml
[tool.poetry.plugins."xarray_backends"]
[tool.poetry.plugins."xarray.backends"]
"my_engine" = "my_package.my_module:MyBackendEntryClass"
See https://python-poetry.org/docs/pyproject/#plugins for more information on Poetry plugins.

.. _RST lazy_loading:

How to support Lazy Loading
How to support lazy loading
+++++++++++++++++++++++++++

If you want to make your backend effective with big datasets, then you should
support lazy loading.
Basically, you shall replace the :py:class:`numpy.ndarray` inside the
Expand Down Expand Up @@ -317,7 +324,7 @@ grouped in three types of indexes
:py:class:`~xarray.core.indexing.OuterIndexer` and
:py:class:`~xarray.core.indexing.VectorizedIndexer`.
This implies that the implementation of the method ``__getitem__`` can be tricky.
In oder to simplify this task, Xarray provides a helper function,
In order to simplify this task, Xarray provides a helper function,
:py:func:`~xarray.core.indexing.explicit_indexing_adapter`, that transforms
all the input ``indexer`` types (`basic`, `outer`, `vectorized`) in a tuple
which is interpreted correctly by your backend.
Expand All @@ -338,8 +345,8 @@ This is an example ``BackendArray`` subclass implementation:
# other backend specific keyword arguments
):
self.shape = shape
self.dtype = lock
self.lock = dtype
self.dtype = dtype
self.lock = lock
def __getitem__(
self, key: xarray.core.indexing.ExplicitIndexer
Expand Down Expand Up @@ -380,8 +387,9 @@ opening files, we therefore suggest to use the helper class provided by Xarray

.. _RST indexing:

Indexing Examples
Indexing examples
^^^^^^^^^^^^^^^^^

**BASIC**

In the ``BASIC`` indexing support, numbers and slices are supported.
Expand Down Expand Up @@ -426,7 +434,7 @@ The ``OUTER_1VECTOR`` indexing shall supports number, slices and at most one
list. The behaviour with the list shall be the same of ``OUTER`` indexing.

If you support more complex indexing as `explicit indexing` or
`numpy indexing`, you can have a look to the implemetation of Zarr backend and Scipy backend,
`numpy indexing`, you can have a look to the implementation of Zarr backend and Scipy backend,
currently available in :py:mod:`~xarray.backends` module.

.. _RST preferred_chunks:
Expand Down
9 changes: 8 additions & 1 deletion doc/internals/zarr-encoding-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ for the storage of the NetCDF data model in Zarr; see
discussion.

First, Xarray can only read and write Zarr groups. There is currently no support
for reading / writting individual Zarr arrays. Zarr groups are mapped to
for reading / writing individual Zarr arrays. Zarr groups are mapped to
Xarray ``Dataset`` objects.

Second, from Xarray's point of view, the key difference between
Expand Down Expand Up @@ -63,3 +63,10 @@ re-open it directly with Zarr:
print(os.listdir("rasm.zarr"))
print(zgroup.tree())
dict(zgroup["Tair"].attrs)
.. ipython:: python
:suppress:
import shutil
shutil.rmtree("rasm.zarr")
Loading

0 comments on commit 46a4b16

Please sign in to comment.