Commit 4182c214 authored by patrick.lambert's avatar patrick.lambert
Browse files

with export with array of fString

parent 94e2c20b
...@@ -101,20 +101,22 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -101,20 +101,22 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
} }
public double[][] exportToR() { public String[][] exportToR() {
// initialise the distribution range // initialise the distribution range
double southernEdge = northernLimit; double southernEdge = northernLimit;
double northernEdge = southernLimit; double northernEdge = southernLimit;
int southernId = -1; int southernId = -1;
int northernId = -1; int northernId = -1;
String southernName = "";
String northernName = "";
// String southernName = ""; // String southernName = "";
// String northernName = ""; // String northernName = "";
// initialise for centroid // initialise for centroid
TreeMapForCentile latitudeEffective = new TreeMapForCentile(); TreeMapForCentile latitudeEffective = new TreeMapForCentile();
TreeMapForCentile latitudePresence = new TreeMapForCentile(); TreeMapForCentile latitudePresence = new TreeMapForCentile();
double[][] export = new double[1][4]; String[][] export = new String[2][6];
int i = 0; int i = 0;
for (Entry<RiverBasin, QueueMemory<Double>> entry : lastSpawnerNumbersMemory.entrySet()) { for (Entry<RiverBasin, QueueMemory<Double>> entry : lastSpawnerNumbersMemory.entrySet()) {
...@@ -129,7 +131,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -129,7 +131,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// the basin is the new southern edge // the basin is the new southern edge
southernEdge = entry.getKey().getLatitude(); southernEdge = entry.getKey().getLatitude();
southernId = entry.getKey().getBasin_id(); southernId = entry.getKey().getBasin_id();
// southernName = entry.getKey().getName(); southernName = entry.getKey().getName();
} }
// northern edge // northern edge
...@@ -137,7 +139,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -137,7 +139,7 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// the basin is the new northern edge // the basin is the new northern edge
northernEdge = entry.getKey().getLatitude(); northernEdge = entry.getKey().getLatitude();
northernId = entry.getKey().getBasin_id(); northernId = entry.getKey().getBasin_id();
// northernName = entry.getKey().getName(); northernName = entry.getKey().getName();
} }
// for distribution centroide computation // for distribution centroide computation
...@@ -157,10 +159,19 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis ...@@ -157,10 +159,19 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
double basinCentroid = latitudePresence.calculateMedian(); double basinCentroid = latitudePresence.calculateMedian();
double effectiveCentroid = latitudeEffective.calculateMedian(); double effectiveCentroid = latitudeEffective.calculateMedian();
export[0][0] = southernId; export[0][0] = "southern_basin_id";
export[0][1] = northernId; export[0][1] = "southern_basin_name";
export[0][2] = basinCentroid; export[0][2] = "northern_basin_id";
export[0][3] = effectiveCentroid; 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; return export;
} }
......
...@@ -110,11 +110,11 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish ...@@ -110,11 +110,11 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
if (nbAgeForMale > 0.) if (nbAgeForMale > 0.)
maleAgeMemories.get(riverBasin).push(meanAgeForMale / nbAgeForMale); maleAgeMemories.get(riverBasin).push(meanAgeForMale / nbAgeForMale);
else else
maleAgeMemories.get(riverBasin.getBasin_id()).push(Double.NaN); maleAgeMemories.get(riverBasin).push(Double.NaN);
if (nbOfSpawners > 0.) if (nbOfSpawners > 0.)
primiparousMemories.get(riverBasin.getBasin_id()).push(nbOfPrimiparous / nbOfSpawners); primiparousMemories.get(riverBasin).push(nbOfPrimiparous / nbOfSpawners);
else 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 ...@@ -124,7 +124,7 @@ public class AnalyseSpawnerFeatures extends AquaNismsGroupProcess<DiadromousFish
public String[][] exportToR() { public String[][] exportToR() {
int nbBasin = femaleAgeMemories.size(); int nbBasin = femaleAgeMemories.size();
String[][] result = new String[nbBasin + 1][4]; String[][] result = new String[nbBasin + 1][5];
// headers // headers
result[0][0] = "basin_id"; result[0][0] = "basin_id";
result[0][1] = "basin_name"; result[0][1] = "basin_name";
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
*/ */
package analysis; package analysis;
import java.util.Arrays;
import java.util.List; import java.util.List;
import fr.cemagref.simaqualife.extensions.pilot.BatchRunner; import fr.cemagref.simaqualife.extensions.pilot.BatchRunner;
...@@ -99,23 +98,23 @@ public class EasyRun { ...@@ -99,23 +98,23 @@ public class EasyRun {
runSimulation(batchArguments, "tsointsoin", parameterNames, parameterValues); runSimulation(batchArguments, "tsointsoin", parameterNames, parameterValues);
System.out.println("\nAnalyseSpawnerFeatures"); System.out.println("\n== AnalyseSpawnerFeatures ==");
System.out.println("basin_id, female_mean_age, male_mean_age, percent_primiparous");
String[][] spawnerRunResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.8.exportToR"); String[][] spawnerRunResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.8.exportToR");
for (String[] result : spawnerRunResults) { for (String[] record : spawnerRunResults) {
System.out.println(Arrays.toString(result)); for (String value : record)
System.out.print(value + "\t");
System.out.println();
} }
// System.out.println("\nAnalyseFishDistribution"); System.out.println("\n== AnalyseFishDistribution ==");
// System.out.println("southern_basin_id, northern_basin_id, basin_centroid_latitude, String[][] distributionResults = getValuesFromAquanismGroupProcess("processes.processesEachStep.9.exportToR");
// effective_centroid_latitude"); for (String[] record : distributionResults) {
// double[][] distributionResults = for (String value : record)
// getValuesFromAquanismGroupProcess("processes.processesEachStep.9.exportToR"); System.out.print(value + "\t");
// for (double[] result : distributionResults) { System.out.println();
// System.out.println(Arrays.toString(result)); }
// }
System.out.println("\nAnalyseLikelihoodOfPresence"); System.out.println("\n== AnalyseLikelihoodOfPresence ==");
System.out.println(getSingleValueFromAquanismGroupProcess("processes.processesAtEnd.0.getLogLikelihood")); System.out.println(getSingleValueFromAquanismGroupProcess("processes.processesAtEnd.0.getLogLikelihood"));
// List truc = getAListFromAquanismGroupProcess("processes.processesAtEnd.0.getRecords"); // List truc = getAListFromAquanismGroupProcess("processes.processesAtEnd.0.getRecords");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment