From a783ca9ee2d50ea960ae544946e9de29721ca32c Mon Sep 17 00:00:00 2001 From: David Nortes-Martinez <davidnortes@gmail.com> Date: Sat, 22 Jan 2022 10:11:08 +0100 Subject: [PATCH] major changes to separate data extraction from data posttreatment --- geau/data-raw/so_ii_catchment.R | 57 +++++++++++++++++++++++++++++++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/geau/data-raw/so_ii_catchment.R b/geau/data-raw/so_ii_catchment.R index c5045c3..3810028 100644 --- a/geau/data-raw/so_ii_catchment.R +++ b/geau/data-raw/so_ii_catchment.R @@ -1,12 +1,65 @@ -# code to prepare `so_ii_hydro` dataset goes here +# code to prepare `so_ii_catchment` dataset goes here -#selection = c("CdOH", "TopoOH") file_dir = current_version( "data-common/so-ii/topage", pattern = "^[0-9-]+$" ) so_ii_catchment = sf::st_read(file.path(file_dir, "bassin_versant_so_ii.shp")) +# establishing levels of detail in catchments +so_ii_catchment[["degre"]] = 2 +selection_row = list( + mosson = c( + '06B0000002150456066', + '06B0000002150458403', + '06B0000002150458401', + '06B0000002150456007', + '06B0000002150455994' + ), + lez = c( + '06B0000002150456086', + '06B0000002150456009' + ), + lor = c( + '06B0000002150456068', + '06B0000002150456055', + '06B0000002150456053', + '06B0000002150461370', + '06B0000002150457044' + ) +) + +bassin_mosson = so_ii_catchment[so_ii_catchment[["id"]] %in% unlist(unname(selection_row[["mosson"]])), ] +bassin_mosson_geom = sf::st_union(bassin_mosson) +bassin_mosson_df = data.frame( + id = "soii01", + bassin = "Bassin Mosson", + degre = 1 +) +bassin_mosson = sf::st_set_geometry(bassin_mosson_df, bassin_mosson_geom) + +bassin_lez = so_ii_catchment[so_ii_catchment[["id"]] %in% unlist(unname(selection_row[["lez"]])), ] +bassin_lez_geom = sf::st_union(bassin_lez) +bassin_lez_df = data.frame( + id = "soii02", + bassin = "Bassin Lez", + degre = 1 +) +bassin_lez = sf::st_set_geometry(bassin_lez_df, bassin_lez_geom) + +bassin_lor = so_ii_catchment[so_ii_catchment[["id"]] %in% unlist(unname(selection_row[["lor"]])), ] +bassin_lor_geom = sf::st_union(bassin_lor) +bassin_lor_df = data.frame( + id = "soii03", + bassin = "Bassin L'or", + degre = 1 +) +bassin_lor = sf::st_set_geometry(bassin_lor_df, bassin_lor_geom) + +so_ii_catchment = rbind(so_ii_catchment, bassin_mosson) +so_ii_catchment = rbind(so_ii_catchment, bassin_lez) +so_ii_catchment = rbind(so_ii_catchment, bassin_lor) + # updating datasets # actual = setwd(file.path(system.file(package = "geau"), "..")) -- GitLab