Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]> * 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 <[email protected]>
- Loading branch information