Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement the PintIndex #163

Merged
merged 61 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b9baa9c
add a `PintMetaIndex` that for now can only `sel`
keewis Mar 25, 2022
89c5e2a
add a function to compare indexers
keewis Mar 27, 2022
17e9aec
expect indexer dicts for strip_indexer_units
keewis Mar 27, 2022
30a1d80
move the indexer comparison function to the utils
keewis Mar 27, 2022
34caf09
change extract_indexer_units to expect a dict
keewis Mar 27, 2022
05aa5a6
fix a few calls to extract_indexer_units
keewis Mar 27, 2022
2e0e5bd
one more call
keewis Mar 27, 2022
818db6c
Merge branch 'main' into pint-meta-index
keewis Sep 11, 2023
a049d03
implement `create_variables` and `from_variables`
keewis Sep 13, 2023
0706bc6
use the new index to attach units to dimension coordinates
keewis Sep 13, 2023
a603860
pass the dictionary of indexers instead iterating manually
keewis Sep 13, 2023
dea881c
use `Coordinates._construct_direct`
keewis Sep 13, 2023
9427b20
Merge branch 'main' into pint-meta-index
keewis Sep 14, 2023
a54b94a
delegate `isel` to the wrapped index and wrap the result
keewis Sep 14, 2023
23d1f76
Merge branch 'main' into pint-meta-index
keewis Sep 16, 2023
f0d0890
add a inline `repr` for the index
keewis Dec 6, 2023
fa9f1b3
stubs for the remaining methods
keewis Dec 9, 2023
fb01e32
rename the index class to `PintIndex`
keewis Dec 9, 2023
9278a2d
add a utility method to wrap the output of the wrapped index's methods
keewis Dec 9, 2023
3200bc8
implement `equals`
keewis Dec 9, 2023
281f03c
implement `roll`, `rename`, and `__getitem__` by forwarding
keewis Dec 9, 2023
c5e9022
start adding tests
keewis Dec 10, 2023
2c2c814
add tests for `create_variables`
keewis Dec 10, 2023
e5d8369
add tests for `sel`
keewis Dec 10, 2023
50a7287
add tests for `isel`
keewis Dec 10, 2023
2b3c5bb
improve the tests for `sel`
keewis Dec 10, 2023
57ea8e5
add tests for `equals`
keewis Dec 10, 2023
3eed8c9
add tests for `roll`
keewis Dec 10, 2023
aebaf37
add tests for `rename`
keewis Dec 10, 2023
58c540f
add tests for `__getitem__`
keewis Dec 10, 2023
9cb7e91
add tests for `_repr_inline_`
keewis Dec 10, 2023
9822520
configure coverage, just in case
keewis Dec 11, 2023
55ccb00
use `_replace` instead of manually constructing the new index
keewis Dec 11, 2023
6bd6726
explicitly check that the pint index gets created
keewis Dec 22, 2023
c7d523b
also verify that non-quantity variables don't become `PintIndex`ed
keewis Dec 22, 2023
bae3c3e
Merge branch 'main' into pint-meta-index
keewis Jun 23, 2024
9dde67d
don't use `.pint.sel`
keewis Jun 23, 2024
235ca0e
Merge branch 'main' into pint-meta-index
keewis Jun 23, 2024
b927436
fix `PintIndex.from_variables` and properly test it
keewis Jun 23, 2024
c31e6b0
quantify the test data
keewis Jun 23, 2024
415d059
explicity quantify the input of the `interp_like` tests
keewis Jun 25, 2024
1939b2d
also strip the units of `other`
keewis Jul 6, 2024
2538104
change expectations in the conversion tests
keewis Jul 6, 2024
eb2c405
refactor `attach_units_dataset`
keewis Jul 6, 2024
0d46b66
get `convert_units` to accept indexes
keewis Jul 6, 2024
caf4668
strip indexes as well
keewis Jul 6, 2024
7303960
change the `.pint.to` tests to not include indexes
keewis Jul 6, 2024
e88738d
extract the units of `other` in `.pint.interp_like`
keewis Jul 6, 2024
0b400d0
quantify the input and expected data in the `reindex` tests
keewis Jul 6, 2024
5bd3ec7
remove the left-over explicit quantification in the `interp` tests
keewis Jul 6, 2024
77eef6d
get `.pint.reindex` to work by explicitly converting, stripping, and …
keewis Jul 6, 2024
c38eb5a
quantify the input and expected objects in the `reindex_like` tests
keewis Jul 6, 2024
7277eb5
get `reindex_like` to work with indexes
keewis Jul 6, 2024
c7cf340
quantify expected only if we expect to make use of it
keewis Jul 6, 2024
948d20f
quantify input and expected objects in the `sel` and `loc` tests
keewis Jul 6, 2024
8c76cbc
get `.pint.sel` and `.pint.loc` to work with the indexes
keewis Jul 6, 2024
f9cb15c
remove the warning about indexed coordinates
keewis Jul 6, 2024
49942bf
preserve the order of the variables
keewis Jul 6, 2024
20dd15c
remove the remaining uses of `Coordinates._construct_direct`
keewis Jul 8, 2024
5efb318
whats-new entry
keewis Jul 9, 2024
f53539a
expose the index
keewis Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"metadata": {},
"outputs": [],
"source": [
"monthly_means.pint.sel(\n",
"monthly_means.sel(\n",
" lat=ureg.Quantity(4350, \"angular_minute\"),\n",
" lon=ureg.Quantity(12000, \"angular_minute\"),\n",
")"
Expand Down
2 changes: 2 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ What's new
------------------
- drop support for python 3.9 (:pull:`266`)
By `Justus Magin <https://github.com/keewis>`_.
- create a `PintIndex` to allow units on indexed coordinates (:pull:`163`, :issue:`162`)
By `Justus Magin <https://github.com/keewis>`_ and `Benoit Bovy <https://github.com/benbovy>`_.

0.4 (23 Jun 2024)
-----------------
Expand Down
2 changes: 2 additions & 0 deletions pint_xarray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from . import accessors, formatting, testing # noqa: F401
from .accessors import default_registry as unit_registry
from .accessors import setup_registry
from .index import PintIndex

try:
__version__ = version("pint-xarray")
Expand All @@ -21,4 +22,5 @@
"testing",
"unit_registry",
"setup_registry",
"PintIndex",
]
Loading