Skip to content

Commit 9e0f312

Browse files
authored
Merge branch 'main' into parsedims
2 parents ccf9561 + 6f1cf51 commit 9e0f312

File tree

16 files changed

+301
-95
lines changed

16 files changed

+301
-95
lines changed

.github/workflows/upstream-dev-ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ jobs:
8080
if: success()
8181
id: status
8282
run: |
83+
export ZARR_V3_EXPERIMENTAL_API=1
8384
python -m pytest --timeout=60 -rf \
8485
--report-log output-${{ matrix.python-version }}-log.jsonl
8586
- name: Generate and publish the report

ci/requirements/all-but-dask.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies:
3030
- pip
3131
- pseudonetcdf
3232
- pydap
33-
# - pynio # not compatible with netCDF4>1.5.3, see #4491
3433
- pytest
3534
- pytest-cov
3635
- pytest-env

ci/requirements/environment-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ dependencies:
3030
- pre-commit
3131
- pseudonetcdf
3232
- pydap
33-
# - pynio # Not available on Windows
3433
- pytest
3534
- pytest-cov
3635
- pytest-env

ci/requirements/environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ dependencies:
3434
- pre-commit
3535
- pseudonetcdf
3636
- pydap
37-
# - pynio # not compatible with netCDF4>1.5.3, see #4491
3837
- pytest
3938
- pytest-cov
4039
- pytest-env

ci/requirements/min-all-deps.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ dependencies:
4040
- pip
4141
- pseudonetcdf=3.2
4242
- pydap=3.2
43-
# - pynio=1.5.5 # see: https://github.com/pydata/xarray/issues/4491
4443
- pytest
4544
- pytest-cov
4645
- pytest-env

doc/user-guide/io.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,10 @@ We recommend installing cfgrib via conda::
12091209
Formats supported by PyNIO
12101210
--------------------------
12111211

1212+
.. warning::
1213+
1214+
The PyNIO backend is deprecated_. PyNIO is no longer maintained_. See
1215+
12121216
Xarray can also read GRIB, HDF4 and other file formats supported by PyNIO_,
12131217
if PyNIO is installed. To use PyNIO to read such files, supply
12141218
``engine='pynio'`` to :py:func:`open_dataset`.
@@ -1217,12 +1221,9 @@ We recommend installing PyNIO via conda::
12171221

12181222
conda install -c conda-forge pynio
12191223

1220-
.. warning::
1221-
1222-
PyNIO is no longer actively maintained and conflicts with netcdf4 > 1.5.3.
1223-
The PyNIO backend may be moved outside of xarray in the future.
1224-
12251224
.. _PyNIO: https://www.pyngl.ucar.edu/Nio.shtml
1225+
.. _deprecated: https://github.com/pydata/xarray/issues/4491
1226+
.. _maintained: https://github.com/NCAR/pynio/issues/53
12261227

12271228
.. _io.PseudoNetCDF:
12281229

doc/whats-new.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ What's New
1414
1515
np.random.seed(123456)
1616
17-
1817
.. _whats-new.2022.11.1:
1918

2019
v2022.11.1 (unreleased)
@@ -23,6 +22,8 @@ v2022.11.1 (unreleased)
2322
New Features
2423
~~~~~~~~~~~~
2524

25+
- Add experimental support for Zarr's in-progress V3 specification. (:pull:`6475`).
26+
By `Gregory Lee <https://github.com/grlee77>`_ and `Joe Hamman <https://github.com/jhamman>`_.
2627

2728
Breaking changes
2829
~~~~~~~~~~~~~~~~
@@ -49,13 +50,16 @@ Breaking changes
4950

5051
Deprecations
5152
~~~~~~~~~~~~
52-
53+
- The PyNIO backend has been deprecated (:issue:`4491`, :pull:`7301`).
54+
By `Joe Hamman <https://github.com/jhamman>`_.
5355

5456
Bug fixes
5557
~~~~~~~~~
5658

