Generate SQL code for separate indexed NOAA GHCN tables for each feature e.g. PRCP for precipitation

gen_query_ghcn_base_sfeat(
  sfeat,
  out_qry_dir,
  out_tbl_name_pfx,
  fire_base_tbl_name
)

Arguments

sfeat

(character) : The NOAA GHCN feature to create a separate table for e.g "PRCP", "SNOW", "SNWD", "TMAX", "TMIN", "TOBS", "TAVG"

out_qry_dir

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

out_tbl_name_pfx

(character) : The default table name prefix to take. This will define prefix the name of the output table and also the output query file name. In this case a suitable default value is "ghcnd_observations"

fire_base_tbl_name

(character) : The table name for the GHCN-D observations table. In this case a suitable default value is "ghcnd_observations"

Value

(tibble) : A tibble with the query string, file path to store the query, and a check of whether the filepath exists

Examples

if (FALSE) { library("tidyverse") gen_query_ghcn_base_sfeat(sfeat = "PRCP", out_qry_dir = ".", out_tbl_name_pfx = "ghcnd_observations", fire_base_tbl_name = "ghcnd_observations") }