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

New ignore_properties keyword to cfdm.unique_constructs #240

Closed
davidhassell opened this issue Feb 14, 2023 · 1 comment · Fixed by #241
Closed

New ignore_properties keyword to cfdm.unique_constructs #240

davidhassell opened this issue Feb 14, 2023 · 1 comment · Fixed by #241
Labels
enhancement New feature or request
Milestone

Comments

@davidhassell
Copy link
Contributor

davidhassell commented Feb 14, 2023

It would be useful to allow cfdm.unique_constructs to ignore selected properties when assessing equality of input constructs. For example, two Field constructs may differ only by a timestamp within their "history" properties, and this may be of no concern. This would look like:

>>> import cfdm
>>> f = cfdm.example_field(0)
>>> f2 = f.copy()
>>> f.set_property('foo', 'bar')
>>> f2.set_property('foo', 'bar2')
>>> cfdm.unique_constructs([f, f2]) 
[<Field: specific_humidity(latitude(5), longitude(8)) 1>,
 <Field: specific_humidity(latitude(5), longitude(8)) 1>]
>>> cfdm.unique_constructs([f, f2], ignore_properties='foo')
[<Field: specific_humidity(latitude(5), longitude(8)) 1>]
@sadielbartholomew
Copy link
Member

Nice idea! Reviewing the PRs now.

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

Successfully merging a pull request may close this issue.

2 participants