Skip to content

Cell methods: Handle cell methods that apply to norm ancillary variables (CF-1.13) #374

@davidhassell

Description

@davidhassell

The new CF conventions for anomalies, introduced at CF-1.13, allow an ancillary variable to have a standardised cell_methods attribute.

In the updated CF data model, the ancillary cell methods are "owned" by the parent field construct, rather than the field ancillary construct to which they directly apply. This is because when an ancillary variable has cell methods, they are really contributing to the physical definition of the parent data variable.

We need cfdm to be able to read, parse, store, and write ancillary variable cell methods.

All cell method constructs are stored on the field, but an individual cell method needs to know whether it applies to the field, or to one of the field ancillaries.

The order of cell methods is important. The field ancillary cell methods should come immediately after the field's anomaly_wrt cell method.

We need a syntax to make this distinction clear to the user. I propose:

>>> 
Field: air_temperature (ncvar%ta)
---------------------------------
Data            : air_temperature(atmosphere_hybrid_height_coordinate(1), latitude(10), longitude(9)) K
Cell methods    : area: mean time(1): maximum area: anomaly_wrt ancillary(latitude(10), longitude(9)) norm[time: minimum]
Field ancils    : air_temperature standard_error(latitude(10), longitude(9)) = [[0.76, ..., 0.32]] K
Dimension coords: atmosphere_hybrid_height_coordinate(1) = [20.0] m
                : latitude(10) = [2.2, ..., -1.76] degrees
                : longitude(9) = [-4.7, ..., -1.18] degrees
                : time(1) = [2019-01-01 00:00:00]

>>> f.cell_method('method:anomaly_wrt')
<CellMethod: fieldancillary0[time: minimum]>

I.e. The cell methods that apply to an anomaly norm come directly after the anomaly_wrt cell method, and are contained in within norm[...]. When printed on its own (not in the context of the parent field), the ancillary cell method is contained in key[...] where key is the construct identifier for the field ancillary to which it applies.

PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions