Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFacet.java @ 6342:b8cd8e2d0c35
SedimentLoadFacet, issue1235: Ignore values not measured at measurement stations
begin of range.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 14 Jun 2013 17:09:25 +0200 |
parents | 3ec08ff0f497 |
children | 588e99129883 |
comparison
equal
deleted
inserted
replaced
6341:3ec08ff0f497 | 6342:b8cd8e2d0c35 |
---|---|
97 TreeMap<Double, Double> sortedKmLoad = new TreeMap<Double,Double>(); | 97 TreeMap<Double, Double> sortedKmLoad = new TreeMap<Double,Double>(); |
98 | 98 |
99 double[] km = sd[0]; | 99 double[] km = sd[0]; |
100 double[] load = sd[1]; | 100 double[] load = sd[1]; |
101 | 101 |
102 // Build map of km->load, but directly exclude the ones which do | |
103 // not match against a measurements station ranges start. | |
102 for (int i = 0 ; i < km.length; i++) { | 104 for (int i = 0 ; i < km.length; i++) { |
103 sortedKmLoad.put(km[i], load[i]); | 105 for (MeasurementStation station: stations) { |
106 if (Math.abs(station.getStation() - km[i]) <= EPSILON) { | |
107 sortedKmLoad.put(km[i], load[i]); | |
108 continue; | |
109 } | |
110 } | |
104 } | 111 } |
105 | 112 |
106 // [0] -> x, [1] -> y | 113 // [0] -> x, [1] -> y |
107 double[][] values = new double[2][]; | 114 double[][] values = new double[2][]; |
108 values[0] = new double[km.length*3]; | 115 values[0] = new double[sortedKmLoad.size()*3]; |
109 values[1] = new double[km.length*3]; | 116 values[1] = new double[sortedKmLoad.size()*3]; |
110 | |
111 List<double[]> kmWithoutStation = new ArrayList<double[]>(); | |
112 | 117 |
113 // Find station via its station (km). | 118 // Find station via its station (km). |
114 // TODO use a binarySearch instead of linear absdiff approach | 119 // TODO use a binarySearch instead of linear absdiff approach |
115 int i = 0; | 120 int i = 0; |
116 for (Map.Entry<Double, Double> kmLoad: sortedKmLoad.entrySet()) { | 121 for (Map.Entry<Double, Double> kmLoad: sortedKmLoad.entrySet()) { |