Tools for computing the spectral kinetic energy budget of a dry, fully compressible, non-hydrostatic atmosphere on regional domains. Designed to analyze energy transfers across scales in both wavenumber and physical space. The package targets model outputs on either regular lon–lat (equiangular) or Cartesian horizontal grids, with a geometric-height vertical coordinate.
This mode computes the budget of horizontal kinetic energy (HKE) in wavenumber space using FFTs, suitable for studying spectral energy transfers across scales. The budget is formulated following Peng et al. (2015), and Wang et al.(2018) as:
-
$E_h(k)$ — isotropic spectrum of HKE at wavenumber$k$ . -
$C_{A\to h}(k)$ — conversion from available potential energy (APE) to HKE. -
$T_h(k)$ — nonlinear spectral transfer of HKE (across scales). -
$L_h(k)$ — linear spectral transfer of HKE due to Coriolis. -
$F_{\uparrow}(k)$ — net vertical flux of HKE + pressure pressure-work flux -
$\mathrm{Div}_h(k)$ — tendency from 3-D divergence processes. -
$H_h(k)$ — diabatic tendency (heating/cooling). -
$J_h(k)$ — adiabatic nonconservative tendency. -
$D_h(k)$ — diffusive/dissipative tendency (viscosity, filters).
Terms
- FFT backed chunk-friendly xarray/dask implementation (out-of-core). Fully parallel along non-horizontal spatial dimensions
- NetCDF output with CF-style metadata (horizontal coordinates replaced with wavenumber in rad/m)
This mode computes local scale-to-scale transfers at specified wavelengths based on third-order
structure functions. This code is largely based on LoSSETT
. The energy transfer from scales larger than
where,
-
J. Peng, L. Zhang, and J. Guan (2015). Applications of a Moist Nonhydrostatic Formulation of the Spectral Energy Budget to Baroclinic Waves. J. Atmos. Sci., 70(7), 2055-2073. https://doi.org/10.1175/JAS-D-14-0306.1
-
Wang, Y., L. Zhang, J. Peng, and S. Liu, 2018: Mesoscale Horizontal Kinetic Energy Spectra of a Tropical Cyclone. J. Atmos. Sci., 75, 3579–3596, https://doi.org/10.1175/JAS-D-17-0391.1.
-
J. Duchon, and R. Robert (2000). Inertial energy dissipation for weak solutions of incompressible Euler and Navier-Stokes equations. Nonlinearity, 13(1), 249. https://doi.org/10.1088/0951-7715/13/1/312
# Install package directly via git
pip install git+https://github.com/deterministic-nonperiodic/sbudget.gitInstall manually with clean environment (recommended)
# clone repository
git clone https://github.com/deterministic-nonperiodic/sbudget.git
cd sbudget
# Install clean environment
conda env create -f environment.yml
conda activate budget
# editable install
pip install -e .Quick help
sbudget --helpInspect configuration file
sbudget inspect examples/config.yamlCompute budget based on configuration file
sbudget compute examples/config.yamlInspect input file(s)
sbudget inspect examples/config.yaml \
--input-path ./data/model_output.nc \
--dims z,lat,lon \
--engine h5netcdfWrite to a different file or store type (NetCDF/Zarr)
sbudget compute examples/config.yaml \
--output-path ./out/budget.nc \
--store netcdf --overwriteSwitch to scale transfer mode in physical space and define wavelengths (meters). This mode calculates inter-scale transfers at specified wavelengths based on third-order structure functions.
sbudget compute examples/config.yaml \
--mode scale_transfer \
--scales 1000,5000,10000Perform analysis on selected levels and scales. Note, level selection is ignored in "spectral_budget" mode since continuous sampling is required for computing vertical gradients
sbudget compute examples/config.yaml --mode scale_transfer \
--levels 60e3 --scales 20e3,35e3