Layer instance contains all the properties for a single snow layer (e.g. temperature, frac_volume, etc).
It also contains a microstructure attribute that holds the microstructural properties (e.g. radius, corr_length, etc).
The class of this attribute defines the microstructure model to use (see
Layer class should not be modified at all even if you need new properties to define the layer (e.g. brine concentration, humidity, …). If the property you need to add is
related to geometric aspects, it is probably better to use an existing microstructure model or to create a new one. If the new parameter is not related to geometrical aspect,
write a function similar to
make_snow_layer() (choose an explicit name for your purpose). In this function, create the layer by calling the Layer
constructor as in
make_snow_layer() and then add your properties with lay.myproperty=xxx, … See the example of liquid water in
This approach avoids specialization of the Layer class. The new function can be in any file (inc. out of smrt directories), and should be added in
if it is of general interest and written in a generic way, that is, covers many use cases for many users with default arguments, etc.
Layer(thickness, microstructure_model=None, temperature=273.15, permittivity_model=None, inclusion_shape=None, **kwargs)¶
Contains the properties for a single snow layer including the microstructure attribute which holds the microstructure properties.
To create layer, it is recommended to use of the functions
return the SSA, compute it if necessary
return the permittivity of the i-th medium depending on the frequency and internal layer properties. Usually i=0 is air and i=1 is ice for dry snow with a low or moderate density.
- i – number of the medium. 0 is reserved for the background
- frequency – frequency of the wave (Hz)
complex permittivity of the i-th medium
Function to provide very basic input checks on the layer information
- temperature is between 100 and the freezing point (Kelvin units check),
- density is between 1 and DENSITY_OF_ICE (SI units check)
- layer thickness is above zero
return the layer with inverted autocorrelation and inverted permittivities.
return the class corresponding to the microstructure_model defined in modulename.
This function import the correct module if possible and return the class. It is used internally and should not be needed for normal usage.
Parameters: modulename – name of the python module in smrt/microstructure_model
create an microstructure instance.
This function is called internally and should not be needed for normal use.
param modelname_or_class: name of the module or directly the class. param type: string param **kwargs: all the arguments need for the specific autocorrelation. returns: instance of the autocorrelation modelname with the parameters given in **kwargs Example:
To import the StickyHardSpheres class with spheres radius of 1mm, stickiness of 0.5 and fractional_volume of 0.3:
shs = make_autocorrelation("StickyHardSpheres", radius=0.001, stickiness=0.5, frac_volume=0.3)
This decorator is used for the permittivity functions. It declares the layer properties needed to call the function and the optiona once. This allows permittivity functions to use any properties of the layer, as long as it is defined.