comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 1906:0de18085948a

Respect position for computed discharge curve when interpolating WQs for e.g. for fixations. flys-artifacts/trunk@3266 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Nov 2011 10:25:16 +0000
parents 2e2ca95459d2
children 61baa34af1d4
comparison
equal deleted inserted replaced
1905:d025009fec73 1906:0de18085948a
144 CallMeta meta) 144 CallMeta meta)
145 { 145 {
146 logger.debug("WQKmsInterpolArtifact.initialize"); 146 logger.debug("WQKmsInterpolArtifact.initialize");
147 WINFOArtifact winfo = (WINFOArtifact) artifact; 147 WINFOArtifact winfo = (WINFOArtifact) artifact;
148 importData(winfo, "river"); 148 importData(winfo, "river");
149 importData(winfo, "location"); 149 importData(winfo, "ld_locations");
150 logger.debug("WQKmsInterpolArtifact is @(location) " +
151 this.getDataAsString("location"));
152 } 150 }
153 151
154 152
155 /** 153 /**
156 * Get a list containing the one and only State. 154 * Get a list containing the one and only State.
173 WstValueTable interpolator = WstValueTableFactory.getTable( 171 WstValueTable interpolator = WstValueTableFactory.getTable(
174 getDataAsInt("wst_id")); 172 getDataAsInt("wst_id"));
175 // @TODO we might have to give column position for certain datasets. 173 // @TODO we might have to give column position for certain datasets.
176 // getDataAsInt("col_pos")); 174 // getDataAsInt("col_pos"));
177 175
178 // TODO respect given km. 176 double [][] vs = interpolator.interpolateWQColumnwise(
179 double [][] vs = interpolator.interpolateWQColumnwise(44.51); 177 getDataAsDouble("ld_locations"));
180 178
181 for (int x = 0; x < vs[1].length; x++) { 179 for (int x = 0; x < vs[1].length; x++) {
182 logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]); 180 logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]);
183 } 181 }
184 182
194 try { 192 try {
195 return Integer.valueOf(val); 193 return Integer.valueOf(val);
196 } 194 }
197 catch (NumberFormatException e) { 195 catch (NumberFormatException e) {
198 logger.warn("Could not get data " + dataName + " as int", e); 196 logger.warn("Could not get data " + dataName + " as int", e);
197 return 0;
198 }
199 }
200
201
202 /**
203 * Get a DataItem casted to double (0 if fails).
204 */
205 public double getDataAsDouble(String dataName) {
206 String val = getDataAsString(dataName);
207 try {
208 return Double.valueOf(val);
209 }
210 catch (NumberFormatException e) {
211 logger.warn("Could not get data " + dataName + " as double", e);
199 return 0; 212 return 0;
200 } 213 }
201 } 214 }
202 215
203 216

http://dive4elements.wald.intevation.org