annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataCalculation.java @ 8194:59e50aa0c6c2

Removed obsolete imports.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 04 Sep 2014 17:47:32 +0200
parents 8d447516b7dd
children 04d1d56d896b
rev   line source
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2014 by Bundesanstalt für Gewässerkunde
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
3 *
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
6 * documentation coming with Dive4Elements River for details.
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
7 */
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
8 package org.dive4elements.river.artifacts.model.minfo;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
9
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
10 import java.util.ArrayList;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
11 import java.util.List;
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
12 import java.util.Map;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
13 import java.util.Set;
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
14 import java.util.TreeMap;
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
15 import java.util.TreeSet;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
16
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
17 import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
18 import org.dive4elements.river.artifacts.model.Calculation;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
19 import org.dive4elements.river.artifacts.model.CalculationResult;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
21 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadData.Value;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
22 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadData.Station;
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
23 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadDataValueFilter.And;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
24 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadDataValueFilter.IsEpoch;
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
25 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadDataValueFilter.IsOfficial;
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
26 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadDataValueFilter.Not;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
27 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadDataValueFilter.TimeRangeIntersects;
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
28 import org.dive4elements.river.utils.DoubleUtil;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
29
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
30 public class SedimentLoadDataCalculation
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
31 extends Calculation
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
32 {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
33 private static final Logger log = Logger
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
34 .getLogger(SedimentLoadDataCalculation.class);
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
35
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
36 public static final int [] TOTAL_LOAD = {
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
37 SedimentLoadData.GF_COARSE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
38 SedimentLoadData.GF_FINE_MIDDLE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
39 SedimentLoadData.GF_SAND,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
40 SedimentLoadData.GF_SUSP_SEDIMENT
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
41 };
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
42
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
43 public static final int [] BED_LOAD = {
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
44 SedimentLoadData.GF_COARSE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
45 SedimentLoadData.GF_FINE_MIDDLE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
46 SedimentLoadData.GF_SAND
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
47 };
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
48
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
49 public static final int [] BED_LOAD_SUSP_SAND = {
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
50 SedimentLoadData.GF_COARSE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
51 SedimentLoadData.GF_FINE_MIDDLE,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
52 SedimentLoadData.GF_SAND,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
53 SedimentLoadData.GF_SUSP_SAND
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
54 };
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
55
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
56 public static final int [] COARSE = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
57 SedimentLoadData.GF_COARSE
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
58 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
59
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
60 public static final int [] FINE_MIDDLE = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
61 SedimentLoadData.GF_FINE_MIDDLE
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
62 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
63
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
64 public static final int [] SAND = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
65 SedimentLoadData.GF_SAND
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
66 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
67
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
68 public static final int [] SUSP_SAND = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
69 SedimentLoadData.GF_SUSP_SAND
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
70 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
71
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
72 public static final int [] SUSP_SAND_BED = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
73 SedimentLoadData.GF_SUSP_SAND_BED
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
74 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
75
8175
d2673ca68e70 Precalculated sums from the database will come through recommendations.
Tom Gottfried <tom@intevation.de>
parents: 8172
diff changeset
76 public static final int [] SUSP_SEDIMENT = {
8050
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
77 SedimentLoadData.GF_SUSP_SEDIMENT
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
78 };
9e79e384aa8b Sediment load: Added more 'sums' to be calculated.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8049
diff changeset
79
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
80 public static final class LoadSum {
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
81 private String description;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
82 private int [] grainFractions;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
83
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
84 public LoadSum(String description, int [] grainFractions) {
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
85 this.description = description;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
86 this.grainFractions = grainFractions;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
87 }
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
88 public static final LoadSum make(String description, int [] grainFractions) {
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
89 return new LoadSum(description, grainFractions);
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
90 }
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
91
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
92 public String getDescription() {
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
93 return description;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
94 }
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
95
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
96 public int [] getGrainFractions() {
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
97 return grainFractions;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
98 }
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
99
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
100 public int getStationType() {
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
101 return SedimentLoadData.measurementStationType(
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
102 SedimentLoadData.grainFractionIndex(this.description));
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
103 }
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
104 } // class LoadSum
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
105
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
106 public static final LoadSum [] LOAD_SUMS = {
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
107 // Names are alignt to the grain_fractions table
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
108 LoadSum.make("total", TOTAL_LOAD),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
109 LoadSum.make("bed_load", BED_LOAD),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
110 LoadSum.make("bed_load_susp_sand", BED_LOAD_SUSP_SAND),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
111 LoadSum.make("coarse", COARSE),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
112 LoadSum.make("fine_middle", FINE_MIDDLE),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
113 LoadSum.make("sand", SAND) ,
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
114 LoadSum.make("susp_sand", SUSP_SAND),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
115 LoadSum.make("susp_sand_bed", SUSP_SAND_BED),
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
116 LoadSum.make("suspended_sediment", SUSP_SEDIMENT),
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
117 };
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
118
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
119 public static class Sum implements Value.Visitor {
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
120
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
121 protected int n;
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
122 protected double sum;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
123
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
124 public Sum() {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
125 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
126
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
127 public double getSum() {
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
128 return sum;
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
129 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
130
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
131 public int getN() {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
132 return n;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
133 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
134
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
135 public void reset() {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
136 n = 0;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
137 sum = 0.0;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
138 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
139
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
140 @Override
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
141 public void visit(Value value) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
142 sum += value.getValue();
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
143 ++n;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
144 }
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
145 } // class Sum
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
146
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
147 private String river;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
148 private String yearEpoch;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
149 private String unit;
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
150 private int [][] epochs;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
151 private int [] years;
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
152 private double from;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
153 private double to;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
154
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
155
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
156 public SedimentLoadDataCalculation() {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
157 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
158
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
159 public CalculationResult calculate(SedimentLoadAccess access) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
160 log.info("SedimentLoadDataCalculation.calculate");
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
161
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
162 String river = access.getRiverName();
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
163 String yearEpoch = access.getYearEpoch();
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
164 String unit = access.getUnit();
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
165
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
166 int [] years = null;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
167 int [][] epochs = null;
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
168
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
169 double from = access.getLowerKM();
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
170 double to = access.getUpperKM();
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
171
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
172 if (yearEpoch.equals("year")) {
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
173 years = access.getPeriod();
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
174 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
175 else if (yearEpoch.equals("epoch") || yearEpoch.equals("off_epoch")) {
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
176 epochs = access.getEpochs();
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
177 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
178 else {
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
179 addProblem("minfo.missing.year_epoch");
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
180 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
181
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
182 if (river == null) {
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
183 // TODO: i18n
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
184 addProblem("minfo.missing.river");
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
185 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
186
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
187 if (years == null && epochs == null) {
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
188 addProblem("minfo.missing.time");
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
189 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
190
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
191 if (!hasProblems()) {
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
192 this.river = river;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
193 this.yearEpoch = yearEpoch;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
194 this.unit = unit;
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
195 this.years = years;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
196 this.epochs = epochs;
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
197 this.from = from;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
198 this.to = to;
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
199 return internalCalculate();
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
200 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
201
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
202 return error(null);
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
203 }
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
204
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
205 private CalculationResult error(String msg) {
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
206 if (msg != null) addProblem(msg);
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
207 return new CalculationResult(this);
8052
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
208 }
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
209
1dae69eff79d Sediment load: take arguments from sediment access.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8050
diff changeset
210 private CalculationResult internalCalculate() {
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
211 if ("year".equals(yearEpoch)) return calculateYears();
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
212 if ("epoch".equals(yearEpoch)) return calculateEpochs();
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
213 if ("off_epoch".equals(yearEpoch)) return calculateOffEpochs();
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
214
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
215 // TODO: i18n
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
216 return error("minfo.sediment.load.unknown.calc.mode");
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
217 }
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
218
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
219 private CalculationResult calculateYears() {
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
220 SedimentLoadData sld =
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
221 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
222 if (sld == null) {
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
223 // TODO: i18n
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
224 return error("minfo.sediment.load.no.data");
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
225 }
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
226
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
227 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
228
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
229 Set<Integer> missingFractions = new TreeSet<Integer>();
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
230
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
231 Not notEpochs = new Not(IsEpoch.INSTANCE);
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
232
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
233 Sum sum = new Sum();
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
234
8066
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
235 SedimentDensity sd = getSedimentDensity();
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
236
8145
52504fc2cd58 Calculate all single years in given interval but only once.
Tom Gottfried <tom@intevation.de>
parents: 8131
diff changeset
237 int min = Math.min(years[0], years[1]);
52504fc2cd58 Calculate all single years in given interval but only once.
Tom Gottfried <tom@intevation.de>
parents: 8131
diff changeset
238 int max = Math.max(years[0], years[1]);
52504fc2cd58 Calculate all single years in given interval but only once.
Tom Gottfried <tom@intevation.de>
parents: 8131
diff changeset
239
52504fc2cd58 Calculate all single years in given interval but only once.
Tom Gottfried <tom@intevation.de>
parents: 8131
diff changeset
240 for (int year = min; year <= max; ++year) {
8068
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
241 Value.Filter filter = new And(notEpochs)
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
242 .add(new TimeRangeIntersects(year));
8131
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
243 String period = Integer.toString(year);
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
244
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
245 for (LoadSum ls: LOAD_SUMS) {
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
246
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
247 double [][] result = sum(
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
248 sld, ls.getGrainFractions(), ls.getStationType(),
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
249 filter, sum, missingFractions);
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
250
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
251 if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
252 // TODO: resolve i18n
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
253 addProblem("minfo.sediment.load.no.fractions",
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
254 ls.getDescription());
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
255 continue;
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
256 }
8066
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
257
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
258 transformT2M3(sd, year, result);
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
259
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
260 SedimentLoadDataResult.Fraction sldrf =
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
261 new SedimentLoadDataResult.Fraction(ls.getDescription(), result, period);
8066
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
262
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
263 sldr.addFraction(sldrf);
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
264 }
8145
52504fc2cd58 Calculate all single years in given interval but only once.
Tom Gottfried <tom@intevation.de>
parents: 8131
diff changeset
265
8055
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
266 }
cd35b76f1ef8 Sediment load. More off year based calculations.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8053
diff changeset
267 // TODO: Generate messages for missing fractions.
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
268 return new CalculationResult(sldr, this);
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
269 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
270
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
271 private CalculationResult calculateEpochs() {
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
272 SedimentLoadData sld =
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
273 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
274 if (sld == null) {
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
275 // TODO: i18n
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
276 return error("minfo.sediment.load.no.data");
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
277 }
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
278
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
279 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
280
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
281 Set<Integer> missingFractions = new TreeSet<Integer>();
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
282
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
283 Sum sum = new Sum();
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
284
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
285 SedimentDensity sd = getSedimentDensity();
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
286
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
287 // They are not epochs, they are single years!
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
288 Not notEpochs = new Not(IsEpoch.INSTANCE);
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
289
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
290 for (int [] epoch: epochs) {
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
291 int min = Math.min(epoch[0], epoch[1]);
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
292 int max = Math.max(epoch[0], epoch[1]);
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
293
8131
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
294 String period = Integer.toString(epoch[0]) + " - " +
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
295 Integer.toString(epoch[1]);
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
296
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
297 for (LoadSum ls: LOAD_SUMS) {
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
298
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
299 List<double [][]> results = new ArrayList<double [][]>();
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
300
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
301 for (int year = min; year <= max; ++year) {
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
302 Value.Filter filter = new And(notEpochs)
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
303 .add(new TimeRangeIntersects(year));
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
304
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
305 double [][] result = sum(
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
306 sld, ls.getGrainFractions(), ls.getStationType(),
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
307 filter, sum, missingFractions);
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
308
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
309 if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
310 // TODO: resolve i18n
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
311 addProblem("minfo.sediment.load.no.fractions",
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
312 ls.getDescription());
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
313 continue;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
314 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
315
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
316 transformT2M3(sd, year, result);
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
317 results.add(result);
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
318 }
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
319
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
320 double [][] result = average(results);
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
321
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
322 SedimentLoadDataResult.Fraction sldrf =
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
323 new SedimentLoadDataResult.Fraction(ls.getDescription(),
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
324 result, period);
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
325 sldr.addFraction(sldrf);
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
326 }
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
327
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
328 }
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
329 // TODO: Generate messages for missing fractions.
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
330 return new CalculationResult(sldr, this);
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
331 }
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
332
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
333 private CalculationResult calculateOffEpochs() {
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
334 SedimentLoadData sld =
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
335 SedimentLoadDataFactory.INSTANCE.getSedimentLoadData(river);
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
336 if (sld == null) {
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
337 // TODO: i18n
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
338 return error("minfo.sediment.load.no.data");
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
339 }
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
340
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
341 SedimentLoadDataResult sldr = new SedimentLoadDataResult();
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
342
8068
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
343 SedimentDensity sd = getSedimentDensity();
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
344
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
345 Set<Integer> missingFractions = new TreeSet<Integer>();
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
346
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
347 for (int [] epoch: epochs) {
8068
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
348 Value.Filter filter = new And(IsOfficial.INSTANCE)
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
349 .add(new TimeRangeIntersects(epoch[0], epoch[1]));
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
350
8068
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
351 int year = Math.min(epoch[0], epoch[1]);
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
352
8131
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
353 String period = Integer.toString(epoch[0]) + " - " +
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
354 Integer.toString(epoch[1]);
fae48b3c09d1 Add period to sedimentloaddataresult fraction
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8130
diff changeset
355
8060
25feef564d09 Sediment load: More of official epochs.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8057
diff changeset
356 Sum sum = new Sum();
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
357
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
358 for (LoadSum ls: LOAD_SUMS) {
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
359 double [][] result = sum(
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
360 sld, ls.getGrainFractions(), ls.getStationType(),
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
361 filter, sum, missingFractions);
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
362
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
363 if (result[0].length == 0 || DoubleUtil.isNaN(result[1])) {
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
364 // TODO: resolve i18n
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
365 addProblem("minfo.sediment.load.no.fractions",
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
366 ls.getDescription());
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
367 continue;
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
368 }
8068
9ecd6267323b Sediment load: transform units for official epochs, too.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8067
diff changeset
369 transformT2M3(sd, year, result);
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
370 SedimentLoadDataResult.Fraction sldrf =
8185
76e1e9d81ce2 Removed obsolete average and renamed some symbols to make the difference between single fractions and sums of them clearer in the calculation.
Tom Gottfried <tom@intevation.de>
parents: 8176
diff changeset
371 new SedimentLoadDataResult.Fraction(ls.getDescription(), result, period);
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
372 sldr.addFraction(sldrf);
8057
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
373 }
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
374 }
555dc5a9b282 Sediment load: More on calculating epoch loads.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8055
diff changeset
375 // TODO: Generate messages for missing fractions.
8062
8489565ff563 Sedimen load: Added bundle for fraction results.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8060
diff changeset
376 return new CalculationResult(sldr, this);
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
377 }
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
378
8066
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
379 private final boolean inM3() {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
380 return unit.equals("m3_per_a");
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
381 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
382
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
383 private SedimentDensity getSedimentDensity() {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
384 return inM3()
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
385 ? SedimentDensityFactory.getSedimentDensity(river, from, to)
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
386 : null;
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
387 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
388
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
389 private static void transformT2M3(SedimentDensity sd, int year, double [][] data) {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
390 if (sd == null) {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
391 return;
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
392 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
393 double [] kms = data[0];
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
394 double [] values = data[1];
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
395 for (int i = 0; i < kms.length; ++i) {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
396 if (Double.isNaN(kms[i]) || Double.isNaN(kms[i])) {
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
397 continue;
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
398 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
399 double density = sd.getDensity(kms[i], year);
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
400 values[i] /= density;
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
401 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
402 }
fe5ef780f8b1 Sediment load: fetch sediment density for transforming t/a to m^3/a.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8062
diff changeset
403
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
404 public double[][] sum(
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
405 SedimentLoadData sld,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
406 int [] grainFractions,
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
407 int lsSType,
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
408 Value.Filter filter,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
409 Sum sum,
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
410 Set<Integer> missingFractions
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
411 ) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
412 List<Station> stations = sld.findStations(from, to);
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
413
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
414 double [] values = new double[grainFractions.length];
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
415
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
416 double [][] result = new double[2][stations.size()];
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
417
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
418 for (int j = 0, S = stations.size(); j < S; ++j) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
419 Station station = stations.get(j);
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
420 int sType = station.getType();
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
421
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
422 for (int i = 0; i < grainFractions.length; ++i) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
423 int gf = grainFractions[i];
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
424 int gfSType = SedimentLoadData.measurementStationType(gf);
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
425
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
426 sum.reset();
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
427
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
428 // Add current single fraction at current station
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
429 station.filterGrainFraction(gf, filter, sum);
8193
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
430
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
431 if (gfSType == Station.UNKNOWN) {
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
432 log.error("No measurement station type defined for " +
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
433 "fraction-index" + gf);
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
434 }
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
435 else {
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
436 if (lsSType != Station.BED_LOAD &&
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
437 lsSType != Station.SUSPENDED &&
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
438 (sType == Station.BED_LOAD ||
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
439 sType == Station.SUSPENDED) &&
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
440 sum.getN() == 0) {
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
441 /* In case the station-type of the load sum is
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
442 a combined type and we are at non-combined station:
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
443 we need to add values from previous station of
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
444 the other type for fractions not given here. */
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
445 int otherType = sType == Station.BED_LOAD ?
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
446 Station.SUSPENDED : Station.BED_LOAD;
8d447516b7dd Sum up fractions from stations and previous stations according to respective validity model.
Tom Gottfried <tom@intevation.de>
parents: 8185
diff changeset
447 Station prev = station.prevByType(otherType);
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
448 if (prev != null) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
449 prev.filterGrainFraction(gf, filter, sum);
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
450 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
451 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
452 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
453
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
454 if (sum.getN() == 0) {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
455 missingFractions.add(gf);
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
456 values[i] = Double.NaN;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
457 } else {
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
458 values[i] = sum.getSum();
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
459 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
460 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
461 result[0][j] = station.getStation();
8053
72760ca2fc2b Sediment load: dispatch calculation modes.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8052
diff changeset
462 result[1][j] = DoubleUtil.sum(values);
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
463 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
464
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
465 // TODO: Handle 'virtual' measument stations 'from' and 'to'.
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
466
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
467 return result;
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
468 }
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
469
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
470 private static final class XSum {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
471 private double sum;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
472 private int n;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
473 public XSum() {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
474 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
475 public void add(double v) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
476 sum += v;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
477 ++n;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
478 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
479 public double avg() {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
480 return sum/n;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
481 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
482 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
483
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
484 private static double [][] average(List<double [][]> data) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
485
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
486 TreeMap<Double, XSum> map = new TreeMap<Double, XSum>();
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
487
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
488 for (double [][] pair: data) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
489 double [] kms = pair[0];
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
490 double [] vs = pair[1];
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
491 for (int i = 0; i < kms.length; ++i) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
492 double km = kms[i];
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
493 double v = vs[i];
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
494 if (Double.isNaN(km)) {
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
495 continue;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
496 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
497 XSum xsum = map.get(km);
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
498 if (xsum == null) {
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
499 map.put(km, xsum = new XSum());
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
500 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
501 xsum.add(v);
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
502 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
503 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
504
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
505 double [][] result = new double[2][map.size()];
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
506 int i = 0;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
507 for (Map.Entry<Double, XSum> entry: map.entrySet()) {
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
508 result[0][i] = entry.getKey();
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
509 result[1][i] = entry.getValue().avg();
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
510 ++i;
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
511 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
512
8176
7b0b3b1a2ee8 Let epochs be averages over their years.
Tom Gottfried <tom@intevation.de>
parents: 8175
diff changeset
513 return result;
8067
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
514 }
6d24ba2ac964 Sediment load: refactored epoch calculation to not average over all but per year.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 8066
diff changeset
515
8049
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
516 }
d49846f05108 Sediment load: (incomplete) new sediment load calculation.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff changeset
517 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org