get_weights.W | R Documentation |
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.
get_weights.W(top, bottom, bathymetry)
top |
The shallowest depth in the depth window. |
bottom |
The deepest depth in the depth window. |
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.
An array of water layer thicknesses to match the dimensions of a NEMO-MEDUSA array.
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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.