diff run.r @ 4:a069fc43b0b1 draft

"planemo upload for repository https://forgemia.inra.fr/carboseq/record-projet-carboseq/-/tree/ed5816b24b0c91099c78cbb5bbbe835ae5c74cd7/toos/CarboSeqSimulator commit ed5816b24b0c91099c78cbb5bbbe835ae5c74cd7-dirty"
author siwaa
date Fri, 23 Aug 2024 13:19:04 +0000
parents 89c69fcbf561
children 366449cab681
line wrap: on
line diff
--- a/run.r	Fri Aug 23 10:09:37 2024 +0000
+++ b/run.r	Fri Aug 23 13:19:04 2024 +0000
@@ -7,7 +7,7 @@
     # Default values for optional parameters
 	url <- "https://coby.infosol.inrae.fr:8080/semantify/"
 	srcDir <- NULL
-	part <- "modeltoolbox_sem_sep"
+	part <- "modeltoolbox"
 	DS <- T
 	NBCores <- 1
     # Parse arguments
@@ -35,14 +35,10 @@
 	if (grepl("^--srcOut=", arg)) {
             srcOut <- sub("^--srcOut=", "", arg)
         }
-	
-	if (grepl("^--semPath=", arg)) {
-            semPath <- sub("^--semPath=", "", arg)
-        }
 
     }
     
-    list(url = url, srcDir = srcDir, part = part, DS = DS, NBCores = NBCores, srcOut = srcOut, semPath = semPath)
+    list(url = url, srcDir = srcDir, part = part, DS = DS, NBCores = NBCores, srcOut = srcOut)
 }
 
 argus <- parse_args()
@@ -53,7 +49,6 @@
 NBCores <- argus[["NBCores"]]
 
 srcOut <- argus[["srcOut"]]
-semPath <- argus[["semPath"]]
 
 if (!endsWith(srcOut, "/")) {
   srcOut <- paste0(srcOut, "/")
@@ -66,6 +61,14 @@
 # DS=TRUE
 # NBCores=10
 
+ppi <- list(
+					weatherRetrievalMethod = "service",
+		    			srcDir = srcDir,
+					doSemantify = DS,
+			 	        weatherRetrievalURL = "https://147.100.203.110/climate",
+					semantifierServiceURL = url
+	    )
+
 
 # MTB{{{
 if (part == "modeltoolbox") {
@@ -81,40 +84,19 @@
 }
 #}}}
 
-if (part == "modeltoolbox_sem_sep") {
-	DS <- F
-	print("Setting DS to F. Will semantify outside of the csoprapreprocessor functions")
-	f0 <- function(){
-		csopratools::semantify(
-			  inputDir = srcDir,
-			  outputDir = srcDir,
-			  name = "carboseq",
-			  # use = "service",
-			  URL = url,
-			  use = "java",
-			  semantifierRootPath =  semPath,
-			  extFileNames = paste0(c("crop", "soil", "units"), ".csv")
-		)
-		print("between semantify and load")
-		modeltoolbox::loadCSVs(maxCores = NBCores, cinputCalculator = "cinest", 
-		       preprocessorInputs = ppi)
-		print("between load an sim")       
-		modeltoolbox::runSims(maxCores = NBCores)
-		res <- modeltoolbox::getYearlySOCResults()
-		fileName <- "resRun.RData"
-		filePath <- file.path(srcOut, fileName)
-		save(res, file = filePath)
-	}
+# prepro{{
+if (part == "csoprapreprocessor") {
+f0 <- function(){
+	path <- this.path::this.dir()
+	print(path)
+	setwd(path)
+	setwd("../..")
+	source("src/csoprapreprocessor/src-utils.r")
+	CsopPre$Tool$sourceCodeFiles()
+	CsopPre$runPreprocessor(name = "carboseq", maxCores = NBCores, preprocessorInputs = ppi)
 }
-
-ppi <- list(
-					weatherRetrievalMethod = "service",
-		    			srcDir = srcDir,
-					doSemantify = DS,
-			 	        weatherRetrievalURL = "https://147.100.203.110/climate",
-					semantifierServiceURL = url
-	    )
-
+}
+#}}}
 
 print(url)
 print(srcDir)
@@ -122,7 +104,6 @@
 print(DS)
 print(NBCores)
 print(f0)
-
 f0()