derive_transport
Attributes
Functions
|
Interpolate dataset variable from 3D to 2D grid using xesmf |
|
Interpolate dataset variable from 3D to 2D grid using xesmf. |
|
P-chip interpolation on 2-D. x, y, xi, yi should be 1-D |
|
This infers the eddy trasport tensor following the approach of Bachmann et al. (2015) |
|
Flux-gradient calculation if wishing to validate the eddy-flux derivation. |
|
Kzz is hard to derive so smooth over unrealistically high diffusion. |
|
Kyy can't be negative. Put in check/correction as Plumb & Mahlman 1986 |
|
Take anti-symmetric part of eddy transport tensor to derive |
|
Calculate w* (eddy advective component) using potential temperature (not used) |
|
Ensure residual wind fields are non-divergence. |
|
Add convective parameters straight from MERRA2 met data |
|
Take monthly 2D transport and make CF compliant 3D netcdf files |
Module Contents
- derive_transport.model_trans_dir
- derive_transport.weight_folder = '/user/home/lw13938/work/TwoDmodel/weights'
- derive_transport.monthly_transport = '/user/home/lw13938/work/TwoDmodel/TransportParameters'
- derive_transport.filepath = '/user/home/lw13938/work/GCClassic.13.3.4/rundirs/Tracer_outputs/'
- derive_transport.gc_metpath = '/user/home/lw13938/shared/GEOS_CHEM/data/ExtData/GEOS_4x5/MERRA2/'
- derive_transport.interpolate_T(ds_met, var, zb3D, lon, zx2D, latx2D)
Interpolate dataset variable from 3D to 2D grid using xesmf
- Parameters:
ds_met (dataset) – xarray dataset containing variable to interpolate
var (string) – variable to interpolate
zb3D (array) – Scale height of 3D model
lon (array) – Longitude of 3D model
zx2D (array) – Scale height of 2D model
latx2D (array) – Latitude of 2D model
- Returns:
xarray DataArray of interpolated variable
- Return type:
DataArray
- derive_transport.interpolate_cflux(ds_met, var, zb3D, lon, zx2D, latx2D)
Interpolate dataset variable from 3D to 2D grid using xesmf. Basically the same as interpolate_T but need some slight modifications.
- Parameters:
ds_met (dataset) – xarray dataset containing variable to interpolate
var (string) – variable to interpolate
zb3D (array) – Scale height of 3D model
lon (array) – Longitude of 3D model
zx2D (array) – Scale height of 2D model
latx2D (array) – Latitude of 2D model
- Returns:
xarray DataArray of interpolated variable
- Return type:
DataArray
- derive_transport.pchip2(x, y, z, xi, yi)
P-chip interpolation on 2-D. x, y, xi, yi should be 1-D and z.shape == (len(x), len(y))
Taken from: https://scipy-user.scipy.narkive.com/FG5DVM1l/2-d-data-interpolation This ensures monoticity for interpolation (splines can over/undershoot)
- derive_transport.infer_eddy_agrid(dsvqt, dsvt, dswqt, dswt, y2D, ym2D)
This infers the eddy trasport tensor following the approach of Bachmann et al. (2015) Input are data arrays of v and w winds, and dataset of transport tracers all interpolated to the 2D model resolution.
- Parameters:
dsvqt (dataset) – Concentrations on same grid as v-field
dsvt (dataset) – Met data on same grid as v-field
dswqt (dataset) – Concentrations on same grid as w-field
dswt (dataset) – Met data on same grid as w-field
y2D (array) – y-coordinate at grid cell edges
ym2D (array) – y-coordinate at grid cell mid-points
- Returns:
Lists containing the eddy flux tensor and gradient flux fields
- Return type:
list
- derive_transport.validation_tracer_agrid(dsvqt, dsvt, dswqt, dswt, tn, y2D, ym2D)
Flux-gradient calculation if wishing to validate the eddy-flux derivation. Note, this is not currently used.
- Parameters:
dsvqt (dataset) – Concentrations on same grid as v-field
dsvt (dataset) – Met data on same grid as v-field
dswqt (dataset) – Concentrations on same grid as w-field
dswt (dataset) – Met data on same grid as w-field
tn (int) – Tracer number used for validation
y2D (array) – y-coordinate at grid cell edges
ym2D (array) – y-coordinate at grid cell mid-points
- Returns:
Gradient flux fields.
- Return type:
arrays
- derive_transport.smoothKzz(Kz, limit=50.0, lower=False)
Kzz is hard to derive so smooth over unrealistically high diffusion. Kzz is generally higher in the lower atmosphere. Set upper Kzz limit to 50 m2/s (Plumb and Mahlman max is around 20) as upper limit, and reset as the average of surrounding grid squares.
- Parameters:
Kz (array) – Kzz component of eddy-transport tensor
limit (float, optional) – Upper limit of Kzz. Defaults to 50.
lower (bool, optional) – True if setting a lower limit. Defaults to False.
- Returns:
Smoothed Kzz tensor component.
- Return type:
array
- derive_transport.correct_eddy(K, zm2D, z2D, ym2D, y2D)
Kyy can’t be negative. Put in check/correction as Plumb & Mahlman 1986
- Parameters:
K (list) – Eddy-transport tensor
zm2D (array) – z-coordinate mid-points in 2D model
z2D (array) – z-coordinate edges in 2D model
ym2D (array) – y-coordinate mid-points in 2D model
y2D (array) – y-coordinate edges in 2D model
- Returns:
- Corrected Eddy-transport tensor, the Kzy tensor component
interpolated to other edges, diffusivity on different grids
- Return type:
list, arrays
- derive_transport.derive_ustar(K, Kzy_ygrid, Kyz_zgrid, zm2D, ym2D)
Take anti-symmetric part of eddy transport tensor to derive residual advective transport.
- Parameters:
K (list) – Eddy-transport tensor.
Kzy_ygrid (array) – Kzy component on v-wind grid.
Kyz_zgrid (array) – Kzy component on w-wind grid.
zm2D (array) – z-coordinate mid-points in 2D model.
ym2D (array) – y-coordinate mid-points in 2D model.
- Returns:
residual v and w advection.
- Return type:
array
- derive_transport.wstar_potentialtemp(dsTwt, dsvwt, H)
Calculate w* (eddy advective component) using potential temperature (not used)
- derive_transport.make_nondivergent(w_in, v_in, cosc, cose, H, z, zm, y, dz, dy)
Ensure residual wind fields are non-divergence. This is lost through interpolation etc.
- Parameters:
w_in (array) – Divergent w-wind.
v_in (array) – Divergent v-wind.
cosc (_type_) – Cosine of latitude at grid centres.
cose (_type_) – Cosine of latitude at grid edges.
H (float) – Scale height
z (array) – z-coordinate edge points in 2D model.
zm (array) – z-coordinate mid-points in 2D model.
y (array) – y-coordinate edge points in 2D model.
dz (array) – Grid cell heights.
dy (array) – Grid cell widths.
- Returns:
Non-divergent w and v wind fields.
- Return type:
arrays
- derive_transport.add_convection(ds2d)
Add convective parameters straight from MERRA2 met data
- Parameters:
ds2d (xarray dataset) – The monthly dataset of 2D transport to which the convection will be added
- Returns:
A Data Array of the 2D monthly convective flux
- Return type:
xarray dataarray
- derive_transport.make_2D_yearly_files(start_year, end_year=None)
Take monthly 2D transport and make CF compliant 3D netcdf files
- derive_transport.month