Scripts#
Post-Processing#
CS_calculation_genmodel.py#
Compute dynamic Smagorinsky coefficients as function of scale from UM NetCDF output and store them in a NetCDF files
cs_dynamic [-h] [--h_resolution H_RESOLUTION] [--t_range T_RANGE T_RANGE]
[--z_range Z_RANGE Z_RANGE] [--input_format {um,monc,sgs}] [--plot_show]
[--plot_path PLOT_PATH] [--z_chunk_size Z_CHUNK_SIZE]
[--t_chunk_size T_CHUNK_SIZE]
[--sgs_model {all,vel_all,theta_all,Smag_vel,Smag_vel_diag,Carati,Kosovic,Smag_theta,Smag_theta_diag} [{all,vel_all,theta_all,Smag_vel,Smag_vel_diag,Carati,Kosovic,Smag_theta,Smag_theta_diag} ...]]
[--filter_type {box,gaussian}] [--filter_scales FILTER_SCALES [FILTER_SCALES ...]]
[--regularize_filter_type {box,gaussian}]
[--regularize_filter_scales REGULARIZE_FILTER_SCALES [REGULARIZE_FILTER_SCALES ...]]
input_files {um,monc,sgs} output_path
options#
I/O datasets on disk#
location of NetCDF diagnostic file(s). Recognizes glob patterns and walks directory trees, e.g.
(default:'./my_file_p[br]*nc'(All files in the pattern should belong to the same simulation).None)input_format- Type of'input_files'. Only support different NetCDF flavours from various production codes.'sgs'refers to files produced by sgs_tools. (default:None)--h_resolutionH_RESOLUTION-horizontal resolution in meters. ONLY used for UM ideal simulations(will use to overwrite horizontal coordinates).
(default:0)--t_rangeT_RANGE- time interval to consider, in code coordinates, negative value are interpreted as min/max respectively (default:[-1, -1])--z_rangeZ_RANGE- vertical interval to consider, in code coordinates, negative values are interpreted as take the min/max respectively (default:[-1, -1])Output directory, where to write netcdf output files. Will create/overwrite existing file and create any missing intermediate directories
(default:None)--input_formatINPUT_FORMAT(default:um)
Plotting parameters#
--plot_show- flag to display generated plots--plot_pathPLOT_PATH- output directory, for storing generated plots (default:None)
Dask parameters#
--z_chunk_sizeZ_CHUNK_SIZE-Size of dask array chunks in the vertical direction. Should divide the total number of levels. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)--t_chunk_sizeT_CHUNK_SIZE-Size of dask array chunks in the time direction. Should divide the total number time snapshots. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)
Model parameters#
--sgs_modelSGS_MODEL- Choice of models for which to compute dynamic coefficients. (default:all)--filter_typeFILTER_TYPE- Shape of filter kernel to use for scale separation. (default:box)--filter_scalesFILTER_SCALES- Scales to perform filter at, in number of cells. If a single value is given, it will be used for all regularize_filter_scales. Otherwise, must provide as many values as for regularize_filter_scales (default:(2,))--regularize_filter_typeREGULARIZE_FILTER_TYPE- Shape of filter kernel used for coefficient regularization. (default:box)--regularize_filter_scalesREGULARIZE_FILTER_SCALES- Scales to perform regularization at, in number of cells. If a single value is given, it will be used for all filter_scale. Otherwise, must provide as many values as for filter_scale (default:(2,))
post_process.py#
Post process a simulation and save result as NetCDF files
post_process [-h] [--h_resolution H_RESOLUTION] [--t_range T_RANGE T_RANGE]
[--z_range Z_RANGE Z_RANGE] [--overwrite_existing] [--hdims HDIMS [HDIMS ...]]
[--vertical_profiles] [--vprofile_fields VPROFILE_FIELDS [VPROFILE_FIELDS ...]]
[--vprofile_stats VPROFILE_STATS [VPROFILE_STATS ...]]
[--vprofile_fname_out VPROFILE_FNAME_OUT] [--horizontal_spectra]
[--power_spectra_fields POWER_SPECTRA_FIELDS [POWER_SPECTRA_FIELDS ...]]
[--cross_spectra_fields CROSS_SPECTRA_FIELDS [CROSS_SPECTRA_FIELDS ...]]
[--radial_smooth_factor RADIAL_SMOOTH_FACTOR] [--radial_truncation]
[--hspectra_fname_out HSPECTRA_FNAME_OUT] [--anisotropy]
[--box_domain_scales BOX_DOMAIN_SCALES [BOX_DOMAIN_SCALES ...]]
[--box_meter_scales BOX_METER_SCALES [BOX_METER_SCALES ...]]
[--box_delta_scales BOX_DELTA_SCALES [BOX_DELTA_SCALES ...]]
[--gauss_scales GAUSS_SCALES [GAUSS_SCALES ...]]
[--aniso_fname_out ANISO_FNAME_OUT] [--z_chunk_size Z_CHUNK_SIZE]
[--t_chunk_size T_CHUNK_SIZE]
input_files {um,monc,sgs} output_path
options#
I/O datasets on disk#
location of NetCDF diagnostic file(s). Recognizes glob patterns and walks directory trees, e.g.
(default:'./my_file_p[br]*nc'(All files in the pattern should belong to the same simulation).None)input_format- Type of'input_files'. Only support different NetCDF flavours from various production codes.'sgs'refers to files produced by sgs_tools. (default:None)--h_resolutionH_RESOLUTION-horizontal resolution in meters. ONLY used for UM ideal simulations(will use to overwrite horizontal coordinates).
(default:0)--t_rangeT_RANGE- time interval to consider, in code coordinates, negative value are interpreted as min/max respectively (default:[-1, -1])--z_rangeZ_RANGE- vertical interval to consider, in code coordinates, negative values are interpreted as take the min/max respectively (default:[-1, -1])
Output datasets on disk#
output directory, where to store post-processed results will create any missing intermediate directories
(default:None)--overwrite_existing- behaviour if diagnostic file already exists. default: skip
Vertical Profiles#
--vertical_profiles- Swtitch for computing vertical profiles.--vprofile_fieldsVPROFILE_FIELDS- List of fields whose vertical profile to compute. (default:['vel', 'theta', 's', 'vert_heat_flux', 'vert_mom_flux', 'fluct_ke', 'tke', 'smag_visc_m', 'smag_visc_h', 'smag_visc_m_vert', 'smag_visc_h_vert', 'csDelta', 'cs_theta', 'cs_diag', 'cs_theta_diag'])--vprofile_statsVPROFILE_STATS- Statistics to generate vertical profiles with. (default:['mean', 'std', 'median'])--vprofile_fname_outVPROFILE_FNAME_OUT- Filename where to save the generated vertical profile. relative to output_path (default:post_proc_vert_profiles.nc)
Horizontal spectra#
--horizontal_spectra- Horizontal power spectra and cross spectra.--power_spectra_fieldsPOWER_SPECTRA_FIELDS- Fields whose power spectra to compute. (default:['u', 'v', 'w', 'theta'])--cross_spectra_fieldsCROSS_SPECTRA_FIELDS-Fields whose cross spectra to compute. Use spaces to between cross spectra and commas between fields in each cross-spectrim, e.g. u,v v,w
(default:[('u', 'w'), ('v', 'w'), ('u', 'v'), ('theta', 'w')])--radial_smooth_factorRADIAL_SMOOTH_FACTOR- Radial binning of radial horizontal spectrum in units of delta_kx spacings (default:1)Truncation of radial horizontal spectrum. If True will disregard wavenumbers above the maximum linear wavenumber.
--hspectra_fname_outHSPECTRA_FNAME_OUT- Filename where to save the generated horisontal spectra. relative to output_path (default:post_proc_spectra.nc)--aniso_fname_outANISO_FNAME_OUT-Core filename where to save the generated anisotropy eigen values. relative to output_path. Will append the filter label. Will set an
(default:'.nc'extension (whether given or not).post_proc_anisotropy)
Anisotropy diagnostics#
--anisotropy- Anisotropy of velocity strain and stress--box_domain_scalesBOX_DOMAIN_SCALES-Anisotropy box filter and coarse-graining scales in fraction of the horizontal domain size. Will round to nearest integer number of horizontal grid cells. Will combine all box scales and ignore entries which are less than 2 delta apart.
(default:[1, 0.5, 0.25])--box_meter_scalesBOX_METER_SCALES-Anisotropy box filter and coarse-graining scales in meters. Will round to nearest integer number of horizontal grid cells. Will combine all box scales and ignore entries which are less than 2 delta apart
(default:[800, 400, 200, 100])--box_delta_scalesBOX_DELTA_SCALES-Anisotropy box filter and coarse-graining scales in units of horizontal grid spacing delta. Will combine all box scales and ignore entries which are less than 2 delta apart.
(default:[2, 4, 8, 16])--gauss_scalesGAUSS_SCALES- Anisotropy Gaussian filter scales in units of horizontal grid spacing. Support 2 and 4 (default:[2, 4])
Dask parameters#
--z_chunk_sizeZ_CHUNK_SIZE-Size of dask array chunks in the vertical direction. Should divide the total number of levels. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)--t_chunk_sizeT_CHUNK_SIZE-Size of dask array chunks in the time direction. Should divide the total number time snapshots. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)
BasicComparisonSimAnalysis.py#
Create (and optionally save) standard diagnostic plots for a dry atmospheric boundary layer UM simulation Best-suited to one-parameter suite of simulations, but can handle several varying parameters through plot_style_file
sim_comparison [-h] [--times [TIMES ...]] [--z_range Z_RANGE Z_RANGE] [--plot_show]
[--plot_path PLOT_PATH] [--plot_style_file PLOT_STYLE_FILE]
[--hor_slice_levels [HOR_SLICE_LEVELS ...]] [--skip_vert_profiles] [--verbose]
[--z_chunk_size Z_CHUNK_SIZE] [--t_chunk_size T_CHUNK_SIZE]
input_files [input_files ...] h_resolution [h_resolution ...]
options#
I/O datasets on disk#
Location of a set simulation outputs – UM NetCDF diagnostic files. Recognizes glob patterns and walks directory trees, e.g.
(default:'./my_file_p[br]*nc'Can have multiple files per simulation, but only one glob pattern per simulation. (All files in a glob pattern should belong to the same simulation).None)horizontal resolution (will use to overwrite horizontal coordinates). If a single resolution is given, assume it applies to all input files. Else, must give as many resolutions as inpu_file glob patterns.
NB works for ideal simulations
(default:None)--timesTIMES-times at which to perform the analysis; in code coordinates; will find nearest available match. default (which is empty) means the full data range at 1h intervals.
(default:[])--z_rangeZ_RANGE- vertical interval to consider, in code coordinates, negative values are interpreted as take the min/max respectively (default:[-1, -1])
Plotting parameters#
--plot_show- flag to display generated plots--plot_pathPLOT_PATH- output directory, for storing generated plots (default:None)--plot_style_filePLOT_STYLE_FILE-Configuration file describing a list of plot style and decorations to matched sequentially to each simulation. See plot_config_template.json for a template. If absent, will use
(default:default_plotting_styleand cycle through different colors.None)--hor_slice_levelsHOR_SLICE_LEVELS-Vertical height at which to plot horizontal slices. If not given will omit these plots.
(default:[])--skip_vert_profiles- skip vertical profiles from plotting
Dask parameters#
--z_chunk_sizeZ_CHUNK_SIZE-Size of dask array chunks in the vertical direction. Should divide the total number of levels. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)--t_chunk_sizeT_CHUNK_SIZE-Size of dask array chunks in the time direction. Should divide the total number time snapshots. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)
ReferenceComparisonSimAnalysis.py#
Create (and optionally save) standard diagnostic plots for a dry atmospheric boundary layer UM simulation Best-suited to one-parameter suite of simulations, but can handle several varying parameters through plot_style_file
ref_comparison [-h] [--times [TIMES ...]] [--z_range Z_RANGE Z_RANGE] [--plot_show]
[--plot_path PLOT_PATH]
[--hor_slice_levels HOR_SLICE_LEVELS [HOR_SLICE_LEVELS ...]]
[--skip_vert_profiles] [--verbose] [--z_chunk_size Z_CHUNK_SIZE]
[--t_chunk_size T_CHUNK_SIZE]
target reference h_resolution
options#
I/O datasets on disk#
target-Location of target simulation outputs – UM NetCDF diagnostic files. Recognizes glob patterns and walks directory trees, e.g.
(default:'./my_file_p[br]*nc'Can have multiple files, but only one glob pattern. (All files in a glob pattern should belong to the simulation).None)Location of reference simulation outputs – UM NetCDF diagnostic files. Recognizes glob patterns and walks directory trees, e.g.
(default:'./my_file_p[br]*nc'Can have multiple files, but only one glob pattern. (All files in a glob pattern should belong to the simulation).None)horizontal resolution (will use to overwrite horizontal coordinates). must apply to both reference and target. NB works for ideal simulations
(default:None)--timesTIMES-times at which to perform the analysis; in code coordinates; will find nearest available match. default (which is empty) means the full data range
(default:[])--z_rangeZ_RANGE- vertical interval to consider, in code coordinates, negative values are interpreted as take the min/max respectively (default:[-1, -1])
Plotting parameters#
--plot_show- flag to display generated plots--plot_pathPLOT_PATH- output directory, for storing generated plots (default:None)--hor_slice_levelsHOR_SLICE_LEVELS- Vertical height at which to plot horizontal slices (default:[])--skip_vert_profiles- skip vertical profiles from plotting
Dask parameters#
--z_chunk_sizeZ_CHUNK_SIZE-Size of dask array chunks in the vertical direction. Should divide the total number of levels. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)--t_chunk_sizeT_CHUNK_SIZE-Size of dask array chunks in the time direction. Should divide the total number time snapshots. Smaller size leads to smaller memory footprint, but may penalize walltime. NB:The default value has not been optimised.
(default:None)
Pre-processing#
make_UM_level_sets.py#
Create a constant level set namelist for the UM from given model top height and number of levels
um_levels [-h] output_file z_top_of_model n_z_rho
positional arguments#
output_file- output path, will create/overwrite existing file and create any missing intermediate directories (default:None)z_top_of_model- top of model a.k.a. last theta level in meters (default:None)n_z_rho- number of rho-levels, will have one more theta level (default:None)