Skip to content

Commit f1738a0

Browse files
authored
Clean up backend indexing some more (#10376)
* Making decoding arrays lazy too * Add IndexingAdapter mixin class * Cleanup backends some more * Revert "Add IndexingAdapter mixin class" This reverts commit 930f24d. * Fix scipy backend * Add scipy-only CI job xref #8909 * Pin array-api-strict * Fix doctest * Add test for #8909 Closes #8909, #8921 * Remove user warning * fix types * Add whats-new * fix types * Fix docs build
1 parent 8796d55 commit f1738a0

17 files changed

+93
-23
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ jobs:
5454
- env: "bare-minimum"
5555
python-version: "3.10"
5656
os: ubuntu-latest
57+
- env: "bare-min-and-scipy"
58+
python-version: "3.10"
59+
os: ubuntu-latest
5760
- env: "min-all-deps"
5861
python-version: "3.10"
5962
os: ubuntu-latest

ci/requirements/all-but-dask.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- aiobotocore
7-
- array-api-strict
7+
- array-api-strict<2.4
88
- boto3
99
- bottleneck
1010
- cartopy

ci/requirements/all-but-numba.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
# Pin a "very new numpy" (updated Sept 24, 2024)
77
- numpy>=2.1.1
88
- aiobotocore
9-
- array-api-strict
9+
- array-api-strict<2.4
1010
- boto3
1111
- bottleneck
1212
- cartopy
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: xarray-tests
2+
channels:
3+
- conda-forge
4+
- nodefaults
5+
dependencies:
6+
- python=3.10
7+
- coveralls
8+
- pip
9+
- pytest
10+
- pytest-cov
11+
- pytest-env
12+
- pytest-mypy-plugins
13+
- pytest-timeout
14+
- pytest-xdist
15+
- numpy=1.24
16+
- packaging=23.1
17+
- pandas=2.1
18+
- scipy=1.11

ci/requirements/environment-3.14.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- aiobotocore
7-
- array-api-strict
7+
- array-api-strict<2.4
88
- boto3
99
- bottleneck
1010
- cartopy

ci/requirements/environment-windows-3.14.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xarray-tests
22
channels:
33
- conda-forge
44
dependencies:
5-
- array-api-strict
5+
- array-api-strict<2.4
66
- boto3
77
- bottleneck
88
- cartopy

ci/requirements/environment-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: xarray-tests
22
channels:
33
- conda-forge
44
dependencies:
5-
- array-api-strict
5+
- array-api-strict<2.4
66
- boto3
77
- bottleneck
88
- cartopy

ci/requirements/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- nodefaults
55
dependencies:
66
- aiobotocore
7-
- array-api-strict
7+
- array-api-strict<2.4
88
- boto3
99
- bottleneck
1010
- cartopy

doc/whats-new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Bug fixes
2626
~~~~~~~~~
2727
- Fix Pydap test_cmp_local_file for numpy 2.3.0 changes, 1. do always return arrays for all versions and 2. skip astype(str) for numpy >= 2.3.0 for expected data. (:pull:`10421`)
2828
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
29+
- Fix the SciPy backend for netCDF3 files . (:issue:`8909`, :pull:`10376`)
30+
By `Deepak Cherian <https://github.com/dcherian>`_.
2931

3032

3133
Documentation

xarray/backends/memory.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import numpy as np
66

77
from xarray.backends.common import AbstractWritableDataStore
8+
from xarray.core import indexing
89
from xarray.core.variable import Variable
910

1011

@@ -24,7 +25,12 @@ def get_attrs(self):
2425
return self._attributes
2526

2627
def get_variables(self):
27-
return self._variables
28+
res = {}
29+
for k, v in self._variables.items():
30+
v = v.copy(deep=True)
31+
res[k] = v
32+
v._data = indexing.LazilyIndexedArray(v._data)
33+
return res
2834

2935
def get_dimensions(self):
3036
return {d: s for v in self._variables.values() for d, s in v.dims.items()}

0 commit comments

Comments
 (0)