π οΈ Helper Toolsο
A collection of helper tools included within SounderPy.
Printing a dictionary of profile parametersο
Return a massive dictionary of common calculated paramters and special variables for a vertical profile.
- Data returned in this dictionary includeβ¦
an interpolated version of the profile
basic parameters such as mixing ratio, theta-e, wet-bulb, etc
Thermodynamic parameters such as SB, MU, ML parcel properties (LCL, LFC, EL, CAPE, CIN, etc)
Kinematic parameters such as storm motion, storm-relative wind, streamwise vorticity, SRH, etc.
- class sounding_paramsο
- .calc(clean_data)ο
- Parameters:
clean_data (dict, required) β a dictionary of SounderPy data (see π Tools for Getting Data)
- Returns:
special sounding parameters
- Return type:
dict
Note
These calculated parameters are the same used on SounderPy plots. This function simply returns the master dictionary of all of these values.
Finding site lat/lon pairsο
- spy.get_latlon(station_type, station_id)ο
Return a latitude-longitude float pair in a
list
- Parameters:
station_type (str, required) β the station βtypeβ that corresponds with the given station ID
station_id (str, required) β the station ID for the given station type
- Returns:
lat/lon float pair
- Return type:
list
Example:
spy.get_latlon('metar', 'kmop')
spy.get_latlon('bufkit', 'apx')
spy.get_latlon('raob', 'oun')
spy.get_latlon('buoy', '45210')
note: you can use this lat/lon pair list when calling the function get_model_data
Saving data to a fileο
- spy.to_file(file_type, clean_data, filename=None)ο
Create a file of βcleanedβ SounderPy data
- Parameters:
file_type (str, required) β a str representing the file type youβd like to export data to.
clean_data (dict, required) β βcleanedβ SounderPy data dict
filename (str, required) β the name youβd like to give the file
- Returns:
a file of SounderPy data.
- Example:
File options include csv, cm1, & sharppy
spy.to_file('csv', clean_data)
spy.to_file('cm1', clean_data)
spy.to_file('sharppy', clean_data)
Interpolating a vertical profileο
- spy.interp_data(variable, heights, step=100)ο
Interpolate a 1D array of data (such as a temperature profile) over a given interval (step) based on a corresponding array of height values.
- Parameters:
variable (arr, required) β an array of data to be interpolated. Must be same length as height array.
heights (arr, required) β heights corresponding to the vertical profile used to interpolate. Must be same length as variable array.
step (int, optional) β the resolution of interpolation. Default is 100 (recommended value is 100)
- Returns:
interp_var, an array of interpolated data.
- Return type:
arr
Example:
spy.interp_data(temperature_array, height_array, step=100)
Finding a βnearestβ valueο
- spy.find_nearest(array, value)ο
Return a value of an index of an array whoβs value is closest to a define value.
- Parameters:
array (arr, required) β an array of data to be searched through
heights (int or float, required) β the value used to compare against the array of data
- Returns:
nearest_idx, index of the data array that corresponds with the nearest value to the given value
- Return type:
int
Example:
z_equals_500m = spy.interp_data(z, 500)