Skip to content

Initial user docs for pint support #7001

@pp-mo

Description

@pp-mo

If we merge the FEATURE_cfpint branch, we will have in Iris :

  • an experimental control switch, iris.experimental.units.USE_CFPINT, allowing you to switch to pint units by default
  • a public make_unit() call, used to create Iris unit objects from any input str/None/pint/cfpint/cf_unit

We will have a what's-new entry, but we should also have a dedicated page explaining the principles.
The basics are discussed in this discussion.

Key points to note, which the user docs should include :

  • iris .units properties may be either either cf_units.Unit or pint.Unit type
  • in both cases, the actual unit type is converted (on assignment) to a specialised Iris subtype with extra functionality
  • unit given as strings are converted to a default type, selectable as either cf_units or pint
  • Iris pint-based units
    • are pint units, and support the pint APIs
    • are based on 'cfpint' units
      • defined in cfpint repo
      • in turn based on pint, with additions :
        • translation from udunits-like strings
        • support of cftime date units, including a calendar property
    • also support the Iris-specific special units of "unknown" and "no-unit"
    • currently provide "legacy", methods mimicking cf_units, which will eventually be removed
  • user code
    • can adopt pint-based units, either by supplying Pint (or cfpint) objects, or by enabling "USE_CFPINT".
    • can then use pint (and cfpint) unit APIs.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions