Skip to content

Commit

Permalink
pint support for Dataset (pydata#3975)
Browse files Browse the repository at this point in the history
* remove the xfail marks from all aggregations except prod and np.median

* rewrite the aggregation tests

* rewrite the repr tests

it still does not check the content of the repr, though

* rewrite some more tests

* simplify the numpy-method-with-args tests

* always use the same data units unless the compatibility is tested

* partially rewrite more tests

* rewrite combine_first

This also adds tests for units in indexes, which are by default stripped.

* simplify the comparisons test a bit

* skip the tests for identical

* remove the map_values function

* only call convert_units if necessary

* use assert_units_equal and assert_equal in broadcast_like and skip it

* remove the conditional skip since pint now supports __array_function__

* only skip the broadcast_like tests if we attempt to put units in indexes

* remove the xfail mark from the where tests

* reimplement the broadcast_equals tests

* reimplement the tests on stacked arrays

* refactor the to_stacked_array tests

this test is marked as skipped because the unit registry always
returns numpy.array objects which are not hashable, so the initial
dataset with units cannot be constructed (the result of
to_stacked_array wouldn't be correct either because IndexVariable
doesn't support units)

* fix the stacking and reordering tests

* don't create a coordinate for the isel tests

* separate the tests for units in dims from the tests for units in data

* refactor the dataset constructor tests

* fix the repr tests

* raise on all warnings

* rename merge_mappings to zip_mappings

* rename merge_dicts to merge_mappings

* make the missing value filling tests raise on warnings

* remove a leftover assert_equal_with_units

* refactor the sel tests

* make the loc tests a slightly modified copy of the sel tests

* make the drop_sel tests a slightly modified version of the sel tests

* refactor the head / tail / thin tests

* refactor the squeeze tests to not have multiple tests per case

* skip the head / tail / thin tests with units in dimensions

* combine the interp and reindex tests

* combine the interp_like and reindex_like tests

* refactor the computation tests

* rewrite the computation objects tests

* rewrite the resample tests

* rewrite the grouped operations tests

* rewrite the content manipulation tests

* refactor the merge tests

* remove the old assert_equal_with_units function

* xfail the groupby_bins tests for now

* fix and use allclose

* filterwarnings for the whole TestDataset class

* modify the squeeze tests to not use units in indexes

* replace skip with xfail

* update whats-new.rst

* update the xfail reason for the rolling_exp tests

* temporarily use pip to install pint

since the feedstock seems to take a while

* don't use pip to install pint

* update the xfail to require at least 0.12.1

* xfail the prod tests

* filter only UnitStrippedWarning

* remove unncessary commas
  • Loading branch information
keewis authored Jun 17, 2020
1 parent ad0a76b commit 66e7730
Show file tree
Hide file tree
Showing 3 changed files with 699 additions and 768 deletions.
2 changes: 1 addition & 1 deletion ci/requirements/py36-min-nep18.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
- msgpack-python=0.6 # remove once distributed is bumped. distributed GH3491
- numpy=1.17
- pandas=0.25
- pint=0.11
- pint
- pip
- pytest
- pytest-cov
Expand Down
2 changes: 1 addition & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ New Features
- Support dask handling for :py:meth:`DataArray.idxmax`, :py:meth:`DataArray.idxmin`,
:py:meth:`Dataset.idxmax`, :py:meth:`Dataset.idxmin`. (:pull:`3922`)
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
- More support for unit aware arrays with pint (:pull:`3643`)
- More support for unit aware arrays with pint (:pull:`3643`, :pull:`3975`)
By `Justus Magin <https://github.com/keewis>`_.
- Support overriding existing variables in ``to_zarr()`` with ``mode='a'`` even
without ``append_dim``, as long as dimension sizes do not change.
Expand Down
Loading

0 comments on commit 66e7730

Please sign in to comment.