Mercurial > repos > siwaa > redelac_stics_g
comparison 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 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:c7d424481b03 |
|---|---|
| 1 library(SticsRFiles) | |
| 2 library(dplyr) | |
| 3 | |
| 4 workspace <- paste0(getwd(), "/WS") | |
| 5 javastics_path <- getwd() | |
| 6 | |
| 7 txt_path <- paste0(getwd(), "/WS/txt_files") | |
| 8 dir.create(txt_path,recursive = T) | |
| 9 | |
| 10 gen_usms_xml2txt(javastics = javastics_path, | |
| 11 workspace = workspace, | |
| 12 out_dir = txt_path, | |
| 13 check = FALSE) | |
| 14 | |
| 15 USMsFile <- "USMs.csv" | |
| 16 TecFile <- "Tec.csv" | |
| 17 IniFile <- "Ini.csv" | |
| 18 StationFile <- "Station.csv" | |
| 19 | |
| 20 # Generate STICS xml files------------------------------------------------------------------------------ | |
| 21 | |
| 22 # USMs file | |
| 23 usms_param <- read_params_table(file.path(workspace, USMsFile)) %>% | |
| 24 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) | |
| 25 gen_usms_xml(file = file.path(workspace, "usms.xml"), param_df = usms_param) | |
| 26 | |
| 27 # Tec files | |
| 28 tec_param <- read_params_table(file.path(workspace, TecFile)) | |
| 29 gen_tec_xml(param_table = tec_param, out_path = workspace) | |
| 30 | |
| 31 # Ini files | |
| 32 ini_param <- read_params_table(file.path(workspace, IniFile)) | |
| 33 gen_ini_xml(param_df = ini_param, out_dir = workspace) | |
| 34 | |
| 35 # Sta files | |
| 36 sta_param <- read_params_table(file.path(workspace, StationFile)) | |
| 37 gen_sta_xml(param_df = sta_param, out_dir = workspace) | |
| 38 | |
| 39 # Generate STICS txt files------------------------------------------------------------------------------ | |
| 40 # List of USMs | |
| 41 list_usms <- SticsRFiles::get_usms_list(file = file.path(workspace,"usms.xml")) | |
| 42 | |
| 43 ### Generate txt files into individual folders | |
| 44 | |
| 45 # generate text files | |
| 46 gen_usms_xml2txt(javastics = javastics_path, | |
| 47 workspace = workspace, | |
| 48 out_dir = txt_path, | |
| 49 verbose = TRUE, | |
| 50 usm = list_usms, | |
| 51 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) | |
| 52 |
