Grid
Handling the grid for TMI.
TMI.linearindex — Function
function linearindex(wet)
Read and assemble the grid coordinates.Arguments
wet: 3D mask for wet points
Output
R: array of linear indices, but not a LinearIndices type
TMI.cellarea — Function
Horizontal area of grid cellTMI.cellvolume — Function
function cellvolume(γ)::Field
Volume of each grid cell.TMI.surfacepatch — Function
function surfacepatch
Make a surface boundary condition
with a rectangular patchArguments
lonbox: longitudes of box edgeslatbox: latitudes of box edgesγ: TMI.grid
Output
d: vector that describes surface patch
TMI.depthindex — Function
function depthindex(I)
Get the k-index (depth level) from the Cartesian indexTMI.lonindex — Function
function lonindex(I)
Get the i-index (lon index) from the Cartesian indexTMI.latindex — Function
function latindex(I)
Get the j-index (latitude index) from the Cartesian indexTMI.surfaceindex — Function
function surfaceindex(I)
Get the vector-index where depth level == 1 and it is ocean.TMI.northindex — Function
function northindex(I)
Get the vector index on the northern open boundaryTMI.eastindex — Function
function eastindex(I)
Get the vector index on the northern open boundaryTMI.southindex — Function
function southindex(I)
Get the vector-index on the southern open boundaryTMI.westindex — Function
function westindex(I)
Get the vector index on the western open boundaryTMI.horizontaldistance — Function
function horizontaldistance(loc,γ)Arguments
loc: 3-tuple of lon,lat,depth locationγ: TMI.grid
Output
hordist: horizontal distance to nearest tracer grid points
TMI.interpindex — Function
function interpindex(loc,γ) Weights for linear interpolation. The derivative of linear interpolation is needed in sensitivity studies. ReverseDiff.jl could find this quantity automatically. Instead we dig into the Interpolations.jl package to find the weights that are effectively the partial derivatives of the function.
Arguments
c: a temporary tracer field, would be nice to make it unnecessaryloc: (lon,lat,depth) tuple of a location of interestγ: TMI grid
Output
δ: weights on a 3D tracer field grid
TMI.shiftloc — Function
function shiftloc(loc)
sometimes loc longitudes are outside of grid due to different conventions
assumption: 360° shift is enough to get back on gridTMI.interpweights — Function
function interpweights(loc,γ) Weights for linear interpolation. The derivative of linear interpolation is needed in sensitivity studies. ReverseDiff.jl could find this quantity automatically. Instead we dig into the Interpolations.jl package to find the weights that are effectively the partial derivatives of the function.
Arguments
loc: (lon,lat,depth) tuple of a location of interestγ: TMI grid
Output
δ: weights on a 3D tracer field grid