Skip to content

New ignore_properties keyword to cfdm.unique_constructs #240

Closed

Description

@davidhassell

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>]

Activity

  1. added this to the Next release milestone on Feb 14, 2023
  2. sadielbartholomew commented on Feb 24, 2023

    @sadielbartholomew
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions