This is a generic function that is used to determine an appropriate resolution given an area, cell spacing, or correlated length scale. It does so by extracting the appropriate length/area column and searching it for a value close to the input.
dg_closest_res(
dggs,
col,
val,
round = "nearest",
show_info = TRUE,
metric = TRUE
)
A number representing the grid resolution
A dggs object from dgconstruct()
Column in which to search for a close value. Should be: area_km, spacing_km, or cls_km.
The value to search for
What direction to search in. Must be nearest, up, or down.
Print the area, spacing, and CLS of the chosen resolution.
Whether input and output should be in metric (TRUE) or imperial (FALSE)
library(dggridR)
dggs <- dgconstruct(res=20)
res <- dg_closest_res(dggs,'area_km',1)
dggs <- dgsetres(dggs,res)
Run the code above in your browser using DataLab