adw_sf {adw} | R Documentation |
The irregularly-spaced data are interpolated onto regular latitude-longitude grids by weighting each station according to its distance and angle from the center of a search radius.
adw_sf(ds, extent, gridsize = 5, cdd = 1000, m = 4, nmin = 3, nmax = 10)
ds |
a input dataframe which contains the column names of lon, lat, value. |
extent |
a polygon object with class 'sf' (package 'sf'). Assume that the coordinate reference system is WGS1984 (EPSG: 4326). |
gridsize |
the grid size, i.e. the grid resolution. units: degree. |
cdd |
correlation decay distance, i.e. the maximum search radius. unit: kilometer. default value: 1000km. |
m |
is used to adjust the weighting function further, higher values of m increase the rate at which the weight decays with distance. default value 4. |
nmin |
the minimum number of observation points required to interpolate a grid within the search radius (i.e. cdd); if the number of stations within the search ridius (cdd) is less than nmin, a missing value will be generated to fill this grid. default value 3. |
nmax |
The number of nearest points within the search radius to use for interpolation. default value 10. |
a regular latitude-longitude dataframe grid (interpoled values).
Caesar, J., L. Alexander, and R. Vose, 2006: Large-scale changes in observed daily maximum and minimum temperatures: Creation and analysis of a new gridded data set. Journal of Geophysical Research, 111, https://doi.org/10.1029/2005JD006280.
set.seed(2)
dd <- data.frame(lon = runif(100, min = 110, max = 117),
lat = runif(100, min = 31, max = 37),
value = runif(100, min = -10, max = 10))
head(dd)
urlmap <- "https://geo.datav.aliyun.com/areas_v3/bound/410000.json"
hmap <- sf::read_sf(urlmap, as_tibble = FALSE) |> sf::st_make_valid() # return a 'sf' object.
grd <- adw_sf(dd, extent = hmap, gridsize = 0.5, cdd = 500)
head(grd)