Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixDerivateFacet.java @ 3081:26119b7b3154
Fixing output generator hacking
flys-artifacts/trunk@4677 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Sun, 17 Jun 2012 20:45:01 +0000 |
parents | dc2765e31e1f |
children | ba7df29264cd |
comparison
equal
deleted
inserted
replaced
3080:dc2765e31e1f | 3081:26119b7b3154 |
---|---|
32 | 32 |
33 /** House logger. */ | 33 /** House logger. */ |
34 private static Logger logger = Logger.getLogger(FixDerivateFacet.class); | 34 private static Logger logger = Logger.getLogger(FixDerivateFacet.class); |
35 | 35 |
36 private double currentKm; | 36 private double currentKm; |
37 private double maxQ; | |
37 | 38 |
38 /** Trivial Constructor. */ | 39 /** Trivial Constructor. */ |
39 public FixDerivateFacet() { | 40 public FixDerivateFacet() { |
40 } | 41 } |
41 | 42 |
79 String function = access.getFunction(); | 80 String function = access.getFunction(); |
80 Function ff = FunctionFactory.getInstance().getFunction(function); | 81 Function ff = FunctionFactory.getInstance().getFunction(function); |
81 Function.Derivative fd = ff.getDerivative(); | 82 Function.Derivative fd = ff.getDerivative(); |
82 | 83 |
83 Parameters params = result.getParameters(); | 84 Parameters params = result.getParameters(); |
85 | |
86 // Determine maxQ | |
87 double[] maxQs = params | |
88 .interpolate("km", this.currentKm, new String [] { "max_q" }); | |
89 if(maxQs != null) { | |
90 maxQ = maxQs[0]; | |
91 } | |
92 | |
84 int row = params.binarySearch("km", currentKm, Math.pow(10, -4)); | 93 int row = params.binarySearch("km", currentKm, Math.pow(10, -4)); |
85 if(row < 0) { | 94 if(row < 0) { |
86 row = -row - 1; | 95 row = -row - 1; |
87 logger.debug("getData: no direct hit in params.binarySearch"); | 96 logger.debug("getData: no direct hit in params.binarySearch"); |
88 } | 97 } |
110 } | 119 } |
111 } | 120 } |
112 | 121 |
113 | 122 |
114 protected double getMaxQ(FixResult result, double km) { | 123 protected double getMaxQ(FixResult result, double km) { |
115 double maxQ = 0; | |
116 | |
117 KMIndex<QW []> kmQWRef = result.getReferenced(); | |
118 | |
119 QW[] qwRef = kmQWRef.binarySearch(km).getValue(); | |
120 if (qwRef != null) { | |
121 for (int i = 0; i < qwRef.length; i++) { | |
122 if (qwRef[i].getQ() > maxQ) { | |
123 maxQ = qwRef[i].getQ(); | |
124 } | |
125 } | |
126 } | |
127 | |
128 KMIndex<AnalysisPeriod []> kmQWDAna = result.getAnalysisPeriods(); | |
129 AnalysisPeriod[] periods = kmQWDAna.binarySearch(km).getValue(); | |
130 | |
131 if(periods != null) { | |
132 for (int i = 0; i < periods.length; i++) { | |
133 QWD[] qwdAna = periods[i].getQWDs(); | |
134 if (qwdAna != null) { | |
135 for (int j = 0; j < qwdAna.length; j++) { | |
136 if (qwdAna[j].getQ() > maxQ) { | |
137 maxQ = qwdAna[j].getQ(); | |
138 } | |
139 } | |
140 } | |
141 } | |
142 } | |
143 return maxQ; | 124 return maxQ; |
144 } | 125 } |
145 | 126 |
146 /** | 127 /** |
147 * Create a deep copy of this Facet. | 128 * Create a deep copy of this Facet. |