EEAaq_idw_map {EEAaq} | R Documentation |
Build a spatial interpolation map based on the Inverse Distance Weighting technique.
Description
EEAaq_idw_map
recieves as input a EEAaq_taggr_df
or a EEAaq_taggr_df_sfc
class object and produces a
spatial interpolation map. Depending on the time frequency of the aggregation, multiple maps are generated, one for
each timestamp.
It may be exported as pdf, jpeg, png, gif and html.
Usage
EEAaq_idw_map(
data = NULL,
pollutant = NULL,
aggr_fun,
bounds_level = NULL,
distinct = FALSE,
gradient = TRUE,
idp = 2,
nmax = NULL,
maxdist = NULL,
dynamic = FALSE,
fill_NUTS_level = NULL,
tile = "Esri.WorldGrayCanvas",
save = NULL,
filepath = NULL,
width = 1280,
height = 720,
res = 144,
delay = 1,
verbose = TRUE
)
Arguments
data |
an object of class |
pollutant |
vector containing the pollutant for which to build the map. It must be one of the pollutants
contained in |
aggr_fun |
charachter containing the aggregation function to use for computing the interpolation. It must
be one of the statistics contained in |
bounds_level |
character containing the NUTS level or LAU for which draw internal boundaries. Admissible values are 'NUTS0', 'NUTS1', 'NUTS2', 'NUTS3', 'LAU'. |
distinct |
logic value (T or F). If |
gradient |
logic value (T or F). If |
idp |
numeric value that specify the inverse distance weighting power. For further information see
|
nmax |
numeric value; specify the number of nearest observations that should be
used for the inverse distance weighting computing, where nearest is defined in terms of the
space of the spatial locations. By default, all observations are used. For further information see
|
maxdist |
numeric value; only observations within a distance of |
dynamic |
logic value (T or F). If |
fill_NUTS_level |
character containing the NUTS level or LAU for which to aggregate the idw computing,
in order to obtain a uniform coloring inside each area at the specified level.
(For instance if |
tile |
character representing the name of the provider tile. To see the full list of the providers, run
|
save |
character representing in which extension to save the map. Allowed values are 'jpeg', 'png', 'pdf'
(if |
filepath |
a character string giving the file path. |
width , height |
the width and the height of the plot, expressed in pixels (by default |
res |
the nominal resolution in ppi which will be recorded in the bitmap file, if a positive integer
(by default |
delay |
numeric value specifying the time to show each image in seconds, when |
verbose |
logic value (T or F). If |
Details
EEAaq_idw_map
create a spatial interpolation map, based on the Inverse Distance Weighting method (Shepard 1968).
This method starts from the available georeferenced data and estimates the value of the variable in the points
where it's unknown as a weighted average of the known values, where weights are given by an inverse function of the
distance of every point from the fixed stations.
The greater the distance of a point from a station, the smaller the weight assigned to the values of the respective
station for the computing of that unknown point.
Given the sampling plan s_{i}
for i=1,...,n
, which represent the location of the air quality stations,
the pollutant concentration value Y(s_i)=Y_i
represents the value of the pollutant concentration detected
by the site s_i
and u
is the point for which the value of the concentration in unknown.
\hat{Y}(u) = \sum_{i=1}^{n} Y_i \omega_i(u),
where
\omega_i(u) = \frac{g(d(s_i,u))}{\sum_{i=1}^{n}g(d(s_i,u))}
represent the weights assigned to each location s_i
and d(s_i,u)
is the distance between u
and s_i
.
Value
cosa restituisce la funzione
Examples
data <- EEAaq_get_data(zone_name = "Milano", NUTS_level = "LAU",
pollutant = "PM10", from = 2023, to = 2023, ID = FALSE, verbose = TRUE)
#Monthly aggregation
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "monthly",
aggr_fun = c("mean", "min", "max"))
#12 maps are generated, one for each month
EEAaq_idw_map(data = t_aggr, pollutant = "PM10",
aggr_fun = "mean", distinct = TRUE,
gradient = TRUE, idp = 2,
dynamic = FALSE)
#Let's try to change the parameters fill_NUTS_level and dynamic
#Now we are going to use a dataset containing PM10 concentrations
#in Milan province (NUTS 3), during 2022
data <- EEAaq_get_data(zone_name = "Milano", NUTS_level = "NUTS3",
pollutant = "PM10", from = 2022, to = 2022)
#yearly aggregation
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "yearly",
aggr_fun = "mean")
#Let's generate one dynamic map, containing the municipalities inside the Milan province
#filled with the mean concentration value for 2022, computed via idw:
EEAaq_idw_map(data = t_aggr, pollutant = "PM10", aggr_fun = "mean",
distinct = TRUE, gradient = FALSE, dynamic = TRUE, fill_NUTS_level = "LAU")