pysiral.l2data
Created on Fri Jul 24 16:30:24 2015
@author: Stefan
Classes
Container for Level-2 intermediate meta data (Essentially |
|
Container for Level-2 intermediate time orbit group (Essentially |
|
Recipe from: |
|
Template for default pysiral class with logging/error handling capabilities |
|
Module Contents
- class pysiral.l2data.Level2Data(metadata, time_orbit, period=None)
Bases:
object- _L2_DATA_ITEMS = ['range', 'sla', 'sla_raw', 'dot', 'elev', 'afrb', 'frb', 'sit', 'radar_mode']
- _HEMISPHERE_CODES
- _PARAMETER_CATALOG
- _PROPERTY_CATALOG
- error
- _n_records
- info
- track
- period = None
- _auto_auxvar_num = 0
- _auxiliary_catalog
- _multidim_auxiliary_catalog
- _auxdata_source_dict
- _source_primary_filename = 'unkown'
- _l2_algorithm_id = 'unkown'
- _l2_version_tag = 'unkown'
- _doi = ''
- _data_record_type = None
- _creation_time
- _is_evenly_spaced
- flag
- radar_mode
- set_parameter(target, value, uncertainty=None)
Convienience method to safely add a parameter with optional uncertainty and/or bias to the level-2 data structure
- set_auxiliary_parameter(var_id, var_name, value, uncertainty=None)
Adds an auxiliary parameter to the data object
- set_multidim_auxiliary_parameter(var_id, var_name, value, dim_dict, update: bool = False)
Adds an auxiliary parameter to the data object different dimensions than the standard (l2.n_records) default data array.
- Parameters:
var_id – (str) The target id for the variable
var_name – (str) The long name of the variable
value – (np.ndarray) The auxiliary parameter
dim_dict – (dictionary) The dimenstion dictionary
update – keyword flag that if true, will try to update an existing array
- Returns:
- get_multidim_auxdata_dimdict(var_name)
- set_data_record_type(data_record_type)
- update_retracked_range(retracker)
- set_metadata(auxdata_source_dict=None, source_primary_filename=None, l2_algorithm_id=None, l2_version_tag=None)
- set_doi(doi)
- get_parameter_by_name(parameter_name, raise_on_error=True)
Method to retrieve a level-2 parameter
- update_parameter(var_name: str, value, uncertainty=None) None
- get_attribute(attribute_name, *args)
Return a string for a given attribute name. This method is required for the output data handler
- _create_l2_data_items()
- _check_if_valid_parameter(parameter_name)
Performs a test if parameter name is a valid level-2 parameter name. Adds error if result negative and returns flag (valid: True, invalid: False)
- _check_valid_size(array, **kwargs)
Test if array has the correct size shape=(n_records). Adds error if not and returns flag (valid: True, invalid: False)
- _get_as_array(value, dtype=np.float32)
Create an output array from values that is of length n_records. Value can be scalar or array of length n_records. If value is any other length or dimension, an error will be added and a nan array of length n_records will be returned
- Arguments:
value (integer, float or )
- Note: This method is mostly used to allow scalar uncertainty and
bias values. It also makes sure that uncertainty and bias are of the same shape than the value, which is not guaranteed in L2ElevationArray. If a wrong uncertainty, bias shape is passed, the result will be nan uncertainties/biases throughout the processing chain and the start of NaN occurences can be used to trace the origin of the error.
- static _get_attr_pysiral_version(*args)
- _get_attr_mission_id(*args)
- _get_attr_source_mission_id(*args)
- _get_attr_source_mission_name(*args)
- _get_attr_source_mission_sensor(*args)
- _get_attr_source_mission_sensor_fn(*args)
Same as source mission sensor, only a sanitized version for filenames
- _get_attr_source_hemisphere(*args)
- _get_attr_hemisphere(*args)
- _get_attr_hemisphere_code(*args)
- _get_attr_startdt(dtfmt)
- _get_attr_stopdt(dtfmt)
- _get_attr_geospatial_lat_min(*args)
- _get_attr_geospatial_lat_max(*args)
- _get_attr_geospatial_lon_min(*args)
- _get_attr_geospatial_lon_max(*args)
- static _gett_attr_geospatial_str(value)
- _get_attr_source_auxdata_sic(*args)
- _get_attr_source_auxdata_sitype(*args)
- _get_attr_source_auxdata_mss(*args)
- _get_attr_source_auxdata_snow(*args)
- _get_attr_source_sic(*args)
- _get_attr_source_sitype(*args)
- _get_attr_source_mss(*args)
- _get_attr_source_snow(*args)
- _get_attr_source_primary(*args)
- _get_attr_l2_algorithm_id(*args)
- _get_attr_l2_version_tag(*args)
- _get_attr_utcnow(*args)
- _get_attr_time_coverage_start(*args)
- _get_attr_time_coverage_end(*args)
- _get_attr_period_coverage_start(*args)
- _get_attr_period_coverage_end(*args)
- _get_attr_time_coverage_duration(*args)
- _get_attr_time_resolution(*args)
- _get_attr_source_timeliness(*args)
Return the timeliness of the l1b source data. Set default to NTC for backwark compability
- _get_attr_cycle(*args)
Return the cycle number of the l1b source data. Set default to -1
- _get_attr_fncycle(*args)
Return the cycle number of the l1b source data. Set default to -1
- _get_attr_orbit(*args)
Return the orbit number of the l1b source data. Set default to -1
- _get_attr_rel_orbit(*args)
Return the orbit number of the l1b source data. Set default to -1
- _get_attr_fnrel_orbit(*args)
Return the orbit number of the l1b source data. Set default to -1
- static cycle_to_subcycle(cy, tr)
- _get_attr_cnes_subcycle(*args)
Return the orbit number of the l1b source data. Set default to -1
- _get_attr_cnes_track(*args)
Return the orbit number of the l1b source data. Set default to -1
- static _get_attr_uuid(*args)
Provide an uuid code (for tracking id’s)
- _get_attr_doi(*args)
- property parameter_catalog
- property full_variable_catalog
- property property_catalog
- property auxvar_names
- property auto_auxvar_id
- property auxiliary_catalog
- property arrshape
- property n_records
- property hemisphere
- property hemisphere_code
- property footprint_spacing
- property dimdict
Returns dictionary with dimensions
- property time
- property longitude
- property latitude
- property altitude
- property surface_type_flag
- property ssh
- class pysiral.l2data.Level2iMetadata
Bases:
pysiral.l1data.L1bMetaDataContainer for Level-2 intermediate meta data (Essentially mimicks the L1bdata equivalent since the data location are idential. This also allows to directly use the l1b.info object directly)
- class pysiral.l2data.Level2iTimeOrbit(**kwargs)
Bases:
pysiral.l1data.L1bTimeOrbitContainer for Level-2 intermediate time orbit group (Essentially mimicks the L1bdata equivalent since the data location are idential. This also allows to directly use the l1b.time_orbit oject directly)
- time = None
- from_l2i_stack(l2i_stack, index_list=None)
Creates a TimeOrbit group object from l2i import. This is necessary when the Level2Data object shall be constructed from an l2i netcdf product. The index list can be used for subsetting (e.g. only use positions with valid freeboard, etc)
- from_l2i_nc_import(l2i)
Creates a TimeOrbit group object from l2i import. This is necessary when the Level2Data object shall be constructed from an l2i netcdf product
- class pysiral.l2data.L2DataArray(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)
Bases:
numpy.ndarrayRecipe from: http://docs.scipy.org/doc/numpy/user/basics.subclassing.html XXX: not yet full slicing capability! -> __getitem__ trouble
always use cls[list] and cls.uncertainty[list] cls[list].uncertainty will fail
- __array_finalize__(obj)
- __getslice__(i, j)
- set_value(value)
- set_uncertainty(uncertainty)
- set_nan_indices(indices)
- class pysiral.l2data.Level2PContainer(period)
Bases:
pysiral.core.legacy_classes.DefaultLoggingClassTemplate for default pysiral class with logging/error handling capabilities
- error
- _period
- _l2i_stack = []
- append_l2i(l2i)
- get_merged_l2()
Returns a Level2Data object with data from all l2i objects
- _get_merged_data(valid_mask: str = None) dict
Returns a dict with merged data groups for all parameters in the l2i file (assumed to be identical for all files in the stack)
- Parameters:
valid_mask – The name of the parameter that defines the mask of valid l2i data points
- Returns:
Dictionary with all mergered l2i parameters
- static _get_empty_data_group(parameter_list)
- property l2i_stack
- property n_l2i_objects
- property period
- class pysiral.l2data.L2iNCFileImport(filename)
Bases:
object- filename
- _n_records = 0
- time_def
- info
- attribute_list = []
- parameter_list = []
- _parse()
- transfer_nan_mask(source, targets)
- mask_variables(indices, targets, value=np.nan)
- project(griddef)
- property n_records
- property mission
- property timeliness