set.defaults: Set default inputs for quantile mapping

Description Usage Arguments Value Directory structure Note on file structure

View source: R/various_defaults_func.R

Description

set.defaults creates a list object that stores the default input parameters for the package quantproj, to be used as an input for most other functions. It also creates the directories set as defaults (and their subdirectories used in various bits of code in this package) if they do not yet exist.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.defaults(aux.dir = paste0(getwd(), "/aux/"),
  base.data.dir = paste0(getwd(), "/base_data/"),
  mod.data.dir = paste0(getwd(), "/model_data/"), fn.suffix = character(),
  filevar = "tas", mod.name = "LENS", base.name = "ERA-INTERIM",
  lat.clip = numeric(), lon.clip = numeric(), base.year.range = c(1979,
  2010), mod.year.range = c(1979, 2099), proj.year.range = c(2011, 2099),
  q_norm = c(0.1, 0.5, 0.9), norm.x.df = c(14, 6, 3),
  base.norm.x.df = c(10, 1, 0), get.volc = F, q_bulk = c(0.1, 0.18, 0.25,
  0.35, 0.42, 0.5, 0.58, 0.65, 0.75, 0.82, 0.9), bulk.x.df = c(14, 6, 3),
  q_tail = c(0.01, 0.1, 0.25, 0.5, 0.75), tail.x.df = c(3, 1, 0),
  index.type = "resampling_rep", resampling.timescale = "year",
  bootstrapping = F, nboots = 50, block.size = 40, varnames = list(lon =
  c("lon", "longitude", "Longitude", "longitude_1"), lat = c("lat", "latitude",
  "Latititude", "latitude_1"), time = c("time"), run = c("run"), loc =
  c("global_loc", "loc", "location", "lonlat")), search.str = character())

Arguments

aux.dir

directory for auxiliary files - saved basis functions, etc.

base.data.dir

the directory with raw data to be projected

mod.data.dir

the directory with raw model ensemble data used to project

fn.suffix

optional add-on to all output filenames

filevar

variable shorthand (CMIP5 syntax, def: "tas" for near-surface air temperature)

mod.name

name of model ensemble (def: "LENS")

base.name

name of data product to be projected (def: "ERA-INTERIM")

lat.clip, lon.clip

if desired, a c(min,max) vector giving bounds for a lon/lat box; only data within this box will be loaded and processed

base.year.range

desired time frame of the "base" time period to project (def: c(1979,2010))

mod.year.range

desired time frame of the time frame to be processed (quantiles calculated) for the model ensmeble; make sure this range includes base.year.range (def: c(1979,2099))

proj.year.range

desired time frame to project to (def: c(2011,2099))

q_norm

normalizing quantiles (must be a 3 x 1 vector, i.e. c(0.1,0.5,0.9))

norm.x.df, bulk.x.df, tail.x.df

degrees of freedom for normalizing, bulk, and tail quantile regressions, in a 3 x 1 vector for c([seasonal],[long-term],[interaction])

get.volc

include a volcanic predictor in the normalization (def: FALSE)

q_bulk

bulk quantiles (must be a [n_bulk_quantiles x 1] vector, i.e. c(0.25,0.3,0.5,0.6,0.75))

q_tail

tail quantiles (must be a [n_bulk_quantiles x 1] vector, i.e. c(0.5,0.9,0.95)). These are fractions of the difference between max(q_bulk) and 0/1!

nboots

number of bootstrap runs (def: 50)

block.size

bootstrap block size (def: 40) (ACROSS RUNS - SO 20 means each bootstrap block is across 20 randomly chosen runs)

varnames

a list with each element giving the possible names for the variable with the same name as the list element. For example, the list element lat=c("lat","latitude","Latititude","latitude_1") makes it so that the latitude variable in the NetCDF files loaded through get.ncdf can be named any of those names without the code running into trouble.

search.str

a search string used to look for the source NetCDF files (def: "[filevar]_day_.*nc", with [filevar] set above)

freq

data frequency shorthand (CMIP5 syntax, def: "day" for daily)

Value

a list object containing all of the parameters listed above, to be used as an input in thd other functions in this package.

Directory structure

Generally, this package uses three main directories (though aux.dir may be the same as either of the data directories, the user is discouraged from setting the two data directories equal or using pre-existing directories, for file dependency reasons):

aux_dir

a directory containing two sub-directories, bases for saved spline basis functions (the predictors in the quantile regression), and run_logs for logging progress on the bigger scripts

base.data.dir

the directory in which to place the raw data to be projected. Contains a sub-directory, output, for the resultant projections.

mod.data.dir

the directory in which to place the model data whose distributional changes are used to project the data in base.data.dir. Contains a sub-directory, params, in which the quantile fit parameters are stored.

Note on file structure

This package assumes all files follow CMIP5 standard file naming conventions; in other words, it assumes that variable, data frequency, model name, and file year range are all encoded in the filenames themselves (see the CMIP5 syntax guide for more information). The filename format is: [variable]_[frequency]_[model]_[experiment]_[run/ensemble member]_[timeframe](_[suffix])


ks905383/quantproj documentation built on Nov. 1, 2020, 9:12 p.m.