crssi_create_cmip_nf_files() creates individual trace files for CRSS from
a netcdf file containing CMIP based natural flow data.
Path to netcdf file containing the CMIP based natural inflow data. See 'Details'.
Path to the top level directory where the trace folders and input files will be created. This folder should exist before using this function.
The year to start the trace files in. Data will be trimmed to start in this year.
The final year of data the trace files will contain.
The scenario number used as an identifier in CRSS. See 'Details.'
The CRSS natural inflow file names to use for the individual traces files.
A boolean that determines whether or not the function should overwrite existing files. See 'Details'.
crssi_create_cmip_nf_files() will create individual trace files named by
oFiles argument for all traces that exist in
iFile. Individual trace
folders, e.g., trace1, trace2, traceN, are created for all traces found in
iFile should be a netcdf file that contains a variable called
naturalFlow. If it does not, then the function will error. The netcdf file
should contain a 3-dimensional array in (trace, gageNumber, time) format.
The CMIP data currently exists for 1950 - 2099. If the user specifies years
outside of this range, the function will abort. Because CRSS needs data to
start in the year that the CRSS simulations begin, this function trims the
data based on
endYear, and correctly formats the trace
files to begin in January of
startYear and end in December of
scenarioNumber is specified by the user and is saved to the slot specified
"crssio.supplyScenarioSlot" option. The following maps supply
scenario names to the scenario numbers that should be used here. (See the
CRSS model documentation for more details on the scenario number.) This
function will error if the
scenarioNumber provided is 1, 2, or 3 as these
data are not created with this function.
1 = Observed Resampled
2 = Direct Paleo Resampled
3 = Paleo-conditioned
4 = CMIP3 Downscaled GCM Projected
5 = CMIP5 Downscaled GCM Projected, BCSD downscaling, quantile mapping secondary bias correction
In addition to the scenario number, the trace number, the hydrology
increment, and the Sacramento Year Type index are created for each trace.
The names of these slots are controlled by the
"crssio.sacYTSlot" options, respectively.
The Sacramento Year Type index is stored in the netcdf file with the natural
flow files, and is created from a regression of a river gage in the
Sacramento Basin. See the CRSS documentation for more details. Finally,
a README file is created in
oFolder that provides some metadata on the
creation of the trace files.
oFiles sets the individual file names for the natural inflow locations. If
you do not use
nf_file_names(), oFiles should contain 29 strings:
one for each of the natural inflow locations, and should be specified in the
default order corresponding to the gages in
overwriteFiles allows the user to control whether existing files within the
trace folders should be overwritten (default is they are not).
iFile is invisibly returned as the main purpose of the function is to write
1 2 3 4 5 6 7 8 9 10
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.