hypernets_processor.anomaly_handler module

AnomalyHandler class

class hypernets_processor.anomaly_handler.AnomalyHandler(context, anomaly_db=None, url=None, anomalies_dict={'a': {'description': 'angle achieved by pan >3 and/or tilt >1 deg away from target angle during sequence', 'error': None, 'error_msg': 'angle achieved by pan >3 and/or tilt >1 deg away from target angle during sequence'}, 'cl': {'description': 'No clear sky irradiance in sequence (i.e. overcast conditions)', 'error': None, 'error_msg': 'No clear sky irradiance in sequence (i.e. overcast conditions)'}, 'd': {'description': 'Discontinuity between VNIR and SWIR', 'error': None, 'error_msg': 'Discontinuity between VNIR and SWIR'}, 'in': {'description': 'Invalid sequence (due to not enough valid radiance or irradiance series)', 'error': <class 'ValueError'>, 'error_msg': 'Invalid sequence (due to not enough valid radiance or irradiance series)'}, 'l': {'description': 'Ld missing for sky reflectance correction', 'error': <class 'ValueError'>, 'error_msg': 'Ld missing for sky reflectance correction'}, 'm': {'description': 'Metadata file missing', 'error': <class 'OSError'>, 'error_msg': 'Metadata file missing'}, 'mf': {'description': 'Invalid sequence, files mentioned in metadatafile are missing in DATA directory', 'error': <class 'ValueError'>, 'error_msg': 'Invalid sequence, files mentioned in metadatafile are missing in DATA directory'}, 'ms': {'description': "There are series missing from the standard sequence (either because not present, or flagged by `not_enough_dark_scans', `not_enough_irr_scans', `not_enough_rad_scans' or `vza_irradiance').", 'error': None, 'error_msg': 'There are series missing from the standard sequence'}, 'nd': {'description': 'Non constant illumination in downwelling radiance', 'error': <class 'ValueError'>, 'error_msg': 'Coefficient of variation for Ld(550) is > 10%'}, 'ned': {'description': 'Not enough Ed scans for series', 'error': None, 'error_msg': 'Not enough Ed scans for series'}, 'nld': {'description': 'Not enough Lsky scans for series', 'error': None, 'error_msg': 'Not enough Lsky scans for series'}, 'nlu': {'description': 'Not enough Lu scans for series', 'error': None, 'error_msg': 'Not enough Lu scans for series'}, 'nu': {'description': 'Non constant illumination', 'error': <class 'ValueError'>, 'error_msg': 'Coefficient of variation for Ed(550) is > 10%'}, 'o': {'description': 'more than 50% of data has random error above 100% (probably corrupted data)', 'error': None, 'error_msg': 'more than 50% of data has random error above 100% (probably corrupted data)'}, 's': {'description': 'meteo data missing', 'error': None, 'error_msg': 'meteo data missing'}, 'u': {'description': 'some of the uncertainties have negative values', 'error': <class 'ValueError'>, 'error_msg': 'some of the uncertainties have negative values'}, 'x': {'description': 'unexpected error during processing', 'error': None, 'error_msg': 'unexpected error during processing'}})

Bases: object

Class for handling anomalies

Parameters:
add_anomaly(anomaly_id, ds=None)

Adds anomaly to anomaly database

Parameters:
  • anomaly_id (str) – anomaly id, must match name of entry in self.anomalies dict

  • ds (xarray.Dataset) – producgt that was being processed when anomaly was raised

add_x_anomaly()

Adds unexpect error anomaly to anomaly database if expected anomaly not already

get_anomaly_description(anomaly_id)

Returns error msg for anomaly id

Return type:

list

Returns:

anomaly error msg

get_anomaly_error(anomaly_id)

Returns error for anomaly id

Return type:

Error

Returns:

anomaly error

get_anomaly_error_msg(anomaly_id)

Returns error msg for anomaly id

Return type:

list

Returns:

anomaly error msg

get_anomaly_ids()

Returns available anomaly ids

Return type:

list

Returns:

anomaly ids

get_crashing_anomaly_ids()

Returns available anomaly ids that result in crashes

Return type:

list

Returns:

crashing anomaly ids

get_sequence_anomalies(sequence_name=None, site_id=None)

Returns anomaly ids of anomalies currently registered for the processed sequence if context attribute is not None, else define of interest

Parameters:

sequence_name (str) – (optional) name of sequence to lookup anomaly ids for, if omitted gets sequence id from

context, if avaiable

Parameters:

site_id (str) – (optional) name of site to lookup anomaly ids for, if omitted gets site id from

context, if avaiable

Return type:

list

Returns:

sequence anomaly ids

get_sequence_crashing_anomalies(sequence_name=None, site_id=None)

Returns crashing anomaly ids of anomalies currently registered for the processed sequence if context attribute is not None, else define

Parameters:

sequence_name (str) – (optional) name of sequence to lookup anomaly ids for, if omitted gets sequence id from

context, if avaiable

Parameters:

site_id (str) – (optional) name of site to lookup anomaly ids for, if omitted gets site id from

context, if avaiable

Return type:

list

Returns:

sequence crashing anomaly ids