Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java @ 6678:0a70a320bfca
Doc.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 29 Jul 2013 09:22:11 +0200 |
parents | 1ca0688dddc7 |
children | 68c7b5811c4f |
comparison
equal
deleted
inserted
replaced
6677:866c914d5988 | 6678:0a70a320bfca |
---|---|
40 protected String unit; | 40 protected String unit; |
41 | 41 |
42 public SedimentLoadCalculation() { | 42 public SedimentLoadCalculation() { |
43 } | 43 } |
44 | 44 |
45 /** Returns CalculationResult with array of SedimentLoadResults. */ | |
45 public CalculationResult calculate(SedimentLoadAccess access) { | 46 public CalculationResult calculate(SedimentLoadAccess access) { |
46 logger.info("SedimentLoadCalculation.calculate"); | 47 logger.info("SedimentLoadCalculation.calculate"); |
47 | 48 |
48 String river = access.getRiver(); | 49 String river = access.getRiver(); |
49 String yearEpoch = access.getYearEpoch(); | 50 String yearEpoch = access.getYearEpoch(); |
85 } | 86 } |
86 | 87 |
87 return new CalculationResult(); | 88 return new CalculationResult(); |
88 } | 89 } |
89 | 90 |
91 /** Returns CalculationResult with array of SedimentLoadResults. */ | |
90 private CalculationResult internalCalculate() { | 92 private CalculationResult internalCalculate() { |
91 logger.debug("internalCalulate; mode:" + yearEpoch); | 93 logger.debug("internalCalulate; mode:" + yearEpoch); |
92 if (yearEpoch.equals("year")) { | 94 if (yearEpoch.equals("year")) { |
93 List<SedimentLoadResult> results = | 95 List<SedimentLoadResult> results = |
94 new ArrayList<SedimentLoadResult>(); | 96 new ArrayList<SedimentLoadResult>(); |
257 } | 259 } |
258 | 260 |
259 return result; | 261 return result; |
260 } | 262 } |
261 | 263 |
262 /** Fetch loads for a single year, calculate total and | 264 /** |
263 * return the result containing both. */ | 265 * Fetch loads for a single year, calculate total and |
266 * return the result containing both. | |
267 * @param y year, e.g. 1980 | |
268 */ | |
264 private SedimentLoadResult calculateYear(int y) { | 269 private SedimentLoadResult calculateYear(int y) { |
265 SedimentLoad load = SedimentLoadFactory.getLoadWithData( | 270 SedimentLoad load = SedimentLoadFactory.getLoadWithData( |
266 this.river, | 271 this.river, |
267 this.yearEpoch, | 272 this.yearEpoch, |
268 this.kmLow, | 273 this.kmLow, |
344 } | 349 } |
345 | 350 |
346 | 351 |
347 /** | 352 /** |
348 * Set total values in load. | 353 * Set total values in load. |
349 * Therefore, run over the kms and find ranges where either all | 354 * |
355 * Therefore, run over the sorted kms and find ranges where either all | |
350 * or all Geschiebe or just the Schwebstoff fractions are set. | 356 * or all Geschiebe or just the Schwebstoff fractions are set. |
351 * Merge these ranges and add (maybe new) respective fractions to | 357 * Merge these ranges and add (maybe new) respective fractions to |
352 * load. | 358 * load. In the process, remember any 'unfished' ends from measurements |
359 * where the km-ranges did not completely match. | |
360 * | |
353 * @param load SedimentLoad to add total values (and ranges) to. | 361 * @param load SedimentLoad to add total values (and ranges) to. |
354 * @return input param load. | 362 * @return input param load, with total values set. |
355 */ | 363 */ |
356 private SedimentLoad partialTotal(SedimentLoad load) { | 364 private SedimentLoad partialTotal(SedimentLoad load) { |
357 SedimentLoad fairLoad = load; | 365 SedimentLoad fairLoad = load; |
358 | 366 |
359 Range lastOtherRange = null; | 367 Range lastOtherRange = null; |
499 } | 507 } |
500 return fairLoad; | 508 return fairLoad; |
501 } | 509 } |
502 | 510 |
503 | 511 |
512 /** | |
513 * Transform values in load. | |
514 * @param load The load of which values should be transformed. | |
515 * @return parameter load with transformed values. | |
516 */ | |
504 private SedimentLoad calculateUnit(SedimentLoad load, int year) { | 517 private SedimentLoad calculateUnit(SedimentLoad load, int year) { |
505 SedimentDensity density = | 518 SedimentDensity density = |
506 SedimentDensityFactory.getSedimentDensity(river, kmLow, kmUp, year); | 519 SedimentDensityFactory.getSedimentDensity(river, kmLow, kmUp, year); |
507 for (double km: load.getKms()) { | 520 for (double km: load.getKms()) { |
508 double dens = density.getDensity(km, year); | 521 double dens = density.getDensity(km, year); |