Wrapper function to generate a single combined or separate SQL files for individual feature GHCN-D lagged aggregated time summaries mapped to individual MTBS fires by specified spatial degrees over a 180 day lag period for each fire

wrap_gen_query_fire_base_ghcnd_sfeat_180d(
  fire_base_start_date = base::as.Date("2000-01-01"),
  max_lag_fire_base_days = 180,
  spat_deg_rad = 0.5,
  summary_type = "AVG",
  sfeat_types,
  out_qry_dir,
  out_tbl_name_pfx,
  fire_base_tbl_name,
  ind_comb_qry = TRUE
)

Arguments

fire_base_start_date

(date) : The minimum date to filter MTBS fire data, we will i.e. dataset will only contain MTBS fires after this date

max_lag_fire_base_days

(integer) : The number of days for GHCN-D weather data to lag behind the fire_base_start_date

spat_deg_rad

(double) : The spatial degree radius to consider around each fire when joining weather data (default value is 0.5)

summary_type

(character) : The SQL summary function to apply to the GHCN-D weather data e.g. "AVG", "MEDIAN" (default value is "AVG")

sfeat_types

(character) : The GHCN-D features to summarize for each given fire. Aggregated and lagged versions of each feature are produced e.g. c("TOBS", "TMIN") for generating the code for 2 features

out_qry_dir

(character) : The directory to save the query. A full file path will be generated as part of the output

ind_comb_qry

(logical) : If TRUE then produces a single combined sql query for all features combined. If FALSE then produces a separate sql queries for an individual GHCN-D feature

Value

(tibble) : A single or separate SQL files for single GHCN features joined to MTBS fire_ids by specified spatial and temporal parameters

Examples

if (FALSE) { library("tidyverse") wrap_gen_query_fire_base_ghcnd_sfeat_180d(fire_base_start_date = base::as.Date("2000-01-01"), max_lag_fire_base_days = 180, spat_deg_rad = 0.5, summary_type = "AVG", sfeat_types = c("TOBS", "TMIN", "TMAX"), out_qry_dir = ".", out_tbl_name_pfx = "mtbs", fire_base_tbl_name = "mtbs_base_01", ind_comb_qry = TRUE) }