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
Coordinates not quantified / quantifiable #124
Comments
Okay, what I was doing was more like ds = xr.Dataset(
{'z': (("x","y"), np.random.random((2, 3)), {"units": "m"})},
coords={"x": [0, 1],
"y": [5, 6, 7]})
ds.x.attrs['units'] = 'm'
ds = ds.pint.quantify(unit_registry=ureg) which leads to ds.z being correctly quantified, but not ds.x Instead running ds = xr.Dataset(
{'z': (("x","y"), np.random.random((2, 3)), {"units": "m"})},
coords={"xx": ("x", [0, 1], {"units": "m"}),
"yy": ("y", [5, 6, 7], {"units": "m"})})
ds = ds.pint.quantify(unit_registry=ureg) Leads to both being correctly quantified. As a beginner with pint/xarray, it's not obvious. Edit: Okay, but this leads to a Dataset/DataArray without associated indexed dimension coordinates. It seems the index coordinate always drops units. Why? |
|
Note that we're currently actively working on removing that restriction in In the meantime, I guess we could make the note more obvious, maybe by not combining it with the one for |
reopening, to be closed by #126 |
If I have a
DataArray
orDataset
, I would expect there to be some way to quantify not just the data, but also the coordinates.<o>.pint.quantify()
seems to only quantify the data.Manually running quantify on the coordinate gives:
Manually constructing from quantified coordinates leads to an explicit dequantify:
Is this functionality not expected to work?
The text was updated successfully, but these errors were encountered: