points2grid_sf {adw}R Documentation

Points were to converted grids using a local gridding method.

Description

the irregularly-spaced data of points are converted onto regular latitude-longitude grids by averaging all stations in grid-boxes.

Usage

points2grid_sf(dd, extent, gridsize = 5)

Arguments

dd

a input dataframe which contains the column names of lon, lat, value.

extent

a polygon object of simple feature (come from package 'sf'). Assume that the coordinate reference system is WGS1984 (EPSG: 4326).

gridsize

the grid size, i.e. the grid resolution. units: degree.

Value

a regular latitude-longitude dataframe grid (grid values).

References

Jones, P. D., and M. Hulme, 1996: Calculating regional climatic time series for temperature and precipitation: Methods and illustrations. Int. J. Climatol., 16, 361–377, https://doi.org/10.1002/(SICI)1097-0088(199604)16:4<361::AID-JOC53>3.0.CO;2-F.

Examples

# 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)
# # example
# hmap <- cnmap::getMap(code = 410000) |> sf::st_make_valid()
# grd <- points2grid_sf(dd, extent = hmap, gridsize = 0.5)
# head(grd)

[Package adw version 0.4.0 Index]