Skip to content

Commit 3a02341

Browse files
authored
Merge branch 'main' into depr-eagerly-compute-group
2 parents 8e50d5e + c22fe17 commit 3a02341

32 files changed

+1157
-131
lines changed

ci/minimum_versions.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020

2121
channels = ["conda-forge"]
2222
platforms = ["noarch", "linux-64"]
23+
# these packages don't fail the CI, but will be printed in the report
24+
ignore_failure_packages = [
25+
# remove when we can pin to pydap 3.5.1 without error
26+
"pydap",
27+
]
28+
# these packages are completely ignored
2329
ignored_packages = [
2430
"coveralls",
2531
"pip",
@@ -171,7 +177,11 @@ def compare_versions(environments, policy_versions):
171177
status = {}
172178
for env, specs in environments.items():
173179
env_status = any(
174-
spec.version > policy_versions[spec.name].version for spec in specs
180+
(
181+
(spec.version > policy_versions[spec.name].version)
182+
and (spec.name not in ignore_failure_packages)
183+
)
184+
for spec in specs
175185
)
176186
status[env] = env_status
177187
return status

ci/requirements/min-all-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ dependencies:
4242
- pandas=2.1
4343
- pint=0.22
4444
- pip
45-
- pydap=3.4
45+
- pydap=3.5
4646
- pytest
4747
- pytest-cov
4848
- pytest-env

doc/api-hidden.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@
530530
Index.rename
531531
Index.copy
532532

533+
indexes.RangeIndex.start
534+
indexes.RangeIndex.stop
535+
indexes.RangeIndex.step
536+
533537
backends.NetCDF4DataStore.close
534538
backends.NetCDF4DataStore.encode
535539
backends.NetCDF4DataStore.encode_attribute

doc/api.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,6 +1573,7 @@ Custom Indexes
15731573
:toctree: generated/
15741574

15751575
CFTimeIndex
1576+
indexes.RangeIndex
15761577

15771578
Creating custom indexes
15781579
-----------------------
@@ -1582,6 +1583,8 @@ Creating custom indexes
15821583
cftime_range
15831584
date_range
15841585
date_range_like
1586+
indexes.RangeIndex.arange
1587+
indexes.RangeIndex.linspace
15851588

15861589
Tutorial
15871590
========

doc/internals/time-coding.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,3 +535,20 @@ To opt-out of timedelta decoding (see issue `Undesired decoding to timedelta64 <
535535
.. note::
536536
Note that in the future the default value of ``decode_timedelta`` will be
537537
``False`` rather than ``None``.
538+
539+
540+
541+
.. ipython:: python
542+
:suppress:
543+
544+
# Cleanup
545+
import os
546+
547+
for f in [
548+
"test-datetimes1.nc",
549+
"test-datetimes2.nc",
550+
"test-timedeltas1.nc",
551+
"test-timedeltas2.nc",
552+
]:
553+
if os.path.exists(f):
554+
os.remove(f)

doc/user-guide/io.rst

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,37 +1245,44 @@ over the network until we look at particular values:
12451245

12461246
.. image:: ../_static/opendap-prism-tmax.png
12471247

1248-
Some servers require authentication before we can access the data. For this
1249-
purpose we can explicitly create a :py:class:`backends.PydapDataStore`
1250-
and pass in a `Requests`__ session object. For example for
1251-
HTTP Basic authentication::
1248+
Some servers require authentication before we can access the data. Pydap uses
1249+
a `Requests`__ session object (which the user can pre-define), and this
1250+
session object can recover `authentication`__` credentials from a locally stored
1251+
``.netrc`` file. For example, to connect to a server that requires NASA's
1252+
URS authentication, with the username/password credentials stored on a locally
1253+
accessible ``.netrc``, access to OPeNDAP data should be as simple as this::
12521254

12531255
import xarray as xr
12541256
import requests
12551257

1256-
session = requests.Session()
1257-
session.auth = ('username', 'password')
1258+
my_session = requests.Session()
12581259

1259-
store = xr.backends.PydapDataStore.open('http://example.com/data',
1260-
session=session)
1261-
ds = xr.open_dataset(store)
1260+
ds_url = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/example.nc'
12621261

1263-
`Pydap's cas module`__ has functions that generate custom sessions for
1264-
servers that use CAS single sign-on. For example, to connect to servers
1265-
that require NASA's URS authentication::
1262+
ds = xr.open_dataset(ds_url, session=my_session, engine="pydap")
12661263

1267-
import xarray as xr
1268-
from pydata.cas.urs import setup_session
1264+
Moreover, a bearer token header can be included in a `Requests`__ session
1265+
object, allowing for token-based authentication which OPeNDAP servers can use
1266+
to avoid some redirects.
12691267

1270-
ds_url = 'https://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/example.nc'
12711268

1272-
session = setup_session('username', 'password', check_url=ds_url)
1273-
store = xr.backends.PydapDataStore.open(ds_url, session=session)
1269+
Lastly, OPeNDAP servers may provide endpoint URLs for different OPeNDAP protocols,
1270+
DAP2 and DAP4. To specify which protocol between the two options to use, you can
1271+
replace the scheme of the url with the name of the protocol. For example::
12741272

1275-
ds = xr.open_dataset(store)
1273+
# dap2 url
1274+
ds_url = 'dap2://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/example.nc'
1275+
1276+
# dap4 url
1277+
ds_url = 'dap4://gpm1.gesdisc.eosdis.nasa.gov/opendap/hyrax/example.nc'
1278+
1279+
While most OPeNDAP servers implement DAP2, not all servers implement DAP4. It
1280+
is recommended to check if the URL you are using `supports DAP4`__ by checking the
1281+
URL on a browser.
12761282

12771283
__ https://docs.python-requests.org
1278-
__ https://www.pydap.org/en/latest/client.html#authentication
1284+
__ https://pydap.github.io/pydap/en/notebooks/Authentication.html
1285+
__ https://pydap.github.io/pydap/en/faqs/dap2_or_dap4_url.html
12791286

12801287
.. _io.pickle:
12811288

@@ -1356,7 +1363,10 @@ To export just the dataset schema without the data itself, use the
13561363
# However, `ds` (rather than the unpickled dataset) refers to the open file. Delete
13571364
# `ds` to close the file.
13581365
del ds
1359-
os.remove("saved_on_disk.nc")
1366+
1367+
for f in ["saved_on_disk.nc", "saved_on_disk.h5"]:
1368+
if os.path.exists(f):
1369+
os.remove(f)
13601370
13611371
This can be useful for generating indices of dataset contents to expose to
13621372
search indices or other automated data discovery tools.

doc/whats-new.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,20 @@ New Features
2424

2525
- Added `scipy-stubs <https://github.com/scipy/scipy-stubs>`_ to the ``xarray[types]`` dependencies.
2626
By `Joren Hammudoglu <https://github.com/jorenham>`_.
27+
- Improved compatibility with OPeNDAP DAP4 data model for backend engine ``pydap``. This
28+
includes ``datatree`` support, and removing slashes from dimension names. By
29+
`Miguel Jimenez-Urias <https://github.com/Mikejmnez>`_.
2730

2831
Breaking changes
2932
~~~~~~~~~~~~~~~~
3033

34+
- The minimum versions of some dependencies were changed
35+
36+
===================== ========= =======
37+
Package Old New
38+
===================== ========= =======
39+
pydap 3.4 3.5.0
40+
===================== ========= =======
3141

3242
Deprecations
3343
~~~~~~~~~~~~
@@ -50,6 +60,8 @@ Documentation
5060

5161
- Fix references to core classes in docs (:issue:`10195`, :pull:`10207`).
5262
By `Mattia Almansi <https://github.com/malmans2>`_.
63+
- Fix references to point to updated pydap documentation (:pull:`10182`).
64+
By `Miguel Jimenez-Urias <https://github.com/Mikejmnez>`_.
5365

5466
Internal Changes
5567
~~~~~~~~~~~~~~~~
@@ -65,9 +77,11 @@ Andrecho, Deepak Cherian, Ian Hunt-Isaak, Karl Krauth, Mathias Hauser, Maximilia
6577

6678
New Features
6779
~~~~~~~~~~~~
68-
6980
- Allow setting a ``fill_value`` for Zarr format 3 arrays. Specify ``fill_value`` in ``encoding`` as usual.
7081
(:issue:`10064`). By `Deepak Cherian <https://github.com/dcherian>`_.
82+
- Added :py:class:`indexes.RangeIndex` as an alternative, memory saving Xarray index representing
83+
a 1-dimensional bounded interval with evenly spaced floating values (:issue:`8473`, :pull:`10076`).
84+
By `Benoit Bovy <https://github.com/benbovy>`_.
7185

7286
Breaking changes
7387
~~~~~~~~~~~~~~~~

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ filterwarnings = [
346346
"default:the `pandas.MultiIndex` object:FutureWarning:xarray.tests.test_variable",
347347
"default:Using a non-tuple sequence for multidimensional indexing is deprecated:FutureWarning",
348348
"default:Duplicate dimension names present:UserWarning:xarray.namedarray.core",
349+
# Zarr 2 V3 implementation
350+
"ignore:Zarr-Python is not in alignment with the final V3 specification",
349351
# TODO: this is raised for vlen-utf8, consolidated metadata, U1 dtype
350352
"ignore:is currently not part .* the Zarr version 3 specification.",
351353
# TODO: remove once we know how to deal with a changed signature in protocols

0 commit comments

Comments
 (0)