View source: R/EEAaq_idw_map.R
EEAaq_idw_map | R Documentation |
EEAaq_idw_map
requires 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. Interpolation maps may be exported as pdf, jpeg, png, gif and html.Build a spatial interpolation map based on the Inverse Distance Weighting technique.
The function EEAaq_idw_map
requires 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. Interpolation maps may be exported as pdf, jpeg, png, gif and html.
EEAaq_idw_map(
data = NULL,
pollutant = NULL,
aggr_fun,
distinct = FALSE,
gradient = TRUE,
idp = 2,
nmax = NULL,
maxdist = NULL,
NUTS_filler = NULL,
NUTS_extborder = NULL,
NUTS_intborder = NULL,
dynamic = FALSE,
tile = "Esri.WorldGrayCanvas",
filepath = NULL,
width = 1280,
height = 720,
res = 144,
delay = 1,
save = NULL,
verbose = TRUE
)
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 |
character containing the aggregation function to use for computing the interpolation. It must
be one of the statistics contained in |
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 |
NUTS_filler |
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. Recall that the NUTS classification (Nomenclature of territorial units for statistics) is a hierarchical system for dividing up the economic territory of the EU and the UK. The levels are defined as follows:
For instance if |
NUTS_extborder |
character containing the NUTS level or LAU for which draw external boundaries. Admissible values are 'NUTS0', 'NUTS1', 'NUTS2', 'NUTS3', 'LAU'. |
NUTS_intborder |
character containing the NUTS level or LAU for which draw internal boundaries. Admissible values are 'NUTS0', 'NUTS1', 'NUTS2', 'NUTS3', 'LAU'. |
dynamic |
logic value (T or F). If |
tile |
character representing the name of the provider tile. To see the full list of the providers, run
|
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 |
save |
character representing in which extension to save the map. Allowed values are 'jpeg', 'png', 'pdf'
(if |
verbose |
logic value (T or F). If |
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
.
cosa restituisce la funzione
## Not run:
`%>%` <- dplyr::`%>%`
### Filter all the stations installed in the city (LAU) of Milano (Italy)
IDstations <- EEAaq_get_stations(byStation = FALSE, complete = FALSE)
IDstations <- IDstations %>%
dplyr::filter(LAU_NAME == "Milano") %>%
dplyr::pull(AirQualityStationEoICode) %>%
unique()
### Download NO2 measurement for the city of Milano from January 1st
### to December 31st, 2023
data <- EEAaq_get_data(IDstations = IDstations, pollutants = "NO2",
from = "2023-01-01", to = "2023-01-31",
verbose = TRUE)
### Monthly aggregation: compute station-specific monthly minimum,
### average, and maximum NO2 concentrations
t_aggr <- EEAaq_time_aggregate(data = data, frequency = "monthly",
aggr_fun = c("mean", "min", "max"))
### Static IDW interpolation of the average NO2 concentrations for the
### whole Lombardy region (NUTS_extborder = "NUTS2"). Interpolated values
### are then aggregated at the provincial level (NUTS_filler = "NUTS3")
EEAaq_idw_map(data = t_aggr, pollutant = "NO2", aggr_fun = "mean",
distinct = TRUE, gradient = FALSE,
dynamic = FALSE,
NUTS_filler = "NUTS3",
NUTS_extborder = "NUTS2")
### Dynamic IDW interpolation map (interactive leafleat) of the average
### NO2 concentrations for the whole Lombardy region
### (NUTS_extborder = "NUTS2"). Interpolated values are then aggregated
### at the municipal level (NUTS_filler = "LAU")
EEAaq_idw_map(data = t_aggr, pollutant = "NO2", aggr_fun = "mean",
distinct = TRUE, gradient = FALSE,
dynamic = TRUE,
NUTS_filler = "LAU",
NUTS_extborder = "NUTS2",
NUTS_intborder = "LAU")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.