# HG changeset patch # User Felix Wolfsteller # Date 1321439116 0 # Node ID 0de18085948ae75a7b0d22636a4f2fb85def9fbf # Parent d025009fec73905be4e89a0803b7871022fdc683 Respect position for computed discharge curve when interpolating WQs for e.g. for fixations. flys-artifacts/trunk@3266 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r d025009fec73 -r 0de18085948a flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Nov 16 09:43:58 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Nov 16 10:25:16 2011 +0000 @@ -1,3 +1,9 @@ +2011-11-16 Felix Wolfsteller + + * src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java: + Get ld_locations not locations data item to determine km. + (getDataAsDouble): New helper function to get data item as double. + 2011-11-16 Felix Wolfsteller * doc/conf/meta-data.xml: Recommend fixations for computed discharge diff -r d025009fec73 -r 0de18085948a flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java Wed Nov 16 09:43:58 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java Wed Nov 16 10:25:16 2011 +0000 @@ -146,9 +146,7 @@ logger.debug("WQKmsInterpolArtifact.initialize"); WINFOArtifact winfo = (WINFOArtifact) artifact; importData(winfo, "river"); - importData(winfo, "location"); - logger.debug("WQKmsInterpolArtifact is @(location) " + - this.getDataAsString("location")); + importData(winfo, "ld_locations"); } @@ -175,8 +173,8 @@ // @TODO we might have to give column position for certain datasets. // getDataAsInt("col_pos")); - // TODO respect given km. - double [][] vs = interpolator.interpolateWQColumnwise(44.51); + double [][] vs = interpolator.interpolateWQColumnwise( + getDataAsDouble("ld_locations")); for (int x = 0; x < vs[1].length; x++) { logger.debug("getWQAtKm: Q/W " + vs[0][x] + " / " + vs[1][x]); @@ -202,6 +200,21 @@ /** + * Get a DataItem casted to double (0 if fails). + */ + public double getDataAsDouble(String dataName) { + String val = getDataAsString(dataName); + try { + return Double.valueOf(val); + } + catch (NumberFormatException e) { + logger.warn("Could not get data " + dataName + " as double", e); + return 0; + } + } + + + /** * Get the "current" state (there is but one). * @param cc ignored. * @return the "current" (only possible) state.