ModvegeEnvironment: growR environment data

ModvegeEnvironmentR 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_name

Name of site to be simulated.

run_name

Name of simulation run. Allows distinguishing between different simulations at the same site. Defaults to "-" for no name.

run_name_in_filename

How the run name will be represented in an output file. If run_name is the default "-", indicating no name, this will be an empty string. Otherwise, it will be the run_name prepended by and underscore ⁠_⁠.

years

Years for which environment data (weather & management) is present.

param_file

Name of supplied parameter file.

weather_file

Name of supplied weather file.

management_file

Name of supplied management file.

parameters

A ModvegeParameters object.

weather

A WeatherData object.

management

A ManagementData object.

input_dir

Directory 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_name

string Name of the simulated site.

run_name

string Name of the simulation run. Used to differentiate between different simulation conditions at the same site. Defaults to "-", which indicates no specific run name.

years

numeric Vector of integer years to be simulated.

param_file

string Name of file that contains site and vegetation parameters. If default value "-" is provided, it is assumed to be "SITENAME_parameters.csv".

weather_file

string Analogous to param_file.

management_file

string Analogous to param_file.

input_dir

string 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_name

Str. 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_name

Name 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
year

int; 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
deep

Whether to make a deep clone.

See Also

read_config()

WeatherData⁠$get_weather_for_year()⁠, ManagementData⁠$get_management_for_year()⁠


growR documentation built on May 29, 2024, 9:12 a.m.