writeSelectionCHK: Writes a chk file containing the variables selected for...

View source: R/writeSelectionCHK.R

writeSelectionCHKR Documentation

Writes a chk file containing the variables selected for printing

Description

RSMinerve writes result files or performs plots for a selection of variables. This selection can be stored in and loaded to RSMInerve from a chk file. The function writeSelectionCHK writes such a file from a tibble.

Usage

writeSelectionCHK(filepath, data, name)

Arguments

filepath

Path to file to be written.

data

Tibble or data frame with description of variables to be written.

name

A character string for the name of the selection.

Details

The chk file is structured as shown in the following example:
<?xml version="1.0" encoding="utf-8"?>
<Selection>
<Name>New selection</Name>
<Path>Model Koksu\Source QSpring\Kichkinesay - QUp (m3/s)</Path>
<Path>Model Koksu\Comparator Comparator 1\QReference (m3/s)</Path>
<Path>Model Koksu\Comparator Comparator 1\QSimulation (m3/s)</Path>
...
The content of the Path parts is parsed from a tibble with columns Model, Object, ID and Variable. The input tibble of the example above would be:
A tibble: 94 x 3
Model Object Variable
<chr> <chr> <chr>
Model Koksu Source QSpring Kichkinesay - QUp (m3/s)
Model Koksu Comparator Comparator 1 QReference (m3/s)
Model Koksu Comparator Comparator 1 QSimulation (m3/s)
... ... ...

Value

NULL if successful.

See Also

Other RS Minerve IO: getChunkSize(), load_minerve_input_csv(), readDBCSV(), readForcingCSV(), readForcingSTR(), readRSMParameters(), readResultCSV(), readResultDST(), readSelectionCHK(), translateCSVtoDST(), writeRSMParameters()

Examples

## Not run: 
filepath <- normalizePath(file.path("test_writeSelectionCHK.chk"))
Object_IDs <- c("SOCONT 1", "SOCONT 2", "SOCONT 3")
data <- tibble::tibble(
  Model = rep("Tutorial_Model", length(Object_IDs)),
  Object = rep("SOCONT", length(Object_IDs)),
  ID = Object_IDs,
  Variable = rep("Qtot (m3/s)")
)
name <- "SOCONT Qtot"
writeSelectionCHK(filepath, data, name)

## End(Not run)

hydrosolutions/riversCentralAsia documentation built on Feb. 7, 2023, 4:50 p.m.