Spacing metrics of neighbouring cells: wall length, centre distance and cell wall midpoint ratio
Source:R/cell_metrics.R
wall_metrics.RdMeasures every wall between a cell and an adjacent cell: how long it is, how far apart the two cell centres are, and how far the wall's midpoint lies from the line between the centres.
Value
Data frame with one row per wall: cell_id,
neighbor_id, wall_km, center_distance_km and
midpoint_ratio. A wall between two of the given cells appears once,
on the row of the cell given first; a wall to a cell not given appears on
the given cell's row.
Details
The centre distance is the great-circle distance between the two cell centres. Gregory et al. (2008) measure the spread of a grid's intercell distances by their coefficient of variation.
The cell wall midpoint ratio (Gregory et al. 2008, after Heikes and Randall
1995) is the distance from the wall's midpoint to the midpoint of the
great-circle arc joining the two centres, over the wall's length. It is 0
where the arc between the centres crosses the wall at its middle, as it does
between two regular hexagons; a finite-volume scheme that evaluates a flux
at the wall's midpoint is most accurate there. The wall's midpoint is the
point halfway along the wall as the grid draws it (see
cell_metrics).
References
Gregory, M. J., Kimerling, A. J., White, D. and Sahr, K. (2008). A comparison of intercell metrics on discrete global grid systems. Computers, Environment and Urban Systems 32(3), 188-203. doi:10.1016/j.compenvurbsys.2007.11.003
Heikes, R. and Randall, D. A. (1995). Numerical integration of the shallow-water equations on a twisted icosahedral grid. Part II. A detailed description of the grid and an analysis of numerical accuracy. Monthly Weather Review 123(6), 1881-1887. doi:10.1175/1520-0493(1995)123<1881:NIOTSW>2.0.CO;2
See also
cell_metrics for cell shape,
get_neighbors
Examples
g <- hex_grid(resolution = 3, aperture = 3)
w <- wall_metrics(grid = g)
sd(w$center_distance_km) / mean(w$center_distance_km)
summary(w$midpoint_ratio)
# The walls around one cell
cell <- lonlat_to_cell(16.37, 48.21, g)
wall_metrics(cell, g)