Commit 81e30271 authored by patrick.lambert's avatar patrick.lambert
Browse files

many bugs fixed

parent bcbaddf4
......@@ -372,9 +372,11 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
OffshoreBasin offshorebasin = new OffshoreBasin(basin_id, name, OffshoreBasinFunction.valueOf(function));
if (mapOffshoreBasin != null) {
if (mapOffshoreBasin.containsKey(name))
offshorebasin.getShape().append(mapInshoreBasin.get(name), true);
else {
if (mapOffshoreBasin.containsKey(name)) {
System.out.println(name);
// offshorebasin.getShape().append(mapInshoreBasin.get(name), true);
offshorebasin.setShape(mapInshoreBasin.get(name));
} else {
System.out.println(name + "does not exist in " + offshoreBasinShpFile);
System.exit(1);
}
......@@ -396,10 +398,6 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
try {
// open the file
reader = new FileReader(distanceGridFileName);
/*
* // TODO fill the distance in each basin for (Basin basin : grid) {
* basin.setNeighboursDistances(getNeighboursWithDistance(basin)); }
*/
// Parsing the file
scanner = new Scanner(reader);
......@@ -433,6 +431,46 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
e.printStackTrace();
}
// ============================================ connection between basins
try {
// open the file
reader = new FileReader(distanceGridFileName);
// Parsing the file
scanner = new Scanner(reader);
scanner.useLocale(Locale.ENGLISH); // to have a point as decimal separator !!!
scanner.useDelimiter(Pattern.compile("[;,\r\n]"));
// skip first line with headers
scanner.nextLine();
String[] connections;
RiverBasin riverBasin;
InshoreBasin inshoreBasin;
OffshoreBasin winteringBasin;
OffshoreBasin summeringBasin;
while (scanner.hasNextLine()) {
connections = scanner.nextLine().replaceAll("\"", "").split(",");
riverBasin = getRiverBasin(connections[1]);
inshoreBasin = getInshoreBasin(connections[1]);
winteringBasin = getOffshoreBasin(connections[3]);
summeringBasin = getOffshoreBasin(connections[5]);
riverBasin.setConnectedInshoreBasin(inshoreBasin);
riverBasin.setConnectedWinteringOffshoreBasin(winteringBasin);
riverBasin.setConnectedSummeringOffshoreBasin(summeringBasin);
inshoreBasin.setConnectedRiverBasin(riverBasin);
}
scanner.close();
reader.close();
} catch (Exception e) {
e.printStackTrace();
}
// ======================== create a QueueMemoryMap to keep the spawnerOrigine in each basin
List<String> basinNames = new ArrayList<String>();
for (RiverBasin basin : riverBasins) {
......@@ -516,11 +554,11 @@ public class RIOBasinNetworkWithContinent extends RIOBasinNetwork {
/**
* @return the temperatureCatchmentFile
* @return the prefix of temperaure file (scenario,climatic model)
*/
@Override
public String getTemperatureCatchmentFile() {
return null;
return (temperatureRiverFile.split("_")[0]);
}
......
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