Mercurial > repos > siwaa > redelac_stics_g
view redelacSticsInputGenerator.R @ 0:c7d424481b03 draft
"planemo upload for repository https://forgemia.inra.fr/redelac"
author | siwaa |
---|---|
date | Wed, 07 Jun 2023 06:08:27 +0000 |
parents | |
children | e344100f3354 |
line wrap: on
line source
library(SticsRFiles) library(dplyr) workspace <- paste0(getwd(), "/WS") javastics_path <- getwd() txt_path <- paste0(getwd(), "/WS/txt_files") dir.create(txt_path,recursive = T) gen_usms_xml2txt(javastics = javastics_path, workspace = workspace, out_dir = txt_path, check = FALSE) USMsFile <- "USMs.csv" TecFile <- "Tec.csv" IniFile <- "Ini.csv" StationFile <- "Station.csv" # Generate STICS xml files------------------------------------------------------------------------------ # USMs file usms_param <- read_params_table(file.path(workspace, USMsFile)) %>% select(usm_name,datedebut,datefin,finit,nomsol,fstation,fclim1,fclim2,culturean,nbplantes,codesimul,fplt_1,ftec_1,flai_1,fplt_2,ftec_2,flai_2) gen_usms_xml(file = file.path(workspace, "usms.xml"), param_df = usms_param) # Tec files tec_param <- read_params_table(file.path(workspace, TecFile)) gen_tec_xml(param_table = tec_param, out_path = workspace) # Ini files ini_param <- read_params_table(file.path(workspace, IniFile)) gen_ini_xml(param_df = ini_param, out_dir = workspace) # Sta files sta_param <- read_params_table(file.path(workspace, StationFile)) gen_sta_xml(param_df = sta_param, out_dir = workspace) # Generate STICS txt files------------------------------------------------------------------------------ # List of USMs list_usms <- SticsRFiles::get_usms_list(file = file.path(workspace,"usms.xml")) ### Generate txt files into individual folders # generate text files gen_usms_xml2txt(javastics = javastics_path, workspace = workspace, out_dir = txt_path, verbose = TRUE, usm = list_usms, check=FALSE) #je mets l'option a FALSE car sinon j'ai soit disant des fichiers climatiques manquants du type 14050.198,14050.199,14050.2 (pas de lecture des z?ros)