Skip to content

Support flag_masks #199

@dcherian

Description

@dcherian

From http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#flags

int basin(lat, lon);
       standard_name: region;
       flag_values: 1, 2, 3;
       flag_meanings:"atlantic_arctic_ocean indo_pacific_ocean global_ocean";
data:
   basin: 1, 1, 1, 1, 2, ..... ;

It'd be nice to provide .cf.__eq__ and allow

ds.where(basin.cf == "atlantic_arctic_ocean")  # becomes ds.where(basin == 1)

or ds.where(basin.cf.flag == "atlantic_arctic_ocean"))?

We could do something similar for .isin too

I don't understand flag_masks but we could probably do something similar

  byte sensor_status_qc(time, depth, lat, lon) ;
    sensor_status_qc:long_name = "Sensor Status" ;
    sensor_status_qc:_FillValue = 0b ;
    sensor_status_qc:valid_range = 1b, 63b ;
    sensor_status_qc:flag_masks = 1b, 2b, 4b, 8b, 16b, 32b ;
    sensor_status_qc:flag_meanings = "low_battery processor_fault
                                      memory_fault disk_fault
                                      software_fault
                                      maintenance_required" ;

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions