Mercurial > repos > siwaa > redelac_stics_a
changeset 1:8ce4e694e8f6 draft default tip
"planemo upload for repository https://forgemia.inra.fr/redelac/redelac-toolbox/-/tree/da77b35ba19889b7800e44db967c33ca6e55c39a/tools/REDELACcomputeAclim commit da77b35ba19889b7800e44db967c33ca6e55c39a-dirty"
| author | siwaa |
|---|---|
| date | Thu, 02 Jul 2026 07:35:08 +0000 |
| parents | 80842c5ecb58 |
| children | |
| files | redelacComputeAclim.R redelacComputeAclim.xml |
| diffstat | 2 files changed, 32 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/redelacComputeAclim.R Tue Feb 24 08:53:06 2026 +0000 +++ b/redelacComputeAclim.R Thu Jul 02 07:35:08 2026 +0000 @@ -1,3 +1,4 @@ + library(data.table) #version 1.14.2 library(dplyr) #version 1.0.10 library(ggplot2) @@ -14,8 +15,29 @@ png1Out = args[5] png2Out = args[6] +# sanityzing + +trimedHorizon <-str_trim(horizons) +purgedHorizon <-str_sub(trimedHorizon, 1, nchar(trimedHorizon)-1) + +listHory <- lapply(unlist(strsplit(purgedHorizon, ",")), function(x) {tmpdata <- str_split(str_trim(x), " ")[[1]]; paste0("(annee<", tmpdata[3], ")&(annee>",tmpdata[2], ")~\"", tmpdata[1], "\"" )}) + +rules <- lapply(unlist(strsplit(purgedHorizon, ",")), function(x) {tmpdata <- str_split(str_trim(x), " ")[[1]]; list (condition = paste0("(annee<", tmpdata[3], ")&(annee>",tmpdata[2], ")"), label = tmpdata[1])}) + +rules + +cases <- lapply(rules, \(r) { + expr(!!parse_expr(r$condition) ~ !!r$label) +}) + +str(cases) + +cases + liste_mailles_SAFRAN <- list.dirs(climatPath,full.names = F,recursive = F) +print(liste_mailles_SAFRAN) + #agregation des fichiers climatiques dans un unique fichier fichier_climat_tot<- NULL @@ -68,16 +90,23 @@ listHory <- lapply(unlist(strsplit(purgedHorizon, ",")), function(x) {tmpdata <- str_split(str_trim(x), " ")[[1]]; paste0("(annee<", tmpdata[3], ")&(annee>",tmpdata[2], ")~\"", tmpdata[1], "\"" )}) + + + + listHory paste(listHory, collapse = ",", sep = "") -horizonsFilter <- parse_expr(paste(listHory, collapse = ",", sep = "")) +#horizonsFilter <- parse_expr(paste(listHory, collapse = ",", sep = "")) listHory +#fichier_climat_tot <- fichier_climat_tot %>% +# mutate(horizon=case_when(!!horizonsFilter)) + fichier_climat_tot <- fichier_climat_tot %>% - mutate(horizon=case_when(!!horizonsFilter)) + mutate(horizon=case_when(!!!cases)) #fichier_climat_tot <- fichier_climat_tot %>% # mutate(horizon=case_when((annee>1990)&(annee<2025)~"ref"))
--- a/redelacComputeAclim.xml Tue Feb 24 08:53:06 2026 +0000 +++ b/redelacComputeAclim.xml Thu Jul 02 07:35:08 2026 +0000 @@ -1,4 +1,4 @@ -<tool id="redelacSticsComputeAclim" name="redelacSticsComputeAclim" version="1.0.1"> +<tool id="redelacSticsComputeAclim" name="redelacSticsComputeAclim" version="1.0.2"> <description>to compute aclim on Stics climate</description> <requirements> <container type="singularity">docker://registry.forge.inrae.fr/redelac/redelac-toolbox/sticsrpacks:5337507635242b3ad0f3559a1a6b666512ecf002
