pysiral.auxdata.snow

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

Warren99

Base class for all subtype auxdata base classes (e.g. SICBaseClass).

Warren99AMSR2Clim

Class for monthly snow depth & density climatology based on merged Warren99 climatology and

Warren99AMSR2ClimDataContainer

A dedicated data container for the merged W99/AMSR2 snow climatology. This class has been introduced

SeasonalArcticSnowDensityMallett2020

Returns a seasonal varying but regionally static snow density from Mallett et al. 2020. The density

FixedSnowDepthDensity

Returns constant depth & density (values from l2 processor definition).

ICDCSouthernClimatology

Class for daily climatology fields from UHH ICDC

SnowParameterContainer

Functions

get_l2_snow_handler(name)

Module Contents

class pysiral.auxdata.snow.Warren99(*args, **kwargs)

Bases: 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

sd_coefs
swe_coefs
earth_radius = 6371000.8
water_density = 1024.0
p
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)

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

_get_warren99_fit_from_l2(l2)

This convinience function translates the information from the l2 object for the evaluate method

_get_sd_coefs(month)
_get_swe_coefs(month)
_get_snow_depth(month, l2x, l2y)
_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

_get_snow_density(snow_depth, month, l2x, l2y)

Extract along-track snow density

class pysiral.auxdata.snow.Warren99AMSR2Clim(*args, **kwargs)

Bases: 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:

_data
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

Parameters:

l2 – The Level-2 data container

Returns:

None

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:

_get_snow_track(l2)

Extract the snow depth and density track along the l2 track :param l2: :return:

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:

class pysiral.auxdata.snow.Warren99AMSR2ClimDataContainer(cfg, use_daily_scaling)

Bases: 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

cfg
use_daily_scaling
data = None
filepaths = []
error
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:

get_lonlat()

Return longitude and latitude variables :return:

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:

get_filepath(month_num)

Return the file path for a given month :param month_num: Number of month (1-12) :return:

get_monthly_field(month_num, parameter_name)

Return the monthly field for given parameter name :param month_num: :param parameter_name: :return:

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

get_reference_datetimes(date_tuple)

Creates datetimes objects for the reference dates for the actual winter season :param date_tuple: :return:

get_weighted_variable(date_tuple, parameter_name)

Compute the weighted variable between two reference dates :param date_tuple: :param parameter_name: :return:

property w99_weight

Return the static regional mask for the merged climatology :return:

property has_data_loaded

Status flag if data is present for the current data period :return:

property month_nums
property reference_dates

Return the reference dates for the :return:

class pysiral.auxdata.snow.SeasonalArcticSnowDensityMallett2020(*args, **kwargs)

Bases: 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.

subclass_init()

Not requires :return:

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:

class pysiral.auxdata.snow.FixedSnowDepthDensity(*args, **kwargs)

Bases: 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

subclass_init()
get_l2_track_vars(l2)

This method raises a NotImplementedError if it is not overwritten by child class :return:

class pysiral.auxdata.snow.ICDCSouthernClimatology(*args, **kwargs)

Bases: pysiral.auxdata.AuxdataBaseClass

Class for daily climatology fields from UHH ICDC

_data = None
get_l2_track_vars(l2)

This method raises a NotImplementedError if it is not overwritten by child class :return:

load_requested_auxdata()

Loads file from local repository only if needed

_get_snow_track(l2)

Extract snow depth from grid

class pysiral.auxdata.snow.SnowParameterContainer

Bases: object

depth = None
density = None
depth_uncertainty = None
density_uncertainty = None
set_invalid(indices)
set_dummy(n_records)
pysiral.auxdata.snow.get_l2_snow_handler(name)