Skip to contents

This function generates a spatial interpolation of air temperature (or other variable) using Local Climate Zones (LCZs) and Kriging. More details: https://bymaxanjos.github.io/LCZ4r/articles/Introd_local_LCZ4r.html

Usage

lcz_interp_map(
  x,
  data_frame = "",
  var = "",
  station_id = "",
  ...,
  sp.res = 100,
  tp.res = "hour",
  vg.model = "Sph",
  by = NULL,
  impute = NULL,
  isave = FALSE,
  LCZinterp = TRUE
)

Arguments

x

A SpatRaster object containing the LCZ map. The LCZ map can be obtained using the lcz_get_map() function.

data_frame

A data frame containing air temperature measurements and station IDs. The data frame should have a date field in hourly or higher resolution format.

var

Name of the variable for interpolation, e.g. air temperature, in the dataframe.

station_id

Name of the station ID variable in the dataframe.

...

Additional arguments for the selectByDate function from the openair package. These arguments allow for flexible selection of specific time periods (year, month, day, hour). Examples of how to use these arguments include:

  • Year(s): Numeric value(s) specifying the year(s) to select. For example, year = 1998:2004 selects all years between 1998 and 2004 (inclusive), while year = c(1998, 2004) selects only the years 1998 and 2004.

  • Month(s): Numeric or character value(s) specifying the months to select. Numeric examples: month = 1:6 (January to June), or character examples: month = c("January", "December").

  • Day(s): Numeric value(s) specifying the days to select. For instance, day = 1:30 selects days from 1 to 30, or day = 15 selects only the 15th day of the month.

  • Hour(s): Numeric value(s) specifying the hours to select. For example, hour = 0:23 selects all hours in a day, while hour = 9 selects only the 9th hour.

  • Start date: A string specifying the start date in either start="DD/MM/YYYY" (e.g., "1/2/1999") or "YYYY-mm-dd" format (e.g., "1999-02-01").

  • End date: A string specifying the end date in either end="DD/MM/YYYY" (e.g., "1/2/1999") or "YYYY-mm-dd" format (e.g., "1999-02-01").

sp.res

Spatial resolution in unit of meters for interpolation. Default is 100.

tp.res

Temporal resolution, the time period to average to. Default is “hour”, but includes “day”, “week”, “month” or “year”.

vg.model

If kriging is selected, the list of viogrammodels that will be tested and interpolated with kriging. Default is "Sph". The model are "Sph", "Exp", "Gau", "Ste". They names respective shperical, exponential,gaussian,Matern familiy, Matern, M. Stein's parameterization.

by

data frame time-serie split: “year”, “season”, “seasonyear”, “month”, “monthyear”, “weekday”, “weekend”, “site”, “daylight”(daytime and nighttime).See argument type in openair package:https://bookdown.org/david_carslaw/openair/sections/intro/openair-package.html#the-type-option

impute

Method to impute missing values (“mean”, “median”, “knn”, “bag”).

isave

Save the plot into your directory.

LCZinterp

If set to TRUE (default), the LCZ interpolation approach is used. If set to FALSE, conventional interpolation without LCZ is used.

Value

A map of LCZ-air temperature in terra raster GeoTIF format

See also

See the documentation for lcz_get_map() to obtain an LCZ map.

Examples

if (FALSE) { # \dontrun{
# Daily air temperature values in September 2019 .
 my_interp <- lcz_interp_map(lcz_map, data_frame = lcz_data, var = "airT",
                               station_id = "station", tp.res = "day", sp.res= 100,
                               year = 2019, month=9)
 } # }