Skip to content

Commit b309cb0

Browse files
authored
prepare the release of v0.2 (#101)
* fix the markup * collapse the data in DataArray HTML reprs * mention the unit-aware methods * reword [skip-ci] * add missing word [skip-ci]
1 parent 674029a commit b309cb0

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

docs/examples/plotting.ipynb

+26-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"outputs": [],
1717
"source": [
1818
"import xarray as xr\n",
19-
"import pint_xarray"
19+
"import pint_xarray\n",
20+
"from pint_xarray import unit_registry as ureg\n",
21+
"\n",
22+
"xr.set_options(display_expand_data=False)"
2023
]
2124
},
2225
{
@@ -105,6 +108,27 @@
105108
"monthly_means"
106109
]
107110
},
111+
{
112+
"cell_type": "markdown",
113+
"id": "14ea5eb8",
114+
"metadata": {},
115+
"source": [
116+
"Most operations will preserve the units but there are some which will drop them (see the [duck array integration status](https://xarray.pydata.org/en/stable/user-guide/duckarrays.html#missing-features) page). To work around that there are unit-aware versions on the `.pint` accessor. For example, to select data use `.pint.sel` instead of `.sel`:"
117+
]
118+
},
119+
{
120+
"cell_type": "code",
121+
"execution_count": null,
122+
"id": "93e4ca4e",
123+
"metadata": {},
124+
"outputs": [],
125+
"source": [
126+
"monthly_means.pint.sel(\n",
127+
" lat=ureg.Quantity(4350, \"angular_minute\"),\n",
128+
" lon=ureg.Quantity(12000, \"angular_minute\"),\n",
129+
")"
130+
]
131+
},
108132
{
109133
"cell_type": "markdown",
110134
"id": "still-ebony",
@@ -142,7 +166,7 @@
142166
"name": "python",
143167
"nbconvert_exporter": "python",
144168
"pygments_lexer": "ipython3",
145-
"version": "3.8.6"
169+
"version": "3.9.2"
146170
}
147171
},
148172
"nbformat": 4,

docs/whats-new.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ What's new
55

66
0.2 (*unreleased*)
77
------------------
8-
- rewrite :py:meth:`Dataset.pint.quantify` and :py:meth:`DataArray.pint.quantify`,
9-
to use pint's `parse_units` instead of `parse_expression` (:pull:`40`)
8+
- rewrite :py:meth:`Dataset.pint.quantify` and :py:meth:`DataArray.pint.quantify`, to
9+
use pint's ``UnitRegistry.parse_units`` instead of ``UnitRegistry.parse_expression``
10+
(:pull:`40`)
1011
By `Tom Nicholas <https://github.com/TomNicholas>`_.
1112
- ensure the variables which causes the error is explicit if an error occurs in
1213
:py:meth:`Dataset.pint.quantify` and other methods (:pull:`43`, :pull:`91`)

0 commit comments

Comments
 (0)