Reference Guide
Air Sounding
This module allows to plot an upper air sounding on a Skew-T diagramm. It can also try to detect interesting layers into the upper air sounding.
Classes
- class air_sounding.AirSounding(variables: VariablesSet)
Allows to plot and analyse an upper air sounding
Attributes
- nb_dataint
The length of the given
VariablesSet.- datadict
The variables contained into the given
VariablesSet.
Methods
- show(layers: tuple = ())
Plots and displays the upper air sounding on a Skew-T diagramm and a hodograph.
Parameters
- layerstuple, optionnal
By default:
(). The layers to be represented on the Skew-T diagramm.
- auto_layers(layer_size: int = 0, nb_layers: int = 10, show: bool = False)
This method attempts to find interesting layers in the upper air sounding and prints the characteristics of these layers.
Parameters
- layer_sizeint, optionnal
By default: automatic size. The size of each layers in termes of indexes.
- nb_layersint, optionnal
By default:
10. The maximum number of layers you want.- showbool, optionnal
By default:
False. If set onTrue, once the layers have been analyzed, it will plot the layers on the Skew-T diagramm.
Variables
This module provide a class to manipulate variables with dimensions.
Classes
- class variables.LockedWarning
Warns the user that he’s trying to modify a locked VariablesSet instance.
- class variables.VariablesSet(filename: str, **kwargs)
This class provides a standard format for passing variables to an AirSounding instance. It also allows data to be split between ascending and descending profiles.
Attributes
- datapd.DataFrame, private
The DataFrame that contains all the data from the upper air sounding.
- variablesdict, private
Identified variables in
data. You can only identify the variables required by AirSounding, in particular :the pressure;
the temperature;
the dewpoint;
the easterly wind;
the northerly wind.
- lockedbool, private
Falseif the instance can still be edited.
Methods
- add_press(vardata: tuple)
Adds pressure to
variables.Parameters
- vardatatuple
This tuple must contains:
the name of the pressure in
data;the unit of the pressure in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to add a pressure when the VariablesSet is locked.
- add_temp(vardata: tuple)
Adds temperature to
variables.Parameters
- vardatatuple
This tuple must contains:
the name of the temperature in
data;the unit of the temperature in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to add a temperature when the VariablesSet is locked.
- add_dewpoint(vardata: tuple)
Adds dewpoint to
variables.Parameters
- vardatatuple
This tuple must contains:
the name of the dewpoint in
data;the unit of the dewpoint in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to add a dewpoint when the VariablesSet is locked.
- add_windu(vardata: tuple)
Adds east wind component to
variables.Parameters
- vardatatuple
This tuple must contains:
the name of the east wind component in
data;the unit of the east wind component in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to add an east component of the wind when the VariablesSet is locked.
- add_windv(vardata: tuple)
Adds north wind component to
variables.Parameters
- vardatatuple
This tuple must contains:
the name of the north wind component in
data;the unit of the north wind component in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to add a north component of the wind when the VariablesSet is locked.
- compute_dewpoint(temperature: tuple, relative_humitidy: tuple)
Computes the dewpoint from the air temperature and the relative humidity.
Parameters
- temperaturetuple
This tuple must contains:
the name of the temperature in
data;the unit of the temperature in
data(cf.metpy.units).
- relative_humiditytuple
This tuple must contains:
the name of the relative humidity in
data;the unit of the relative humidity in
data(cf.metpy.units).
Warns
- LockedWarning
This warning should appear if you try to compute the dewpoint when the VariablesSet is locked.
- apply_threshold(threshold: float, ascending: bool = True, start_cut: bool = False, atol: int = 10)
This function cuts data by applying a threshold to the pressure. It will retain all data above this threshold. You can also request an ascending or descending profile for altitude sounding.
Warning
Applying a threshold will lock the
VariablesSetinstance.Parameters
- thresholdfloat
The threshold to apply on pressure, all pressure above this value will be retain.
- ascendingbool, optionnal
By default:
True. Indicates which profile you want to keep. Ifascendingis set onTrueit will keep the ascending profile, otherwise the descending profile.- start_cutbool, optionnal
By default:
FalseIf set onTrueit will cuts the data at the start.- atolint, optionnal
By default:
10The absolute tolerance parameter.
Warns
- LockedWarning
This warning should appear if you try to apply a threshold when the VariablesSet is locked.
Layers
This module provides functions for dividing a signal into layers by analyzing the strongest gradients into the input signal.
Functions
- layers.check_indices_spacing(indices: list, index_to_check: int, min_dist: int)
Checks that the index to be checked is far enough away from all the others.
Parameters
- indiceslist
All the indices, they’re considered as a reference.
- index_to_checkint
The index to be checked.
- min_distint
The minimum distance beetween two indices.
Returns
- outbool
It equals
Trueifindex_to_checkis far enough away from all the others, andFalsein the other case.
- layers.get_layers(layer_size: int, nb_layers: int, *datas)
Extracts strongest gradients from input data. If you give several input datas, the result will be the concatenation of all the gradients found.
Parameters
- layer_sizeint
The minimum size of each layer (in terms of index). The input datas will be divided into small layers of this size, and the sliding gradients will be computed on these layers.
- nb_layersint
The numbers of layers you want.
- datas
All the data on which you wish to obtain the strongest gradients.
Returns
- outlist
The sorted list of the indices of all the strongest gradients.
Exemple
If you’re searching for small phenomena into an upper air sounding, you should pass a small
layer_size. You also have two variables from the sounding (e.g. temperature and humidty) and you want 10 layers:layers_indices = get_layers(10, 10, data_temp, data_relative_hum)
Files
This little module gives some functions to handle common file formats.
Functions
- files.open_ftr(filename: str, **kwargs)
Opens and creates a
VariablesSetinstance from a ftr file.Parameters
- filenamestr
The name of the ftr file to be read.
- kwargs
The keyword arguments to be given to
pandas.read_csv.
Returns
- v_setVariablesSet
The
VariablesSetinstance, ready to be given toAirSounding.
- files.open_cor(filename: str, **kwargs)
Opens and creates a
VariablesSetinstance from a cor file.Parameters
- filenamestr
The name of the cor file to be read.
- kwargs
The keyword arguments to be given to
pandas.read_csv.
Returns
- v_setVariablesSet
The
VariablesSetinstance, ready to be given toAirSounding.