Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/WINFOArtifact.java @ 8704:93a31cfb18c0
(issue1787) Sort WQ data locally over Q bevor lookup of Qs for given W.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Thu, 23 Apr 2015 19:13:33 +0200 |
parents | ea17665c5aad |
children | f51b9305d338 |
comparison
equal
deleted
inserted
replaced
8703:e4f9e2316e92 | 8704:93a31cfb18c0 |
---|---|
227 | 227 |
228 if (qs == null) { | 228 if (qs == null) { |
229 log.debug("Determine Q values based on a set of W values."); | 229 log.debug("Determine Q values based on a set of W values."); |
230 qSel = false; | 230 qSel = false; |
231 ws = getWs(); | 231 ws = getWs(); |
232 double [][] qws = getQsForWs(ws); | 232 double [][] qws = getQsForWs(ws, report); |
233 if (qws == null || qws.length == 0) { | 233 if (qws == null || qws.length == 0) { |
234 return error(new WQKms[0], "converting.ws.to.qs.failed"); | 234 return error(new WQKms[0], "converting.ws.to.qs.failed"); |
235 } | 235 } |
236 qs = qws[0]; | 236 qs = qws[0]; |
237 | 237 |
659 * | 659 * |
660 * @param ws An array of W values. | 660 * @param ws An array of W values. |
661 * | 661 * |
662 * @return an array of Q values. | 662 * @return an array of Q values. |
663 */ | 663 */ |
664 public double [][] getQsForWs(double[] ws) { | 664 public double [][] getQsForWs(double[] ws, Calculation report) { |
665 | 665 |
666 if (ws == null) { | 666 if (ws == null) { |
667 log.error("getQsForWs: ws == null"); | 667 log.error("getQsForWs: ws == null"); |
668 return null; | 668 return null; |
669 } | 669 } |
706 for (int i = 0; i < ws.length; ++i) { | 706 for (int i = 0; i < ws.length; ++i) { |
707 double w = ws[i]; | 707 double w = ws[i]; |
708 if (debug) { | 708 if (debug) { |
709 log.debug("getQsForWs: lookup Q for W: " + w); | 709 log.debug("getQsForWs: lookup Q for W: " + w); |
710 } | 710 } |
711 // There could bemore than one Q per W. | 711 // There could be more than one Q per W. |
712 double [] qs = wst.findQsForW(km, w); | 712 double [] qs = wst.findQsForW(km, w, report); |
713 for (int j = 0; j < qs.length; ++j) { | 713 for (int j = 0; j < qs.length; ++j) { |
714 outWs.add(ws[i]); | 714 outWs.add(ws[i]); |
715 outQs.add(qs[j]); | 715 outQs.add(qs[j]); |
716 } | 716 } |
717 generatedWs |= qs.length != 1; | 717 generatedWs |= qs.length != 1; |