This script aligns meteorology datasets in at temporal resolution for debiasing & temporal downscaling. Note: The output here is stored in memory! Note: can probably at borrow from or adapt align_data.R in Benchmarking module, but it's too much of a black box at the moment.

align.met(train.path, source.path, yrs.train = NULL, yrs.source = NULL,
  n.ens = NULL, pair.mems = FALSE, mems.train = NULL,
  seed = Sys.Date(), print.progress = FALSE)

Arguments

train.path

- path to the dataset to be used to downscale the data

source.path

- data to be bias-corrected aligned with training data (from align.met)

yrs.train

- (optional) specify a specific years to be loaded for the training data; prevents needing to load the entire dataset. If NULL, all available years will be loaded. If not null, should be a vector of numbers (so you can skip problematic years)

yrs.source

- (optional) specify a specific years to be loaded for the source data; prevents needing to load the entire dataset. If NULL, all available years will be loaded. If not null, should be a vector of numbers (so you can skip problematic years)

n.ens

- number of ensemble members to generate and save

pair.mems

- logical stating whether ensemble members should be paired in the case where ensembles are being read in in both the training and source data

mems.train

- (optional) string of ensemble identifiers that ensure the training data is read in a specific order to ensure consistent time series & proper error propagation. If null, members of the training data ensemble will be randomly selected and ordered. Specifying the ensemble members IDs (e.g. CCSM_001, CCSM_002) will ensure ensemble members are properly identified and combined.

seed

- specify seed so that random draws can be reproduced

print.progress

- if TRUE, prints progress bar

Value

2-layered list (stored in memory) containing the training and source data that are now matched in temporal resolution have the specified number of ensemble members - dat.train (training dataset) and dat.source (source data to be downscaled or bias-corrected) are both lists that contain separate data frames for time indices and all available met variables with ensemble members in columns

Details

Align meteorology datasets for debiasing

1. Assumes that both the training and source data are in *at least* daily resolution and each dataset is in a consistent temporal resolution being read from a single file (CF/Pecan format). For example, CMIP5 historical/p1000 runs where radiation drivers are in monthly resolution and temperature is in daily will need to be reconciled using one of the "met2CF" or "download" or "extract" functions 2. Default file structure: Ensembles members for a given site or set of simes are housed in a common folder with the site ID. Right now everything is based off of Christy's PalEON ensemble ID scheme where the site ID is a character string (e.g. HARVARD) followed the SOURCE data family (i.e. GCM) as a string and then the ensemble member ID as a number (e.g. 001). For example, the file path for a single daily ensemble member for PalEON is: "~/Desktop/Research/met_ensembles/data/met_ensembles/HARVARD/day/ensembles/bcc-csm1-1_004" with each year in a separate netcdf file inside of it. "bcc-csm1-1_004" is an example of an ensemnle member ID that might be used if you are specifying mems.train.

See also

Other debias - Debias & Align Meteorology Datasets into continuous time series: debias.met.regression