Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
SimAquaLife
GR3D
Commits
4182c214
Commit
4182c214
authored
Mar 24, 2021
by
patrick.lambert
Browse files
with export with array of fString
parent
94e2c20b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/analysis/AnalyseFishDistribution.java
View file @
4182c214
...
...
@@ -101,20 +101,22 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
}
public
double
[][]
exportToR
()
{
public
String
[][]
exportToR
()
{
// initialise the distribution range
double
southernEdge
=
northernLimit
;
double
northernEdge
=
southernLimit
;
int
southernId
=
-
1
;
int
northernId
=
-
1
;
String
southernName
=
""
;
String
northernName
=
""
;
// String southernName = "";
// String northernName = "";
// initialise for centroid
TreeMapForCentile
latitudeEffective
=
new
TreeMapForCentile
();
TreeMapForCentile
latitudePresence
=
new
TreeMapForCentile
();
double
[][]
export
=
new
double
[
1
][
4
];
String
[][]
export
=
new
String
[
2
][
6
];
int
i
=
0
;
for
(
Entry
<
RiverBasin
,
QueueMemory
<
Double
>>
entry
:
lastSpawnerNumbersMemory
.
entrySet
())
{
...
...
@@ -129,7 +131,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// the basin is the new southern edge
southernEdge
=
entry
.
getKey
().
getLatitude
();
southernId
=
entry
.
getKey
().
getBasin_id
();
//
southernName = entry.getKey().getName();
southernName
=
entry
.
getKey
().
getName
();
}
// northern edge
...
...
@@ -137,7 +139,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// the basin is the new northern edge
northernEdge
=
entry
.
getKey
().
getLatitude
();
northernId
=
entry
.
getKey
().
getBasin_id
();
//
northernName = entry.getKey().getName();
northernName
=
entry
.
getKey
().
getName
();
}
// for distribution centroide computation
...
...
@@ -157,10 +159,19 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
double
basinCentroid
=
latitudePresence
.
calculateMedian
();
double
effectiveCentroid
=
latitudeEffective
.
calculateMedian
();
export
[
0
][
0
]
=
southernId
;
export
[
0
][
1
]
=
northernId
;
export
[
0
][
2
]
=
basinCentroid
;
export
[
0
][
3
]
=
effectiveCentroid
;
export
[
0
][
0
]
=
"southern_basin_id"
;
export
[
0
][
1
]
=
"southern_basin_name"
;
export
[
0
][
2
]
=
"northern_basin_id"
;
export
[
0
][
3
]
=
"northern_basin_name"
;
export
[
0
][
4
]
=
"basin_centroid_latitude"
;
export
[
0
][
5
]
=
"effective_centroid_latitude"
;
export
[
1
][
0
]
=
String
.
valueOf
(
southernId
);
export
[
1
][
1
]
=
southernName
;
export
[
1
][
2
]
=
String
.
valueOf
(
northernId
);
export
[
1
][
3
]
=
northernName
;
export
[
1
][
4
]
=
String
.
valueOf
(
basinCentroid
);
export
[
1
][
5
]
=
String
.
valueOf
(
effectiveCentroid
);
return
export
;
}
...
...
src/main/java/analysis/AnalyseSpawnerFeatures.java
View file @
4182c214
...
...
@@ -110,11 +110,11 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
if
(
nbAgeForMale
>
0
.)
maleAgeMemories
.
get
(
riverBasin
).
push
(
meanAgeForMale
/
nbAgeForMale
);
else
maleAgeMemories
.
get
(
riverBasin
.
getBasin_id
()
).
push
(
Double
.
NaN
);
maleAgeMemories
.
get
(
riverBasin
).
push
(
Double
.
NaN
);
if
(
nbOfSpawners
>
0
.)
primiparousMemories
.
get
(
riverBasin
.
getBasin_id
()
).
push
(
nbOfPrimiparous
/
nbOfSpawners
);
primiparousMemories
.
get
(
riverBasin
).
push
(
nbOfPrimiparous
/
nbOfSpawners
);
else
primiparousMemories
.
get
(
riverBasin
.
getBasin_id
()
).
push
(
Double
.
NaN
);
primiparousMemories
.
get
(
riverBasin
).
push
(
Double
.
NaN
);
}
}
}
...
...
@@ -124,7 +124,7 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
public
String
[][]
exportToR
()
{
int
nbBasin
=
femaleAgeMemories
.
size
();
String
[][]
result
=
new
String
[
nbBasin
+
1
][
4
];
String
[][]
result
=
new
String
[
nbBasin
+
1
][
5
];
// headers
result
[
0
][
0
]
=
"basin_id"
;
result
[
0
][
1
]
=
"basin_name"
;
...
...
src/main/java/analysis/EasyRun.java
View file @
4182c214
...
...
@@ -16,7 +16,6 @@
*/
package
analysis
;
import
java.util.Arrays
;
import
java.util.List
;
import
fr.cemagref.simaqualife.extensions.pilot.BatchRunner
;
...
...
@@ -99,23 +98,23 @@ public class EasyRun {
runSimulation
(
batchArguments
,
"tsointsoin"
,
parameterNames
,
parameterValues
);
System
.
out
.
println
(
"\nAnalyseSpawnerFeatures"
);
System
.
out
.
println
(
"basin_id, female_mean_age, male_mean_age, percent_primiparous"
);
System
.
out
.
println
(
"\n== AnalyseSpawnerFeatures =="
);
String
[][]
spawnerRunResults
=
getValuesFromAquanismGroupProcess
(
"processes.processesEachStep.8.exportToR"
);
for
(
String
[]
result
:
spawnerRunResults
)
{
System
.
out
.
println
(
Arrays
.
toString
(
result
));
for
(
String
[]
record
:
spawnerRunResults
)
{
for
(
String
value
:
record
)
System
.
out
.
print
(
value
+
"\t"
);
System
.
out
.
println
();
}
// System.out.println("\nAnalyseFishDistribution");
// System.out.println("southern_basin_id, northern_basin_id, basin_centroid_latitude,
// effective_centroid_latitude");
// double[][] distributionResults =
// getValuesFromAquanismGroupProcess("processes.processesEachStep.9.exportToR");
// for (double[] result : distributionResults) {
// System.out.println(Arrays.toString(result));
// }
System
.
out
.
println
(
"\n== AnalyseFishDistribution =="
);
String
[][]
distributionResults
=
getValuesFromAquanismGroupProcess
(
"processes.processesEachStep.9.exportToR"
);
for
(
String
[]
record
:
distributionResults
)
{
for
(
String
value
:
record
)
System
.
out
.
print
(
value
+
"\t"
);
System
.
out
.
println
();
}
System
.
out
.
println
(
"\nAnalyseLikelihoodOfPresence"
);
System
.
out
.
println
(
"\n
==
AnalyseLikelihoodOfPresence
==
"
);
System
.
out
.
println
(
getSingleValueFromAquanismGroupProcess
(
"processes.processesAtEnd.0.getLogLikelihood"
));
// List truc = getAListFromAquanismGroupProcess("processes.processesAtEnd.0.getRecords");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment