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

Allow relaxed_units in cf.aggregate to cope with invalid (in addition to missing) units #602

Closed
davidhassell opened this issue Feb 27, 2023 · 0 comments · Fixed by #603
Closed
Labels
aggregation Rerlating to metadata-based field and domain aggregation enhancement New feature or request
Milestone

Comments

@davidhassell
Copy link
Collaborator

Currently, the relaxed_units keyword to cf.aggregate copes with missing units (i.e. cf.units()), but not invalid but otherwise equal units:

>>> # 3.14.0 behaviour
>>> f = cf.example_field(0)
>>> bad_units = cf.Units("bad-units")
>>  f.override_units(bad_units, inplace=True)
>>> g = f[:2]
>>> h = f[2:]
>>> i = cf.aggregate([g, h], relaxed_units=True)
[<CF Field: specific_humidity(latitude(2), longitude(8)) bad-units>,
 <CF Field: specific_humidity(latitude(3), longitude(8)) bad-units>]

It would be good to extend the functionality to include this case:

>>> # Desired new behaviour
>>> i = cf.aggregate([g, h], relaxed_units=True)
[<CF Field: specific_humidity(latitude(5), longitude(8)) bad-units>]
@davidhassell davidhassell added the enhancement New feature or request label Feb 27, 2023
@davidhassell davidhassell added this to the Next release milestone Feb 27, 2023
@davidhassell davidhassell added the aggregation Rerlating to metadata-based field and domain aggregation label Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aggregation Rerlating to metadata-based field and domain aggregation enhancement New feature or request
Projects
None yet
1 participant