5759
- Import ``nc_time_axis`` when needed (:issue:`7275`, :pull:`7276`).
5860
By `Michael Niklas <https://github.com/headtr1ck>`_.
61+
- Fix static typing of :py:meth:`xr.polyval` (:issue:`7312`, :pull:`7315`).
62+
By `Michael Niklas <https://github.com/headtr1ck>`_.
5963

6064
Documentation
6165
~~~~~~~~~~~~~

pyproject.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ module = [
4040
"cfgrib.*",
4141
"cftime.*",
4242
"cupy.*",
43-
"dask.*",
44-
"distributed.*",
4543
"fsspec.*",
4644
"h5netcdf.*",
4745
"h5py.*",
@@ -52,11 +50,9 @@ module = [
5250
"Nio.*",
5351
"nc_time_axis.*",
5452
"numbagg.*",
55-
"numpy.*",
5653
"netCDF4.*",
5754
"netcdftime.*",
5855
"pandas.*",
59-
"pint.*",
6056
"pooch.*",
6157
"PseudoNetCDF.*",
6258
"pydap.*",
@@ -70,8 +66,6 @@ module = [
7066
"zarr.*",
7167
]
7268

73-
# version spanning code is hard to type annotate (and most of this module will
74-
# be going away soon anyways)
7569
[[tool.mypy.overrides]]
7670
ignore_errors = true
77-
module = "xarray.core.pycompat"
71+
module = []

setup.cfg

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,12 @@ markers =
147147

148148
[flake8]
149149
ignore =
150-
E203 # whitespace before ':' - doesn't work well with black
151-
E402 # module level import not at top of file
152-
E501 # line too long - let black worry about that
153-
E731 # do not assign a lambda expression, use a def
154-
W503 # line break before binary operator
150+
# E203: whitespace before ':' - doesn't work well with black
151+
# E402: module level import not at top of file
152+
# E501: line too long - let black worry about that
153+
# E731: do not assign a lambda expression, use a def
154+
# W503: line break before binary operator
155+
E203, E402, E501, E731, W503
155156
exclude =
156157
.eggs
157158
doc

xarray/backends/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,7 @@ def to_zarr(
15041504
region: Mapping[str, slice] | None = None,
15051505
safe_chunks: bool = True,
15061506
storage_options: dict[str, str] | None = None,
1507+
zarr_version: int | None = None,
15071508
) -> backends.ZarrStore:
15081509
...
15091510

@@ -1525,6 +1526,7 @@ def to_zarr(
15251526
region: Mapping[str, slice] | None = None,
15261527
safe_chunks: bool = True,
15271528
storage_options: dict[str, str] | None = None,
1529+
zarr_version: int | None = None,
15281530
) -> Delayed:
15291531
...
15301532

@@ -1543,6 +1545,7 @@ def to_zarr(
15431545
region: Mapping[str, slice] | None = None,
15441546
safe_chunks: bool = True,
15451547
storage_options: dict[str, str] | None = None,
1548+
zarr_version: int | None = None,
15461549
) -> backends.ZarrStore | Delayed:
15471550
"""This function creates an appropriate datastore for writing a dataset to
15481551
a zarr ztore
@@ -1609,6 +1612,13 @@ def to_zarr(
16091612
f"``region`` with to_zarr(), got {append_dim} in both"
16101613
)
16111614

1615+
if zarr_version is None:
1616+
# default to 2 if store doesn't specify it's version (e.g. a path)
1617+
zarr_version = int(getattr(store, "_store_version", 2))
1618+
1619+
if consolidated is None and zarr_version > 2:
1620+
consolidated = False
1621+
16121622
if mode == "r+":
16131623
already_consolidated = consolidated
16141624
consolidate_on_close = False
@@ -1627,6 +1637,7 @@ def to_zarr(
16271637
write_region=region,
16281638
safe_chunks=safe_chunks,
16291639
stacklevel=4, # for Dataset.to_zarr()
1640+
zarr_version=zarr_version,
16301641
)
16311642

16321643
if mode in ["a", "r+"]:

0 commit comments

Comments
 (0)