Skip to content

Commit 9a0c744

Browse files
fujiisoupshoyer
authored andcommitted
indexing with broadcasting (#1639)
* Implemented `_broadcast_indexes` in Variable.py * Diagonal indexing for Variable. * update _broadcast_indexes. update tests. * Support basic boolean indexing. * tests for dask-based Variable * Explicitly mark xfail flags * orthogonal indexing for dask. * Refactor DaskArrayAdapter * Added MissingDimensionsError. Improve DaskIndexingAdapter, Variable.__getitem__ * use `np.arange(*slice.indices(size))` rather than `np.arange(size)[slice]`. * Add orthogonalize_indexers * A bug fix. * Working with LazilyIndexedArray * Fix in LazilyIndexedArray. * add @requires_dask in test_variable * rename orthogonalize_indexers -> unbroadcast_indexers * Wrap LazilyIndexedArray so that it accepts broadcasted-indexers * small rename * Another small fix * Remove unused function. * Added _broadcast_indexes_1vector * Minor fix * Avoid doubly wrapping by LazilyIndexedArray * General orthogonal indexing for dask array. * Added base class IndexableArrayAdapter * Deprecate _unbroadcast_indexers and support IndexerTuple classes * removed unintended prints. * Some clean up. * Some small fix. * Care for boolean array. * Always map boolean index to integer array. * Takes care of boolean index in test_indexing * replace self.assertTrue by assert * Fix based on shoyer's comments. * Added `to_tuple()` method to IndexerTuple class. * Removed: 'orthogonal_indexer', 'canonicalize_indexer' * update IndexVariable.__getitem__ * Made to_tuple function. * BASIC_INDEXING_TYPES * Removed unused function from tests. * assert -> raise * Update Dataset.isel * Use `merge_variables` in checking the consistency. * Cleanup Dataset.__getitem__ * Add comment about why align() is unneeded * Ensure correct tests are run in test_variable.py * Support pointwise indexing with dask * Add a vindex routine for np.ndarray * Add an OrderedSet to xarray.core.utils * Support dask and numpy vindex with one path * Fix test failures * working with `Dataset.sel` * Added more tests * Changes per review * Restore `isel_points`. Remove automatic tuple conversion for `sel` * Some clean up * Supported indexing by a scalar Variable * Supported the indexing by DataArray with coordinates. * Update DataArray.loc and DataArray.sel to use Dataset.loc and Dataset.sel * Added inhouse normalize_axis_index * Support an integer key for _advanced_indexer_subspaces * Add warning for coordinate conflict. * Warning changes DeprecationWarning -> FutureWarning. * fix related to pytest.warns * Another fix related to warning. * Raise an Error for confusing indexing type * Minor fix * Test for indexing by a scalar coordinate. * Modified test * Remove too specialized errorning * Working with docs * Found a bug in as_variable * Working with docs * Enable indexing IndexVariable by multi-dimensional Variable. * Found a bug in indexing np.ndarray * Added a test for boolean-DataArray indexing. * Make sure assignment certainly works. * Added assignment section * pep8 * Remove unused tests. * Add more docs. * Api.rst changed * Add link in whats-new * Small format cleanup * allow positional indexing with unsigned integer types * Catch up to the previous merge. * workaround for daskarray with uint indexer. * Add a section about assignment, full indexing rules. * warning added for reindex for DataArray indexers. * Move warning in alignment.reindex_variables. * + Change API to attach non-dimensional coordinates. + Remove warnings for the coordinate conflict. * Some clean up. Fix error in test_reindex_warning * Enable vindex for PandasIndexAdapter. * Add deprecation warning for isel_points * Add a sanity check for boolean vectorized indexing. * Modify tests to take care of the sanity check related to boolean array indexing. * Another follow up * pep8 * Clean up sanity checks in broadcast_indexers * Fix unintended rename * indexing.rst edits * remove note about conflicts for now * Apply coordinate conflict rule. * Python 2 support * Add tests for mindex selection. * Drop coordinate of itself. * Clean up the coordinate dropping logic. * A small bug fix in coordinate dropping logic * Fixes based on jhamman's comments. * Improve test for warning. * Remove unused assert sentence. * Simplify rules for indexing conflicts * Better error-message for multiindex vectorized-selection.
1 parent 4c3c332 commit 9a0c744

23 files changed

+2061
-434
lines changed

doc/api.rst

-4
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ Indexing
105105
Dataset.loc
106106
Dataset.isel
107107
Dataset.sel
108-
Dataset.isel_points
109-
Dataset.sel_points
110108
Dataset.squeeze
111109
Dataset.reindex
112110
Dataset.reindex_like
@@ -247,8 +245,6 @@ Indexing
247245
DataArray.loc
248246
DataArray.isel
249247
DataArray.sel
250-
DataArray.isel_points
251-
DataArray.sel_points
252248
DataArray.squeeze
253249
DataArray.reindex
254250
DataArray.reindex_like

0 commit comments

Comments
 (0)