get_weights.W: Calculate Water Layer Thicknesses Within an Array...

get_weights.WR Documentation

Calculate Water Layer Thicknesses Within an Array (Velocities)

Description

This function is a variant of 'get_weights' which applies to water velocities. Water velocities from NEMO-MEDUSA are on a different vector of depths. This function calculates the thickness of the water layer around each point in a NEMO-MEDUSA array. These thicknesses are needed to calculate weighted averages across a depth window.

Usage

get_weights.W(top, bottom, bathymetry)

Arguments

top

The shallowest depth in the depth window.

bottom

The deepest depth in the depth window.

Details

The function starts by calculating the thickness of the depth window represented by the shallowest layer in the array. This is the depth to halfway between the shallowest and the next layer, subtracting any depth to the top of the window, i.e. If the top of the window is the sea surface, the first array layer is at 5m, and the second is at 10m, the water thickness about the first point is 7.5m (mean(5, 10) - 0). The function then checks whether the depth of this layer of points is shallower than the depth to the seafloor for any of the points. For these points which exist below the seafloor, thicknesses are replaced by the depth to the seafloor, minus the depth to the top of the depth window.

The function then populates the thicknesses of the mid-layers in a for-loop, working increasingly deeper. The thickness about a point is calculated as the difference between the depth halfway to the point above, and the depth halfway to the point below. Checks and replacements are performed, as explained above, to see whether any points are now beyond the limit of the bathymetry, or approaching the 'top' or 'bottom' of the depth window. If they are, the claculations are performed again using the new max and min depths.

The thicknesses for the deepest layer of points are calculated as the depth to the seafloor minus the mid-depth of the deepest two layers.

If a weight is <= 0, it is replaced with NA as this indicates land.

Value

An array of water layer thicknesses to match the dimensions of a NEMO-MEDUSA array.

See Also

Other NEMO-MEDUSA spatial tools: calculate_depth_share(), calculate_proximity_weight(), empty(), get_weights(), netcdf_scheme_helpers, scheme_column(), scheme_interp_slice(), scheme_strathE2E(), stratify(), voronoi_grid(), xyindex_to_nindex()


Jack-H-Laverick/nemomedusR documentation built on Dec. 12, 2022, 5:21 a.m.