|
3 | 3 | import java.io.File; |
4 | 4 | import java.io.FileReader; |
5 | 5 | import java.io.IOException; |
| 6 | +import java.io.StringWriter; |
6 | 7 | import java.util.HashMap; |
7 | 8 | import java.util.LinkedList; |
8 | 9 | import java.util.List; |
@@ -45,6 +46,7 @@ public class TelemacHelper { |
45 | 46 | RES_VAR.put("BOTTOM", "B"); |
46 | 47 | RES_VAR.put("FROUDE", "F"); |
47 | 48 | RES_VAR.put("DEBIT SCALAIRE", "Q"); |
| 49 | + RES_VAR.put("SCALAR FLOWRATE", "Q"); |
48 | 50 | RES_VAR.put("DEBIT SUIVANT X", "I"); |
49 | 51 | RES_VAR.put("DEBIT SUIVANT Y", "J"); |
50 | 52 | RES_VAR.put("FROTTEMENT", "W"); |
@@ -144,9 +146,10 @@ static Map<String, double[][]> extractPOIfromRES(File res, Properties poi) throw |
144 | 146 |
|
145 | 147 | for (int vi = 0; vi < s.getVariables().length; vi++) { |
146 | 148 | String v = s.getVariables()[vi]; |
147 | | - //System.err.println("Reading " + v + " at:"); |
| 149 | + //System.err.println("> Reading " + v + " at:"); |
148 | 150 | for (String p : poi.stringPropertyNames()) { |
149 | | - //System.err.println(p); |
| 151 | + try { |
| 152 | + //System.err.println("> "+p); |
150 | 153 | if (poi.getProperty(p).contains(",") && poi.getProperty(p).contains(":")) { // so, this is a x0,y0:nx,ny:x1,y1 zone poi |
151 | 154 | String cs = poi.get(p).toString(); |
152 | 155 | String cs0 = cs.substring(0, cs.indexOf(":")); |
@@ -186,7 +189,7 @@ static Map<String, double[][]> extractPOIfromRES(File res, Properties poi) throw |
186 | 189 | } |
187 | 190 | } |
188 | 191 | dat.put(RES_VAR.get(v) + "_" + p, d); |
189 | | - dat.put(p+"_xy", xy); |
| 192 | + dat.put("xy_" + p, xy); |
190 | 193 |
|
191 | 194 | } else if (poi.getProperty(p).contains(",")) { // so, this is a x,y poi, to get containing cell results |
192 | 195 | double[] d = new double[s.getPasDeTemps().length]; |
@@ -216,6 +219,11 @@ static Map<String, double[][]> extractPOIfromRES(File res, Properties poi) throw |
216 | 219 | } |
217 | 220 | dat.put(RES_VAR.get(v) + "_" + p, new double[][]{d}); |
218 | 221 | } |
| 222 | + }catch (Exception e) { |
| 223 | + System.err.println("Failed to read " + v + " at: "+p+" :"); |
| 224 | + e.printStackTrace(); |
| 225 | + dat.put(RES_VAR.get(v) + "_" + p, new double[][]{}); |
| 226 | + } |
219 | 227 | } |
220 | 228 | } |
221 | 229 |
|
@@ -309,6 +317,7 @@ static void write(File f, String s) { |
309 | 317 | }*/ |
310 | 318 |
|
311 | 319 | static String printDoubleArray2D(double[][] d) { |
| 320 | + if (d==null || d.length==0) return null; |
312 | 321 | Object[] o = new Object[d[0].length]; |
313 | 322 | for (int i = 0; i < o.length; i++) { |
314 | 323 | Object[] oi = new Object[d.length]; |
|
0 commit comments