pysiral.auxdata.snow ==================== .. py:module:: pysiral.auxdata.snow .. autoapi-nested-parse:: Created on Sun Apr 24 13:57:56 2016 @author: Stefan Important Note: All snow 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 SNOW subclasses need to register at minimum the following variable: snow depth (snow depth on sea ice in meter) id: sd name: snow_depth snow_density (snow density on sea ice in kg/m^3) id: sdens name: snow_density e.g., this code line is mandatory for `get_l2_track_vars` (uncertainty can be None): # Register Variables self.register_auxvar("sd", "snow_depth", value, uncertainty) self.register_auxvar("sdens", "snow_density", value, uncertainty) Classes ------- .. autoapisummary:: pysiral.auxdata.snow.Warren99 pysiral.auxdata.snow.Warren99AMSR2Clim pysiral.auxdata.snow.Warren99AMSR2ClimDataContainer pysiral.auxdata.snow.SeasonalArcticSnowDensityMallett2020 pysiral.auxdata.snow.FixedSnowDepthDensity pysiral.auxdata.snow.ICDCSouthernClimatology pysiral.auxdata.snow.SnowParameterContainer Functions --------- .. autoapisummary:: pysiral.auxdata.snow.get_l2_snow_handler Module Contents --------------- .. py:class:: Warren99(*args, **kwargs) Bases: :py:obj:`pysiral.auxdata.AuxdataBaseClass` Base class for all subtype auxdata base classes (e.g. SICBaseClass). This class defines the mandatory set of methods and properties for all auxdata classes .. py:attribute:: sd_coefs .. py:attribute:: swe_coefs .. py:attribute:: earth_radius :value: 6371000.8 .. py:attribute:: water_density :value: 1024.0 .. py:attribute:: p .. py:method:: evaluate(lons, lats, month_num) Return the result of the Warren Climatology for a given set of lons, lats and the month number (1-12) .. py:method:: get_l2_track_vars(l2) Get the snow depth, density and their uncertainties for the track in the l2 data object including the potential modification of the original climatology and filters .. py:method:: _get_warren99_fit_from_l2(l2) This convinience function translates the information from the l2 object for the evaluate method .. py:method:: _get_sd_coefs(month) .. py:method:: _get_swe_coefs(month) .. py:method:: _get_snow_depth(month, l2x, l2y) .. py:method:: _get_warren_uncertainty(month, sd) Get the uncertainty from the Warren climatology for snow depth and density snow depth: sum of fit rms and interannual variability snow density fit rms of snow water equivalent .. py:method:: _get_snow_density(snow_depth, month, l2x, l2y) Extract along-track snow density .. py:class:: Warren99AMSR2Clim(*args, **kwargs) Bases: :py:obj:`pysiral.auxdata.AuxdataBaseClass` Class for monthly snow depth & density climatology based on merged Warren99 climatology and monthly AMSR2 snow depth composite (source: IUP). The source data is organized as netCDF files that contain a: 1. monthly climatological snow depth and density 2. the mask of the W99 region of influence 3. uncertainties of geophysical parameters This class reads the netCDF data and applies a correction for first-year sea ice areas in regions solely influenced by the Warren99 climatalogy. REQUIREMENTS: - Level-2 object has attribute `sitype` (sea ice type classication: 0 [fyi] <) sitype <= 1 [myi]) - options has attribute `fyi_correction_factor` (factor 0-1 for reduction of snow depth in FYI W99 areas) OPTIONAL: - options has boolean attribute `daily_scaling` (if True snow depth and density will be scaled between successive month) NOTES: - This class is mainly designed to be calles from the Level-2 processor for trajectory based data sets. An more generalized version is in planning. UPDATES: - [July 2020] With AWI CryoSat-2 v2.3 a change was introduced to allow a daily change of the snow depth fields rather than monthly (see github issue: https://github.com/shendric/pysiral/issues/40) .. py:attribute:: _data .. py:method:: get_l2_track_vars(l2) This is the method that will be evoked by the Level-2 processor. This method will extract the geophysical parameters :param l2: The Level-2 data container :return: None .. py:method:: update_external_data() This method overwrites the default behaviour of loading a dedicated file per l2 track object. The functionality is delegated to a specific data class for this auxiliary data set. :return: .. py:method:: _get_snow_track(l2) Extract the snow depth and density track along the l2 track :param l2: :return: .. py:property:: use_daily_scaling Return a flag that indicates whether to use daily scaling (absence of flag in options will be treated as no) :return: .. py:class:: Warren99AMSR2ClimDataContainer(cfg, use_daily_scaling) Bases: :py:obj:`object` A dedicated data container for the merged W99/AMSR2 snow climatology. This class has been introduced with the use of daily scaling that requires data to loaded also from month adjacent to the month of the current Level-2 data object .. py:attribute:: cfg .. py:attribute:: use_daily_scaling .. py:attribute:: data :value: None .. py:attribute:: filepaths :value: [] .. py:attribute:: error .. py:method:: load() Load the required data. This will load the data for all winter month into memory and the return either a weighted fiels (if `use_daily_scaling` is True) or just the field from the corresponding month :return: .. py:method:: get_lonlat() Return longitude and latitude variables :return: .. py:method:: get_var(parameter_name, date_tuple) Get the a geophysical variable from the netCDF(s). If daily scaling is activated, the date information given by date tuple will be used to create output fields that are interpolated between adjacent month. :param parameter_name: :param date_tuple: :return: .. py:method:: get_filepath(month_num) Return the file path for a given month :param month_num: Number of month (1-12) :return: .. py:method:: get_monthly_field(month_num, parameter_name) Return the monthly field for given parameter name :param month_num: :param parameter_name: :return: .. py:method:: get_reference_month_nums(date_tuple) Return the two month required for the interpolation. :param date_tuple: [year, month, day] as integer :return: month_left, month_right, weight_factor .. py:method:: get_reference_datetimes(date_tuple) Creates datetimes objects for the reference dates for the actual winter season :param date_tuple: :return: .. py:method:: get_weighted_variable(date_tuple, parameter_name) Compute the weighted variable between two reference dates :param date_tuple: :param parameter_name: :return: .. py:property:: w99_weight Return the static regional mask for the merged climatology :return: .. py:property:: has_data_loaded Status flag if data is present for the current data period :return: .. py:property:: month_nums .. py:property:: reference_dates Return the reference dates for the :return: .. py:class:: SeasonalArcticSnowDensityMallett2020(*args, **kwargs) Bases: :py:obj:`pysiral.auxdata.AuxdataBaseClass` Returns a seasonal varying but regionally static snow density from Mallett et al. 2020. The density is computed as a linear function of time (elapsed month since the October for the Arctic winter season): rho_snow = 6.50 * t + 274.51 with t: month since October. Reference: Mallett, R. D. C., Lawrence, I. R., Stroeve, J. C., Landy, J. C., and Tsamados, M.: Brief communication: Conventional assumptions involving the speed of radar waves in snow introduce systematic underestimates to sea ice thickness and seasonal growth rate estimates, The Cryosphere, 14, 251–260, https://doi.org/10.5194/tc-14-251-2020, 2020. Notes: - This parametrization is valid stricly only for the northern hemisphere - Here we interpret the time t not as month since October but as fractional month (computed via days since Oct 15) to avoid artifical jumps of geophysical paramters between the last day of a month and the first of a next one. Example entry in l2 proc config files: - snow: name: snow_density_seasonal_mallett options: snow_density_uncertainty: 50. .. py:method:: subclass_init() Not requires :return: .. py:method:: get_l2_track_vars(l2) Mandatory method for the Level-2 processor. Registers snow density (and only density) as the auxiliary parameter. :param l2: :return: .. py:class:: FixedSnowDepthDensity(*args, **kwargs) Bases: :py:obj:`pysiral.auxdata.AuxdataBaseClass` Returns constant depth & density (values from l2 processor definition). Example entry in l2 proc config files: - snow: name: constant options: snow_density_uncertainty: 50 TODO: Add uncertainties .. py:method:: subclass_init() .. py:method:: get_l2_track_vars(l2) This method raises a NotImplementedError if it is not overwritten by child class :return: .. py:class:: ICDCSouthernClimatology(*args, **kwargs) Bases: :py:obj:`pysiral.auxdata.AuxdataBaseClass` Class for daily climatology fields from UHH ICDC .. py:attribute:: _data :value: None .. py:method:: get_l2_track_vars(l2) This method raises a NotImplementedError if it is not overwritten by child class :return: .. py:method:: load_requested_auxdata() Loads file from local repository only if needed .. py:method:: _get_snow_track(l2) Extract snow depth from grid .. py:class:: SnowParameterContainer Bases: :py:obj:`object` .. py:attribute:: depth :value: None .. py:attribute:: density :value: None .. py:attribute:: depth_uncertainty :value: None .. py:attribute:: density_uncertainty :value: None .. py:method:: set_invalid(indices) .. py:method:: set_dummy(n_records) .. py:function:: get_l2_snow_handler(name)