“Node” utility functions
TempestExtremes
- utils.nodes.tempestextremes_utils.node_utils.run_detectNodes(input_filelist, detect_filelist, mpi_np=1, searchby='min', detect_var='msl', merge_dist=6.0, bounds=None, closedcontour_commands='msl,200.0,5.5,0;_DIFF(z(300millibars),z(500millibars)),-58.8,6.5,1.0', output_commands='msl,min,0;_VECMAG(u10,v10),max,2.0;zs,min,0', timeinterval='6hr', lonname='longitude', latname='latitude', logdir='./log/', regional=False, quiet=False, out_command_only=False)[source]
Detect and track minimum based on TempestExtremes.
TC detection is based on warm-core criterion from Zarzycki and Ullrich (2017) https://agupubs.onlinelibrary.wiley.com/doi/10.1002/2016GL071606
Parameters
- input_fileliststr
String with a path to the textfile containing the input data required.
- detect_fileliststr
String with a path to the textfile containing the names of the detectNode output.
- mpi_npint, optional
Number of cores used in the calculation, given to mpi command. Defaults to 1.
- searchby{“min”, “max”}, optional
Type of extremum to search for. Defaults to “min”.
- detect_varstr, optional
String with the variable to detect (must match in the input netcdf file). Defaults to “msl”.
- merge_distfloat, optional
Distance for merging nodes. Defaults to 6.0.
- boundslist (N=4), optional
A list containing the bounds of a bounding box to do detection in the form
[minlon,maxlon,minlat,maxlat]. Defaults to None.- closedcontour_commandsstr, optional
String with the closed contour commands. Should be of the form
<var,op,threshold,dist>with commands separated by a “;”. Defaults to “msl,200.0,5.5,0;_DIFF(z(300millibars),z(500millibars)),-58.8,6.5,1.0”.- output_commandsstr, optional
String with the output commands. Should be of the form
<var,op,dist>with commands separated by a “;”. Defaults to “msl,min,0;_VECMAG(u10,v10),max,2.0;zs,min,0”.- timeintervalstr, optional
String with the time interval (e.g. “6hr”). Defaults to “6hr”.
- lonnamestr, optional
String with the longitude variable name, as in the input netcdfs. Defaults to “longitude”.
- latnamestr, optional
String with the latitude variable name, as in the input netcdfs. Defaults to “latitude”.
- logdirstr, optional
String with the path for logfile output. Defaults to “./log/”.
- regionalbool, optional
If True, tells TE that it is expecting a regional grid without periodic boundaries. Defaults to False.
- quietbool, optional
If True, progress information is suppressed. Defaults to False.
- out_command_onlybool, optional
If True, will not run the TE command but instead with output the command for terminal use. Defaults to False.
Returns
- tuple of (str, str)
A tuple containing stdout and stderr from the DetectNodes subprocess if quiet is False, otherwise nothing.
Notes
This function wraps the TempestExtremes DetectNodes command. Ensure the TEMPESTEXTREMESDIR environment variable is set.
Examples
>>> # Assuming you have input and detect filelists ready >>> # stdout, stderr = run_detectNodes("input_files.txt", "detect_output.txt", mpi_np=4) >>> # print("DetectNodes stdout:", stdout)
- utils.nodes.tempestextremes_utils.node_utils.run_nodeCompose(stitch_file, compose_file, in_fmt, level_type, grid_type='XY', variables=['u', 'v'], lonname='longitude', latname='latitude', dx=0.5, resx=11, quiet=False, out_command_only=False)[source]
Parameters
- stitch_filedtype str
String with a path to the csv file of the stitch node output data.
- compose_filedtype str
String with a path to the netcdf file of the compose node output data.
- level_typedtype str
level type of era5 data [‘pressure-levels’, ‘single-levels’, ‘potential-temperature’]
- grid_typedtype str
grid type of the output data default=’XY’
- variableslist (N=n)
a list containing names of variables in the form of [‘u’, ‘v’]
- lonnamedtype str
String with the longitude variable name, as in the input netcdfs
- latnamedtype str
String with the latitude variable name, as in the input netcdfs
- dx: dtype float
Horizontal grid spacing of the XY grid
- resx: dtype int
Number of grid ceels in each coordiante on the XY grid
- quietbool
Optional, default
False. IfTrue, progress information is suppressed.- out_command_onlybool
Optional, default
False. IfTrue, will not run the TE command but instead with output the command for terminal use.
- utils.nodes.tempestextremes_utils.node_utils.run_stitchNodes(input_filelist, stitch_file, mpi_np=1, output_filefmt='csv', in_fmt_commands='lon,lat,msl', range_dist=8.0, minim_time='54h', maxgap_time='24h', min_endpoint_dist=12.0, threshold_condition='wind,>=,10.0,10;lat,<=,50.0,10;lat,>=,-50.0,10;zs,<,150,10', quiet=False, out_command_only=False)[source]
input_filelist — text file contain a list of DetectNode output files stitch_file — a single text file with stitched nodes output_filefmt — output format (gfdl|csv|csvnohead) range_dist — the distance between two nodes in two consecutive time steps
adjust this parameter according to timeinterval in run_detectNodes at least >= merge_dist in run_detectNodes
minim_time — the minimum time detected nodes must sustain maxgap_time — the maximum gap within the track threshold_var — threshold variable threshold_op — threshold operation (>|<|==|!=) threshold_val — threshold value threshold_time — the numbe of timesteps threshold must be satisfied