pysiral.l2data ============== .. py:module:: pysiral.l2data .. autoapi-nested-parse:: Created on Fri Jul 24 16:30:24 2015 @author: Stefan Classes ------- .. autoapisummary:: pysiral.l2data.Level2Data pysiral.l2data.Level2iMetadata pysiral.l2data.Level2iTimeOrbit pysiral.l2data.L2DataArray pysiral.l2data.Level2PContainer pysiral.l2data.AttributeList pysiral.l2data.L2iNCFileImport Module Contents --------------- .. py:class:: Level2Data(metadata, time_orbit, period=None) Bases: :py:obj:`object` .. py:attribute:: _L2_DATA_ITEMS :value: ['range', 'sla', 'sla_raw', 'dot', 'elev', 'afrb', 'frb', 'sit', 'radar_mode'] .. py:attribute:: _HEMISPHERE_CODES .. py:attribute:: _PARAMETER_CATALOG .. py:attribute:: _PROPERTY_CATALOG .. py:attribute:: error .. py:attribute:: _n_records .. py:attribute:: info .. py:attribute:: track .. py:attribute:: period :value: None .. py:attribute:: _auto_auxvar_num :value: 0 .. py:attribute:: _auxiliary_catalog .. py:attribute:: _multidim_auxiliary_catalog .. py:attribute:: _auxdata_source_dict .. py:attribute:: _source_primary_filename :value: 'unkown' .. py:attribute:: _l2_algorithm_id :value: 'unkown' .. py:attribute:: _l2_version_tag :value: 'unkown' .. py:attribute:: _doi :value: '' .. py:attribute:: _data_record_type :value: None .. py:attribute:: _creation_time .. py:attribute:: _is_evenly_spaced .. py:attribute:: flag .. py:attribute:: radar_mode .. py:method:: 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 .. py:method:: set_auxiliary_parameter(var_id, var_name, value, uncertainty=None) Adds an auxiliary parameter to the data object .. py:method:: 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. :param var_id: (str) The target id for the variable :param var_name: (str) The long name of the variable :param value: (np.ndarray) The auxiliary parameter :param dim_dict: (dictionary) The dimenstion dictionary :param update: keyword flag that if true, will try to update an existing array :return: .. py:method:: get_multidim_auxdata_dimdict(var_name) .. py:method:: set_data_record_type(data_record_type) .. py:method:: update_retracked_range(retracker) .. py:method:: set_metadata(auxdata_source_dict=None, source_primary_filename=None, l2_algorithm_id=None, l2_version_tag=None) .. py:method:: set_doi(doi) .. py:method:: get_parameter_by_name(parameter_name, raise_on_error=True) Method to retrieve a level-2 parameter .. py:method:: update_parameter(var_name: str, value, uncertainty=None) -> None .. py:method:: get_attribute(attribute_name, *args) Return a string for a given attribute name. This method is required for the output data handler .. py:method:: _create_l2_data_items() .. py:method:: _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) .. py:method:: _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) .. py:method:: _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. .. py:method:: _get_attr_pysiral_version(*args) :staticmethod: .. py:method:: _get_attr_mission_id(*args) .. py:method:: _get_attr_source_mission_id(*args) .. py:method:: _get_attr_source_mission_name(*args) .. py:method:: _get_attr_source_mission_sensor(*args) .. py:method:: _get_attr_source_mission_sensor_fn(*args) Same as source mission sensor, only a sanitized version for filenames .. py:method:: _get_attr_source_hemisphere(*args) .. py:method:: _get_attr_hemisphere(*args) .. py:method:: _get_attr_hemisphere_code(*args) .. py:method:: _get_attr_startdt(dtfmt) .. py:method:: _get_attr_stopdt(dtfmt) .. py:method:: _get_attr_geospatial_lat_min(*args) .. py:method:: _get_attr_geospatial_lat_max(*args) .. py:method:: _get_attr_geospatial_lon_min(*args) .. py:method:: _get_attr_geospatial_lon_max(*args) .. py:method:: _gett_attr_geospatial_str(value) :staticmethod: .. py:method:: _get_attr_source_auxdata_sic(*args) .. py:method:: _get_attr_source_auxdata_sitype(*args) .. py:method:: _get_attr_source_auxdata_mss(*args) .. py:method:: _get_attr_source_auxdata_snow(*args) .. py:method:: _get_attr_source_sic(*args) .. py:method:: _get_attr_source_sitype(*args) .. py:method:: _get_attr_source_mss(*args) .. py:method:: _get_attr_source_snow(*args) .. py:method:: _get_attr_source_primary(*args) .. py:method:: _get_attr_l2_algorithm_id(*args) .. py:method:: _get_attr_l2_version_tag(*args) .. py:method:: _get_attr_utcnow(*args) .. py:method:: _get_attr_time_coverage_start(*args) .. py:method:: _get_attr_time_coverage_end(*args) .. py:method:: _get_attr_period_coverage_start(*args) .. py:method:: _get_attr_period_coverage_end(*args) .. py:method:: _get_attr_time_coverage_duration(*args) .. py:method:: _get_attr_time_resolution(*args) .. py:method:: _get_attr_source_timeliness(*args) Return the timeliness of the l1b source data. Set default to NTC for backwark compability .. py:method:: _get_attr_cycle(*args) Return the cycle number of the l1b source data. Set default to -1 .. py:method:: _get_attr_fncycle(*args) Return the cycle number of the l1b source data. Set default to -1 .. py:method:: _get_attr_orbit(*args) Return the orbit number of the l1b source data. Set default to -1 .. py:method:: _get_attr_rel_orbit(*args) Return the orbit number of the l1b source data. Set default to -1 .. py:method:: _get_attr_fnrel_orbit(*args) Return the orbit number of the l1b source data. Set default to -1 .. py:method:: cycle_to_subcycle(cy, tr) :staticmethod: .. py:method:: _get_attr_cnes_subcycle(*args) Return the orbit number of the l1b source data. Set default to -1 .. py:method:: _get_attr_cnes_track(*args) Return the orbit number of the l1b source data. Set default to -1 .. py:method:: _get_attr_uuid(*args) :staticmethod: Provide an uuid code (for tracking id's) .. py:method:: _get_attr_doi(*args) .. py:property:: parameter_catalog .. py:property:: full_variable_catalog .. py:property:: property_catalog .. py:property:: auxvar_names .. py:property:: auto_auxvar_id .. py:property:: auxiliary_catalog .. py:property:: arrshape .. py:property:: n_records .. py:property:: hemisphere .. py:property:: hemisphere_code .. py:property:: footprint_spacing .. py:property:: dimdict Returns dictionary with dimensions .. py:property:: time .. py:property:: longitude .. py:property:: latitude .. py:property:: altitude .. py:property:: surface_type_flag .. py:property:: ssh .. py:class:: Level2iMetadata Bases: :py:obj:`pysiral.l1data.L1bMetaData` Container 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) .. py:class:: Level2iTimeOrbit(**kwargs) Bases: :py:obj:`pysiral.l1data.L1bTimeOrbit` Container 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) .. py:attribute:: time :value: None .. py:method:: 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) .. py:method:: 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 .. py:class:: L2DataArray(shape, dtype=float, buffer=None, offset=0, strides=None, order=None) Bases: :py:obj:`numpy.ndarray` Recipe 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 .. py:method:: __array_finalize__(obj) .. py:method:: __getslice__(i, j) .. py:method:: set_value(value) .. py:method:: set_uncertainty(uncertainty) .. py:method:: set_nan_indices(indices) .. py:class:: Level2PContainer(period) Bases: :py:obj:`pysiral.core.legacy_classes.DefaultLoggingClass` Template for default pysiral class with logging/error handling capabilities .. py:attribute:: error .. py:attribute:: _period .. py:attribute:: _l2i_stack :value: [] .. py:method:: append_l2i(l2i) .. py:method:: get_merged_l2() Returns a Level2Data object with data from all l2i objects .. py:method:: _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) :param valid_mask: The name of the parameter that defines the mask of valid l2i data points :return: Dictionary with all mergered l2i parameters .. py:method:: _get_empty_data_group(parameter_list) :staticmethod: .. py:property:: l2i_stack .. py:property:: n_l2i_objects .. py:property:: period .. py:class:: AttributeList Bases: :py:obj:`object` .. py:method:: set_attribute(name, value) .. py:class:: L2iNCFileImport(filename) Bases: :py:obj:`object` .. py:attribute:: filename .. py:attribute:: _n_records :value: 0 .. py:attribute:: time_def .. py:attribute:: info .. py:attribute:: attribute_list :value: [] .. py:attribute:: parameter_list :value: [] .. py:method:: _parse() .. py:method:: transfer_nan_mask(source, targets) .. py:method:: mask_variables(indices, targets, value=np.nan) .. py:method:: project(griddef) .. py:property:: n_records .. py:property:: mission .. py:property:: timeliness