comparison redelacSticsInputGenerator.R @ 3:e344100f3354 draft

"planemo upload for repository https://forgemia.inra.fr/redelac commit ff64e62033c2485113100d60c38be73e59ef119c"
author siwaa
date Thu, 29 Jun 2023 10:50:58 +0000
parents c7d424481b03
children 4f8d87b9c246
comparison
equal deleted inserted replaced
2:c60c25773642 3:e344100f3354
4 workspace <- paste0(getwd(), "/WS") 4 workspace <- paste0(getwd(), "/WS")
5 javastics_path <- getwd() 5 javastics_path <- getwd()
6 6
7 txt_path <- paste0(getwd(), "/WS/txt_files") 7 txt_path <- paste0(getwd(), "/WS/txt_files")
8 dir.create(txt_path,recursive = T) 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 9
15 USMsFile <- "USMs.csv" 10 USMsFile <- "USMs.csv"
16 TecFile <- "Tec.csv" 11 TecFile <- "Tec.csv"
17 IniFile <- "Ini.csv" 12 IniFile <- "Ini.csv"
18 StationFile <- "Station.csv" 13 StationFile <- "Station.csv"
23 usms_param <- read_params_table(file.path(workspace, USMsFile)) %>% 18 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) 19 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) 20 gen_usms_xml(file = file.path(workspace, "usms.xml"), param_df = usms_param)
26 21
27 # Tec files 22 # Tec files
28 tec_param <- read_params_table(file.path(workspace, TecFile)) 23 tec_param <- read_params_table(file.path(workspace, TecFile)) %>%
29 gen_tec_xml(param_table = tec_param, out_path = workspace) 24 select(!c(annee, date_min, date_max, Date_res_1, Date_res_2, Type_res_1, Type_res_2, Date_trav_1, Date_trav_2, Date_trav_3, Type_trav_1, Type_trav_2 ,Type_trav_3, plante_sem, date_sem, starts_with("nom_vari"), date_ferti_1, date_ferti_2, date_ferti_3, type_eng_1, type_eng_2, type_eng_3, date_rec, date_des, juleclair, nbinfloecl))
25 gen_tec_xml(param_df = tec_param, out_dir = workspace)
26 # select(!c(annee, date_min, date_max, Date_res_1, Date_res_2, Type_res_1, Type_res_2, Date_trav_1, Date_trav_2, Date_trav_3, Type_trav_1, Type_trav_2 ,Type_trav_3, plante_sem, date_sem)
30 27
31 # Ini files 28 # Ini files
32 ini_param <- read_params_table(file.path(workspace, IniFile)) 29 ini_param <- read_params_table(file.path(workspace, IniFile))
33 gen_ini_xml(param_df = ini_param, out_dir = workspace) 30 gen_ini_xml(param_df = ini_param, out_dir = workspace)
34 31
41 list_usms <- SticsRFiles::get_usms_list(file = file.path(workspace,"usms.xml")) 38 list_usms <- SticsRFiles::get_usms_list(file = file.path(workspace,"usms.xml"))
42 39
43 ### Generate txt files into individual folders 40 ### Generate txt files into individual folders
44 41
45 # generate text files 42 # generate text files
46 gen_usms_xml2txt(javastics = javastics_path, 43 gen_usms_xml2txt(javastics = javastics_path,
47 workspace = workspace, 44 workspace = workspace,
48 out_dir = txt_path, 45 out_dir = txt_path,
49 verbose = TRUE, 46 verbose = TRUE,
50 usm = list_usms, 47 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 48