comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java @ 3096:d7b0f52d6d04

FixA: Calculate Delta W(t) for reference points, too. flys-artifacts/trunk@4695 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 18 Jun 2012 16:00:19 +0000
parents 5642a83420f2
children 23de6d678fba
comparison
equal deleted inserted replaced
3095:6ea299c208cd 3096:d7b0f52d6d04
167 double [] kms = DoubleUtil.explode(from, to, step / 1000.0); 167 double [] kms = DoubleUtil.explode(from, to, step / 1000.0);
168 168
169 final double [] qs = new double[eventColumns.size()]; 169 final double [] qs = new double[eventColumns.size()];
170 final double [] ws = new double[qs.length]; 170 final double [] ws = new double[qs.length];
171 171
172 Fitting.QWFactory qwFactory = new Fitting.QWFactory() { 172 Fitting.QWDFactory qwdFactory = new Fitting.QWDFactory() {
173 @Override 173 @Override
174 public QW create(double q, double w) { 174 public QWD create(double q, double w) {
175 // Check all the event columns for close match 175 // Check all the event columns for close match
176 // and take the description and the date from meta. 176 // and take the description and the date from meta.
177 for (int i = 0; i < qs.length; ++i) { 177 for (int i = 0; i < qs.length; ++i) {
178 if (Math.abs(qs[i]-q) < EPSILON 178 if (Math.abs(qs[i]-q) < EPSILON
179 && Math.abs(ws[i]-w) < EPSILON) { 179 && Math.abs(ws[i]-w) < EPSILON) {
180 Column column = eventColumns.get(i); 180 Column column = eventColumns.get(i);
181 return new QW( 181 return new QWD(
182 q, w, 182 q, w,
183 column.getDescription(), 183 column.getDescription(),
184 column.getDate()); 184 column.getDate(),
185 0d);
185 } 186 }
186 } 187 }
187 log.warn("cannot find column for (" + q + ", " + w + ")"); 188 log.warn("cannot find column for (" + q + ", " + w + ")");
188 return new QW(q, w); 189 return new QWD(q, w);
189 } 190 }
190 }; 191 };
191 192
192 Fitting fitting = new Fitting(func, qwFactory, preprocessing); 193 Fitting fitting = new Fitting(func, qwdFactory, preprocessing);
193 194
194 String [] parameterNames = func.getParameterNames(); 195 String [] parameterNames = func.getParameterNames();
195 196
196 Parameters results = 197 Parameters results =
197 new Parameters(createColumnNames(parameterNames)); 198 new Parameters(createColumnNames(parameterNames));
200 201
201 if (debug) { 202 if (debug) {
202 log.debug("number of kms: " + kms.length); 203 log.debug("number of kms: " + kms.length);
203 } 204 }
204 205
205 KMIndex<QW []> outliers = new KMIndex<QW []>(); 206 KMIndex<QW []> outliers = new KMIndex<QW []>();
206 KMIndex<QW []> referenced = new KMIndex<QW []>(kms.length); 207 KMIndex<QWD []> referenced = new KMIndex<QWD []>(kms.length);
207 208
208 int kmIndex = results.columnIndex("km"); 209 int kmIndex = results.columnIndex("km");
209 int chiSqrIndex = results.columnIndex("chi_sqr"); 210 int chiSqrIndex = results.columnIndex("chi_sqr");
210 int maxQIndex = results.columnIndex("max_q"); 211 int maxQIndex = results.columnIndex("max_q");
211 int [] parameterIndices = results.columnIndices(parameterNames); 212 int [] parameterIndices = results.columnIndices(parameterNames);

http://dive4elements.wald.intevation.org