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
}
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;
}
......
......@@ -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";
......
......@@ -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");
......
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