You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a scheme for requiring one of multiple options #7
Some ISTP variables, such as LABLAXIS and LABL_PTR_1, are required only if another variable is not present. We need some way of representing these variable types in the schema, and to update the code to properly handle them.
Features
Schema can represent multiple variables, where one of n is required
Code prints a warning or indicates in some way if the required variable is missing
CDFAttributeManager will successfully include only one of the required variables if only one is present.
I did some thinking on this a while ago - I'll include my notes here....
The different types of conditional requirements fall into one of the following categories:
Attribute Value (attribute_value): The presence of an attribute is required based on the value of another required attribute.
The attribute used for the condition_key must be a required attribute.
Variable Name (variable_name): The presence of an attribute is required based on the name of the variable.
The condition_key is used as a REGEX here to match any variable names that match the given pattern.
Attribute Present (attribute_present): The presence of an attribute is required based on the presence of other, required or optional, attributes.
The condition_key can be a list of attribute names. If any of the attributes in the condition_key are present, then the required_attributes must also be present.
<file_type>_variable_attribute_schema.yaml
attribute_key:
CATDESC:
description: > This is a human readable description of the data variable.derived: falserequired: trueoverwrite: falsevalid_values: nullalternate: null...WCSAXES:
description: > number of axes in the associated data array.human_readable: WCS axesderived: falsederivation_fn: _get_wcs_naxisrequired: falseoverwrite: falsevalid_values: nullalternate: null...conditional_requirements:
# =======================================# CDF Conditions for Metadata Attributes# =======================================
- condition_type: 'attribute_value'condition_key: 'VAR_TYPE'condition_value: 'data'required_attributes:
- CATDESC
- DEPEND_0
- DISPLAY_TYPE
- FIELDNAM
- FILLVAL
- FORMAT
- LABLAXIS
- SI_CONVERSION
- UNITS
- VALIDMIN
- VALIDMAX
- VAR_TYPE
- condition_type: 'attribute_value'condition_key: 'VAR_TYPE'condition_value: 'support_data'required_attributes:
- CATDESC
- FIELDNAM
- FILLVAL
- FORMAT
- LABLAXIS
- SI_CONVERSION
- UNITS
- VALIDMIN
- VALIDMAX
- VAR_TYPE
- condition_type: 'attribute_value'condition_key: 'VAR_TYPE'condition_value: 'metadata'required_attributes:
- CATDESC
- FIELDNAM
- FILLVAL
- FORMAT
- VAR_TYPE
- condition_type: 'variable_name'condition_key: 'EPOCH*'# Variable Attribute Names in Conditions? condition_value: nullrequired_attributes:
- REFERENCE_POSITION
- RESOLUTION
- TIME_BASE
- TIME_SCALE
- condition_type: 'attribute_present'condition_key:
- WCSAXES
- CNAME0condition_value: nullrequired_attributes:
- MJDREF
- TIMEUNIT
- TIMEDEL
- CNAMEi # Iterable
- CTYPEi # Iterable
- CUNITi # Iterable
- CRPIXi # Iterable
- CRVALi # Iterable
- CDELTi # Iterable
Activity
Alrobbertz commentedon Sep 4, 2024
I did some thinking on this a while ago - I'll include my notes here....
The different types of conditional requirements fall into one of the following categories:
attribute_value): The presence of an attribute is required based on the value of another required attribute.condition_keymust be a required attribute.variable_name): The presence of an attribute is required based on the name of the variable.condition_keyis used as a REGEX here to match any variable names that match the given pattern.attribute_present): The presence of an attribute is required based on the presence of other, required or optional, attributes.condition_keycan be a list of attribute names. If any of the attributes in thecondition_keyare present, then therequired_attributesmust also be present.<file_type>_variable_attribute_schema.yaml