compliance_checker.cfutil.attr_membership(attr_val, value_set, attr_type=<class 'str'>, modifier_fn=<function <lambda>>)[source]#

Helper function passed to netCDF4.Dataset.get_attributes_by_value Checks that attr_val exists, has the same type as attr_type, and is contained in value_set attr_val: The value of the attribute being checked attr_type: A type object that the attr_val is expected to have the same

type as. If the type is not the same, a warning is issued and the code attempts to cast attr_val to the expected type.

value_set: The set against which membership for attr_val is tested modifier_fn: A function to apply to attr_val prior to applying the set

membership test