Skip to content

Commit 7d0096e

Browse files
keewisjthielen
andauthored
rewrite quantify and dequantify (#17)
* add a function to extract / retrieve unit attributes * add a function to zip mappings * partially rewrite Dataset.pint.quantify * add tests for the unit attribute extraction function * also make sure that deleting attributes works * add a function to attach units as string attributes * also extract unit attributes from variable objects * refactor the unit attr extraction tests * allow using a different attr name * use the conversion functions to implement dequantify * update the docs on the return value * update the conditions for _decide_units * rewrite the Dataset quantify and dequantify methods * raise on unit stripped warnings * remove the test checking that dequantify raises if there were no quantities * make sure Dataset.pint.quantify raises only if we would overwrite a quantity * don't try to put units in indexes * check the attributes after dequantify more thoroughly * make sure the attributes are strings * move the str conversion of pint.Unit to a util function * update the dequantify docstrings * update the quantify docstrings * add tests for Dataset.pint.dequantify * update the parameter spec of Dataset.pint.quantify * remove the old attach and quantify functions * fix the template used to format accessor attributes * remove the attrs on quantify * make the description of the units kwargs easier to understand * mention the format of the units * don't use rst references in the descriptions in docstrings * warn about loading data into memory while quantifying * don't try to quantify indexes * replace the delete parameter with a strip function which is important because modifying in-place makes it difficult to test. * update the docstrings * more docstring updates * use K instead of degK Co-authored-by: Jon Thielen <[email protected]> Co-authored-by: Jon Thielen <[email protected]>
1 parent 0c376dd commit 7d0096e

File tree

5 files changed

+448
-158
lines changed

5 files changed

+448
-158
lines changed

docs/api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ DataArray
2121
---------
2222
.. autosummary::
2323
:toctree: generated/
24-
:template: autosummary/accessor_property.rst
24+
:template: autosummary/accessor_attribute.rst
2525

2626
DataArray.pint.magnitude
2727
DataArray.pint.units

0 commit comments

Comments
 (0)