wrappers.interface#
Interface wrapper module to ease setting up the CSAM building blocks
Functions
|
Applies tapering to a non-quadrilateral grid cell |
|
Applies tapering to a quadrilateral grid cell |
Classes
|
Wrapper class corresponding to the First Approximation step |
|
A wrapper class for the constrained spectral approximation method |
|
Wrapper class corresponding to the Second Approximation step |
- class wrappers.interface.get_pmf(nhi, nhj, U, V, debug=False)#
A wrapper class for the constrained spectral approximation method
This class is used in the idealised experiments
- __init__(nhi, nhj, U, V, debug=False)#
Parameters#
- nhiint
number of harmonics in the first horizontal direction
- nhjint
number of harmonics in the second horizontal direction
- Ufloat
wind speed in the first horizontal direction
- Vfloat
wind speed in the second horizontal direction
- debugbool, optional
debug flag, by default False
- sappx(cell, lmbda=0.1, scale=1.0, **kwargs)#
Method to perform the constraint spectral approximation method
Parameters#
- cell
src.var.topo_cell
instance of the cell object
- lmbdafloat, optional
regulariser factor, by default 0.1
- scalefloat, optional
scales the amplitudes for debugging purposes, by default 1.0
- cell
- dfft(cell, summed=False, updt_analysis=False)#
Wrapper that performs discrete fast-Fourier transform on a quadrilateral grid cell
Parameters#
- cell
src.var.topo_cell
instance of the cell object
- summedbool, optional
toggles whether to sum the spectral components, by default False
- updt_analysisbool, optional
toggles update of the <analysis
src.var.analysis
>, by default False
Returns#
- tuple
- returns tuple containing:
- (FFT-computed spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data,list containing the range of horizontal wavenumbers \([\vec{n},\vec{m}]\))
- cell
- cg_spsp(cell, freqs, kklls, dat_2D, summed=False, updt_analysis=False, scale=1.0)#
Method to perform a coarse-graining of spectral space
Deprecated since version 0.90.0.
- recompute_rhs(cell, fobj, lmbda=0.1, **kwargs)#
Method to recompute the reconstructed physical data given a set of spectral amplitudes
Parameters#
- cell
src.var.topo_cell
instance of the cell object
- fobj
src.fourier.f_trans
instance of the Fourier transformer class
- lmbdafloat, optional
regularisation factor, by default 0.1
Returns#
- tuple
- returns tuple containing:
- (FFT-computed spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data)
- cell
- wrappers.interface.taper_quad(params, simplex_lat, simplex_lon, cell, topo)#
Applies tapering to a quadrilateral grid cell
Parameters#
- params
src.var.params
instance of the user-defined parameters class
- simplex_latlist
list of latitudinal coordinates of the vertices
- simplex_lonlist
list of longitudinal coordinates of the vertices
- cell
src.var.topo_cell
instance of a cell object
- topo
src.var.topo
orsrc.var.topo_cell
instance of an object with topography attribute
- params
- wrappers.interface.taper_nonquad(params, simplex_lat, simplex_lon, cell, topo, res_topo=None)#
Applies tapering to a non-quadrilateral grid cell
Parameters#
- params
src.var.params
instance of the user-defined parameters class
- simplex_latlist
list of latitudinal coordinates of the vertices
- simplex_lonlist
list of longitudinal coordinates of the vertices
- cell
src.var.topo_cell
instance of a cell object
- topo
src.var.topo
orsrc.var.topo_cell
instance of an object with topography attributes
- res_topoarray-like, optional
residual orography, only required in iterative refinement, by default None
- params
- class wrappers.interface.first_appx(nhi, nhj, params, topo)#
Wrapper class corresponding to the First Approximation step
Use this routine to apply tapering and to separate the first and second approximation steps
- __init__(nhi, nhj, params, topo)#
Parameters#
- nhiint
number of harmonics in the first horizontal direction
- nhjint
number of harmonics in the second horizontal direction
- params
src.var.params
instance of the user-defined parameters class
- topo
src.var.topo
orsrc.var.topo_cell
instance of an object with topography attribute
- do(simplex_lat, simplex_lon, res_topo=None)#
Do the First Approximation step
Parameters#
- simplex_latlist
list of latitudinal coordinates of the vertices
- simplex_lonlist
list of longitudinal coordinates of the vertices _description_
- res_topoarray-like, optional
residual orography, only required in iterative refinement, by default None
Returns#
- tuple
contains the data for plotting:
(src.var.topo_cell
instance,computed CSAM spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data)corresponding to
sols
inwrappers.diagnostics.diag_plotter.show()
- class wrappers.interface.second_appx(nhi, nhj, params, topo, tri)#
Wrapper class corresponding to the Second Approximation step
Use this routine to apply tapering and to separate the first and second approximation steps
- __init__(nhi, nhj, params, topo, tri)#
Parameters#
- nhiint
number of harmonics in the first horizontal direction
- nhjint
number of harmonics in the second horizontal direction
- params
src.var.params
instance of the user-defined parameters class
- topo
src.var.topo
orsrc.var.topo_cell
instance of an object with topography attribute
- tri
scipy.spatial.qhull.Delaunay
instance of the scipy Delaunay triangulation class
- do(idx, ampls_fa, res_topo=None)#
Do the Second Approximation step
Parameters#
- idxint
index of the non-quadrilateral grid cell
- ampls_faarray-like
spectral modes identified in the first approximation step
- res_topoarray-like, optional
residual orography, only required in iterative refinement, by default None
Returns#
- tuple
contains the data for plotting:
(src.var.topo_cell
instance,computed CSAM spectrum,computed idealised pseudo-momentum fluxes,the reconstructed physical data)corresponding to
sols
inwrappers.diagnostics.diag_plotter.show()
.If
params.recompute_rhs = True
, the tuple contains two lists. The first list is the contains the data above, and the second list contains the data from the recomputation over the quadrilateral domain.