Creates the CRSS natural flow input files used by the Colorado River Simulation System (CRSS)
1 2 3 4 5
Either the string "CoRiverNF", or the relative or absolute path
to the excel workbook. When "CoRiverNF" is used, the data from the
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.
A matrix of the file names (input into CRSS). The default uses
The start and end dates of the natural flow record to
perform ISM, if using something besides the full record. If it is
A boolean that determines whether or not the function should overwrite existing files. See 'Details'.
The start date to be listed in each trace file; should be in 2014-1-31 format
The number of years of data each file should contain. Should be no longer than the number of years in the input data.
createCRSSDNFInputFiles() create individual
trace files for the observed natural flow on the Colorado River Basin using the
Index Sequential Method.
Trace files are formated and saved in a format expected
by the Colorado River Simulation System (CRSS). Data is read from the natural
flow workbook available at http://www.usbr.gov/lc/region/g4000/NaturalFlow/current.html or
CoRiverNF data package. It is much faster to use the data package
rather than the Excel workbook. The data package is created from the Excel
file, so the files created are identical for each of the two data sets.
In addition to creating the natural flow input files, data for two informative
slots are created. These slots include the trace number and the supply scenario
number. The trace numbers are intuitive, i.e., they are integers from 1 to N
where N is the trace number. This information is saved in the slot name that
is set by the "crssio.traceNumberSlot" option. The scenario number provides
the user with a numeric representation of which supply scenario is used. The
observed historical natural flows (used by this function) are supply scenario 1.
For this supply scenario, the decimals of the supply scenario number represent
the start and end year that the ISM method are applied to. For example, if
c('1988-1','2012-12'), the decimal portion
will be 19882012, where the first 4 numbers represent the start year and
the second four numbers represent the end year. The supply scenario slot will
be set to 1.19882012 in this example. This tells the user of CRSS that the
supply scenario is the observed historical natural flows with the ISM method
applied to the 1988-2012 data. The supply scenario slot name is set
by the "crssio.supplyScenarioSlot" option.
The hydrologyIncrement data that sets the random number generator for each year and trace is created for each trace folder. The slot name that is created for the hydrologyIncrement is set by the "crssio.hydroIncrement" option.
Beginning in CRSS v2.6, input data for the Sacramento year type
index are necessary. The historical Sacramento year type data (available at
http://cdec.water.ca.gov/cgi-progs/iodir/WSIHIST) are resampled using
ISM with the same years as the historical natural flows. This function also
creates an input file for each trace that includes the Sacramento year type
index. This file name is controlled by the
crssio.sacYTSlot option and
defaults to "MWD ICS.SacWYType"
overwriteFiles allows the user to control whether existing files within the
trace folders should be overwritten (default is they are not).
Nothing is returned by the function, but it writes out many files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
## Not run: # create 107 traces of 107 years using the CoRiverNF R data package createCRSSDNFInputFiles("CoRiverNF", 'tmp','2017-1-31',107) # will create 20 years for 25 traces based on the 1988-2012 record: crssi_create_dnf_files("CoRiverNF", "tmp", startYear = 2017, endYear = 2036, recordToUse = zoo::as.yearmon(c('1988-1','2012-12')) ) # or identical using other function: createCRSSDNFInputFiles("CoRiverNF", "tmp", startDate = "2017-1-31", nYrs = 20, recordToUse = zoo::as.yearmon(c('1988-1','2012-12')) ) # path to excel file iFile <- 'user/docs/NaturalFlows1906-2012_withExtensions_1.8.15.xlsx' # will create 50 years for 107 traces based on the full (1906-2012) record: crssi_create_dnf_files(iFile, 'NFSinput/', startYear = 2015, endYear = 2064 ) # or same from other function: createCRSSDNFInputFiles(iFile,'NFSinput/','2015-1-31',50) # will create 20 years for 25 traces based on the 1988-2012 record: createCRSSDNFInputFiles(iFile, 'scratch/', '2016-1-31', 20, recordToUse = zoo::as.yearmon(('1988-1','2012-12')) ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.