Determine an appropriate grid resolution based on input data.

Share:

Description

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.

Usage

1
2
dg_closest_res(dggs, col, val, round = "nearest", show_info = TRUE,
  metric = TRUE)

Arguments

dggs

A dggs object from dgconstruct()

col

Column in which to search for a close value. Should be: AreaKm, SpacingKm, or CLSKm.

val

The value to search for

round

What direction to search in. Must be nearest, up, or down.

show_info

Print the area, spacing, and CLS of the chosen resolution.

metric

Whether input and output should be in metric (TRUE) or imperial (FALSE)

Value

A number representing the grid resolution

Examples

1
2
3
4
5
6
7
## Not run: 
library(dggridR)
dggs <- dgconstruct(res=20)
res  <- dg_closest_res(dggs,'AreaKm',1)
dggs <- dgsetres(dggs,res)

## End(Not run)