HermesDataSchema¶
- class hermes_core.util.schema.HermesDataSchema[source]¶
Bases:
object
Class representing the schema of a file type.
Attributes Summary
(
dict
) Default Global Attributes applied for all HERMES Data Files(
dict
) Schema for variable attributes of the file.(
dict
) Schema for variable attributes of the file.Methods Summary
derive_global_attributes
(data)Function to derive global attributes for the given measurement data.
derive_measurement_attributes
(data, var_name)Function to derive metadata for the given measurement.
derive_time_attributes
(data)Function to derive metadata for the time measurement.
global_attribute_info
([attribute_name])Function to generate a
astropy.table.Table
of information about each global metadata attribute.Function to generate a template of required global attributes that must be set for a valid CDF.
measurement_attribute_info
([attribute_name])Function to generate a
astropy.table.Table
of information about each variable metadata attribute.Function to generate a template of required measurement attributes that must be set for a valid CDF measurement variable.
Attributes Documentation
Methods Documentation
- derive_global_attributes(data) OrderedDict [source]¶
Function to derive global attributes for the given measurement data.
- Parameters:
data (
hermes_core.timedata.HermesData
) – An instance ofHermesData
to derive metadata from.- Returns:
attributes (
OrderedDict
) – A dict containingkey: value
pairs of global metadata attributes.
- derive_measurement_attributes(data, var_name: str, guess_types: list[int] | None = None) OrderedDict [source]¶
Function to derive metadata for the given measurement.
- Parameters:
data (
hermes_core.timedata.HermesData
) – An instance ofHermesData
to derive metadata fromvar_name (
str
) – The name of the measurement to derive metadata forguess_types (
list[int]
, optional) – Guessed CDF Type of the variable
- Returns:
attributes (
OrderedDict
) – A dict containingkey: value
pairs of derived metadata attributes.
- derive_time_attributes(data) OrderedDict [source]¶
Function to derive metadata for the time measurement.
- Parameters:
data (
hermes_core.timedata.HermesData
) – An instance ofHermesData
to derive metadata from.- Returns:
attributes (
OrderedDict
) – A dict containingkey: value
pairs of time metadata attributes.
- static global_attribute_info(attribute_name: str | None = None) Table [source]¶
Function to generate a
astropy.table.Table
of information about each global metadata attribute. Theastropy.table.Table
contains all information in the HERMES global attribute schema including:description: (
str
) A brief description of the attributedefault: (
str
) The default value used if none is provided- derived: (
bool
) Whether the attibute can be derived by the HERMES HermesDataSchema
class
- derived: (
required: (
bool
) Whether the attribute is required by HERMES standards- validate: (
bool
) Whether the attribute is included in the validate()
checks (Note, not all attributes that are required are validated)
- validate: (
- overwrite: (
bool
) Whether theHermesDataSchema
attribute derivations will overwrite an existing attribute value with an updated attribute value from the derivation process.
- overwrite: (
- Parameters:
attribute_name (
str
, optional, default None) – The name of the attribute to get specific information for.- Returns:
info (
astropy.table.Table
) – A table of information about global metadata.- Raises:
KeyError – If attribute_name is not a recognized global attribute.:
- static global_attribute_template() OrderedDict [source]¶
Function to generate a template of required global attributes that must be set for a valid CDF.
- Returns:
template (
OrderedDict
) – A template for required global attributes that must be provided.
- static measurement_attribute_info(attribute_name: str | None = None) Table [source]¶
Function to generate a
astropy.table.Table
of information about each variable metadata attribute. Theastropy.table.Table
contains all information in the HERMES variable attribute schema including:description: (
str
) A brief description of the attribute- derived: (
bool
) Whether the attibute can be derived by the HERMES HermesDataSchema
class
- derived: (
required: (
bool
) Whether the attribute is required by HERMES standards- overwrite: (
bool
) Whether theHermesDataSchema
attribute derivations will overwrite an existing attribute value with an updated attribute value from the derivation process.
- overwrite: (
- valid_values: (
str
) List of allowed values the attribute can take for HERMES products, if applicable
- valid_values: (
- alternate: (
str
) An additional attribute name that can be treated as an alternative of the given attribute. Not all attributes have an alternative and only one of a given attribute or its alternate are required.
- alternate: (
- var_types: (
str
) A list of the variable types that require the given attribute to be present.
- var_types: (
- Parameters:
attribute_name (
str
, optional, default None) – The name of the attribute to get specific information for.- Returns:
info (
astropy.table.Table
) – A table of information about variable metadata.- Raises:
KeyError – If attribute_name is not a recognized global attribute.:
- static measurement_attribute_template() OrderedDict [source]¶
Function to generate a template of required measurement attributes that must be set for a valid CDF measurement variable.
- Returns:
template (
OrderedDict
) – A template for required variable attributes that must be provided.