JT Thielen

Results 110 comments of JT Thielen

Very nice! Thank you for helping with this so quickly!

Yes, this could definitely be done with Pint (see the formatting options here: https://pint.readthedocs.io/en/stable/tutorial.html#string-formatting)! Though, in order to interpret CF/UDUNITS-style exponents, a custom preprocessor ([like that in MetPy](https://github.com/Unidata/MetPy/blob/3adfbd81629f0915f8d53e1e7b2509b2628827ca/src/metpy/units.py#L35-L39)) is needed,...

@djhoese MetPy's handling of simultaneous x/y and longitude/latitude might not be optimal right now. Currently, the [line you referenced](https://github.com/Unidata/MetPy/blob/master/metpy/xarray.py#L187) should only come into play if the `grid_mapping` on a variable...

This would be a good thing to ask upstream in Pint! I'm not aware of any modular arithmetic support, but I definitely see something like this being useful.

One additional thing I've realized is needed since writing https://github.com/hgrecco/pint/issues/849#issuecomment-579992247 is a helper for coordinate unit conversion. Not sure what the best name for this would be though. In MetPy,...

> > a helper for coordinate unit conversion. > > So a `da.pint.coords_to`, that gets called within `da.pint.to`? Not quite, it would be separate. I'm thinking of something to change...

> how about also accepting a `dict` / kwargs dict (like `assign` / `assign_coords`) to `DataArray.pint.to` and then using different branches for data and coordinates? That way, converting the data...

I definitely agree that some kind of repr fix is in order. The current default is...less than ideal... ![](https://dl.dropboxusercontent.com/s/cotjfhy5ekhjt26/Screenshot%20from%202020-04-21%2011-59-04.png)

> the HTML `repr` works (`pint` got released today), and there are #20 (docs), #22 (inline repr) and #24 (testing), so once those are merged and the placeholder functions we...

Right now, [Pint does not simultaneously support NumPy and Uncertainties](https://github.com/hgrecco/pint/issues/918), so this integration would likely have to be on hold until they would become mutually supported. xref https://github.com/pydata/xarray/issues/3509