Commit 28e2f6cd authored by patrick.lambert's avatar patrick.lambert
Browse files

with latitude in export

parent 61fbaa65
......@@ -254,40 +254,34 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
// initialise the distribution range
double southernEdge = northernLimit;
double northernEdge = southernLimit;
int southernId = -1;
int northernId = -1;
String southernName = "";
String northernName = "";
// String southernName = "";
// String northernName = "";
RiverBasin northernBasin = null;
RiverBasin southernBasin = null;
// initialise for centroid
TreeMapForCentile latitudeEffective = new TreeMapForCentile();
TreeMapForCentile latitudePresence = new TreeMapForCentile();
String[][] export = new String[2][6];
for (RiverBasin riverBasin : riverBasins) {
double meanLastRecruitment = riverBasin.getLastRecruitments().getMean();
if (meanLastRecruitment >= minimumRecruitsForPopulatedBasin) {
// the river basin is considered populated
// NOTE : recruiit number is calulated after thermal tolerance impact
// CHECK : recruiit number is calulated after thermal tolerance impact
// (which is intreaged in the stock-recruitment relationship)
// southern edge
if (riverBasin.getLatitude() < southernEdge) {
// the basin is the new southern edge
southernEdge = riverBasin.getLatitude();
southernId = riverBasin.getBasin_id();
southernName = riverBasin.getName();
southernBasin = riverBasin;
}
// northern edge
if (riverBasin.getLatitude() > northernEdge) {
// the basin is the new northern edge
northernEdge = riverBasin.getLatitude();
northernId = riverBasin.getBasin_id();
northernName = riverBasin.getName();
northernBasin = riverBasin;
}
// for distribution centroide computation
......@@ -297,29 +291,41 @@ public class AnalyseFishDistribution extends AquaNismsGroupProcess<DiadromousFis
}
}
// if the universe is empty (none of basins is populated)
if (southernEdge == northernLimit & northernEdge == southernLimit) {
southernEdge = (northernLimit + southernLimit) / 2.;
northernEdge = southernEdge;
}
// distribution centroids computation
double basinCentroid = latitudePresence.calculateMedian();
double effectiveCentroid = latitudeEffective.calculateMedian();
// export
String[][] export = new String[2][7];
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);
export[0][2] = "southern_latitude";
export[0][3] = "northern_basin_id";
export[0][4] = "northern_basin_name";
export[0][5] = "northern_latitude";
export[0][6] = "basin_centroid_latitude";
export[0][7] = "effective_centroid_latitude";
if (southernBasin != null & northernBasin != null) {
export[1][0] = String.valueOf(southernBasin.getBasin_id());
export[1][1] = southernBasin.getName();
export[1][2] = String.valueOf(southernBasin.getLatitude());
export[1][3] = String.valueOf(northernBasin.getBasin_id());
export[1][4] = northernBasin.getName();
export[1][5] = String.valueOf(northernBasin.getLatitude());
export[1][6] = String.valueOf(basinCentroid);
export[1][7] = String.valueOf(effectiveCentroid);
} else {
export[1][0] = "NA";
export[1][1] = "NA";
export[1][2] = "NA";
export[1][3] = "NA";
export[1][4] = "NA";
export[1][5] = "NA";
export[1][6] = "NA";
export[1][7] = "NA";
}
return export;
}
......
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