Commit 20a9301
implement the
* add a `PintMetaIndex` that for now can only `sel`
* add a function to compare indexers
* expect indexer dicts for strip_indexer_units
* move the indexer comparison function to the utils
* change extract_indexer_units to expect a dict
* fix a few calls to extract_indexer_units
* one more call
* implement `create_variables` and `from_variables`
Co-authored-by: Benoit Bovy <benbovy@gmail.com>
* use the new index to attach units to dimension coordinates
* pass the dictionary of indexers instead iterating manually
* use `Coordinates._construct_direct`
* delegate `isel` to the wrapped index and wrap the result
* add a inline `repr` for the index
* stubs for the remaining methods
* rename the index class to `PintIndex`
* add a utility method to wrap the output of the wrapped index's methods
* implement `equals`
* implement `roll`, `rename`, and `__getitem__` by forwarding
* start adding tests
* add tests for `create_variables`
* add tests for `sel`
* add tests for `isel`
* improve the tests for `sel`
* add tests for `equals`
* add tests for `roll`
* add tests for `rename`
* add tests for `__getitem__`
* add tests for `_repr_inline_`
* configure coverage, just in case
* use `_replace` instead of manually constructing the new index
* explicitly check that the pint index gets created
* also verify that non-quantity variables don't become `PintIndex`ed
* don't use `.pint.sel`
* fix `PintIndex.from_variables` and properly test it
* quantify the test data
This allows us to test with quantified indexes.
* explicity quantify the input of the `interp_like` tests
* also strip the units of `other`
* change expectations in the conversion tests
* refactor `attach_units_dataset`
* get `convert_units` to accept indexes
* strip indexes as well
* change the `.pint.to` tests to not include indexes
These are already covered by the conversion tests, so no need to repeat.
* extract the units of `other` in `.pint.interp_like`
* quantify the input and expected data in the `reindex` tests
* remove the left-over explicit quantification in the `interp` tests
* get `.pint.reindex` to work by explicitly converting, stripping, and then reattaching
* quantify the input and expected objects in the `reindex_like` tests
* get `reindex_like` to work with indexes
* quantify expected only if we expect to make use of it
* quantify input and expected objects in the `sel` and `loc` tests
* get `.pint.sel` and `.pint.loc` to work with the indexes
In theory, we could also use `sel` and `loc` directly, but that would
not allow us to change the units of the result (or at least, as far as
I can tell).
* remove the warning about indexed coordinates
* preserve the order of the variables
* remove the remaining uses of `Coordinates._construct_direct`
* whats-new entry
* expose the index
---------
Co-authored-by: Benoit Bovy <benbovy@gmail.com>PintIndex (#163)1 parent ca4e282 commit 20a9301
File tree
11 files changed
+1000
-562
lines changed- docs
- examples
- pint_xarray
- tests
11 files changed
+1000
-562
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| 25 | + | |
24 | 26 | | |
0 commit comments