Skip to contents

Import reach geometries into a SIC project

Usage

sic_import_reaches(
  reaches,
  import_mode = "ImportXml_UPDATE",
  cfg = loadConfig()
)

Arguments

reaches

A list of ReachTxt objects (See split_reach)

import_mode

character, importation mode of EdiSIC (See https://sic.g-eau.fr/Import-sections-in-text-format?lang=en#import-modes-2)

cfg

a config object. Configuration to use. See loadConfig for details

Value

A numeric code returned by shell

Examples

# Minor bed generation
profT <- matrix(c(2, 6, 0, 2), ncol = 2)
min_reach <- create_uniform_reach_txt(abscissas = seq(0, 10000, 100),
                                      upstream_bed_elevation = 8 + 10000 * 0.002,
                                      slope = 0.002,
                                      section_type = "L",
                                      profile = profT)

# Major bed generation
data("floodam_ead_dem")
dem <- terra::rast(floodam_ead_dem)
node_coords <- matrix(c(102550, 102550, 110000, 100000), ncol = 2)
space_step = 100
section_width = 5000
maj_reach <- dem_to_reach_txt(dem, node_coords, space_step, section_width, major_bed = TRUE)

# Merge minor and major beds and split into 2 reaches
reach <- merge(min_reach, maj_reach)
reaches <- split_reach(reach, seq(0, 10000, 5000))

if (FALSE) {
# Import with EdiSic
cfg <- cfg_tmp_project()
sic_import_reaches(reaches, cfg = cfg)
}