wrappers.diagnostics#
Diagnostic wrapper module to ease setting up the CSAM building blocks
Classes
|
Helper class for evaluation of the CSAM on a Delaunay triangulated domain. |
|
Helper class to plot CSAM-computed data |
- class wrappers.diagnostics.delaunay_metrics(params, tri, writer=None)#
Helper class for evaluation of the CSAM on a Delaunay triangulated domain.
- __init__(params, tri, writer=None)#
Parameters#
- params
src.var.params
instance of the user-defined parameter class
- tri
scipy.spatial.qhull.Delaunay
instance of the scipy Delaunay triangulation class
- writer
src.io.writer
, optional metric will be written to a HDF5 file if writer object is provided, by default None
- params
- update_quad(idx, uw_ref, uw_fa)#
Store the computed idealised pseudo-momentum fluxes on a quadrilateral grid, i.e., the reference grid.
Parameters#
- idxstr or int
index of the cell
- uw_refarray-like
2D array the size of a dense (truncated) spectral space containing the reference idealised pseudo-momentum fluxes
- uw_faarray-like
2D array the size of a dense (truncated) spectral space containing the first-approximation’s idealised pseudo-momentum fluxes
- get_rel_err(triangle_pair)#
Method to get the relative error explicitly before
wrappers.diagnostics.delaunay_metrics.end()
is called.Parameters#
- triangle_pairlist
a list containing the index pair in
int
for the Delaunay triangles corresponding to a quadrilateral grid cell
Returns#
- float
the relative error of the CSAM on the Delaunay triangles against the FFT-computed reference
- update_pair(triangle_pair, store_error=True)#
Update metric computation instance with the data from the newly computed triangle pair
Parameters#
- triangle_pairlist
a list containing the index pair in
int
for the Delaunay triangles corresponding to a quadrilateral grid cell- store_errorbool, optional
keep a list of the errors for each triangle pair, by default True. Otherwise, the errors are discarded and only the average error is stored.
- class wrappers.diagnostics.diag_plotter(params, nhi, nhj)#
Helper class to plot CSAM-computed data
- __init__(params, nhi, nhj)#
Parameters#
- params
src.var.params
instance of the user-defined parameter class
- nhiint
number of harmonics in the first horizontal direction
- nhjint
number of harmonics in the second horizontal direction
- params
- show(rect_idx, sols, kls=None, v_extent=None, dfft_plot=False, output_fig=True, fs=(14.0, 4.0), ir_args=None, fn=None, phys_lbls=None)#
Plots the data
Parameters#
- rect_idxint
index of the quadrilateral grid cell
- solstuple
- contains the data for plotting:
- (
src.var.topo_cell
instance,computed CSAM spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data)
sols
is the tuple returned bywrappers.interface.first_appx.do()
andwrappers.interface.second_appx.do()
- klslist, optional
list of size 2, each element is a vector containing the (k,l)-wavenumbers, by default None. Only required to plot FFT spectra.
- v_extentlist, optional
[z_min, z_max]
the vertical extent of the physical reconstruction, by default None- dfft_plotbool, optional
toggles whether a spectrum is the full FFT spectral space or the dense truncated CSAM spectrum, By default False, i.e. plot CSAM spectrum.
- output_figbool, optional
toggles writing figure output, by default True
- fstuple, optional
figure size, by default (14.0,4.0)
- ir_argslist, optional
- additional user-defined arguments:
- [title of the physical reconstruction panel,title of the power spectrum panel,title of the idealised pseudo-momentum flux panel,vertical extent of the power spectrum,vertical extent of the idealised pseudo-momentum flux spectrum]
By default None
- fnstr, optional
output filename, by default None
- phys_lblslist, optional
axis labels for the physical plot, by default None