Replies: 3 comments 1 reply
-
This looks cool, @durack1. I think if there is a feature / use-case in mind, this could be migrated to: #271. |
Beta Was this translation helpful? Give feedback.
-
I also just came across with the import xarray as xr
import cf_xarray.units
import pint_xarray
ds = xr.open_dataset('gs://cmip6/CMIP6/CMIP/NCAR/CESM2-FV2/historical/r2i1p1f1/Amon/sfcWind/gn/v20200226/', engine='zarr')
ds = ds.pint.quantify()
squared_wind = ds['sfcWind'] ** 2
squared_wind.pint.units
|
Beta Was this translation helpful? Give feedback.
-
BTW, is it possible to update units of xarray objects by directly assigning a string? e.g. one of the following? That's something I regularly did with cdms2 objects
It's probably possible to do so for an in-memory variable. But what about changing the units (or any other attribute) of a variable in a nc file. My apologies for this slightly off-topic question With cdms2, I would open the file in 'r+' mode, use a file variable pointer, assign the new units and close the file. |
Beta Was this translation helpful? Give feedback.
-
This newly announced
pint
package sounds interesting. Not sure if it's more useable thanudunits
?Beta Was this translation helpful? Give feedback.
All reactions