gfdlvitals.diags.m6toolbox module
A collection of useful functions…
- gfdlvitals.diags.m6toolbox.MOCpsi(vh, vmsk=None)
Sums ‘vh’ zonally and cumulatively in the vertical to yield an overturning stream function, psi(y,z).
- gfdlvitals.diags.m6toolbox.genBasinMasks(x, y, depth, verbose=False)
- gfdlvitals.diags.m6toolbox.get_z(rg, depth, var_name)
Returns 3d interface positions from netcdf group rg, based on dimension data for variable var_name
- gfdlvitals.diags.m6toolbox.ice9(i, j, source, xcyclic=True, tripolar=True)
An iterative (stack based) implementation of “Ice 9”.
The flood fill starts at [j,i] and treats any positive value of “source” as passable. Zero and negative values block flooding.
xcyclic = True allows cyclic behavior in the last index. (default) tripolar = True allows a fold across the top-most edge. (default)
Returns an array of 0’s and 1’s.
- gfdlvitals.diags.m6toolbox.ice9Wrapper(x, y, depth, xy0)
- gfdlvitals.diags.m6toolbox.maskFromDepth(depth, zCellTop)
Generates a “wet mask” for a z-coordinate model based on relative location of the ocean bottom to the upper interface of the cell.
depth (2d) is positiveo zCellTop (scalar) is a negative position of the upper interface of the cell..
- gfdlvitals.diags.m6toolbox.moc_maskedarray(vh, mask=None)
- gfdlvitals.diags.m6toolbox.nearestJI(x, y, xy0)
Find (j,i) of cell with center nearest to (x0,y0).
- gfdlvitals.diags.m6toolbox.readNCFromTar(tar, file, var)
- gfdlvitals.diags.m6toolbox.rho_Wright97(S, T, P=0)
Returns the density of seawater for the given salinity, potential temperature and pressure.
Units: salinity in PSU, potential temperature in degrees Celsius and pressure in Pascals.
- gfdlvitals.diags.m6toolbox.section2quadmesh(x, z, q, representation='pcm')
Creates the appropriate quadmesh coordinates to plot a scalar q(1:nk,1:ni) at horizontal positions x(1:ni+1) and between interfaces at z(nk+1,ni), using various representations of the topography.
Returns X(2*ni+1), Z(nk+1,2*ni+1) and Q(nk,2*ni) to be passed to pcolormesh.
TBD: Optionally, x can be dimensioned as x(ni) in which case it will be extraplated as if it had had dimensions x(ni+1).
Optional argument:
- representation=’pcm’ (default) yields a step-wise visualization, appropriate for
z-coordinate models.
- representation=’plm’ yields a piecewise-linear visualization more representative
of general-coordinate (and isopycnal) models.
- representation=’linear’ is the aesthetically most pleasing but does not
represent the data conservatively.
- gfdlvitals.diags.m6toolbox.southOf(x, y, xy0, xy1)
Returns 1 for point south/east of the line that passes through xy0-xy1, 0 otherwise.