SW2toTable: Spreadsheet-like daily output of 'SOILWAT2' simulations

SW2toTableR Documentation

Spreadsheet-like daily output of SOILWAT2 simulations

Description

The main purpose of this function is the side-effect of writing easy-to-share, daily simulation output of relevant variables to disk.

Usage

metric_SW2toTable_daily(
  path,
  name_sw2_run,
  id_scen_used,
  list_years_scen_used,
  zipped_runs = FALSE,
  out = "across_years",
  dir_out_SW2toTable = file.path("..", "Outputs"),
  format_share_SW2toTable = c("rds", "csv"),
  outputs_SW2toTable = c("all", "meteo", "snow", "radiation", "waterbalance",
    "evapotranspiration", "soiltemperature", "VWC", "SWP", "SWAat30bar", "MDD"),
  share_soillayer_ids = NULL,
  ...
)

Arguments

path

A character string. The path to the simulation project folder that contains the individual folder of each simulated site.

name_sw2_run

A character string. The name of the folder (or zip archive, see zipped_runs) of the simulated site for which metrics are to be calculated. rSOILWAT2 input and output is organized following conventions of rSFSW2, i.e., inputs for each scenario are stored in a list object named “swRunScenariosData” which is stored on disk as a file “sw_input.RData”; and output data is stored for each scenario separately in an object named “runDataSC” in a file “sw_output_scX.RData” where X is the number of the scenario.

id_scen_used

An integer vector. The numbers of scenarios for which metrics are to be calculated.

list_years_scen_used

A list of integer vectors. Each scenario in id_scen_used must have a corresponding vector of calendar years (for which the metrics) will be calculated.

zipped_runs

A logical value. Describes whether name_sw2_run is a zip archive or a regular folder.

out

A character string. Signaling whether the functions returns a time series of yearly values or an aggregate (e.g., mean) across years. One of “ts_years” or “across_years”.

dir_out_SW2toTable

A character string. The path at which output is stored on disk.

format_share_SW2toTable

A character string. The function produces output files in format of either “rds” via base::saveRDS() or “csv” via utils::write.csv().

outputs_SW2toTable

A vector of character strings. If “all”, then all implemented output variables are included.

share_soillayer_ids

A numeric vector. The indices of simulated soil layers to include in the output files. If NULL, then all simulated soil layers are included.

...

Additional arguments

Notes

This is not a metric as any of the regular metrics produced by the package.

Details

This function produces files as side-effect which utilizes a different output mechanism than the regular metrics provided by the package. To make this possible, a few hacks are required:

  • The argument out is set to “across_years” despite the fact that this function produces daily output.

  • The function returns dummy output that is processed by the regular output mechanism of the package.


DrylandEcology/rSW2metrics documentation built on May 25, 2023, 10:38 a.m.