From c0a6bcf21526f15c4ae765e27f5f1e0cee4549e0 Mon Sep 17 00:00:00 2001 From: Steve Harris Date: Mon, 4 Feb 2013 16:36:29 -0500 Subject: [PATCH] 13.2.1-5 baseline Former-commit-id: 05c2ca86f4b73a3367831533e4cbf2d90d7d3df4 [formerly 1a74d2f0c5b451c4756b408509192b71c2d82279] [formerly b4014794deccf872302bb9d04771d3b63701406e] [formerly f99f99e2f577787f1b4e4c6de1b14f60d6f56fa6 [formerly b4014794deccf872302bb9d04771d3b63701406e [formerly 7a6958217f8b67edac937a23cb1c2ae8a89cedce]]] Former-commit-id: f99f99e2f577787f1b4e4c6de1b14f60d6f56fa6 Former-commit-id: 3422292903b976eeee7ff48443c918b662079695 [formerly 418d8ca0d8117f682c98ce8c104fa0f9ae96e988] Former-commit-id: 39cb931bc9ea384e768bd837f4d7a1597baa63c6 --- .../gfe/core/griddata/DiscreteGridData.java | 39 ++-- .../gfe/core/griddata/WeatherGridData.java | 40 ++-- .../src/com/raytheon/viz/warngen/gis/Wx.java | 84 +++++--- .../gfe/slice/DiscreteGridSlice.java | 23 ++- .../gfe/slice/WeatherGridSlice.java | 32 +-- .../gfe/slice/DiscreteGridSliceTest.java | 189 +++++++++++++++++- .../config/PointSourceConfiguration.java | 12 ++ .../uf/edex/dat/utils/FreezingLevel.java | 44 ++-- 8 files changed, 350 insertions(+), 113 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java index f61fb64209..d80900ecc9 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/DiscreteGridData.java @@ -67,6 +67,8 @@ import com.vividsolutions.jts.geom.MultiPolygon; * 05Aug2008 #1383 ebabin Fix for time shift not working. * 06Nov2008 #1591 wdougherty Fix isValid() so it can return true * Tweak doSet() for filtered grids, fix bugs + * 30Jan2013 #15719 jdynina Fixed allowed field size to accept more + * than 128 characters * * * @@ -154,7 +156,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { for (int newy = j - ss; newy <= j + ss; newy++) { // if inside grid limits, make a smoothed value if (originalGrid.isValid(newx, newy)) { - histo[originalGrid.get(newx, newy)]++; + histo[0xFF & originalGrid.get(newx, newy)]++; } } } @@ -251,7 +253,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { public WxValue getWxValue(int x, int y) { // throw new UnsupportedOperationException("Attempt to getWxValue: "); populate(); - int index = getGrid().get(x, y); + int index = 0xFF & getGrid().get(x, y); DiscreteWxValue tmpDiscreteWxValue = new DiscreteWxValue( getKey()[index], getParm()); @@ -584,8 +586,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // fancy code in here to prevent lots of repeated combining // for efficiency. // Make an array of byte...init to MAX_VALUE - byte newValues[] = new byte[Byte.MAX_VALUE]; - Arrays.fill(newValues, Byte.MAX_VALUE); + byte newValues[] = new byte[255]; + Arrays.fill(newValues, (byte)-1); byte[] gridA = discreteGrid.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array(); @@ -596,18 +598,19 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { if ((byte) 1 == pToSetA[rowOffset + col]) { // pointsToSet selects this grid point byte dataPoint = gridA[rowOffset + col]; + int dataPointIdx = 0xFF & dataPoint; if (dataPoint != index) { // value needs to change - if (newValues[dataPoint] == Byte.MAX_VALUE) { + if (newValues[dataPointIdx] == (byte)-1) { // new key hasn't been found DiscreteKey combinedKey = DiscreteKey.combine( - dk, getKey()[dataPoint]); + dk, getKey()[dataPointIdx]); // Store new key index in lookup table - newValues[dataPoint] = lookupKeyValue(combinedKey); + newValues[dataPointIdx] = lookupKeyValue(combinedKey); } // Update the grid - gridA[rowOffset + col] = newValues[dataPoint]; + gridA[rowOffset + col] = newValues[dataPointIdx]; } } } @@ -676,7 +679,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { } // set up translation matrix - byte translate[] = new byte[128]; + byte translate[] = new byte[255]; Arrays.fill(translate, (byte) -1); // get the grid @@ -715,7 +718,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // if inside grid limits, copy value to new position // of working grid. if (sliceGrid.isValid(newx, newy)) { - byte og = originalGrid.get(i, j); + //byte og = originalGrid.get(i, j); + int og = 0xFF & originalGrid.get(i, j); byte v = translate[og]; if (v == -1) { v = lookupKeyValue(originalKey[og]); @@ -895,7 +899,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { int numValues = values.getXdim() * values.getYdim(); byte[] bp = values.getBuffer().array(); for (int i = 0; i < numValues; i++) { - if (bp[i] + 1 > key.size()) { + if ((0xFF & bp[i]) > key.size() -1) { throw new IllegalArgumentException( "Illegal discrete grid (bad values) in gridSet()"); } @@ -918,7 +922,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { for (int i = 0; i < dim.x; i++) { for (int j = 0; j < dim.y; j++) { if (points.get(i, j) == 1) { - grid.set(i, j, remap[values.get(i, j)]); + grid.set(i, j, remap[0xFF & values.get(i, j)]); } } } @@ -942,7 +946,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { protected DiscreteKey doGetDiscreteValue(int x, int y) { byte gridValue = getGrid().get(x, y); - return getKey()[gridValue]; + int gridValueIdx = 0xFF & gridValue; + return getKey()[gridValueIdx]; } /* @@ -1049,12 +1054,14 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable { // check data values byte[] data = grid.getBuffer().array(); DiscreteKey[] keys = getKey(); - byte keySize = (byte) keys.length; + //byte keySize = (byte) keys.length; + int keySize = keys.length; for (int j = 0; j < data.length; j++) { - if (data[j] > keySize) { + int value = 0xFF & data[j]; + if (value > keySize) { statusHandler.handle(Priority.PROBLEM, emsg + "Data=" - + (int) data[j] + " Min=0 Max=" + (int) keySize); + + (int) value + " Min=0 Max=" + (int) keySize); return false; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java index 5b4168bac7..4f0e1390e8 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/griddata/WeatherGridData.java @@ -63,6 +63,8 @@ import com.vividsolutions.jts.geom.MultiPolygon; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 15, 2011 randerso Initial creation + * Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx + * strings * * * @@ -150,7 +152,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // if inside grid limits, make a // smoothed value if (originalGrid.isValid(newx, newy)) { - histo[originalGrid.get(newx, newy)]++; + histo[0xFF & originalGrid.get(newx, newy)]++; } } } @@ -240,7 +242,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { public WxValue getWxValue(int x, int y) { // throw new UnsupportedOperationException("Attempt to getWxValue: "); populate(); - int index = getGrid().get(x, y); + int index = 0xFF & getGrid().get(x, y); WeatherWxValue tmpWeatherWxValue = new WeatherWxValue(getKeys()[index], getParm()); @@ -564,8 +566,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // fancy code in here to prevent lots of repeated combining // for efficiency. // Make an array of byte...init to MAX_VALUE - byte newValues[] = new byte[Byte.MAX_VALUE]; - Arrays.fill(newValues, Byte.MAX_VALUE); + byte newValues[] = new byte[255]; + Arrays.fill(newValues, (byte)-1); byte[] gridA = weatherGrid.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array(); @@ -577,18 +579,19 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { if ((byte) 1 == pToSetA[rowOffset + col]) { // pointsToSet selects this grid point byte dataPoint = gridA[rowOffset + col]; + int dataPointIdx = 0xFF & dataPoint; if (dataPoint != index) { // value needs to change - if (newValues[dataPoint] == Byte.MAX_VALUE) { + if (newValues[dataPointIdx] == (byte)-1) { // new key hasn't been found WeatherKey combinedKey = new WeatherKey(wk); - combinedKey.addAll(getKeys()[dataPoint]); + combinedKey.addAll(getKeys()[dataPointIdx]); // Store new key index in lookup table - newValues[dataPoint] = lookupKeyValue(combinedKey); + newValues[dataPointIdx] = lookupKeyValue(combinedKey); } // Update the grid - gridA[rowOffset + col] = newValues[dataPoint]; + gridA[rowOffset + col] = newValues[dataPointIdx]; } } } @@ -718,7 +721,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { } // set up translation matrix - byte translate[] = new byte[128]; + //byte translate[] = new byte[128]; + byte translate[] = new byte[255]; Arrays.fill(translate, (byte) -1); // get the grid @@ -757,7 +761,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // if inside grid limits, copy value to new position // of working grid. if (sliceGrid.isValid(newx, newy)) { - byte og = originalGrid.get(i, j); + //byte og = originalGrid.get(i, j); + int og = 0xFF & originalGrid.get(i, j); byte v = translate[og]; if (v == -1) { v = lookupKeyValue(originalKey[og]); @@ -871,7 +876,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { int numValues = values.getXdim() * values.getYdim(); byte[] bp = values.getBuffer().array(); for (int i = 0; i < numValues; i++) { - if (bp[i] + 1 > key.size()) { + if ((0xFF & bp[i]) > key.size() -1) { throw new IllegalArgumentException( "Illegal weather grid (bad values) in gridSet()"); } @@ -888,7 +893,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { for (int i = 0; i < dim.x; i++) { for (int j = 0; j < dim.y; j++) { if (points.get(i, j) == 1) { - grid.set(i, j, remap[values.get(i, j)]); + grid.set(i, j, remap[0xFF & values.get(i, j)]); } } } @@ -912,7 +917,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { protected WeatherKey doGetWeatherValue(int x, int y) { byte gridValue = getGrid().get(x, y); - return getKeys()[gridValue]; + int gridValueIdx = 0xFF & gridValue; + return getKeys()[gridValueIdx]; } /* @@ -1019,12 +1025,14 @@ public class WeatherGridData extends AbstractGridData implements INumpyable { // check data values byte[] data = grid.getBuffer().array(); WeatherKey[] keys = getKeys(); - byte keySize = (byte) keys.length; + //byte keySize = (byte) keys.length; + int keySize = keys.length; for (int j = 0; j < data.length; j++) { - if (data[j] > keySize) { + int value = 0xFF & data[j]; + if (value > keySize) { statusHandler.handle(Priority.PROBLEM, emsg + "Data=" - + (int) data[j] + " Min=0 Max=" + (int) keySize); + + (int) value + " Min=0 Max=" + (int) keySize); return false; } } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java index f80698498e..fc157905b8 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java @@ -100,7 +100,8 @@ import com.vividsolutions.jts.geom.Point; * in pathcast. * Oct 05, 2012 DR15429 Qinglu Lin Updated code to keep duplicate names of cities * which are at different locations in pathcast. - * Oct 17, 2012 jsanchez Moved the path cast data collecting to a seperate class. + * Oct 17, 2012 jsanchez Moved the path cast data collecting to a separate class. + * Jan 31, 2013 1557 jsanchez Used allowDuplicates flag to collect points with duplicate names. * * * @@ -618,6 +619,7 @@ public class Wx { // All configs should have the same "isWithinPolygon" flag boolean isWithinPolygon = pointConfigs[0].isWithinPolygon(); + boolean allowDuplicates = pointConfigs[0].isAllowDuplicates(); // Sort by fields should have been validated to be same as well List fields = pointConfigs[0].getSortBy() != null ? Arrays @@ -702,12 +704,14 @@ public class Wx { GeodeticCalculator gc = new GeodeticCalculator(); Map nameMap = new HashMap( (int) (availablePoints.size() * 1.3)); + List pointsWithinDistance = new ArrayList(); for (int i = 0; i < coords.length; ++i) { Coordinate coord = localCoords[i]; Geometry localDistanceGeom = dimensions == 1 ? localSearchArea : gf .createPoint(coord); Geometry distanceGeom = dimensions == 1 ? searchArea : gf .createPoint(coords[i]); + pointsWithinDistance.clear(); nameMap.clear(); for (ClosestPoint cp : availablePoints) { @@ -716,33 +720,31 @@ public class Wx { double distance = localDistanceGeom.distance(localPt); if (distance <= thresholdInMeters) { - // check map of currently added points for closer point with - // the same name - ClosestPoint existingPt = nameMap.get(cp.name); - if (existingPt == null || distance < existingPt.distance) { - // Set the distances - ClosestPoint cp2 = new ClosestPoint(cp); - cp2.distance = distance; - cp2.roundedDistance = (int) metersToDistance - .convert(distance); - gc.setStartingGeographicPoint(cp2.point.x, cp2.point.y); - Coordinate cen = distanceGeom.getCentroid() - .getCoordinate(); - cen = GisUtil.restoreAlaskaLon(cen); - gc.setDestinationGeographicPoint(cen.x, cen.y); - cp2.azimuth = gc.getAzimuth(); - cp2.oppositeAzimuth = ClosestPoint - .adjustAngle(cp2.azimuth + 180); - cp2.roundedAzimuth = GeoUtil.roundAzimuth(cp2.azimuth); - cp2.oppositeRoundedAzimuth = ClosestPoint - .adjustAngle(cp2.roundedAzimuth + 180); - nameMap.put(cp2.name, cp2); + if (allowDuplicates) { + // collect all points that are within the threshold + ClosestPoint cp2 = createClosestPoint(cp, distance, + metersToDistance, distanceGeom, gc); + pointsWithinDistance.add(cp2); + } else { + // check map of currently added points for closer point + // with the same name + ClosestPoint existingPt = nameMap.get(cp.name); + if (existingPt == null + || distance < existingPt.distance) { + ClosestPoint cp2 = createClosestPoint(cp, distance, + metersToDistance, distanceGeom, gc); + nameMap.put(cp2.name, cp2); + } } } } - List pts = new ArrayList( - nameMap.values()); + List pts = null; + if (allowDuplicates) { + pts = new ArrayList(pointsWithinDistance); + } else { + pts = new ArrayList(nameMap.values()); + } if (fields.isEmpty() == false) { // Sort the points based on sortBy fields Collections.sort(pts, new ClosestPointComparator(fields)); @@ -817,6 +819,40 @@ public class Wx { return null; } + /** + * Helper method to create a ClosestPoint object. + * + * @param cp + * @param distance + * between the cp to the + * @param metersToDistance + * Unit converter to calculate the rounded distance. + * @param distanceGeom + * Geometry search area. + * @param gc + * Geodetic Calculator to determine the azimuth + * @return ClosestPoint object set with roundedDistance, azimuth, etc. + */ + private ClosestPoint createClosestPoint(ClosestPoint cp, double distance, + UnitConverter metersToDistance, Geometry distanceGeom, + GeodeticCalculator gc) { + // Set the distances + ClosestPoint cp2 = new ClosestPoint(cp); + cp2.distance = distance; + cp2.roundedDistance = (int) metersToDistance.convert(distance); + gc.setStartingGeographicPoint(cp2.point.x, cp2.point.y); + Coordinate cen = GisUtil.restoreAlaskaLon(distanceGeom.getCentroid() + .getCoordinate()); + gc.setDestinationGeographicPoint(cen.x, cen.y); + cp2.azimuth = gc.getAzimuth(); + cp2.oppositeAzimuth = ClosestPoint.adjustAngle(cp2.azimuth + 180); + cp2.roundedAzimuth = GeoUtil.roundAzimuth(cp2.azimuth); + cp2.oppositeRoundedAzimuth = ClosestPoint + .adjustAngle(cp2.roundedAzimuth + 180); + + return cp2; + } + public double getMovementSpeed() { return getMovementSpeed(null); } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSlice.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSlice.java index ca8a1dbebe..40b38d8428 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSlice.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSlice.java @@ -54,6 +54,8 @@ import com.raytheon.uf.common.time.TimeRange; * 01/29/2008 chammack Initial Creation. * 02/13/2008 879 rbell Legacy conversion * 06/10/2009 2159 rjpeter Updated checkDims to check grid for null + * 01/30/2013 15719 jdynina Allowed more than 128 char width wx + * string * * * @author chammack @@ -233,8 +235,8 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { byte[] thisData = grid.getBuffer().array(); byte[] rhsData = rhsGrid.getBuffer().array(); for (int i = 0; i < thisData.length; i++) { - if (!this.key[thisData[i]] - .equals(rhsDiscreteGridSlice.key[rhsData[i]])) { + if (!this.key[0xFF & thisData[i]] + .equals(rhsDiscreteGridSlice.key[0xFF & rhsData[i]])) { return false; } } @@ -254,10 +256,11 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { Grid2DByte discreteGrid = getDiscreteGrid(); byte[] b = discreteGrid.getBuffer().array(); for (int i = 0; i < b.length; i++) { - if (b[i] >= keyLength) { + int index = 0xFF & b[i]; + if (index >= keyLength) { return "Data Values Exceeded in Grid at coordinate: " + (i % discreteGrid.getXdim()) + "," - + (i / discreteGrid.getXdim()) + " Value=" + b[i] + + (i / discreteGrid.getXdim()) + " Value=" + index + " MinAllowed=0 MaxAllowed=" + (keyLength - 1); } } @@ -365,7 +368,7 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { if (editArea.get(i, j) != 0) { // Get the DiscreteKey from the source grid byte dByte = gsDiscreteGrid.get(i, j); - DiscreteKey dKey = gs.key[dByte]; + DiscreteKey dKey = gs.key[0xFF & dByte]; // See if this key already exists in target grid boolean found = false; byte keyIndex = 0; @@ -445,9 +448,9 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { List currentKeys = new ArrayList( Arrays.asList(this.key)); byte[] data = discreteGrid.getBuffer().array(); - byte thisB; + int thisB; for (int i = 0; i < data.length; i++) { - thisB = data[i]; + thisB = 0xFF & data[i]; byte keyIndex; if ((keyIndex = (byte) currentKeys.indexOf(gs.key[thisB])) != -1) { data[i] = keyIndex; @@ -599,7 +602,7 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { byte[] rhsB = gs.getDiscreteGrid().getBuffer().array(); byte[] b = bits.getBuffer().array(); for (int i = 0; i < thisB.length; i++) { - if (key[thisB[i]].equals(gs.key[rhsB[i]])) { + if (key[0xFF & thisB[i]].equals(gs.key[0xFF & rhsB[i]])) { b[i] = (byte) 1; } } @@ -659,9 +662,9 @@ public class DiscreteGridSlice extends AbstractGridSlice implements Cloneable { DiscreteKey newKey[] = new DiscreteKey[usedKeys.size()]; for (Iterator usedKeysI = usedKeys.iterator(); usedKeysI .hasNext(); keyIndex++) { - Byte thisByte = usedKeysI.next(); + byte thisByte = usedKeysI.next(); discreteGrid.setAllOfValue(thisByte, (byte) keyIndex); - newKey[keyIndex] = key[thisByte.intValue()]; + newKey[keyIndex] = key[0xFF & thisByte]; } setDiscreteGrid(discreteGrid); diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/WeatherGridSlice.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/WeatherGridSlice.java index 89a95ec2f2..aba75e680e 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/WeatherGridSlice.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/src/com/raytheon/uf/common/dataplugin/gfe/slice/WeatherGridSlice.java @@ -53,6 +53,7 @@ import com.raytheon.uf.common.time.TimeRange; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 15, 2011 randerso Initial creation + * Jan 30, 2013 15719 jdynina Allowed more than 128 char wx string * * * @@ -235,7 +236,8 @@ public class WeatherGridSlice extends AbstractGridSlice { byte[] thisData = grid.getBuffer().array(); byte[] rhsData = rhsGrid.getBuffer().array(); for (int i = 0; i < thisData.length; i++) { - if (!this.keys[thisData[i]].equals(slice.keys[rhsData[i]])) { + if (!this.keys[0xFF & thisData[i]] + .equals(slice.keys[0xFF & rhsData[i]])) { return false; } } @@ -255,10 +257,11 @@ public class WeatherGridSlice extends AbstractGridSlice { Grid2DByte weatherGrid = getWeatherGrid(); byte[] b = weatherGrid.getBuffer().array(); for (int i = 0; i < b.length; i++) { - if (b[i] >= keyLength) { + int index = 0xFF & b[i]; + if (index >= keyLength) { return "Data Values Exceeded in Grid at coordinate: " + (i % weatherGrid.getXdim()) + "," - + (i / weatherGrid.getXdim()) + " Value=" + b[i] + + (i / weatherGrid.getXdim()) + " Value=" + index + " MinAllowed=0 MaxAllowed=" + (keyLength - 1); } } @@ -366,7 +369,7 @@ public class WeatherGridSlice extends AbstractGridSlice { if (editArea.get(i, j) != 0) { // Get the WeatherKey from the source grid byte dByte = gsWeatherGrid.get(i, j); - WeatherKey dKey = gs.keys[dByte]; + WeatherKey dKey = gs.keys[0xFF & dByte]; // See if this key already exists in target grid boolean found = false; byte keyIndex = 0; @@ -445,14 +448,16 @@ public class WeatherGridSlice extends AbstractGridSlice { List currentKeys = new ArrayList( Arrays.asList(this.keys)); - byte[] b = weatherGrid.getBuffer().array(); - for (int i = 0; i < b.length; i++) { + byte[] data = weatherGrid.getBuffer().array(); + int thisB; + for (int i = 0; i < data.length; i++) { + thisB = 0xFF & data[i]; byte keyIndex; - if ((keyIndex = (byte) currentKeys.indexOf(gs.keys[b[i]])) != -1) { - b[i] = keyIndex; + if ((keyIndex = (byte) currentKeys.indexOf(gs.keys[thisB])) != -1) { + data[i] = keyIndex; } else { - b[i] = (byte) currentKeys.size(); - currentKeys.add(new WeatherKey(gs.keys[b[i]])); + data[i] = (byte) currentKeys.size(); + currentKeys.add(new WeatherKey(gs.keys[thisB])); } } @@ -601,7 +606,7 @@ public class WeatherGridSlice extends AbstractGridSlice { byte[] rhsB = gs.getWeatherGrid().getBuffer().array(); byte[] b = bits.getBuffer().array(); for (int i = 0; i < thisB.length; i++) { - if (keys[thisB[i]].equals(gs.keys[rhsB[i]])) { + if (keys[0xFF & thisB[i]].equals(gs.keys[0xFF & rhsB[i]])) { b[i] = (byte) 1; } } @@ -644,7 +649,7 @@ public class WeatherGridSlice extends AbstractGridSlice { // process the grid for (int i = 0; i < weatherGrid.getXdim(); i++) { for (int j = 0; j < weatherGrid.getYdim(); j++) { - used[weatherGrid.get(i, j)] = true; + used[0xFF & weatherGrid.get(i, j)] = true; } } // indicate used @@ -681,7 +686,8 @@ public class WeatherGridSlice extends AbstractGridSlice { // now remap the data for (int i = 0; i < weatherGrid.getXdim(); i++) { for (int j = 0; j < weatherGrid.getYdim(); j++) { - weatherGrid.set(i, j, (byte) invMapping[weatherGrid.get(i, j)]); + weatherGrid.set(i, j, + (byte) invMapping[0xFF & weatherGrid.get(i, j)]); } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/test/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSliceTest.java b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/test/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSliceTest.java index ab260ac5a9..09cd3be33c 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/test/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSliceTest.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/test/com/raytheon/uf/common/dataplugin/gfe/slice/DiscreteGridSliceTest.java @@ -24,8 +24,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import junit.framework.Assert; - +import org.junit.Assert; import org.junit.Test; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; @@ -53,6 +52,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 02/27/2008 879 rbell Initial Creation. + * 01/30/2013 15719 jdynina Allowed more than 128 chars in wx string * * * @@ -65,10 +65,149 @@ public class DiscreteGridSliceTest { List dkd = new ArrayList(); { dkd.add(new DiscreteKeyDef("", "No Data")); - dkd.add(new DiscreteKeyDef("A", "Alpha")); - dkd.add(new DiscreteKeyDef("B", "Beta")); + dkd.add(new DiscreteKeyDef("A", "Alfa")); + dkd.add(new DiscreteKeyDef("B", "Bravo")); dkd.add(new DiscreteKeyDef("C", "Charlie")); dkd.add(new DiscreteKeyDef("D", "Delta")); + dkd.add(new DiscreteKeyDef("E", "Echo")); + dkd.add(new DiscreteKeyDef("F", "Foxtrot")); + dkd.add(new DiscreteKeyDef("G", "Golf")); + dkd.add(new DiscreteKeyDef("H", "Hotel")); + dkd.add(new DiscreteKeyDef("I", "India")); + dkd.add(new DiscreteKeyDef("J", "Juliet")); + dkd.add(new DiscreteKeyDef("K", "Kilo")); + dkd.add(new DiscreteKeyDef("L", "Lima")); + dkd.add(new DiscreteKeyDef("M", "Mike")); + dkd.add(new DiscreteKeyDef("N", "November")); + dkd.add(new DiscreteKeyDef("O", "Oscar")); + dkd.add(new DiscreteKeyDef("P", "Papa")); + dkd.add(new DiscreteKeyDef("Q", "Quebec")); + dkd.add(new DiscreteKeyDef("R", "Romeo")); + dkd.add(new DiscreteKeyDef("S", "Sierra")); + dkd.add(new DiscreteKeyDef("T", "Tango")); + dkd.add(new DiscreteKeyDef("U", "Uniform")); + dkd.add(new DiscreteKeyDef("V", "Victor")); + dkd.add(new DiscreteKeyDef("W", "Whiskey")); + dkd.add(new DiscreteKeyDef("X", "Xray")); + dkd.add(new DiscreteKeyDef("Y", "Yankee")); + dkd.add(new DiscreteKeyDef("Z", "Zulu")); + dkd.add(new DiscreteKeyDef("AA", "Alfa Alfa")); + dkd.add(new DiscreteKeyDef("AB", "Alfa Bravo")); + dkd.add(new DiscreteKeyDef("AC", "Alfa Charlie")); + dkd.add(new DiscreteKeyDef("AD", "Alfa Delta")); + dkd.add(new DiscreteKeyDef("AE", "Alfa Echo")); + dkd.add(new DiscreteKeyDef("AF", "Alfa Foxtrot")); + dkd.add(new DiscreteKeyDef("AG", "Alfa Golf")); + dkd.add(new DiscreteKeyDef("AH", "Alfa Hotel")); + dkd.add(new DiscreteKeyDef("AI", "Alfa India")); + dkd.add(new DiscreteKeyDef("AJ", "Alfa Juliet")); + dkd.add(new DiscreteKeyDef("AK", "Alfa Kilo")); + dkd.add(new DiscreteKeyDef("AL", "Alfa Lima")); + dkd.add(new DiscreteKeyDef("AM", "Alfa Mike")); + dkd.add(new DiscreteKeyDef("AN", "Alfa November")); + dkd.add(new DiscreteKeyDef("AO", "Alfa Oscar")); + dkd.add(new DiscreteKeyDef("AP", "Alfa Papa")); + dkd.add(new DiscreteKeyDef("AQ", "Alfa Quebec")); + dkd.add(new DiscreteKeyDef("AR", "Alfa Romeo")); + dkd.add(new DiscreteKeyDef("AS", "Alfa Sierra")); + dkd.add(new DiscreteKeyDef("AT", "Alfa Tango")); + dkd.add(new DiscreteKeyDef("AU", "Alfa Uniform")); + dkd.add(new DiscreteKeyDef("AV", "Alfa Victor")); + dkd.add(new DiscreteKeyDef("AW", "Alfa Whiskey")); + dkd.add(new DiscreteKeyDef("AX", "Alfa Xray")); + dkd.add(new DiscreteKeyDef("AY", "Alfa Yankee")); + dkd.add(new DiscreteKeyDef("AZ", "Alfa Zulu")); + dkd.add(new DiscreteKeyDef("BA", "Bravo Alfa")); + dkd.add(new DiscreteKeyDef("BB", "Bravo Bravo")); + dkd.add(new DiscreteKeyDef("BC", "Bravo Charlie")); + dkd.add(new DiscreteKeyDef("BD", "Bravo Delta")); + dkd.add(new DiscreteKeyDef("BE", "Bravo Echo")); + dkd.add(new DiscreteKeyDef("BF", "Bravo Foxtrot")); + dkd.add(new DiscreteKeyDef("BG", "Bravo Golf")); + dkd.add(new DiscreteKeyDef("BH", "Bravo Hotel")); + dkd.add(new DiscreteKeyDef("BI", "Bravo India")); + dkd.add(new DiscreteKeyDef("BJ", "Bravo Juliet")); + dkd.add(new DiscreteKeyDef("BK", "Bravo Kilo")); + dkd.add(new DiscreteKeyDef("BL", "Bravo Lima")); + dkd.add(new DiscreteKeyDef("BM", "Bravo Mike")); + dkd.add(new DiscreteKeyDef("BN", "Bravo November")); + dkd.add(new DiscreteKeyDef("BO", "Bravo Oscar")); + dkd.add(new DiscreteKeyDef("BP", "Bravo Papa")); + dkd.add(new DiscreteKeyDef("BQ", "Bravo Quebec")); + dkd.add(new DiscreteKeyDef("BR", "Bravo Romeo")); + dkd.add(new DiscreteKeyDef("BS", "Bravo Sierra")); + dkd.add(new DiscreteKeyDef("BT", "Bravo Tango")); + dkd.add(new DiscreteKeyDef("BU", "Bravo Uniform")); + dkd.add(new DiscreteKeyDef("BV", "Bravo Victor")); + dkd.add(new DiscreteKeyDef("BW", "Bravo Whiskey")); + dkd.add(new DiscreteKeyDef("BX", "Bravo Xray")); + dkd.add(new DiscreteKeyDef("BY", "Bravo Yankee")); + dkd.add(new DiscreteKeyDef("BZ", "Bravo Zulu")); + dkd.add(new DiscreteKeyDef("CA", "Charlie Alfa")); + dkd.add(new DiscreteKeyDef("CB", "Charlie Bravo")); + dkd.add(new DiscreteKeyDef("CC", "Charlie Charlie")); + dkd.add(new DiscreteKeyDef("CD", "Charlie Delta")); + dkd.add(new DiscreteKeyDef("CE", "Charlie Echo")); + dkd.add(new DiscreteKeyDef("CF", "Charlie Foxtrot")); + dkd.add(new DiscreteKeyDef("CG", "Charlie Golf")); + dkd.add(new DiscreteKeyDef("CH", "Charlie Hotel")); + dkd.add(new DiscreteKeyDef("CI", "Charlie India")); + dkd.add(new DiscreteKeyDef("CJ", "Charlie Juliet")); + dkd.add(new DiscreteKeyDef("CK", "Charlie Kilo")); + dkd.add(new DiscreteKeyDef("CL", "Charlie Lima")); + dkd.add(new DiscreteKeyDef("CM", "Charlie Mike")); + dkd.add(new DiscreteKeyDef("CN", "Charlie November")); + dkd.add(new DiscreteKeyDef("CO", "Charlie Oscar")); + dkd.add(new DiscreteKeyDef("CP", "Charlie Papa")); + dkd.add(new DiscreteKeyDef("CQ", "Charlie Quebec")); + dkd.add(new DiscreteKeyDef("CR", "Charlie Romeo")); + dkd.add(new DiscreteKeyDef("CS", "Charlie Sierra")); + dkd.add(new DiscreteKeyDef("CT", "Charlie Tango")); + dkd.add(new DiscreteKeyDef("CU", "Charlie Uniform")); + dkd.add(new DiscreteKeyDef("CV", "Charlie Victor")); + dkd.add(new DiscreteKeyDef("CW", "Charlie Whiskey")); + dkd.add(new DiscreteKeyDef("CX", "Charlie Xray")); + dkd.add(new DiscreteKeyDef("CY", "Charlie Yankee")); + dkd.add(new DiscreteKeyDef("CZ", "Charlie Zulu")); + dkd.add(new DiscreteKeyDef("DA", "Delta Alfa")); + dkd.add(new DiscreteKeyDef("DB", "Delta Bravo")); + dkd.add(new DiscreteKeyDef("DC", "Delta Charlie")); + dkd.add(new DiscreteKeyDef("DD", "Delta Delta")); + dkd.add(new DiscreteKeyDef("DE", "Delta Echo")); + dkd.add(new DiscreteKeyDef("DF", "Delta Foxtrot")); + dkd.add(new DiscreteKeyDef("DG", "Delta Golf")); + dkd.add(new DiscreteKeyDef("DH", "Delta Hotel")); + dkd.add(new DiscreteKeyDef("DI", "Delta India")); + dkd.add(new DiscreteKeyDef("DJ", "Delta Juliet")); + dkd.add(new DiscreteKeyDef("DK", "Delta Kilo")); + dkd.add(new DiscreteKeyDef("DL", "Delta Lima")); + dkd.add(new DiscreteKeyDef("DM", "Delta Mike")); + dkd.add(new DiscreteKeyDef("DN", "Delta November")); + dkd.add(new DiscreteKeyDef("DO", "Delta Oscar")); + dkd.add(new DiscreteKeyDef("DP", "Delta Papa")); + dkd.add(new DiscreteKeyDef("DQ", "Delta Quebec")); + dkd.add(new DiscreteKeyDef("DR", "Delta Romeo")); + dkd.add(new DiscreteKeyDef("DS", "Delta Sierra")); + dkd.add(new DiscreteKeyDef("DT", "Delta Tango")); + dkd.add(new DiscreteKeyDef("DU", "Delta Uniform")); + dkd.add(new DiscreteKeyDef("DV", "Delta Victor")); + dkd.add(new DiscreteKeyDef("DW", "Delta Whiskey")); + dkd.add(new DiscreteKeyDef("DX", "Delta Xray")); + dkd.add(new DiscreteKeyDef("DY", "Delta Yankee")); + dkd.add(new DiscreteKeyDef("DZ", "Delta Zulu")); + dkd.add(new DiscreteKeyDef("EA", "Echo Alfa")); + dkd.add(new DiscreteKeyDef("EB", "Echo Bravo")); + dkd.add(new DiscreteKeyDef("EC", "Echo Charlie")); + dkd.add(new DiscreteKeyDef("ED", "Echo Delta")); + dkd.add(new DiscreteKeyDef("EE", "Echo Echo")); + dkd.add(new DiscreteKeyDef("EF", "Echo Foxtrot")); + dkd.add(new DiscreteKeyDef("EG", "Echo Golf")); + dkd.add(new DiscreteKeyDef("EH", "Echo Hotel")); + dkd.add(new DiscreteKeyDef("EI", "Echo India")); + dkd.add(new DiscreteKeyDef("EJ", "Echo Juliet")); + dkd.add(new DiscreteKeyDef("EK", "Echo Kilo")); + dkd.add(new DiscreteKeyDef("EL", "Echo Lima")); + dkd.add(new DiscreteKeyDef("EM", "Echo Mike")); } String siteId = "XXX"; @@ -127,8 +266,8 @@ public class DiscreteGridSliceTest { private final DiscreteKey testDKA1[] = { this.testDK2 }; // ///////////////////////////////////////////////////////////////////////// - private final byte testBA2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15 }; + private final byte testBA2[] = { -128, -127, -126, -125, -124, -123, -122, + -121, -120, -119, -118, -117, -116, -115, -114, -113 }; private final Grid2DByte testG2DB2 = new Grid2DByte(4, 4, this.testBA2); @@ -142,6 +281,38 @@ public class DiscreteGridSliceTest { private final GridDataHistory testGDHA2[] = new GridDataHistory[1]; private final DiscreteKey testDKA2[] = { this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, + this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, this.testDK2, @@ -259,11 +430,13 @@ public class DiscreteGridSliceTest { public final void testCheckKeyAndData() { DiscreteGridSlice test1 = new DiscreteGridSlice(this.testTR2, this.testGPI2, this.testGDHA2, this.testG2DB2, this.testDKA2); - Assert.assertNull(test1.checkKeyAndData()); + String result = test1.checkKeyAndData(); + Assert.assertNull(result); DiscreteGridSlice test2 = new DiscreteGridSlice(this.testTR2, this.testGPI2, this.testGDHA2, this.testG2DB2, new DiscreteKey[15]); - Assert.assertNotNull(test2.checkKeyAndData()); + result = test2.checkKeyAndData(); + Assert.assertNotNull(result); } /** diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java index 0ec069c298..c193e92ff6 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/config/PointSourceConfiguration.java @@ -26,6 +26,7 @@ import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 17, 2011 mschenke Initial creation + * Jan 31, 2013 1557 jsanchez Added the XMLElement allowDuplicates. * * * @@ -80,6 +81,9 @@ public class PointSourceConfiguration { @XmlElement private double distanceThreshold = 10; + @XmlElement + protected boolean allowDuplicates = false; + @XmlElementWrapper(name = "sortBy") @XmlElement(name = "sort") private String[] sortBy; @@ -173,4 +177,12 @@ public class PointSourceConfiguration { this.type = type; } + public boolean isAllowDuplicates() { + return allowDuplicates; + } + + public void setAllowDuplicates(boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java index 900b8b37e1..9b5af71041 100644 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/FreezingLevel.java @@ -54,6 +54,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 19Nov 2011 dhladky Initial creation + * 29 Jan 2013 15729 wkwock fix the algorithm * * * @@ -122,11 +123,9 @@ public class FreezingLevel { try { resultPoint = PointUtil.determineExactIndex( coor, crs, mapGeometry); - System.out.println("Freezing level -- lat,lon:"+coor+" = "+resultPoint); return resultPoint; } catch (Exception e) { - System.out.println("Error: Freezing level -- unable to find x,y coordinate for lat,lon:"+coor); - e.printStackTrace(); + logger.error("Error: Freezing level -- unable to find x,y coordinate for lat,lon:"+coor); } return null; } @@ -138,12 +137,12 @@ public class FreezingLevel { * @return bi-linear interpolation amount the nearest 4 points * @throws VizException */ - public double getValue(String modelName, String prodType, Coordinate coor) { + public Double getValue(String modelName, String prodType, Coordinate coor) { double value = -99999.0; try { //xyLoc is the location in x,y DirectPosition2D xyLoc = findXYloc(coor, prodType); - + //data from hdf5 ScanDataCache cache = ScanDataCache.getInstance(); GridRecord gribRec = cache.getModelData().getGridRecord(modelName, prodType); @@ -151,9 +150,11 @@ public class FreezingLevel { //dimension of the record from hdf5, recNx =151 and recNy=113 during development int recNx = gribRec.getSpatialObject().getNx(); - int recNy = gribRec.getSpatialObject().getNy(); //get four nearest points/values form the record around xyLoc + xyLoc.y=xyLoc.y * 0.9941; //A special adjustment due to PointUtil.determineExactIndex + xyLoc.x=xyLoc.x * 0.9983; // is not as accurate as A1 + int x0=(int)(xyLoc.x); int x1=x0+1; int y0=(int)(xyLoc.y); @@ -164,19 +165,19 @@ public class FreezingLevel { double p3=xyLoc.y-y0; double p4=1-p3; - double value2 = rec.getFloatData()[(recNx * y0) + x0]; - double value3 = rec.getFloatData()[(recNx * y0) + x1]; - double value0 = rec.getFloatData()[(recNx * y1) + x0]; - double value1 = rec.getFloatData()[(recNx * y1) + x1]; + double value0 = rec.getFloatData()[(recNx * y0) + x0]; + double value1 = rec.getFloatData()[(recNx * y0) + x1]; + double value2 = rec.getFloatData()[(recNx * y1) + x0]; + double value3 = rec.getFloatData()[(recNx * y1) + x1]; //do a bi-linear interpolation amount the nearest 4 points value = (p1*p4*value1)+(p2*p4*value0)+(p1*p3*value3)+(p2*p3*value2); - logger.info("bi-linear interpolation value: "+value+" "+value0+" "+value1+ - " "+value2+" "+value3+" for coor:"+coor+" "+recNx+","+recNy); + logger.info("bi-linear interpolation: "+value+"-->("+value0+","+value1+ + ","+value2+","+value3+") at "+xyLoc); } catch (Exception e) { logger.error("No Grib value available....." + modelName + " " + prodType+" lat,lon:"+coor); - e.printStackTrace(); + return null; } return value; } @@ -219,9 +220,6 @@ public class FreezingLevel { int foundValFlag=-1;//-1=all ghValue and tValue are null, //0=all ghValue<=-9000 and tValue<=273.16, 1=found a fLevel - System.out - .println("********** Starting Freezing Level Calculations *****************"); - TreeSet ts= new TreeSet(ghValues.keySet());//want an asc sorted list Iterator it = ts.iterator(); @@ -231,8 +229,6 @@ public class FreezingLevel { Double tValue = tValues.get(level); Double ghValue = ghValues.get(level); - System.out.println("GH Value: " + ghValue + " TValue: " - + tValue); if (ghValue != null && tValue != null && foundValFlag ==-1){ foundValFlag=0; @@ -245,14 +241,13 @@ public class FreezingLevel { .get(ktopLevel) - ghValue) * ((273.16 - tValues .get(jtopLevel)) / (tValue - tValues .get(jtopLevel))))) * .00328; - System.out.println("Formula:"); - System.out.println("(" + ghValues.get(ktopLevel) + logger.error("***Freezing level: "+fLevel+"=" + + "(" + ghValues.get(ktopLevel) + " - ((" + ghValues.get(ktopLevel) + " - " + ghValue + ") * ((273.16 - " + tValues.get(jtopLevel) + ") / (" + tValue + " - " + tValues.get(jtopLevel) + ")))) * .00328"); - System.out.println("*** FreezingLevel = " + fLevel); foundValFlag=1; freezingMap.put(coor, fLevel.floatValue()); break; @@ -265,11 +260,8 @@ public class FreezingLevel { if (foundValFlag==0) {//this means all tValue are <= 273.16 freezingMap.put(coor, 0.0f); - System.out.println("*** FreezingLevel = 0.0"); + logger.error("*** FreezingLevel = 0.0"); } - - System.out - .println("********** Finished Freezing Level Calculations *****************"); } return freezingMap; @@ -357,7 +349,7 @@ public class FreezingLevel { paramXML.setModelName(model); paramXML.setParameterName(param); String sql = getSQL(interval, model, param, refTime); - System.out.println("Freezing level sql="+sql); + logger.info("Freezing level sql="+sql); GridRecord modelRec = DATUtils.getMostRecentGridRecord(interval, sql, paramXML);