Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/SedimentLoadCalculate.java @ 7502:f2d97537f48a
issue1658: Handle new Facet-Types for SedimentLoad.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 01 Nov 2013 16:29:40 +0100 |
parents | a56fe3bc6700 |
children | b8faaac71507 |
comparison
equal
deleted
inserted
replaced
7501:aab63784a80f | 7502:f2d97537f48a |
---|---|
52 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSANDBED = "facet.sediemntload.susp_sand_bed"; | 52 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSANDBED = "facet.sediemntload.susp_sand_bed"; |
53 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT = "facet.sedimentload.susp_sediment"; | 53 public static final String I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT = "facet.sedimentload.susp_sediment"; |
54 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load"; | 54 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD = "facet.sedimentload.total_load"; |
55 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total"; | 55 public static final String I18N_FACET_SEDIMENTLOAD_TOTAL = "facet.sedimentload.total"; |
56 | 56 |
57 private transient SedimentLoadAccess access; | |
58 | |
57 static { | 59 static { |
58 // Active/deactivate facets. | 60 // Active/deactivate facets. |
59 FacetActivity.Registry.getInstance().register( | 61 FacetActivity.Registry.getInstance().register( |
60 "minfo", | 62 "minfo", |
61 new FacetActivity() { | 63 new FacetActivity() { |
64 Artifact artifact, | 66 Artifact artifact, |
65 Facet facet, | 67 Facet facet, |
66 String output | 68 String output |
67 ) { | 69 ) { |
68 String name = facet.getName(); | 70 String name = facet.getName(); |
69 if (name.equals(SEDIMENT_LOAD_COARSE) || | 71 if (name.equals(SEDIMENT_LOAD_TA_COARSE) || |
70 name.equals(SEDIMENT_LOAD_FINEMIDDLE) || | 72 name.equals(SEDIMENT_LOAD_TA_FINEMIDDLE) || |
71 name.equals(SEDIMENT_LOAD_SAND) || | 73 name.equals(SEDIMENT_LOAD_TA_SAND) || |
72 name.equals(SEDIMENT_LOAD_SUSP_SAND) || | 74 name.equals(SEDIMENT_LOAD_TA_SUSP_SAND) || |
73 name.equals(SEDIMENT_LOAD_SUSP_SEDIMENT) || | 75 name.equals(SEDIMENT_LOAD_TA_SUSP_SEDIMENT) || |
74 name.equals(SEDIMENT_LOAD_SUSP_SAND_BED)){ | 76 name.equals(SEDIMENT_LOAD_TA_SUSP_SAND_BED) || |
77 name.equals(SEDIMENT_LOAD_M3A_COARSE) || | |
78 name.equals(SEDIMENT_LOAD_M3A_FINEMIDDLE) || | |
79 name.equals(SEDIMENT_LOAD_M3A_SAND) || | |
80 name.equals(SEDIMENT_LOAD_M3A_SUSP_SAND) || | |
81 name.equals(SEDIMENT_LOAD_M3A_SUSP_SEDIMENT) || | |
82 name.equals(SEDIMENT_LOAD_M3A_SUSP_SAND_BED)){ | |
75 return Boolean.FALSE; | 83 return Boolean.FALSE; |
76 } | 84 } |
77 else if (name.equals(SEDIMENT_LOAD_UNKNOWN)) { | 85 else if (name.equals(SEDIMENT_LOAD_TA_UNKNOWN) |
86 || name.equals(SEDIMENT_LOAD_M3A_UNKNOWN)) { | |
78 D4EArtifact d4e = (D4EArtifact)artifact; | 87 D4EArtifact d4e = (D4EArtifact)artifact; |
79 SedimentLoadUnknownFacet f = | 88 SedimentLoadUnknownFacet f = |
80 (SedimentLoadUnknownFacet) | 89 (SedimentLoadUnknownFacet) |
81 d4e.getNativeFacet(facet, null); | 90 d4e.getNativeFacet(facet, null); |
82 SedimentLoad load = | 91 SedimentLoad load = |
122 CallContext context, List<Facet> facets, Object old) { | 131 CallContext context, List<Facet> facets, Object old) { |
123 logger.debug("SedimentLoadCalculate.computeAdvance"); | 132 logger.debug("SedimentLoadCalculate.computeAdvance"); |
124 | 133 |
125 List<Facet> newFacets = new ArrayList<Facet>(); | 134 List<Facet> newFacets = new ArrayList<Facet>(); |
126 | 135 |
127 SedimentLoadAccess access = new SedimentLoadAccess(artifact); | 136 if (access == null) { |
137 access = new SedimentLoadAccess(artifact); | |
138 } | |
128 | 139 |
129 CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old | 140 CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old |
130 : new SedimentLoadCalculation().calculate(access); | 141 : new SedimentLoadCalculation().calculate(access); |
131 | 142 |
132 if (facets == null || res == null) { | 143 if (facets == null || res == null) { |
155 String river = access.getRiverName(); | 166 String river = access.getRiverName(); |
156 SedimentLoad[] unknown = | 167 SedimentLoad[] unknown = |
157 SedimentLoadFactory.getSedimentLoadUnknown(river, | 168 SedimentLoadFactory.getSedimentLoadUnknown(river, |
158 access.getUnit().replace("_per_","/"), type); | 169 access.getUnit().replace("_per_","/"), type); |
159 | 170 |
171 boolean isUnitTA = access.getUnit().startsWith("t"); | |
172 | |
160 if (res.getReport().hasProblems()) { | 173 if (res.getReport().hasProblems()) { |
161 newFacets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); | 174 newFacets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); |
162 } | 175 } |
163 | 176 |
164 for (int i = 0; i < unknown.length; i++) { | 177 for (int i = 0; i < unknown.length; i++) { |
165 newFacets.add(new SedimentLoadUnknownFacet( | 178 newFacets.add(new SedimentLoadUnknownFacet( |
166 i, | 179 i, |
167 SEDIMENT_LOAD_UNKNOWN, | 180 (isUnitTA)? SEDIMENT_LOAD_TA_UNKNOWN:SEDIMENT_LOAD_M3A_UNKNOWN, |
168 unknown[i].getDescription(), | 181 unknown[i].getDescription(), |
169 ComputeType.ADVANCE, | 182 ComputeType.ADVANCE, |
170 getID(), | 183 getID(), |
171 hash)); | 184 hash)); |
172 } | 185 } |
182 protected void generateYearFacets(CallContext context, List<Facet> newFacets, | 195 protected void generateYearFacets(CallContext context, List<Facet> newFacets, |
183 SedimentLoadResult[] results, String stateId, String hash) { | 196 SedimentLoadResult[] results, String stateId, String hash) { |
184 logger.debug("SedimentLoadCalculate.generateFacets"); | 197 logger.debug("SedimentLoadCalculate.generateFacets"); |
185 | 198 |
186 CallMeta meta = context.getMeta(); | 199 CallMeta meta = context.getMeta(); |
200 boolean isUnitTA = access.getUnit().startsWith("t"); | |
187 | 201 |
188 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | 202 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); |
189 for (int idx = 0; idx < results.length; idx++) { | 203 for (int idx = 0; idx < results.length; idx++) { |
190 SedimentLoadResult res = results[idx]; | 204 SedimentLoadResult res = results[idx]; |
191 if (res.hasCoarseData()) { | 205 if (res.hasCoarseData()) { |
192 newFacets.add(new SedimentLoadFacet( | 206 newFacets.add(new SedimentLoadFacet( |
193 idx, | 207 idx, |
194 SEDIMENT_LOAD_COARSE, | 208 (isUnitTA) |
209 ?SEDIMENT_LOAD_TA_COARSE | |
210 :SEDIMENT_LOAD_M3A_COARSE, | |
195 Resources.getMsg( | 211 Resources.getMsg( |
196 meta, | 212 meta, |
197 I18N_FACET_SEDIMENTLOAD_COARSE, | 213 I18N_FACET_SEDIMENTLOAD_COARSE, |
198 I18N_FACET_SEDIMENTLOAD_COARSE) + | 214 I18N_FACET_SEDIMENTLOAD_COARSE) + |
199 " - " + res.getStartYear(), | 215 " - " + res.getStartYear(), |
202 hash)); | 218 hash)); |
203 } | 219 } |
204 if (res.hasSandData()) { | 220 if (res.hasSandData()) { |
205 newFacets.add(new SedimentLoadFacet( | 221 newFacets.add(new SedimentLoadFacet( |
206 idx, | 222 idx, |
207 SEDIMENT_LOAD_SAND, | 223 (isUnitTA) |
224 ?SEDIMENT_LOAD_TA_SAND | |
225 :SEDIMENT_LOAD_M3A_SAND, | |
208 Resources.getMsg( | 226 Resources.getMsg( |
209 meta, | 227 meta, |
210 I18N_FACET_SEDIMENTLOAD_SAND, | 228 I18N_FACET_SEDIMENTLOAD_SAND, |
211 I18N_FACET_SEDIMENTLOAD_SAND) + | 229 I18N_FACET_SEDIMENTLOAD_SAND) + |
212 " - " + res.getStartYear(), | 230 " - " + res.getStartYear(), |
215 hash)); | 233 hash)); |
216 } | 234 } |
217 if (res.hasFineMiddleData()) { | 235 if (res.hasFineMiddleData()) { |
218 newFacets.add(new SedimentLoadFacet( | 236 newFacets.add(new SedimentLoadFacet( |
219 idx, | 237 idx, |
220 SEDIMENT_LOAD_FINEMIDDLE, | 238 (isUnitTA) |
239 ?SEDIMENT_LOAD_TA_FINEMIDDLE | |
240 :SEDIMENT_LOAD_M3A_FINEMIDDLE, | |
221 Resources.getMsg( | 241 Resources.getMsg( |
222 meta, | 242 meta, |
223 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, | 243 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, |
224 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + | 244 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + |
225 " - " + res.getStartYear(), | 245 " - " + res.getStartYear(), |
228 hash)); | 248 hash)); |
229 } | 249 } |
230 if (res.hasSuspSandData()) { | 250 if (res.hasSuspSandData()) { |
231 newFacets.add(new SedimentLoadFacet( | 251 newFacets.add(new SedimentLoadFacet( |
232 idx, | 252 idx, |
233 SEDIMENT_LOAD_SUSP_SAND, | 253 (isUnitTA) |
254 ?SEDIMENT_LOAD_TA_SUSP_SAND | |
255 :SEDIMENT_LOAD_M3A_SUSP_SAND, | |
234 Resources.getMsg( | 256 Resources.getMsg( |
235 meta, | 257 meta, |
236 I18N_FACET_SEDIMENTLOAD_SUSPSAND, | 258 I18N_FACET_SEDIMENTLOAD_SUSPSAND, |
237 I18N_FACET_SEDIMENTLOAD_SUSPSAND) | 259 I18N_FACET_SEDIMENTLOAD_SUSPSAND) |
238 + " - " + res.getStartYear(), | 260 + " - " + res.getStartYear(), |
241 hash)); | 263 hash)); |
242 } | 264 } |
243 if (res.hasSuspSandBedData()) { | 265 if (res.hasSuspSandBedData()) { |
244 newFacets.add(new SedimentLoadFacet( | 266 newFacets.add(new SedimentLoadFacet( |
245 idx, | 267 idx, |
246 SEDIMENT_LOAD_SUSP_SAND_BED, | 268 (isUnitTA) |
269 ?SEDIMENT_LOAD_TA_SUSP_SAND_BED | |
270 :SEDIMENT_LOAD_M3A_SUSP_SAND_BED, | |
247 Resources.getMsg( | 271 Resources.getMsg( |
248 meta, | 272 meta, |
249 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, | 273 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, |
250 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + | 274 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + |
251 " - " + res.getStartYear(), | 275 " - " + res.getStartYear(), |
254 hash)); | 278 hash)); |
255 } | 279 } |
256 if (res.hasSuspSedimentData()) { | 280 if (res.hasSuspSedimentData()) { |
257 newFacets.add(new SedimentLoadFacet( | 281 newFacets.add(new SedimentLoadFacet( |
258 idx, | 282 idx, |
259 SEDIMENT_LOAD_SUSP_SEDIMENT, | 283 (isUnitTA) |
284 ?SEDIMENT_LOAD_TA_SUSP_SEDIMENT | |
285 :SEDIMENT_LOAD_M3A_SUSP_SEDIMENT, | |
260 Resources.getMsg( | 286 Resources.getMsg( |
261 meta, | 287 meta, |
262 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, | 288 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, |
263 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + | 289 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + |
264 " - " + res.getStartYear(), | 290 " - " + res.getStartYear(), |
268 | 294 |
269 } | 295 } |
270 if (res.hasTotalData()) { | 296 if (res.hasTotalData()) { |
271 newFacets.add(new SedimentLoadFacet( | 297 newFacets.add(new SedimentLoadFacet( |
272 idx, | 298 idx, |
273 SEDIMENT_LOAD_TOTAL, | 299 (isUnitTA) |
300 ?SEDIMENT_LOAD_TA_TOTAL | |
301 :SEDIMENT_LOAD_M3A_TOTAL, | |
274 Resources.getMsg( | 302 Resources.getMsg( |
275 meta, | 303 meta, |
276 I18N_FACET_SEDIMENTLOAD_TOTAL, | 304 I18N_FACET_SEDIMENTLOAD_TOTAL, |
277 I18N_FACET_SEDIMENTLOAD_TOTAL) + | 305 I18N_FACET_SEDIMENTLOAD_TOTAL) + |
278 " - " + res.getStartYear(), | 306 " - " + res.getStartYear(), |
291 String hash | 319 String hash |
292 ) { | 320 ) { |
293 logger.debug("SedimentLoadCalculate.generateEpochFacets"); | 321 logger.debug("SedimentLoadCalculate.generateEpochFacets"); |
294 | 322 |
295 CallMeta meta = context.getMeta(); | 323 CallMeta meta = context.getMeta(); |
324 boolean isUnitTA = access.getUnit().startsWith("t"); | |
296 | 325 |
297 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | 326 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); |
298 for (int idx = 0; idx < results.length; idx++) { | 327 for (int idx = 0; idx < results.length; idx++) { |
299 SedimentLoadResult res = results[idx]; | 328 SedimentLoadResult res = results[idx]; |
300 if (res.hasCoarseData()) { | 329 if (res.hasCoarseData()) { |
301 newFacets.add(new SedimentLoadFacet( | 330 newFacets.add(new SedimentLoadFacet( |
302 idx, | 331 idx, |
303 SEDIMENT_LOAD_COARSE, | 332 (isUnitTA) |
333 ?SEDIMENT_LOAD_TA_COARSE | |
334 :SEDIMENT_LOAD_M3A_COARSE, | |
304 Resources.getMsg( | 335 Resources.getMsg( |
305 meta, | 336 meta, |
306 I18N_FACET_SEDIMENTLOAD_COARSE, | 337 I18N_FACET_SEDIMENTLOAD_COARSE, |
307 I18N_FACET_SEDIMENTLOAD_COARSE) + | 338 I18N_FACET_SEDIMENTLOAD_COARSE) + |
308 " - " + res.getStartYear() + "-" + res.getEndYear(), | 339 " - " + res.getStartYear() + "-" + res.getEndYear(), |
311 hash)); | 342 hash)); |
312 } | 343 } |
313 if (res.hasSandData()) { | 344 if (res.hasSandData()) { |
314 newFacets.add(new SedimentLoadFacet( | 345 newFacets.add(new SedimentLoadFacet( |
315 idx, | 346 idx, |
316 SEDIMENT_LOAD_SAND, | 347 (isUnitTA) |
348 ?SEDIMENT_LOAD_TA_SAND | |
349 :SEDIMENT_LOAD_M3A_SAND, | |
317 Resources.getMsg( | 350 Resources.getMsg( |
318 meta, | 351 meta, |
319 I18N_FACET_SEDIMENTLOAD_SAND, | 352 I18N_FACET_SEDIMENTLOAD_SAND, |
320 I18N_FACET_SEDIMENTLOAD_SAND) + | 353 I18N_FACET_SEDIMENTLOAD_SAND) + |
321 " - " + res.getStartYear() + "-" + res.getEndYear(), | 354 " - " + res.getStartYear() + "-" + res.getEndYear(), |
324 hash)); | 357 hash)); |
325 } | 358 } |
326 if (res.hasFineMiddleData()) { | 359 if (res.hasFineMiddleData()) { |
327 newFacets.add(new SedimentLoadFacet( | 360 newFacets.add(new SedimentLoadFacet( |
328 idx, | 361 idx, |
329 SEDIMENT_LOAD_FINEMIDDLE, | 362 (isUnitTA) |
363 ?SEDIMENT_LOAD_TA_FINEMIDDLE | |
364 :SEDIMENT_LOAD_M3A_FINEMIDDLE, | |
330 Resources.getMsg( | 365 Resources.getMsg( |
331 meta, | 366 meta, |
332 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, | 367 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, |
333 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + | 368 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + |
334 " - " + res.getStartYear(), | 369 " - " + res.getStartYear(), |
337 hash)); | 372 hash)); |
338 } | 373 } |
339 if (res.hasSuspSandData()) { | 374 if (res.hasSuspSandData()) { |
340 newFacets.add(new SedimentLoadFacet( | 375 newFacets.add(new SedimentLoadFacet( |
341 idx, | 376 idx, |
342 SEDIMENT_LOAD_SUSP_SAND, | 377 (isUnitTA) |
378 ?SEDIMENT_LOAD_TA_SUSP_SAND | |
379 :SEDIMENT_LOAD_M3A_SUSP_SAND, | |
343 Resources.getMsg( | 380 Resources.getMsg( |
344 meta, | 381 meta, |
345 I18N_FACET_SEDIMENTLOAD_SUSPSAND, | 382 I18N_FACET_SEDIMENTLOAD_SUSPSAND, |
346 I18N_FACET_SEDIMENTLOAD_SUSPSAND) | 383 I18N_FACET_SEDIMENTLOAD_SUSPSAND) |
347 + " - " + res.getStartYear() + "-" + res.getEndYear(), | 384 + " - " + res.getStartYear() + "-" + res.getEndYear(), |
350 hash)); | 387 hash)); |
351 } | 388 } |
352 if (res.hasSuspSandBedData()) { | 389 if (res.hasSuspSandBedData()) { |
353 newFacets.add(new SedimentLoadFacet( | 390 newFacets.add(new SedimentLoadFacet( |
354 idx, | 391 idx, |
355 SEDIMENT_LOAD_SUSP_SAND_BED, | 392 (isUnitTA) |
393 ?SEDIMENT_LOAD_TA_SUSP_SAND_BED | |
394 :SEDIMENT_LOAD_M3A_SUSP_SAND, | |
356 Resources.getMsg( | 395 Resources.getMsg( |
357 meta, | 396 meta, |
358 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, | 397 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, |
359 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + | 398 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + |
360 " - " + res.getStartYear() + "-" + res.getEndYear(), | 399 " - " + res.getStartYear() + "-" + res.getEndYear(), |
363 hash)); | 402 hash)); |
364 } | 403 } |
365 if (res.hasSuspSedimentData()) { | 404 if (res.hasSuspSedimentData()) { |
366 newFacets.add(new SedimentLoadFacet( | 405 newFacets.add(new SedimentLoadFacet( |
367 idx, | 406 idx, |
368 SEDIMENT_LOAD_SUSP_SEDIMENT, | 407 (isUnitTA) |
408 ?SEDIMENT_LOAD_TA_SUSP_SEDIMENT | |
409 :SEDIMENT_LOAD_M3A_SUSP_SEDIMENT, | |
369 Resources.getMsg( | 410 Resources.getMsg( |
370 meta, | 411 meta, |
371 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, | 412 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, |
372 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + | 413 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + |
373 " - " + res.getStartYear() + "-" + res.getEndYear(), | 414 " - " + res.getStartYear() + "-" + res.getEndYear(), |
377 | 418 |
378 } | 419 } |
379 if (res.hasTotalLoadData()) { | 420 if (res.hasTotalLoadData()) { |
380 newFacets.add(new SedimentLoadFacet( | 421 newFacets.add(new SedimentLoadFacet( |
381 idx, | 422 idx, |
382 SEDIMENT_LOAD_TOTAL_LOAD, | 423 (isUnitTA) |
424 ?SEDIMENT_LOAD_TA_TOTAL_LOAD | |
425 :SEDIMENT_LOAD_M3A_TOTAL_LOAD, | |
383 Resources.getMsg( | 426 Resources.getMsg( |
384 meta, | 427 meta, |
385 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD, | 428 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD, |
386 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD) + | 429 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD) + |
387 " - " + res.getStartYear() + "-" + res.getEndYear(), | 430 " - " + res.getStartYear() + "-" + res.getEndYear(), |
390 hash)); | 433 hash)); |
391 } | 434 } |
392 if (res.hasTotalData()) { | 435 if (res.hasTotalData()) { |
393 newFacets.add(new SedimentLoadFacet( | 436 newFacets.add(new SedimentLoadFacet( |
394 idx, | 437 idx, |
395 SEDIMENT_LOAD_TOTAL, | 438 (isUnitTA) |
439 ?SEDIMENT_LOAD_TA_TOTAL | |
440 :SEDIMENT_LOAD_M3A_TOTAL, | |
396 Resources.getMsg( | 441 Resources.getMsg( |
397 meta, | 442 meta, |
398 I18N_FACET_SEDIMENTLOAD_TOTAL, | 443 I18N_FACET_SEDIMENTLOAD_TOTAL, |
399 I18N_FACET_SEDIMENTLOAD_TOTAL) + | 444 I18N_FACET_SEDIMENTLOAD_TOTAL) + |
400 " - " + res.getStartYear() + "-" + res.getEndYear(), | 445 " - " + res.getStartYear() + "-" + res.getEndYear(), |
413 String hash | 458 String hash |
414 ) { | 459 ) { |
415 logger.debug("SedimentLoadCalculate.generateOffEpochFacets"); | 460 logger.debug("SedimentLoadCalculate.generateOffEpochFacets"); |
416 | 461 |
417 CallMeta meta = context.getMeta(); | 462 CallMeta meta = context.getMeta(); |
463 boolean isUnitTA = access.getUnit().startsWith("t"); | |
418 | 464 |
419 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | 465 // newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); |
420 for (int idx = 0; idx < results.length; idx++) { | 466 for (int idx = 0; idx < results.length; idx++) { |
421 SedimentLoadResult res = results[idx]; | 467 SedimentLoadResult res = results[idx]; |
422 if (res.hasCoarseData()) { | 468 if (res.hasCoarseData()) { |
423 newFacets.add(new SedimentLoadFacet( | 469 newFacets.add(new SedimentLoadFacet( |
424 idx, | 470 idx, |
425 SEDIMENT_LOAD_COARSE, | 471 (isUnitTA) |
472 ?SEDIMENT_LOAD_TA_COARSE | |
473 :SEDIMENT_LOAD_M3A_COARSE, | |
426 Resources.getMsg( | 474 Resources.getMsg( |
427 meta, | 475 meta, |
428 I18N_FACET_SEDIMENTLOAD_COARSE, | 476 I18N_FACET_SEDIMENTLOAD_COARSE, |
429 I18N_FACET_SEDIMENTLOAD_COARSE) + | 477 I18N_FACET_SEDIMENTLOAD_COARSE) + |
430 " - " + res.getStartYear() + "-" + res.getEndYear(), | 478 " - " + res.getStartYear() + "-" + res.getEndYear(), |
433 hash)); | 481 hash)); |
434 } | 482 } |
435 if (res.hasSandData()) { | 483 if (res.hasSandData()) { |
436 newFacets.add(new SedimentLoadFacet( | 484 newFacets.add(new SedimentLoadFacet( |
437 idx, | 485 idx, |
438 SEDIMENT_LOAD_SAND, | 486 (isUnitTA) |
487 ?SEDIMENT_LOAD_TA_SAND | |
488 :SEDIMENT_LOAD_M3A_SAND, | |
439 Resources.getMsg( | 489 Resources.getMsg( |
440 meta, | 490 meta, |
441 I18N_FACET_SEDIMENTLOAD_SAND, | 491 I18N_FACET_SEDIMENTLOAD_SAND, |
442 I18N_FACET_SEDIMENTLOAD_SAND) + | 492 I18N_FACET_SEDIMENTLOAD_SAND) + |
443 " - " + res.getStartYear() + "-" + res.getEndYear(), | 493 " - " + res.getStartYear() + "-" + res.getEndYear(), |
446 hash)); | 496 hash)); |
447 } | 497 } |
448 if (res.hasFineMiddleData()) { | 498 if (res.hasFineMiddleData()) { |
449 newFacets.add(new SedimentLoadFacet( | 499 newFacets.add(new SedimentLoadFacet( |
450 idx, | 500 idx, |
451 SEDIMENT_LOAD_FINEMIDDLE, | 501 (isUnitTA) |
502 ?SEDIMENT_LOAD_TA_FINEMIDDLE | |
503 :SEDIMENT_LOAD_M3A_FINEMIDDLE, | |
452 Resources.getMsg( | 504 Resources.getMsg( |
453 meta, | 505 meta, |
454 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, | 506 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE, |
455 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + | 507 I18N_FACET_SEDIMENTLOAD_FINE_MIDDLE) + |
456 " - " + res.getStartYear() + "-" + res.getEndYear(), | 508 " - " + res.getStartYear() + "-" + res.getEndYear(), |
459 hash)); | 511 hash)); |
460 } | 512 } |
461 if (res.hasSuspSandData()) { | 513 if (res.hasSuspSandData()) { |
462 newFacets.add(new SedimentLoadFacet( | 514 newFacets.add(new SedimentLoadFacet( |
463 idx, | 515 idx, |
464 SEDIMENT_LOAD_SUSP_SAND, | 516 (isUnitTA) |
517 ?SEDIMENT_LOAD_TA_SUSP_SAND | |
518 :SEDIMENT_LOAD_M3A_SUSP_SAND, | |
465 Resources.getMsg( | 519 Resources.getMsg( |
466 meta, | 520 meta, |
467 I18N_FACET_SEDIMENTLOAD_SUSPSAND, | 521 I18N_FACET_SEDIMENTLOAD_SUSPSAND, |
468 I18N_FACET_SEDIMENTLOAD_SUSPSAND) + | 522 I18N_FACET_SEDIMENTLOAD_SUSPSAND) + |
469 " - " + res.getStartYear() + "-" + res.getEndYear(), | 523 " - " + res.getStartYear() + "-" + res.getEndYear(), |
472 hash)); | 526 hash)); |
473 } | 527 } |
474 if (res.hasSuspSandBedData()) { | 528 if (res.hasSuspSandBedData()) { |
475 newFacets.add(new SedimentLoadFacet( | 529 newFacets.add(new SedimentLoadFacet( |
476 idx, | 530 idx, |
477 SEDIMENT_LOAD_SUSP_SAND_BED, | 531 (isUnitTA) |
532 ?SEDIMENT_LOAD_TA_SUSP_SAND_BED | |
533 :SEDIMENT_LOAD_M3A_SUSP_SAND_BED, | |
478 Resources.getMsg( | 534 Resources.getMsg( |
479 meta, | 535 meta, |
480 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, | 536 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED, |
481 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + | 537 I18N_FACET_SEDIMENTLOAD_SUSPSANDBED) + |
482 " - " + res.getStartYear() + "-" + res.getEndYear(), | 538 " - " + res.getStartYear() + "-" + res.getEndYear(), |
485 hash)); | 541 hash)); |
486 } | 542 } |
487 if (res.hasSuspSedimentData()) { | 543 if (res.hasSuspSedimentData()) { |
488 newFacets.add(new SedimentLoadFacet( | 544 newFacets.add(new SedimentLoadFacet( |
489 idx, | 545 idx, |
490 SEDIMENT_LOAD_SUSP_SEDIMENT, | 546 (isUnitTA) |
547 ?SEDIMENT_LOAD_TA_SUSP_SEDIMENT | |
548 :SEDIMENT_LOAD_M3A_SUSP_SEDIMENT, | |
491 Resources.getMsg( | 549 Resources.getMsg( |
492 meta, | 550 meta, |
493 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, | 551 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT, |
494 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + | 552 I18N_FACET_SEDIMENTLOAD_SUSPSEDIMENT) + |
495 " - " + res.getStartYear() + "-" + res.getEndYear(), | 553 " - " + res.getStartYear() + "-" + res.getEndYear(), |
499 | 557 |
500 } | 558 } |
501 if (res.hasTotalLoadData()) { | 559 if (res.hasTotalLoadData()) { |
502 newFacets.add(new SedimentLoadFacet( | 560 newFacets.add(new SedimentLoadFacet( |
503 idx, | 561 idx, |
504 SEDIMENT_LOAD_TOTAL_LOAD, | 562 (isUnitTA) |
563 ?SEDIMENT_LOAD_TA_TOTAL_LOAD | |
564 :SEDIMENT_LOAD_M3A_TOTAL_LOAD, | |
505 Resources.getMsg( | 565 Resources.getMsg( |
506 meta, | 566 meta, |
507 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD, | 567 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD, |
508 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD) + | 568 I18N_FACET_SEDIMENTLOAD_TOTAL_LOAD) + |
509 " - " + res.getStartYear() + "-" + res.getEndYear(), | 569 " - " + res.getStartYear() + "-" + res.getEndYear(), |
512 hash)); | 572 hash)); |
513 } | 573 } |
514 if (res.hasTotalData()) { | 574 if (res.hasTotalData()) { |
515 newFacets.add(new SedimentLoadFacet( | 575 newFacets.add(new SedimentLoadFacet( |
516 idx, | 576 idx, |
517 SEDIMENT_LOAD_TOTAL, | 577 (isUnitTA) |
578 ?SEDIMENT_LOAD_TA_TOTAL | |
579 :SEDIMENT_LOAD_M3A_TOTAL, | |
518 Resources.getMsg( | 580 Resources.getMsg( |
519 meta, | 581 meta, |
520 I18N_FACET_SEDIMENTLOAD_TOTAL, | 582 I18N_FACET_SEDIMENTLOAD_TOTAL, |
521 I18N_FACET_SEDIMENTLOAD_TOTAL) + | 583 I18N_FACET_SEDIMENTLOAD_TOTAL) + |
522 " - " + res.getStartYear() + "-" + res.getEndYear(), | 584 " - " + res.getStartYear() + "-" + res.getEndYear(), |