pysiral.surface

Created on Mon Jul 27 11:25:04 2015

Classes

ClassifierContainer

SurfaceTypeClassifier

This is a parent class that allows to quickly generate surface type classication schemes

SICCI2SurfaceType

new and unified surface type classifier for cryosat2 and envisat

ClassifierThresholdSurfaceType

Simplified surface type classification based on the positive

ClassifierAuxiliarySurfaceType

Surface type classification using a parameter already present in l1p that

Module Contents

class pysiral.surface.ClassifierContainer

Bases: object

_parameters
add_parameter(parameter: numpy.ndarray, parameter_name: str) None
get(parameter_name: str, raise_on_error: bool = False) numpy.ndarray | None
__getattr__(item)

Modify the attribute getter to provide a shortcut to the data content :param item: Name of the parameter :return:

property n_parameters: int
property parameter_list: List[str]
property shape: int | Tuple
class pysiral.surface.SurfaceTypeClassifier(*args, **kwargs)

Bases: object

This is a parent class that allows to quickly generate surface type classication schemes for the Level-2 processpr

surface_type
classifier
radar_modes
_classes = []
set_initial_classification(surface_type: pysiral.core.flags.SurfaceType) None

This method sets an initial surface type classification :param surface_type: :return:

transfer_l1b_classifier(l1: pysiral.l1data.L1bdataNCFile) None

A standard functionality to transfer all l1b classifier :param l1: :return:

add_classifier_parameter(l2: pysiral.l2data.Level2Data, parameter_list: List[str]) None

Retrieve a list of parameters from the l2 and add to the classifier parameter container :param l2: :param parameter_list: :return:

set_unknown_default(n_records: int) None

This method can be used to initialize the surface type with unknown values :return:

set_l1b_land_mask(l1: pysiral.l1data.L1bdataNCFile) None

Use this method to transfer the l1 land mask to the l2 surface type classification.

NOTE: Highly recommended to do this at the end of the surface type classication

in order to overwrite potential mis-classifications.

Parameters:

l1

Returns:

has_class(name: str) bool
class pysiral.surface.SICCI2SurfaceType(*args, **kwargs)

Bases: pysiral.l2proc.procsteps.Level2ProcessorStep, SurfaceTypeClassifier

new and unified surface type classifier for cryosat2 and envisat based on similar (pulse peakiness, backscatter, leading edge width)

#TODO: This could be generalized to automatically compare parameters from config file

_classes = ['unknown', 'ocean', 'lead', 'sea_ice', 'land']
execute_procstep(l1b, l2)

The mandatory class for a Level2ProcessorStep. :param l1b: :param l2: :return:

classify_ocean(opt, is_radar_mode)

Classify ocean waveforms. :param opt: :param is_radar_mode: :return:

classify_leads(opt, month_num, is_radar_mode)

Classify leads in sea ice :param opt: :param month_num: :param is_radar_mode: :return:

classify_sea_ice(opt, month_num, is_radar_mode)

Classify waveforms as sea ice :param opt: The option attribute dictionary :param month_num: :param is_radar_mode: :return:

static get_threshold_value(options, name, month_num)

A unified method to retrieve threshold values from lists (one per month) or a scalar :param options: configuration object :param name: (str) parameter name (must be attribute of) options :param month_num: (int) number of the month (1 - 12) :return: threshold value to use for specific month

property l2_input_vars
property l2_output_vars
property error_bit
class pysiral.surface.ClassifierThresholdSurfaceType(*args, **kwargs)

Bases: pysiral.l2proc.procsteps.Level2ProcessorStep, SurfaceTypeClassifier

Simplified surface type classification based on the positive classification of leads and lazy sea ice classifcation (everything that is not a lead, has a decent leading edge and is within the ice mask)

reference_date = None
execute_procstep(l1: pysiral.l1data.L1bdataNCFile, l2: pysiral.l2data.Level2Data) numpy.ndarray

The mandatory class for a Level2ProcessorStep. :param l1: :param l2: :return:

_classifiy_surface_types() None

Classifiy surface types using the options in the l2 configuration file.

Returns:

_classify_surface_type(opt_dict: dict) pysiral.core.flags.ANDCondition

Compute the surface type flag from the conditions in the config file for a specific radar mode. The expected structure of opt_dict is:

[exclude: surface_type_name] (Optional) radar_mode: <radar mode id> conditions:

  • logical expression with parameter name in brackets {}

The expression will be evaluated with eval() at run time and merged via AND:

flag = condition1 AND condition2 AND condition3 ….

If the exclude option is set, a condition will be added that the the current surface type cannot be any waveform that was previously (see order in cfg.options.surface_types) attributed to another surface type.

Parameters:

opt_dict

Returns:

_get_parameter_list() List[str]

Construct a list of required parameters from the configuration file. This method checks all conditions for parameter name in curly brackets. :return: list of parameters that can be retrieved with l2.get_parameter_by_name()

static _get_expr_param(expression: str) str | None

Get the parameter from an expression in the config file. E.g. for the expression:

{sea_ice_concentration} >= 15.0

the return value will be sea_ice_concentration :param expression: The expression from the config file :return:

property l2_input_vars: List[str]
property l2_output_vars: List[str]
property error_bit: numpy.ndarray
class pysiral.surface.ClassifierAuxiliarySurfaceType(*args, **kwargs)

Bases: pysiral.l2proc.procsteps.Level2ProcessorStep, SurfaceTypeClassifier

Surface type classification using a parameter already present in l1p that was read in from auxiliary files during preprocessing

reference_date = None
_classes = ['unknown', 'ocean', 'lead', 'sea_ice']
execute_procstep(l1, l2) numpy.ndarray

The mandatory class for a Level2ProcessorStep. :param l1: :param l2: :return:

classify_ocean()

Classify ocean waveforms. :return:

classify_leads()

Classify leads in sea ice :return:

classify_sea_ice()

Classify waveforms as sea ice :return:

property l2_input_vars: List[str]
property l2_output_vars: List[str]
property error_bit: numpy.ndarray