-
Notifications
You must be signed in to change notification settings - Fork 0
/
samplingLandStruct.oms
94 lines (84 loc) · 2.52 KB
/
samplingLandStruct.oms
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
This script launches a 3D sampling on the alpha, nF, dES space to explore the effects of land-use
strategy and spatial scale on P, N and maxFragSize/N
*/
// Import the model plugin
import _file_.modelDeclaration._
val P = Val[Double]
val N = Val[Double]
val D = Val[Double]
val Al = Val[Double]
val Ah = Val[Double]
val maxN = Val[Double]
val edge2Area = Val[Double]
val corrLen = Val[Double]
val meanES = Val[Double]
val giniES = Val[Double]
val moranI = Val[Double]
val mIstd = Val[Double]
val fertLoss = Val[Double]
val eukaryoteEnvironment = LocalEnvironment(40)
val readModelOutput =
ScalaTask("""
// read file as an array of lines and get last line
val lastLine = scala.io.Source.fromFile(output).getLines.toList.last.mkString
// split the string and store it in an array
val values = lastLine.split(" ")
val P = values(1).toDouble
val N = values(2).toDouble
val D = values(3).toDouble
val Al = values(4).toDouble
val Ah = values(5).toDouble
val maxN = values(8).toDouble
val edge2Area = values(9).toDouble
val corrLen = values(10).toDouble
val meanES = values(11).toDouble
val giniES = values(12).toDouble
val moranI = values(13).toDouble
val fertLoss = values(14).toDouble
"""
)set(
inputs+=output,
(inputs, outputs)+=(a,nF,a0),
outputs+=(P,N,D,Al,Ah,maxN,edge2Area,corrLen,meanES,giniES,moranI,fertLoss)
)
val modelRunAndRead = MoleTask(modelPluginEuka -- readModelOutput)
// val replications =
// Replication(
// evaluation = modelRunAndRead,
// seed = mySeed,
// sample = 10,
// aggregation = Seq (
// a aggregate average,
// nF aggregate average,
// a0 aggregate average,
// P aggregate average,
// N aggregate average,
// D aggregate average,
// Al aggregate average,
// Ah aggregate average,
// maxN aggregate average,
// edge2Area aggregate average,
// corrLen aggregate average,
// meanES aggregate average,
// giniES aggregate average,
// moranI aggregate average,
// moranI aggregate meanSquaredError as mIstd)
// )
val replications =
Replication(
evaluation = modelRunAndRead,
seed = mySeed,
sample = 100
)
val sampling =
DirectSampling(
evaluation = replications,
sampling =
(T is 0.0)x
(L is 40.0)x
(a in Seq(0.0,0.5,1.0) )x
(nF in LogRange(2.0,1024.0,100) )x
(a0 in Seq(0.3333) ),
)
(sampling on eukaryoteEnvironment hook (workDirectory / "experimentLandStruct-070921-5.csv") )