| ModvegeEnvironment {growR} | R Documentation |
growR environment data
Description
Data structure that contains inputs (parameters pertaining to a site, to the vegetation, to the weather and to the management) to growR simulations.
Details
This class contains site parameters, weather and management data for one simulation run of growR on a given site over several years. Methods are provided to allow access to relevant data for a given year.
All inputs are read in from data files through the respective data classes
WeatherData, ManagementData and ModvegeParameters. These parameters
can be simultaneously specified through a config file using read_config().
Public fields
site_nameName of site to be simulated.
run_nameName of simulation run. Allows distinguishing between different simulations at the same site. Defaults to "-" for no name.
run_name_in_filenameHow the run name will be represented in an output file. If
run_nameis the default "-", indicating no name, this will be an empty string. Otherwise, it will be therun_nameprepended by and underscore_.yearsYears for which environment data (weather & management) is present.
param_fileName of supplied parameter file.
weather_fileName of supplied weather file.
management_fileName of supplied management file.
parametersA ModvegeParameters object.
weatherA WeatherData object.
managementA ManagementData object.
input_dirDirectory in which parameter, weather and management files are searched for. Defaults to 'getOption("growR.input_dir").
Methods
Public methods
Method new()
Instantiate a new ModvegeEnvironment
Usage
ModvegeEnvironment$new( site_name, run_name = "-", years = NULL, param_file = "-", weather_file = "-", management_file = "-", input_dir = NULL )
Arguments
site_namestring Name of the simulated site.
run_namestring Name of the simulation run. Used to differentiate between different simulation conditions at the same site. Defaults to "-", which indicates no specific run name.
yearsnumeric Vector of integer years to be simulated.
param_filestring Name of file that contains site and vegetation parameters. If default value
"-"is provided, it is assumed to be "SITENAME_parameters.csv".weather_filestring Analogous to param_file.
management_filestring Analogous to param_file.
input_dirstring Path to directory containing input files. Defaults to
getOption("growR.input_dir").
Method set_run_name()
Set run name and update run_name_in_filename.
Usage
ModvegeEnvironment$set_run_name(run_name)
Arguments
run_nameStr. New value of
self$run_name.
Method load_inputs()
Load simulation inputs.
Stores parameters, management and weather data from files specified in self$parameter_file, self$weather_file and self$management_file, respectively.
Usage
ModvegeEnvironment$load_inputs()
Method make_filename_for_run()
Ensure a readable filename for given run_name.
Usage
ModvegeEnvironment$make_filename_for_run(run_name)
Arguments
run_nameName of run to be converted into a filename.
Returns
A version of run_name that can be used in a filename.
Method get_environment_for_year()
Get weather and environment for given year
Convenience function to retrieve environmental and management
inputs for given year from multi-year data containers self$weather
and self$management.
Usage
ModvegeEnvironment$get_environment_for_year(year)
Arguments
yearint; year for which to extract data.
Returns
list(W, M) where W is the WeatherData and M the
ManagementData object for given year.
Method clone()
The objects of this class are cloneable with this method.
Usage
ModvegeEnvironment$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
See Also
WeatherData$get_weather_for_year(),
ManagementData$get_management_for_year()