gwr | R Documentation |
Geographically Weighted Regression
gwr(.ref, ...)
## S3 method for class 'character'
gwr(
.ref,
...,
.tar,
coordinates = smpds::CRU_coords,
res = 0.5,
xy_buffer = 1.5,
z_buffer = NA,
cpus = 1,
bandwidth = 1.06,
varid = NULL
)
## S3 method for class 'numeric'
gwr(
.ref,
...,
.tar,
coordinates = smpds::CRU_coords,
res = 0.5,
xy_buffer = 1.5,
z_buffer = NA,
cpus = 1,
bandwidth = 1.06
)
.ref |
Reference data from which the data will be interpolated (see the details section). |
... |
arguments to be passed to other functions |
.tar |
Table with geographical target data, including: |
coordinates |
Reference data set with columns for |
res |
Numeric value for the mask resolution. Default: 0.5 degrees. |
xy_buffer |
Numeric value to be used as the boundary for the search
area in the
|
z_buffer |
Numeric value to be used as the boundary for the search area
in the
|
cpus |
Number of CPUs to be used in parallel, default = 1. |
bandwidth |
bandwidth used in the weighting function, possibly
calculated by |
varid |
String with the identifier of the main variable inside the
NetCDF file pointed by |
The input reference data can be in any of the following formats:
Matrix
: this should be a 3-dimensional object with spatial
components (latitude and longitude) and a temporal component for
representing each time step to be used for the extraction of the data.
String
: this should point to a valid path on disk where the
reference NetCDF file is stored. Note that the parameter called varid
should be used to indicate the identifier of the main variable inside the
NetCDF file (e.g., "tmp"
, "pre"
, "cld"
, etc.).
Table with interpolated values from the .ref
data for each
record/row in .tar
.
This function was adapted from a code developed by Yunke Peng (yunke.peng@usys.ethz.ch) - ETH Zürich: https://github.com/yunkepeng/gwr
Peng, Y., Bloomfield, K.J. and Prentice, I.C., 2020. A theory of plant function helps to explain leaf‐trait and productivity responses to elevation. New Phytologist, 226(5), pp.1274-1284. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/nph.16447")}
## Not run:
`%>%` <- magrittr::`%>%`
data <- tibble::tibble(entity_name = "University of Reading",
latitude = 51.44140,
longitude = -0.9418,
elevation = c(61, 161, 261, 361))
smpds::gwr(.ref = "/path/to/reference-tmp.nc",
.tar = data,
varid = "tmp")
ncin <- ncdf4::nc_open("/path/to/reference-tmp.nc")
reference_data <- ncdf4::ncvar_get(ncin, varid)
ncdf4::nc_close(ncin)
reference_data %>%
smpds::gwr(.tar = data)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.