comparison redelacSticsInputGenerator.R @ 5:4f8d87b9c246 draft

"planemo upload for repository https://forgemia.inra.fr/redelac commit b3a95e69b8c2496ff3ec12c854404798d8bc55b1"
author siwaa
date Tue, 04 Jul 2023 16:37:44 +0000
parents e344100f3354
children bb1ac57f8545
comparison
equal deleted inserted replaced
4:af7d9ca55205 5:4f8d87b9c246
15 # Generate STICS xml files------------------------------------------------------------------------------ 15 # Generate STICS xml files------------------------------------------------------------------------------
16 16
17 # USMs file 17 # USMs file
18 usms_param <- read_params_table(file.path(workspace, USMsFile)) %>% 18 usms_param <- read_params_table(file.path(workspace, USMsFile)) %>%
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) 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)
20 gen_usms_xml(file = file.path(workspace, "usms.xml"), param_df = usms_param)
21 20
22 # Tec files 21 # Tec files
23 tec_param <- read_params_table(file.path(workspace, TecFile)) %>% 22 tec_param <- read_params_table(file.path(workspace, TecFile)) %>%
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)) 23 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) 24 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)
27 25
28 # Ini files 26 # Ini files
29 ini_param <- read_params_table(file.path(workspace, IniFile)) 27 ini_param <- read_params_table(file.path(workspace, IniFile))
30 gen_ini_xml(param_df = ini_param, out_dir = workspace) 28 gen_ini_xml(param_df = ini_param, out_dir = workspace)
31 29
33 sta_param <- read_params_table(file.path(workspace, StationFile)) 31 sta_param <- read_params_table(file.path(workspace, StationFile))
34 gen_sta_xml(param_df = sta_param, out_dir = workspace) 32 gen_sta_xml(param_df = sta_param, out_dir = workspace)
35 33
36 # Generate STICS txt files------------------------------------------------------------------------------ 34 # Generate STICS txt files------------------------------------------------------------------------------
37 # List of USMs 35 # List of USMs
38 list_usms <- SticsRFiles::get_usms_list(file = file.path(workspace,"usms.xml"))
39 36
40 ### Generate txt files into individual folders 37 ### Generate txt files into individual folders
41 38
42 # generate text files 39 for(i in 1:nrow(usms_param)) {
43 gen_usms_xml2txt(javastics = javastics_path, 40 row <- usms_param[i,]
44 workspace = workspace, 41 # do stuff with row
45 out_dir = txt_path,
46 verbose = TRUE,
47 usm = list_usms)
48 42
43 gen_usms_xml(file = file.path(workspace, "usms.xml"), param_df = row)
44
45 gen_usms_xml2txt(javastics = javastics_path,
46 workspace = workspace,
47 out_dir = txt_path,
48 verbose = TRUE)
49 }
50