Skip to content
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

improve units handling #44

Open
chrishavlin opened this issue Mar 13, 2023 · 0 comments
Open

improve units handling #44

chrishavlin opened this issue Mar 13, 2023 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@chrishavlin
Copy link
Collaborator

The units parsing doesn't currently handle composite unit combinations. Should adjust the following to try to parse the unit strings and allow them through if unyt understands:

def _find_units(self, xr_ds) -> dict:
units = {}
for field in self.fields:
unit = getattr(xr_ds[field], "units", "")
if unit != "" and hasattr(unyt.unit_symbols, unit) is False:
unit = ""
units[field] = unit
return units

@chrishavlin chrishavlin added the enhancement New feature or request label Mar 13, 2023
@chrishavlin chrishavlin added this to the v0.2.0 milestone Mar 13, 2023
@chrishavlin chrishavlin modified the milestones: v0.2.0, v0.3.0 Oct 10, 2023
@chrishavlin chrishavlin modified the milestones: v0.3.0, v0.4.0 May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant