comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/WQKmsInterpolArtifact.java @ 1910:61baa34af1d4

Use single column wst interpolators from wqkmsinterpolartifact. flys-artifacts/trunk@3270 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 16 Nov 2011 14:50:19 +0000
parents 0de18085948a
children e20a47be6207
comparison
equal deleted inserted replaced
1909:4b64692b2d1e 1910:61baa34af1d4
89 if (code != null) { 89 if (code != null) {
90 String [] parts = code.split("-"); 90 String [] parts = code.split("-");
91 91
92 if (parts.length >= 4) { 92 if (parts.length >= 4) {
93 int wst = Integer.valueOf(parts[3]); 93 int wst = Integer.valueOf(parts[3]);
94 /* @TODO For certain datasets it might be necessary to 94 int col = -1;
95 * restrict on a single column of wsts. */ 95 String colpos = parts[2];
96 // int col = Integer.valueOf(parts[2]); 96 // Are we interested in a single column or in all columns?
97 //addStringData("col_pos", parts[2]); 97 if (colpos.equals("A")) {
98 ; // Take all.
99 }
100 else {
101 col = Integer.valueOf(colpos);
102 addStringData("col_pos", parts[2]);
103 }
98 addStringData("wst_id", parts[3]); 104 addStringData("wst_id", parts[3]);
99 String wkmsName = WKmsFactory.getWKmsName(wst); 105 String wkmsName = (col > 0)
106 ? WKmsFactory.getWKmsName(col, wst)
107 : WKmsFactory.getWKmsName(wst);
100 Facet facet = new WQFacet( 108 Facet facet = new WQFacet(
101 Resources.getMsg( 109 Resources.getMsg(
102 callMeta, 110 callMeta,
103 wkmsName, 111 wkmsName,
104 wkmsName)); 112 wkmsName));
165 173
166 /** 174 /**
167 * Get WQ at a given km. 175 * Get WQ at a given km.
168 */ 176 */
169 public double [][] getWQAtKm(double km) { 177 public double [][] getWQAtKm(double km) {
178
179 WstValueTable interpolator = null;
170 // Get WstValueTable 180 // Get WstValueTable
171 WstValueTable interpolator = WstValueTableFactory.getTable( 181 if (getDataAsString("col_pos") != null) {
172 getDataAsInt("wst_id")); 182 interpolator = WstValueTableFactory.getWstColumnTable(
173 // @TODO we might have to give column position for certain datasets. 183 getDataAsInt("wst_id"), getDataAsInt("col_pos"));
174 // getDataAsInt("col_pos")); 184 }
185 else {
186 interpolator = WstValueTableFactory.getTable(
187 getDataAsInt("wst_id"));
188 }
175 189
176 double [][] vs = interpolator.interpolateWQColumnwise( 190 double [][] vs = interpolator.interpolateWQColumnwise(
177 getDataAsDouble("ld_locations")); 191 getDataAsDouble("ld_locations"));
178 192
179 for (int x = 0; x < vs[1].length; x++) { 193 for (int x = 0; x < vs[1].length; x++) {

http://dive4elements.wald.intevation.org