Commit 93f51dda authored by patrick.lambert's avatar patrick.lambert
Browse files

export in longer (instead of wider) table

parent d76c2d2d
......@@ -241,22 +241,17 @@ public class ExportExchangesBetweenCatchments extends AquaNismsGroupProcess<Diad
public String[][] exportToR() {
int i, j;
String[][] export = new String[riverBasins.length + 1][riverBasins.length + 1];
String[][] export = new String[riverBasins.length * riverBasins.length + 1][3];
// headers
export[0][0] = "migrationBasin";
j = 1;
for (RiverBasin natalBasin : riverBasins) {
export[0][j] = natalBasin.getName();
j++;
}
export[0][1] = "natalBasin";
export[0][2] = "effective";
i = 1;
for (RiverBasin migrationBasin : riverBasins) {
export[i][0] = migrationBasin.getName();
j = 1;
for (RiverBasin natalBasin : riverBasins) {
for (RiverBasin natalBasin : riverBasins) {
// compute the mean over years
Map<Long, Double> year_effective = exchanges.get(migrationBasin).get(natalBasin);
int n = 0;
double sum = 0;
......@@ -266,10 +261,12 @@ public class ExportExchangesBetweenCatchments extends AquaNismsGroupProcess<Diad
sum += effective;
}
}
export[i][j] = String.valueOf(Math.round(10. * sum / n) / 10);
j++;
// fill in export array
export[i][0] = migrationBasin.getName();
export[i][1] = natalBasin.getName();
export[i][2] = String.valueOf(Math.round(10. * sum / n) / 10.);
i++;
}
i++;
}
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