You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Avoid calling np.asarray on lazy indexing classes (#6874)
* Add get_array to lazy indexing array types.
This returns the underlying array type instead of always casting
to np.array. This is necessary for Zarr stores where the
Zarr Array wraps a cupy array (for example kvikio.zarr.GDSStoree).
In that case, we cannot call np.asarray because __array__ is
expected to always return a numpy array.
We use get_array in Variable.data to make sure we don't load arrays
from such GDSStores.
* Rename to short_array_repr; use Variable.data
instead of always casting to np.asarray
* Fix Variable.load
* Make get_array recursive.
* Some cleanups
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add get_array to PandasIndexingAdaptor
* Finish short_array_repr refactoring
* Rename to get_duck_array
* Try without hasattr check
* Return bare array from LazilyIndexedArray.get_duck_array
* Add get_duck_array to AbstractArray
Clean up short_array_repr.
* Fix zerodim test
* Fix LazilyVectorizedIndexedArray
* Inherit __array__ from ExplicitlyIndexed
* Fix InaccessibleArray in tests
* Fix BackendArray
* reprs Use .data on AbstractArray
* Force netCDF and h5netCDF to return arrays
* Add whats-new
* Add comments; review feedback
* Fix merge.
* Remove another np.asarray
* Avoid np.asarray on __getitem__.
for BoolTypeArray, NativeEndiannessArray
* [WIP] ExplicitlyIndexedBackendArray
* Handle Indexing Adapter classes explicitly.
* Revert "Handle Indexing Adapter classes explicitly."
This reverts commit 46d98ec.
* Revert "[WIP] ExplicitlyIndexedBackendArray"
This reverts commit 9b727e6.
* Fix pydap now that NumpyIndexingAdapter does not automatically cast to array
* Update xarray/backends/pydap_.py
* Add test store.
* [skip-ci] Update whats-new
* Fix test
* fix mypy?
* Fix Zarr test
* test the repr too
* Guard np.asarray for scalars.
* Revert casting to arrays in backend
* Wrap numpy scalars in Explicitly*Indexed*.get_duck_aray
* Apply suggestions from code review
Co-authored-by: Illviljan <[email protected]>
Co-authored-by: Stephan Hoyer <[email protected]>
* Update xarray/tests/__init__.py
Co-authored-by: Illviljan <[email protected]>
* Update xarray/core/indexing.py
* Apply suggestions from code review
Co-authored-by: Illviljan <[email protected]>
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Bring back the ugly check
* Update whats-new
* Fix pre-commit
* silence mypy error
* minimize diff
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Illviljan <[email protected]>
Co-authored-by: Stephan Hoyer <[email protected]>
0 commit comments