pysiral.auxdata.sitype
Created on Sun Apr 24 13:57:56 2016
@author: Stefan
Important Note:
All sitype data handlers must be subclasses of pysiral.auxdata.AuxdataBaseClass in order to work for the Level-2 Processor. If the auxiliary class is based on a static dataset, this should be parsed in __init__.
Please review the variables and properties in the parent class, as well as the correspodning config and support classes for grid track interpolation in the pysiral.auxdata module for additional guidance.
The only other hard requirements is the presence of on specific method in order to be a valid subclass of AuxdataBaseClass:
get_l2_track_vars(l2)
This method will be called during the Level-2 processor. The argument is the Level-2 data object and the purpose of the method is to compute the auxilary variable(s) and associated uncertainty. These variable need to be registered using the register_auxvar(id, name, value, uncertainty) method of the base class. All sitype subclasses need to register at minimum the following variable:
- sea ice type (fraction of multi year ice):
id: sitype name: sea_ice_type
e.g., this code line is mandatory for get_l2_track_vars (uncertainty can be None):
# Register Variables self.register_auxvar(“sitype”, “sea_ice_type”, value, uncertainty)
Classes
This is a class for the OSI-403 product with variables ice_type and confidence_level |
|
Class for reprocessed OSISAF sea ice type products (e.g. for C3S). Currently supports the |
|
MYI Fraction from NASA Team Algorithm (from ICDC UHH) |
|
Returns myi for all ice covered regions |
|
Returns myi for all ice covered regions |
Functions
|
Fill gaps in sea ice type that are indicated as sea ice in the sea ice concentration product. |
Module Contents
- class pysiral.auxdata.sitype.OsiSafSIType(*args, **kwargs)
Bases:
pysiral.auxdata.AuxdataBaseClassThis is a class for the OSI-403 product with variables ice_type and confidence_level
- _data = None
- start_time = None
- hemisphere_code = None
- get_l2_track_vars(l2)
Default grid auxiliary data set
- load_requested_auxdata()
Required subclass method: Load the data file necessary to satisfy condition for requested date
- _get_sitype_track(l2)
- property requested_filepath
Note: this overwrites the property in the super class due to some peculiarities with the filenaming (hemisphere code)
- class pysiral.auxdata.sitype.OsiSafSITypeCDR(*args, **kwargs)
Bases:
pysiral.auxdata.AuxdataBaseClassClass for reprocessed OSISAF sea ice type products (e.g. for C3S). Currently supports the - C3S sea ice type climate data record v1.0 - C2s sea ice type interim climate data record v1.0 - C3S sea ice tyoe climate data record v2.0
- _data = None
- start_time = None
- hemisphere_code = None
- get_l2_track_vars(l2)
Mandadory method of AuxdataBaseClass subclass. Registers two variables to the Level-2 data container:
MYI fraction (id: sitype, name: sea_ice_type)
MYI fraction uncertainty (id: sitype.uncertainty, name: sea_ice_type_uncertainty)
- Parameters:
l2 – Level-2 Data object
- Returns:
None
- load_requested_auxdata() None
Loads file from local repository only if needed :return:
- _get_sitype_track(l2)
Extract ice type and ice type uncertainty along the track :param l2: :return: sitype (array), sitype_uncertainty (array)
- static flag_translator(flag)
Converts the flag in the file into multi-year ice (MYI) fraction:
0.0: fyi 0.5: ambiguous 1.0: myi NaN: everything else
This method only converts a single flag value to MYI fraction and is intended to use with map()
myi_fraction = map(self.flag_translater, flag_values)
Documentation of the flag from the product files (v2.0). Fill value may differ between sea-ice type CDR versions:
``` byte ice_type(time=1, yc=432, xc=432);
:_FillValue = -127B; // byte :long_name = “Classification of sea ice into the classes of first-year ice and multiyear ice”; :standard_name = “sea_ice_classification”; :valid_min = 1B; // byte :valid_max = 4B; // byte :grid_mapping = “Lambert_Azimuthal_Grid”; :coordinates = “time lat lon”; :flag_values = 1B, 2B, 3B, 4B; // byte :flag_meanings = “open_water first_year_ice multi_year_ice ambiguous”; :flag_descriptions = “flag 1: No ice or very open ice (less than 30% ice concentration)
flag 2: Seasonal ice that has formed since last melting season flag 3: Older ice that has survived at least one melting season flag 4: Ambiguous ice with non-significant classification”;
:ancillary_variables = “uncertainty status_flag”; :comment = “this field is the primary sea ice type estimate for this climate data record”;
- Parameters:
flag – (int) The sea ice classification flag value
- Returns:
myi_fraction: (float) MYI fraction
- property requested_filepath: pathlib.Path
Note: this overwrites the property in the super class due to some peculiarities with the filenaming (auto product changes etc) :return: The filepath to the target file
- property cdr_icdr_record_types: List[str]
- property cdr_icdr_record_type_prefix: List[str]
- class pysiral.auxdata.sitype.ICDCNasaTeam(*args, **kwargs)
Bases:
pysiral.auxdata.AuxdataBaseClassMYI Fraction from NASA Team Algorithm (from ICDC UHH)
- _data = None
- get_l2_track_vars(l2)
This method raises a NotImplementedError if it is not overwritten by child class :return:
- _get_requested_date(l2)
Use first timestamp as reference, date changes are ignored
- _get_data(l2)
Loads file from local repository only if needed
- _get_local_repository_filename(l2)
- _get_sitype_track(l2)
- class pysiral.auxdata.sitype.MYIDefault(*args, **kwargs)
Bases:
pysiral.auxdata.AuxdataBaseClassReturns myi for all ice covered regions
- get_l2_track_vars(l2)
Every ice is myi (sitype = 1)
- property uncertainty_default
- class pysiral.auxdata.sitype.FYIDefault(*args, **kwargs)
Bases:
pysiral.auxdata.AuxdataBaseClassReturns myi for all ice covered regions
- get_l2_track_vars(l2)
Every ice is fyi (sitype = 0)
- property uncertainty_default
- pysiral.auxdata.sitype.fill_sitype_gaps(sitype, sitype_uncertainty, sic, sic_threshold=70.0, gap_filled_uncertainty=0.5, max_valid_nn_dist=150, ambiguos_sitype_value=0.5)
Fill gaps in sea ice type that are indicated as sea ice in the sea ice concentration product. Gaps close to a valid sea-ice type value will be filled using a nearest neighbour approach, further gaps will be labeled as ambiguous. Any gap-filled value will be associated with a large uncertainty.
- Parameters:
sitype – sea-ice type array
sitype_uncertainty – sea-ice type uncertainty array
sic – sea-ice concentration array
sic_threshold – threshold in percent as to when a waveform can be intepreted as sea ice
gap_filled_uncertainty – the sea-ice type uncertainty value associated with gap filled values
max_valid_nn_dist – The maximum distance (in points) for valid nearest neighbour interpolation
ambiguos_sitype_value – The value associated to ambiguous gaps
- Returns:
Gap-filled sitype, sitype_uncertainty