Interpolate spatial and temporal thermal anomaly using a Local Climate Zones (LCZ).
Source:R/lcz_anomaly_map.R
lcz_anomaly_map.Rd
Generates an interpolated saptiotemporal anomaly map using LCZ as background. This function applies geostatistical interpolation techniques (e.g., kriging) to estimate anomaly values (e.g., air temperature) across the study area, integrating LCZ classifications. The function allows for flexible time period selection, like hour, daytime, nighttime and so on.
Usage
lcz_anomaly_map(
x,
data_frame = "",
var = "",
station_id = "",
...,
sp.res = 100,
tp.res = "hour",
vg.model = "Sph",
extract.method = "simple",
by = NULL,
impute = NULL,
isave = FALSE,
LCZinterp = TRUE
)
Arguments
- x
A
SpatRaster
object representing the LCZ map, obtained vialcz_get_map()
functions.- data_frame
A data frame containing air temperature measurements with station metadata. The data must include a date column in hourly or higher resolution.
- var
Character. The variable to interpolate (e.g.,
"airT"
for air temperature).- station_id
Character. The column name in
data_frame
identifying weather stations.- ...
Additional arguments passed to
selectByDate
from theopenair
package for flexible time selection. Options include:Year(s):
year = 1998:2004
(selects 1998 to 2004) oryear = c(1998, 2004)
.Month(s):
month = 1:6
(January to June) ormonth = c("January", "December")
.Day(s):
day = 1:30
(days 1 to 30) orday = 15
.Hour(s):
hour = 0:23
(all hours) orhour = 9
.Start/End Date:
"YYYY-mm-dd"
format (e.g.,"1999-02-01"
).
- sp.res
Numeric. Spatial resolution in meters (default:
100
).- tp.res
Character. Temporal resolution for averaging (
"hour"
,"day"
, etc.).- vg.model
Character. Variogram model for kriging. Default is
"Sph"
(spherical). Available models:"Sph"
: Spherical model."Exp"
: Exponential model."Gau"
: Gaussian model."Ste"
: M. Stein's parameterization.
- extract.method
Character. The method used to assign LCZ classes to stations:
"simple": Assigns the LCZ based on the raster cell where the station is located. It often is used in low-density observational network.
"two.step": Filters out stations in heterogeneous LCZ areas (Daniel et al., 2017). It often is used in ultra and high-density observational network, especially in LCZ classes with multiple stations.
"bilinear": Uses bilinear interpolation to assign LCZ values.
- by
Character. Specifies how to split the time series. Options include
"year"
,"month"
,"weekday"
,"weekend"
, etc.- impute
Character. Method to impute missing values (
"mean"
,"median"
,"knn"
,"bag"
).- isave
Logical. If
TRUE
, saves the plot to the working directory.- LCZinterp
Logical. If
TRUE
(default), applies LCZ-based interpolation.
References
Anjos, M., Targino, A. C., Krecl, P., Oukawa, G. Y. & Braga, R. F. Analysis of the urban heat island under different synoptic patterns using local climate zones. Build. Environ. 185, 107268 (2020). Fenner, D., Meier, F., Bechtel, B., Otto, M. & Scherer, D. (2017). Intra and inter ‘local climate zone’ variability of air temperature as observed by crowdsourced citizen weather stations in Berlin, Germany. Meteorol. Z., 26, 525–547. http://www.gstat.org/
See also
See lcz_anomaly()
for LCZ interpolation evaluation.
Author
Max Anjos (https://github.com/ByMaxAnjos)
Examples
if (FALSE) { # \dontrun{
# Load sample data and LCZ map
data("lcz_data")
lcz_map <- lcz_get_map_generator(ID = "8576bde60bfe774e335190f2e8fdd125dd9f4299")
# Plot the LCZ map
lcz_plot_map(lcz_map)
# Perform interpolation anomalies for 2020-01-02 at 04:00h
my_interp <- lcz_anomaly_map(
lcz_map, data_frame = lcz_data, var = "airT",
station_id = "station", year = 2020, month = 1, day = 2, hour = 4,
sp.res = 100, tp.res = "hour", vg.model = "Sph",
LCZinterp = TRUE, isave = TRUE
)
# Perform interpolation for an entire day (returns a raster stack of 24 hours)
my_interp <- lcz_anomaly_map(
lcz_map, data_frame = lcz_data, var = "airT",
station_id = "station", year = 2020, month = 1, day = 2,
sp.res = 100, tp.res = "hour", vg.model = "Sph",
LCZinterp = TRUE, isave = TRUE
)
} # }