13.2.1-9 baseline

Former-commit-id: a339cfb704 [formerly a339cfb704 [formerly 915d8edd4670b38df0474de72cf19c6d8b9aa1a3]]
Former-commit-id: d6dc4694f0
Former-commit-id: 03e04cbcca
This commit is contained in:
Steve Harris 2013-02-20 14:11:20 -05:00
parent 7b6e374314
commit 8b6842526e
16 changed files with 336 additions and 277 deletions

View file

@ -25,7 +25,9 @@
menuText="Convective SIGMET" id="ConvSigmet"> menuText="Convective SIGMET" id="ConvSigmet">
<dataURI>/convsigmet/%</dataURI> <dataURI>/convsigmet/%</dataURI>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/BufrNcwf.xml" menuText="NCWF" id="NCWF">
<dataURI>/bufrncwf/%</dataURI>
</contribute>
<contribute xsi:type="separator" id="separator1"/> <contribute xsi:type="separator" id="separator1"/>
<contribute xsi:type="titleItem" titleText="------ Icing Products ------" /> <contribute xsi:type="titleItem" titleText="------ Icing Products ------" />

View file

@ -2,4 +2,5 @@ source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
plugin.xml plugin.xml,\
config.xml

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration>
<DirectoryImportPath0/>
<DirectoryImportPath1/>
<DirectoryImportPath2/>
<DirectoryImportPath3/>
<DirectoryImportPath4/>
<DirectoryImportPath5/>
<DirectoryImportPath6/>
<DirectoryImportPath7/>
<DirectoryImportPath8/>
<DirectoryImportPath9/>
</configuration>

View file

@ -2,4 +2,5 @@ source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
plugin.xml plugin.xml,\
config.xml

View file

@ -76,7 +76,8 @@ import com.raytheon.viz.ui.widgets.TimeRangeEntry;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 5, 2012 randerso Initial creation * Dec 5, 2012 randerso Initial creation
* Feb 15, 2013 #1629 randerso Fix saving of default plugin to prefs
* *
* </pre> * </pre>
* *
@ -292,7 +293,7 @@ public class GisDataStoreParametersDialog extends CaveJFACEDialog {
String pluginName = prefs.getString(GIS_DATA_STORE_PLUGIN_PREF); String pluginName = prefs.getString(GIS_DATA_STORE_PLUGIN_PREF);
if (!Arrays.asList(getPluginNames()).contains(pluginName)) { if (!Arrays.asList(getPluginNames()).contains(pluginName)) {
pluginName = getPluginNames()[0]; pluginName = getPluginNames()[0];
prefs.setToDefault(GIS_DATA_STORE_PLUGIN_PREF); prefs.setValue(GIS_DATA_STORE_PLUGIN_PREF, pluginName);
try { try {
prefs.save(); prefs.save();
} catch (IOException e1) { } catch (IOException e1) {

View file

@ -25,6 +25,8 @@ import java.util.Date;
import java.util.List; import java.util.List;
import org.opengis.metadata.spatial.PixelOrientation; import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory; import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
@ -64,6 +66,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 01/29/2008 chammack Initial Class Skeleton. * 01/29/2008 chammack Initial Class Skeleton.
* 03/13/2008 879 rbell Legacy conversion. * 03/13/2008 879 rbell Legacy conversion.
* 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid * 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -337,7 +340,12 @@ public abstract class AbstractGridData implements IGridData {
} }
// perform translation // perform translation
return translateDataFrom(sourceGrid); try {
return translateDataFrom(sourceGrid);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Error translating data", e);
return false;
}
} }
@ -350,7 +358,8 @@ public abstract class AbstractGridData implements IGridData {
@Override @Override
public abstract IGridData clone() throws CloneNotSupportedException; public abstract IGridData clone() throws CloneNotSupportedException;
protected abstract boolean translateDataFrom(final IGridData source); protected abstract boolean translateDataFrom(final IGridData source)
throws FactoryException, TransformException;
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -30,6 +30,8 @@ import jep.INumpyable;
import org.apache.commons.lang.mutable.MutableByte; import org.apache.commons.lang.mutable.MutableByte;
import org.geotools.geometry.jts.JTS; import org.geotools.geometry.jts.JTS;
import org.opengis.metadata.spatial.PixelOrientation; import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
@ -69,6 +71,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* Tweak doSet() for filtered grids, fix bugs * Tweak doSet() for filtered grids, fix bugs
* 30Jan2013 #15719 jdynina Fixed allowed field size to accept more * 30Jan2013 #15719 jdynina Fixed allowed field size to accept more
* than 128 characters * than 128 characters
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* *
* </pre> * </pre>
* *
@ -215,7 +218,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
} }
@Override @Override
protected boolean translateDataFrom(IGridData sourceGrid) { protected boolean translateDataFrom(IGridData sourceGrid)
throws FactoryException, TransformException {
if (!(sourceGrid instanceof DiscreteGridData)) { if (!(sourceGrid instanceof DiscreteGridData)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Expected DiscreteGridData as source."); "Expected DiscreteGridData as source.");
@ -586,8 +590,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
// fancy code in here to prevent lots of repeated combining // fancy code in here to prevent lots of repeated combining
// for efficiency. // for efficiency.
// Make an array of byte...init to MAX_VALUE // Make an array of byte...init to MAX_VALUE
byte newValues[] = new byte[255]; byte newValues[] = new byte[255];
Arrays.fill(newValues, (byte)-1); Arrays.fill(newValues, (byte) -1);
byte[] gridA = discreteGrid.getBuffer().array(); byte[] gridA = discreteGrid.getBuffer().array();
byte[] pToSetA = pointsToSet.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array();
@ -598,10 +602,10 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
if ((byte) 1 == pToSetA[rowOffset + col]) { if ((byte) 1 == pToSetA[rowOffset + col]) {
// pointsToSet selects this grid point // pointsToSet selects this grid point
byte dataPoint = gridA[rowOffset + col]; byte dataPoint = gridA[rowOffset + col];
int dataPointIdx = 0xFF & dataPoint; int dataPointIdx = 0xFF & dataPoint;
if (dataPoint != index) { if (dataPoint != index) {
// value needs to change // value needs to change
if (newValues[dataPointIdx] == (byte)-1) { if (newValues[dataPointIdx] == (byte) -1) {
// new key hasn't been found // new key hasn't been found
DiscreteKey combinedKey = DiscreteKey.combine( DiscreteKey combinedKey = DiscreteKey.combine(
dk, getKey()[dataPointIdx]); dk, getKey()[dataPointIdx]);
@ -718,8 +722,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
// if inside grid limits, copy value to new position // if inside grid limits, copy value to new position
// of working grid. // of working grid.
if (sliceGrid.isValid(newx, newy)) { if (sliceGrid.isValid(newx, newy)) {
//byte og = originalGrid.get(i, j); // byte og = originalGrid.get(i, j);
int og = 0xFF & originalGrid.get(i, j); int og = 0xFF & originalGrid.get(i, j);
byte v = translate[og]; byte v = translate[og];
if (v == -1) { if (v == -1) {
v = lookupKeyValue(originalKey[og]); v = lookupKeyValue(originalKey[og]);
@ -899,7 +903,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
int numValues = values.getXdim() * values.getYdim(); int numValues = values.getXdim() * values.getYdim();
byte[] bp = values.getBuffer().array(); byte[] bp = values.getBuffer().array();
for (int i = 0; i < numValues; i++) { for (int i = 0; i < numValues; i++) {
if ((0xFF & bp[i]) > key.size() -1) { if ((0xFF & bp[i]) > key.size() - 1) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Illegal discrete grid (bad values) in gridSet()"); "Illegal discrete grid (bad values) in gridSet()");
} }
@ -946,7 +950,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
protected DiscreteKey doGetDiscreteValue(int x, int y) { protected DiscreteKey doGetDiscreteValue(int x, int y) {
byte gridValue = getGrid().get(x, y); byte gridValue = getGrid().get(x, y);
int gridValueIdx = 0xFF & gridValue; int gridValueIdx = 0xFF & gridValue;
return getKey()[gridValueIdx]; return getKey()[gridValueIdx];
} }
@ -1054,14 +1058,14 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
// check data values // check data values
byte[] data = grid.getBuffer().array(); byte[] data = grid.getBuffer().array();
DiscreteKey[] keys = getKey(); DiscreteKey[] keys = getKey();
//byte keySize = (byte) keys.length; // byte keySize = (byte) keys.length;
int keySize = keys.length; int keySize = keys.length;
for (int j = 0; j < data.length; j++) { for (int j = 0; j < data.length; j++) {
int value = 0xFF & data[j]; int value = 0xFF & data[j];
if (value > keySize) { if (value > keySize) {
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
+ (int) value + " Min=0 Max=" + (int) keySize); + " Min=0 Max=" + keySize);
return false; return false;
} }
} }

View file

@ -27,6 +27,9 @@ import javax.measure.converter.ConversionException;
import javax.measure.converter.UnitConverter; import javax.measure.converter.UnitConverter;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit;
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat;
@ -52,6 +55,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 01/29/2008 chammack Initial Class Skeleton. * 01/29/2008 chammack Initial Class Skeleton.
* 03/13/2008 879 rbell Legacy conversion. * 03/13/2008 879 rbell Legacy conversion.
* 05/20/2009 #2159 rjpeter Fixed doDelta * 05/20/2009 #2159 rjpeter Fixed doDelta
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -400,7 +404,8 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
} }
@Override @Override
protected boolean translateDataFrom(IGridData source) { protected boolean translateDataFrom(IGridData source)
throws FactoryException, TransformException {
if (!(source instanceof ScalarGridData)) { if (!(source instanceof ScalarGridData)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Expected ScalarGridData as source."); "Expected ScalarGridData as source.");
@ -446,14 +451,9 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
RemapGrid remap = new RemapGrid(scalarSource.getParm() RemapGrid remap = new RemapGrid(scalarSource.getParm()
.getGridInfo().getGridLoc(), this.parm.getGridInfo() .getGridInfo().getGridLoc(), this.parm.getGridInfo()
.getGridLoc()); .getGridLoc());
try { Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(),
-99999.99f, maxLimit, minLimit, minLimit);
Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(), setGrid(scalarGrid);
-99999.99f, maxLimit, minLimit, minLimit);
setGrid(scalarGrid);
} catch (Exception e) {
e.printStackTrace();
}
} }
return true; return true;
} }

View file

@ -28,6 +28,7 @@ import javax.measure.converter.UnitConverter;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.opengis.metadata.spatial.PixelOrientation; import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.FactoryException;
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit; import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit;
@ -56,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 01/29/2008 chammack Initial Class Skeleton. * 01/29/2008 chammack Initial Class Skeleton.
* 03/25/2008 879 rbell Legacy conversion. * 03/25/2008 879 rbell Legacy conversion.
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* *
* </pre> * </pre>
* *
@ -445,7 +447,8 @@ public class VectorGridData extends OrderedGridData implements Cloneable {
} }
@Override @Override
protected boolean translateDataFrom(IGridData source) { protected boolean translateDataFrom(IGridData source)
throws FactoryException {
if (!(source instanceof VectorGridData)) { if (!(source instanceof VectorGridData)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Expected VectorGridData as source."); "Expected VectorGridData as source.");

View file

@ -29,6 +29,8 @@ import jep.INumpyable;
import org.apache.commons.lang.mutable.MutableByte; import org.apache.commons.lang.mutable.MutableByte;
import org.geotools.geometry.jts.JTS; import org.geotools.geometry.jts.JTS;
import org.opengis.metadata.spatial.PixelOrientation; import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.RemapGrid; import com.raytheon.uf.common.dataplugin.gfe.RemapGrid;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GFERecord.GridType;
@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* Mar 15, 2011 randerso Initial creation * Mar 15, 2011 randerso Initial creation
* Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx * Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx
* strings * strings
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* *
* </pre> * </pre>
* *
@ -204,7 +207,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
} }
@Override @Override
protected boolean translateDataFrom(IGridData sourceGrid) { protected boolean translateDataFrom(IGridData sourceGrid)
throws FactoryException, TransformException {
if (!(sourceGrid instanceof WeatherGridData)) { if (!(sourceGrid instanceof WeatherGridData)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Expected WeatherGridData as source."); "Expected WeatherGridData as source.");
@ -566,8 +570,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
// fancy code in here to prevent lots of repeated combining // fancy code in here to prevent lots of repeated combining
// for efficiency. // for efficiency.
// Make an array of byte...init to MAX_VALUE // Make an array of byte...init to MAX_VALUE
byte newValues[] = new byte[255]; byte newValues[] = new byte[255];
Arrays.fill(newValues, (byte)-1); Arrays.fill(newValues, (byte) -1);
byte[] gridA = weatherGrid.getBuffer().array(); byte[] gridA = weatherGrid.getBuffer().array();
byte[] pToSetA = pointsToSet.getBuffer().array(); byte[] pToSetA = pointsToSet.getBuffer().array();
@ -579,10 +583,10 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
if ((byte) 1 == pToSetA[rowOffset + col]) { if ((byte) 1 == pToSetA[rowOffset + col]) {
// pointsToSet selects this grid point // pointsToSet selects this grid point
byte dataPoint = gridA[rowOffset + col]; byte dataPoint = gridA[rowOffset + col];
int dataPointIdx = 0xFF & dataPoint; int dataPointIdx = 0xFF & dataPoint;
if (dataPoint != index) { if (dataPoint != index) {
// value needs to change // value needs to change
if (newValues[dataPointIdx] == (byte)-1) { if (newValues[dataPointIdx] == (byte) -1) {
// new key hasn't been found // new key hasn't been found
WeatherKey combinedKey = new WeatherKey(wk); WeatherKey combinedKey = new WeatherKey(wk);
combinedKey.addAll(getKeys()[dataPointIdx]); combinedKey.addAll(getKeys()[dataPointIdx]);
@ -721,7 +725,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
} }
// set up translation matrix // set up translation matrix
//byte translate[] = new byte[128]; // byte translate[] = new byte[128];
byte translate[] = new byte[255]; byte translate[] = new byte[255];
Arrays.fill(translate, (byte) -1); Arrays.fill(translate, (byte) -1);
@ -761,8 +765,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
// if inside grid limits, copy value to new position // if inside grid limits, copy value to new position
// of working grid. // of working grid.
if (sliceGrid.isValid(newx, newy)) { if (sliceGrid.isValid(newx, newy)) {
//byte og = originalGrid.get(i, j); // byte og = originalGrid.get(i, j);
int og = 0xFF & originalGrid.get(i, j); int og = 0xFF & originalGrid.get(i, j);
byte v = translate[og]; byte v = translate[og];
if (v == -1) { if (v == -1) {
v = lookupKeyValue(originalKey[og]); v = lookupKeyValue(originalKey[og]);
@ -876,7 +880,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
int numValues = values.getXdim() * values.getYdim(); int numValues = values.getXdim() * values.getYdim();
byte[] bp = values.getBuffer().array(); byte[] bp = values.getBuffer().array();
for (int i = 0; i < numValues; i++) { for (int i = 0; i < numValues; i++) {
if ((0xFF & bp[i]) > key.size() -1) { if ((0xFF & bp[i]) > key.size() - 1) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Illegal weather grid (bad values) in gridSet()"); "Illegal weather grid (bad values) in gridSet()");
} }
@ -1025,14 +1029,14 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
// check data values // check data values
byte[] data = grid.getBuffer().array(); byte[] data = grid.getBuffer().array();
WeatherKey[] keys = getKeys(); WeatherKey[] keys = getKeys();
//byte keySize = (byte) keys.length; // byte keySize = (byte) keys.length;
int keySize = keys.length; int keySize = keys.length;
for (int j = 0; j < data.length; j++) { for (int j = 0; j < data.length; j++) {
int value = 0xFF & data[j]; int value = 0xFF & data[j];
if (value > keySize) { if (value > keySize) {
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
+ (int) value + " Min=0 Max=" + (int) keySize); + " Min=0 Max=" + keySize);
return false; return false;
} }
} }

View file

@ -70,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 13, 2011 #8393 dgilling Initial creation * Apr 13, 2011 #8393 dgilling Initial creation
* 02/19/13 #1637 randerso Added exception handling for Discrete and Weather
* *
* </pre> * </pre>
* *
@ -689,47 +690,43 @@ public class ASCIIGrid {
RemapGrid remap = new RemapGrid(sourceDomain, outputDomain); RemapGrid remap = new RemapGrid(sourceDomain, outputDomain);
// some data overlaps and remapping is possible // some data overlaps and remapping is possible
switch (gs.getGridInfo().getGridType()) { try {
case SCALAR: switch (gs.getGridInfo().getGridType()) {
ScalarGridSlice scalar = (ScalarGridSlice) gs; case SCALAR:
try { ScalarGridSlice scalar = (ScalarGridSlice) gs;
scalar.setScalarGrid(remap.remap(scalar.getScalarGrid(), scalar.setScalarGrid(remap.remap(scalar.getScalarGrid(),
-99999.99f, maxLimit, minLimit, minLimit)); -99999.99f, maxLimit, minLimit, minLimit));
} catch (Exception e) { break;
statusHandler.handle(Priority.PROBLEM, case VECTOR:
"Unable to remap scalar ASCIIGrid", e); VectorGridSlice vector = (VectorGridSlice) gs;
return false; Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(),
} outputDomain.getNy());
break; Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(),
case VECTOR: outputDomain.getNy());
VectorGridSlice vector = (VectorGridSlice) gs;
Grid2DFloat mag = new Grid2DFloat(outputDomain.getNx(),
outputDomain.getNy());
Grid2DFloat dir = new Grid2DFloat(outputDomain.getNx(),
outputDomain.getNy());
try {
remap.remap(vector.getMagGrid(), vector.getDirGrid(), remap.remap(vector.getMagGrid(), vector.getDirGrid(),
-99999.99f, maxLimit, minLimit, minLimit, mag, dir); -99999.99f, maxLimit, minLimit, minLimit, mag, dir);
} catch (Exception e) { vector.setMagGrid(mag);
statusHandler.handle(Priority.PROBLEM, vector.setDirGrid(dir);
"Unable to remap vector ASCIIGrid", e); break;
return false; case WEATHER:
WeatherGridSlice weather = (WeatherGridSlice) gs;
weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(),
255, 0));
break;
case DISCRETE:
DiscreteGridSlice discrete = (DiscreteGridSlice) gs;
discrete.setDiscreteGrid(remap.remap(
discrete.getDiscreteGrid(), 255, 0));
break;
default:
statusHandler.handle(Priority.WARN,
"Illegal data type detected.");
break;
} }
vector.setMagGrid(mag); } catch (Exception e) {
vector.setDirGrid(dir); statusHandler.handle(Priority.PROBLEM, "Unable to remap ASCIIGrid",
break; e);
case WEATHER: return false;
WeatherGridSlice weather = (WeatherGridSlice) gs;
weather.setWeatherGrid(remap.remap(weather.getWeatherGrid(), 255, 0));
break;
case DISCRETE:
DiscreteGridSlice discrete = (DiscreteGridSlice) gs;
discrete.setDiscreteGrid(remap.remap(discrete.getDiscreteGrid(),
255, 0));
break;
default:
statusHandler.handle(Priority.WARN, "Illegal data type detected.");
break;
} }
return true; return true;

View file

@ -28,7 +28,6 @@ from datetime import datetime
from time import gmtime,strftime from time import gmtime,strftime
from java.io import File from java.io import File
from com.raytheon.uf.common.time import TimeRange from com.raytheon.uf.common.time import TimeRange
from com.raytheon.uf.common.dataplugin.gfe import RemapGrid
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation from com.raytheon.uf.common.dataplugin.gfe.db.objects import GridLocation
from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType
from com.raytheon.edex.plugin.gfe.config import IFPServerConfig from com.raytheon.edex.plugin.gfe.config import IFPServerConfig
@ -48,6 +47,7 @@ from com.raytheon.uf.common.localization import LocalizationContext_Localization
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 07/06/09 1995 bphillip Initial Creation. # 07/06/09 1995 bphillip Initial Creation.
# 02/19/13 1637 randerso Removed unused import
# #
# #
# #

View file

@ -34,11 +34,8 @@ import javax.media.jai.PlanarImage;
import org.geotools.coverage.grid.GridCoverage2D; import org.geotools.coverage.grid.GridCoverage2D;
import org.geotools.coverage.grid.GridCoverageFactory; import org.geotools.coverage.grid.GridCoverageFactory;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.Envelope; import org.opengis.geometry.Envelope;
import org.opengis.referencing.FactoryException; import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException; import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
@ -48,11 +45,10 @@ import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DFloat;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
import com.raytheon.uf.common.geospatial.interpolation.GridReprojection; import com.raytheon.uf.common.geospatial.interpolation.GridReprojection;
import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation;
import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper;
import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; import com.raytheon.uf.common.geospatial.interpolation.data.DataSource;
import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -66,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 5/16/08 875 bphillip Initial Creation. * 5/16/08 875 bphillip Initial Creation.
* 10/10/12 #1260 randerso Added getters for source and destination glocs * 10/10/12 #1260 randerso Added getters for source and destination glocs
* 02/19/13 #1637 randerso Fixed remapping of byte grids
* *
* </pre> * </pre>
* *
@ -73,9 +70,6 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0 * @version 1.0
*/ */
public class RemapGrid { public class RemapGrid {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(RemapGrid.class);
/** The input grid location describing the source data */ /** The input grid location describing the source data */
private GridLocation sourceGloc; private GridLocation sourceGloc;
@ -95,12 +89,23 @@ public class RemapGrid {
* The source grid location describing the source data * The source grid location describing the source data
* @param destinationGloc * @param destinationGloc
* The destination grid location describing the destination data * The destination grid location describing the destination data
* @throws FactoryException
*/ */
public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc) { public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc) {
this.sourceGloc = sourceGloc; this(sourceGloc, destinationGloc, false);
this.destinationGloc = destinationGloc;
} }
/**
* Constructs a new RemapGrid with the given input and output grid locations
*
* @param sourceGloc
* The source grid location describing the source data
* @param destinationGloc
* The destination grid location describing the destination data
* @param rescale
* true if data is to be rescaled
* @throws FactoryException
*/
public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc, public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc,
boolean rescale) { boolean rescale) {
this.sourceGloc = sourceGloc; this.sourceGloc = sourceGloc;
@ -160,12 +165,14 @@ public class RemapGrid {
* @param outputFill * @param outputFill
* The output fill value * The output fill value
* @return The remapped Grid2DByte object * @return The remapped Grid2DByte object
* @throws TransformException
* @throws FactoryException
* @throws IllegalArgumentException * @throws IllegalArgumentException
* If the input dimensions do not match the source dimensions or * If the input dimensions do not match the source dimensions or
* when problems occur during resampling * when problems occur during resampling
*/ */
public Grid2DByte remap(final Grid2DByte input, byte inputFill, public Grid2DByte remap(final Grid2DByte input, byte inputFill,
byte outputFill) { byte outputFill) throws FactoryException, TransformException {
Grid2DByte retVal = null; Grid2DByte retVal = null;
@ -198,7 +205,7 @@ public class RemapGrid {
} }
public Grid2DByte remap(final Grid2DByte input, int inputFill, public Grid2DByte remap(final Grid2DByte input, int inputFill,
int outputFill) { int outputFill) throws FactoryException, TransformException {
return remap(input, (byte) inputFill, (byte) outputFill); return remap(input, (byte) inputFill, (byte) outputFill);
} }
@ -436,64 +443,40 @@ public class RemapGrid {
/** /**
* Resamples the data from the input grid location to the destination grid * Resamples the data from the input grid location to the destination grid
* location. * location
* *
* @param input * @param input
* The input data * The input data
* @return The resampled data * @return The resampled data
* @throws TransformException
* @throws FactoryException
*/ */
private Grid2DByte resample(final Grid2DByte input) { private Grid2DByte resample(final Grid2DByte input)
throws FactoryException, TransformException {
if (input.getXdim() != sourceGloc.getNx() GridGeometry2D sourceGeometry = MapUtil.getGridGeometry(sourceGloc);
|| input.getYdim() != sourceGloc.getNy()) {
statusHandler
.handle(Priority.PROBLEM,
"Cannot resample data. Input data dimensions do not match the input grid location");
return input;
}
int dx = destinationGloc.getNx(); ByteBuffer data = input.getBuffer();
int dy = destinationGloc.getNy(); ByteBuffer resampledData = null;
Grid2DByte data = new Grid2DByte(dx, dy);
Coordinate srcCoord = null; GridGeometry2D destGeometry = MapUtil.getGridGeometry(destinationGloc);
int roundedX = 0; synchronized (this) {
int roundedY = 0; if (interp == null) {
try { interp = new GridReprojection(sourceGeometry, destGeometry);
for (int x = 0; x < dx; x++) { interp.computeTransformTable();
for (int y = 0; y < dy; y++) {
srcCoord = getSourceCoord(x, y);
roundedX = (int) Math.round(srcCoord.x);
roundedY = (int) Math.round(srcCoord.y);
if (roundedX < 0 || roundedY < 0
|| roundedX >= input.getXdim()
|| roundedY >= input.getYdim()) {
data.set(x, y, 0);
} else {
data.set(x, y, input.get(roundedX, roundedY));
}
}
} }
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Error resampling byte data!", e);
} }
DataSource source = new ByteBufferWrapper(data, sourceGeometry);
resampledData = interp.reprojectedGrid(
new NearestNeighborInterpolation(), source,
new ByteBufferWrapper(destGeometry)).getBuffer();
return data; // Remap the the output data into a Grid2DFloat object
}
private Coordinate getSourceCoord(int x, int y) throws Exception { Grid2DByte retVal = new Grid2DByte(destinationGloc.getNx(),
GridGeometry2D destGeom = MapUtil.getGridGeometry(destinationGloc); destinationGloc.getNy(), resampledData);
GridGeometry2D srcGeom = MapUtil.getGridGeometry(sourceGloc);
MathTransform destToCRS = destGeom.getGridToCRS(); return retVal;
MathTransform srcGridFromCRS = srcGeom.getCRSToGrid2D();
DirectPosition destLatLon = destToCRS.transform(new DirectPosition2D(x,
y), null);
DirectPosition srcCoord = srcGridFromCRS.transform(destLatLon, null);
return new Coordinate(srcCoord.getOrdinate(0), srcCoord.getOrdinate(1));
} }
/** /**
@ -550,6 +533,8 @@ public class RemapGrid {
f1 = rasterData.getPixels(rasterData.getMinX(), f1 = rasterData.getPixels(rasterData.getMinX(),
rasterData.getMinY(), rasterData.getWidth(), rasterData.getMinY(), rasterData.getWidth(),
rasterData.getHeight(), f1); rasterData.getHeight(), f1);
JAI.getDefaultInstance().getTileCache().flush();
} else { } else {
GridGeometry2D destGeometry = MapUtil GridGeometry2D destGeometry = MapUtil
.getGridGeometry(destinationGloc); .getGridGeometry(destinationGloc);
@ -569,8 +554,6 @@ public class RemapGrid {
Grid2DFloat retVal = new Grid2DFloat(destinationGloc.getNx(), Grid2DFloat retVal = new Grid2DFloat(destinationGloc.getNx(),
destinationGloc.getNy(), f1); destinationGloc.getNy(), f1);
JAI.getDefaultInstance().getTileCache().flush();
return retVal; return retVal;
} }

View file

@ -97,6 +97,7 @@ public class NsharpResourceHandler {
private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG; private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG;
private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH; private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH;
private String paneConfigurationName; private String paneConfigurationName;
private int numTimeLinePerPage=1;
/* Hodograph Modes - definition is based on definitions in globals_xw.h of BigNsharp */ /* Hodograph Modes - definition is based on definitions in globals_xw.h of BigNsharp */
private static final int HODO_NORMAL = 0; private static final int HODO_NORMAL = 0;
//private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code //private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code
@ -324,8 +325,6 @@ public class NsharpResourceHandler {
break; break;
} }
} }
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curStnIdPage = totalStnIdPage/numTimeLinePerPage + 1;
setCurSndProfileProp(); setCurSndProfileProp();
setCurrentSoundingLayerInfo(); setCurrentSoundingLayerInfo();
resetData(); resetData();
@ -353,8 +352,6 @@ public class NsharpResourceHandler {
break; break;
} }
} }
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp(); setCurSndProfileProp();
setCurrentSoundingLayerInfo(); setCurrentSoundingLayerInfo();
resetData(); resetData();
@ -1579,21 +1576,7 @@ public class NsharpResourceHandler {
} }
//set total time line group and stn id list page number //set total time line group and stn id list page number
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; calculateTimeStnBoxData();
//fix bug, when numTimeLinePerPage ==0 case
if(numTimeLinePerPage <= 0) {
numTimeLinePerPage = 1;
totalTimeLinePage = timeLineStateList.size();
curTimeLinePage = currentTimeLineStateListIndex;
totalStnIdPage = stnStateList.size();
curStnIdPage= currentStnStateListIndex;
}
else{
totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage + 1;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
totalStnIdPage = stnStateList.size()/numTimeLinePerPage + 1;
curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1;
}
/* Chin: TBD: do we need these code? /* Chin: TBD: do we need these code?
@ -1607,7 +1590,9 @@ public class NsharpResourceHandler {
}*/ }*/
//set data time to descriptor //set data time to descriptor
//this is necessary for looping //this is necessary for looping
if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) { // starting 13.2.1, this line is changed by Raytheon
if (( skewtPaneRsc.getDescriptor().getFramesInfo().getFrameCount() == 0)&& !getTimeMatcher) {
//was this line before 13.2.1 if (( skewtPaneRsc.getDescriptor().getTimeMatcher() == null || skewtPaneRsc.getDescriptor().getTimeMatcher().getTimeMatchBasis() == null)&& !getTimeMatcher) {
//DataTime[] dataTimes = new DataTime[dataTimelineList.size()]; //DataTime[] dataTimes = new DataTime[dataTimelineList.size()];
//Chin Note: we just have to do this once and set dataTimes size bigger than 1. //Chin Note: we just have to do this once and set dataTimes size bigger than 1.
//Nsharp handles changing frame itself. It just need system to send change frame notice. //Nsharp handles changing frame itself. It just need system to send change frame notice.
@ -1650,7 +1635,6 @@ public class NsharpResourceHandler {
public void handleUserClickOnStationId(Coordinate c) { public void handleUserClickOnStationId(Coordinate c) {
int numStnIdPerPage = (cnYOrig-dtNextPageEnd)/charHeight;
//first to find if it is for change to next page, or change sorting //first to find if it is for change to next page, or change sorting
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd)); //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
int index =((int)(c.y - dtYOrig))/ charHeight; int index =((int)(c.y - dtYOrig))/ charHeight;
@ -1672,7 +1656,7 @@ public class NsharpResourceHandler {
} }
// recalculate index for time line // recalculate index for time line
index =((int)(c.y - dtNextPageEnd))/ charHeight + index =((int)(c.y - dtNextPageEnd))/ charHeight +
(curStnIdPage-1)* numStnIdPerPage ; (curStnIdPage-1)* numTimeLinePerPage ;
if( index < this.stnStateList.size() ){ if( index < this.stnStateList.size() ){
switch(stnStateList.get(index).getStnState()){ switch(stnStateList.get(index).getStnState()){
@ -1696,7 +1680,6 @@ public class NsharpResourceHandler {
} }
public void handleUserClickOnTimeLine(Coordinate c) { public void handleUserClickOnTimeLine(Coordinate c) {
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
//first to find if it is for change to next/prev page //first to find if it is for change to next/prev page
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd)); //System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
int index =((int)(c.y - dtYOrig))/ charHeight; int index =((int)(c.y - dtYOrig))/ charHeight;
@ -1833,7 +1816,6 @@ public class NsharpResourceHandler {
break; break;
} }
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1; curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp(); setCurSndProfileProp();
setCurrentSoundingLayerInfo(); setCurrentSoundingLayerInfo();
@ -1935,8 +1917,7 @@ public class NsharpResourceHandler {
} }
previousTimeLineStateListIndex = currentTimeLineStateListIndex; previousTimeLineStateListIndex = currentTimeLineStateListIndex;
currentTimeLineStateListIndex = targetIndex; currentTimeLineStateListIndex = targetIndex;
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp(); setCurSndProfileProp();
setCurrentSoundingLayerInfo(); setCurrentSoundingLayerInfo();
resetData(); resetData();
@ -2000,7 +1981,6 @@ public class NsharpResourceHandler {
break; break;
} }
} }
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curStnIdPage = currentStnStateListIndex/numTimeLinePerPage + 1; curStnIdPage = currentStnStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp(); setCurSndProfileProp();
setCurrentSoundingLayerInfo(); setCurrentSoundingLayerInfo();
@ -2744,7 +2724,8 @@ public class NsharpResourceHandler {
if(insetPaneRsc!=null) if(insetPaneRsc!=null)
insetPaneRsc.createInsetWireFrameShapes(); insetPaneRsc.createInsetWireFrameShapes();
if(skewtPaneRsc!=null) if(skewtPaneRsc!=null)
skewtPaneRsc.handleResize(); //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
} }
} }
catch(Exception e) { catch(Exception e) {
@ -2813,7 +2794,8 @@ public class NsharpResourceHandler {
nsharpNative.populateSndgData(soundingLys); nsharpNative.populateSndgData(soundingLys);
//get storm motion wind data after populate sounding from NsharpLib //get storm motion wind data after populate sounding from NsharpLib
skewtPaneRsc.setSoundingLys(soundingLys); skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize(); //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
if(hodoPaneRsc!=null){ if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.setSoundingLys(soundingLys);
hodoPaneRsc.createRscHodoWindShapeAll(); hodoPaneRsc.createRscHodoWindShapeAll();
@ -2851,11 +2833,9 @@ public class NsharpResourceHandler {
nsharpNative.populateSndgData(soundingLys); nsharpNative.populateSndgData(soundingLys);
//get storm motion wind data after populate sounding from NsharpLib //get storm motion wind data after populate sounding from NsharpLib
skewtPaneRsc.setSoundingLys(soundingLys); skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize(); //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
//skewtPaneRsc.createRscPressTempCurveShapeAll(); skewtPaneRsc.createRscWireFrameShapes();
//skewtPaneRsc.createRscwetBulbTraceShape();
//skewtPaneRsc.createRscVTempTraceShape();
//skewtPaneRsc.createParcelShapes(parcelList);
if(hodoPaneRsc!=null){ if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.setSoundingLys(soundingLys);
hodoPaneRsc.createRscHodoWindShapeAll(); hodoPaneRsc.createRscHodoWindShapeAll();
@ -2911,7 +2891,8 @@ public class NsharpResourceHandler {
} }
if(skewtPaneRsc!=null){ if(skewtPaneRsc!=null){
skewtPaneRsc.setSoundingLys(soundingLys); skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize(); //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
} }
if(hodoPaneRsc!=null){ if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.setSoundingLys(soundingLys);
@ -2951,7 +2932,8 @@ public class NsharpResourceHandler {
} }
if(skewtPaneRsc!=null){ if(skewtPaneRsc!=null){
skewtPaneRsc.setSoundingLys(soundingLys); skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize(); //CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
} }
if(hodoPaneRsc!=null){ if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys); hodoPaneRsc.setSoundingLys(soundingLys);
@ -3205,18 +3187,7 @@ public class NsharpResourceHandler {
this.dtWidth = dtWidth; this.dtWidth = dtWidth;
this.cnYOrig = cnYOrig; this.cnYOrig = cnYOrig;
this.dtNextPageEnd = dtNextPage_end; this.dtNextPageEnd = dtNextPage_end;
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight; calculateTimeStnBoxData();
if(numTimeLinePerPage<=0)
numTimeLinePerPage=1;
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage);
totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage ;
if(timeLineStateList.size()%numTimeLinePerPage != 0)
totalTimeLinePage= totalTimeLinePage+1;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage+1;
totalStnIdPage = stnStateList.size()/numTimeLinePerPage;
if(stnStateList.size()%numTimeLinePerPage != 0)
totalStnIdPage++;
curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1; //NEW CODE
} }
/*public void setCharHeight(int charHeight) { /*public void setCharHeight(int charHeight) {
@ -3233,5 +3204,20 @@ public class NsharpResourceHandler {
return paneConfigurationName; return paneConfigurationName;
} }
private void calculateTimeStnBoxData(){
//set total time line group and stn id list page number
numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
if(numTimeLinePerPage<=0)
numTimeLinePerPage=1;
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage);
totalTimeLinePage = timeLineStateList.size()/numTimeLinePerPage ;
if(timeLineStateList.size()%numTimeLinePerPage != 0)
totalTimeLinePage= totalTimeLinePage+1;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage+1;
totalStnIdPage = stnStateList.size()/numTimeLinePerPage;
if(stnStateList.size()%numTimeLinePerPage != 0)
totalStnIdPage++;
curStnIdPage= currentStnStateListIndex/numTimeLinePerPage + 1;
}
} }

View file

@ -83,12 +83,15 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
} }
private void drawNsharpColorNotation(IGraphicsTarget target, Rectangle rect) throws VizException { private void drawNsharpColorNotation(IGraphicsTarget target, Rectangle rect) throws VizException {
PixelExtent extent = new PixelExtent(rect); PixelExtent extent = new PixelExtent(rect);
RGB color; RGB color;
target.setupClippingPlane(extent); target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
//plot notations: //plot notations:
if(dtHeight >= paneHeight)
return;
//draw time line page title etc. only when pane box height is larger than timeline box height
double x = cnXOrig+5*xRatio; double x = cnXOrig+5*xRatio;
double y = cnYOrig+1.5*charHeight; double y = cnYOrig+1.5*charHeight;
//double xGap = paneWidth/3*xRatio; //double xGap = paneWidth/3*xRatio;
@ -135,50 +138,60 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
PixelExtent extent = new PixelExtent(rect); PixelExtent extent = new PixelExtent(rect);
target.setupClippingPlane(extent); target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
double x = dtXOrig; double x;
double y = dtYOrig-1.5*charHeight*yRatio; double y;
String s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage; String s;
target.drawString(font10, s, x, if(dtHeight < paneHeight){
y, 0.0, //draw time line page title etc. only when pane box height is larger than timeline box height
IGraphicsTarget.TextStyle.NORMAL, x = dtXOrig;
NsharpConstants.color_green, y = dtYOrig-1.5*charHeight*yRatio;
HorizontalAlignment.LEFT, s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
VerticalAlignment.TOP, null); target.drawString(font10, s, x,
y = dtYOrig; y, 0.0,
target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); IGraphicsTarget.TextStyle.NORMAL,
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); NsharpConstants.color_green,
HorizontalAlignment.LEFT,
VerticalAlignment.TOP, null);
y = dtYOrig;
target.drawLine(dtXOrig, y, 0.0,dtXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
x = dtXOrig +dtWidth/2; x = dtXOrig +dtWidth/2;
// line divide nextPage and prevPage strings // line divide nextPage and prevPage strings
target.drawLine(x, y, 0.0, target.drawLine(x, y, 0.0,
x , y+1.2*charHeight*yRatio, 0.0, x , y+1.2*charHeight*yRatio, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID); NsharpConstants.color_white,1, LineStyle.SOLID);
x = dtXOrig + 5; x = dtXOrig + 5;
y = y+1.2*charHeight*yRatio; y = y+1.2*charHeight*yRatio;
s = "nextPage"; s = "nextPage";
target.drawString(font10, s, x, target.drawString(font10, s, x,
y, 0.0, y, 0.0,
IGraphicsTarget.TextStyle.NORMAL, IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow, NsharpConstants.color_yellow,
HorizontalAlignment.LEFT, HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null); VerticalAlignment.BOTTOM, null);
x= dtXOrig + dtWidth/2 + 5; x= dtXOrig + dtWidth/2 + 5;
s = "prevPage"; s = "prevPage";
target.drawString(font10, s, x, target.drawString(font10, s, x,
y, 0.0, y, 0.0,
IGraphicsTarget.TextStyle.NORMAL, IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow, NsharpConstants.color_yellow,
HorizontalAlignment.LEFT, HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null); VerticalAlignment.BOTTOM, null);
//line below nextPage string
target.drawLine(dtXOrig, y, 0.0,
dtXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
//line below nextPage string
target.drawLine(dtXOrig, y, 0.0,
dtXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
}
int numTimeLineToShowPerPage = (cnYOrig-dtNextPageEnd)/charHeight; int numTimeLineToShowPerPage = (cnYOrig-dtNextPageEnd)/charHeight;
if(numTimeLineToShowPerPage <1){
numTimeLineToShowPerPage = dtHeight/charHeight;
if(numTimeLineToShowPerPage <1)
numTimeLineToShowPerPage=1;
}
int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage; int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage;
if(timeLineStateList!= null){ if(timeLineStateList!= null){
@ -257,50 +270,60 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
PixelExtent extent = new PixelExtent(rect); PixelExtent extent = new PixelExtent(rect);
target.setupClippingPlane(extent); target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f); target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
double x = stnXOrig; double x;
double y = stnYOrig -1.5*charHeight*yRatio; double y;
String s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage; String s;
target.drawString(font10, s, x, if(dtHeight < paneHeight){
y, 0.0, //draw time line page title etc. only when pane box height is larger than timeline box height
IGraphicsTarget.TextStyle.NORMAL, x = stnXOrig;
NsharpConstants.color_green, y = stnYOrig -1.5*charHeight*yRatio;
HorizontalAlignment.LEFT, s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
VerticalAlignment.TOP, null); target.drawString(font10, s, x,
y = dtYOrig; y, 0.0,
target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID); IGraphicsTarget.TextStyle.NORMAL,
//System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr); NsharpConstants.color_green,
x = stnXOrig +dtWidth/2; HorizontalAlignment.LEFT,
// line divide nextPage and prevPage strings VerticalAlignment.TOP, null);
target.drawLine(x, y, 0.0, y = dtYOrig;
x , y+1.2*charHeight*yRatio, 0.0, target.drawLine(stnXOrig, y, 0.0,stnXEnd , y, 0.0,NsharpConstants.color_white,1, LineStyle.SOLID);
NsharpConstants.color_white,1, LineStyle.SOLID); //System.out.println("drawNsharpDataTimelines picked stn info: "+ pickedStnInfoStr);
x = stnXOrig +dtWidth/2;
// line divide nextPage and prevPage strings
target.drawLine(x, y, 0.0,
x , y+1.2*charHeight*yRatio, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
x = stnXOrig + 5;
y = y+1.2*charHeight*yRatio;
s = "nextPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
x= stnXOrig + dtWidth/2 + 5;
s = "prevPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
//line below neextPage string
target.drawLine(stnXOrig, y, 0.0,
stnXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
}
x = stnXOrig + 5;
y = y+1.2*charHeight*yRatio;
s = "nextPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
x= stnXOrig + dtWidth/2 + 5;
s = "prevPage";
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
NsharpConstants.color_yellow,
HorizontalAlignment.LEFT,
VerticalAlignment.BOTTOM, null);
//line below neextPage string
target.drawLine(stnXOrig, y, 0.0,
stnXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight; int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight;
if(numStnToShow <1){
numStnToShow = dtHeight/charHeight;
if(numStnToShow <1)
numStnToShow=1;
}
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow; int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
int compIndex= 1; int compIndex= 1;
int colorIndex; int colorIndex;
@ -453,16 +476,26 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
float prevWidth = paneWidth; float prevWidth = paneWidth;
paneHeight = (int) ext.getHeight(); paneHeight = (int) ext.getHeight();
paneWidth = (int) (ext.getWidth()); paneWidth = (int) (ext.getWidth());
xRatio = xRatio* paneWidth/prevWidth; //xRatio = xRatio* paneWidth/prevWidth;
yRatio = yRatio* paneHeight/prevHeight; //DEBUGGING yRatio = yRatio* paneHeight/prevHeight;
//charHeight = (int)(NsharpConstants.CHAR_HEIGHT_*yRatio); xRatio = 1;
yRatio = 1;
//if pane height is less than 10 char height, then just plot time line. not plot "messages/title/notations" etc..
if(paneHeight > (int)(10* charHeight*yRatio)){
dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio);
cnHeight = (int)(3* charHeight*yRatio);
dtHeight = paneHeight-(int)(5* charHeight*yRatio);
dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio);
}
else {
dtYOrig = (int) (ext.getMinY());
cnHeight = 0;
dtHeight = paneHeight;
dtNextPageEnd = dtYOrig;
}
dtXOrig = (int) (ext.getMinX()); dtXOrig = (int) (ext.getMinX());
dtYOrig = (int) ext.getMinY()+(int)(2* charHeight*yRatio);
dtWidth = paneWidth/2; dtWidth = paneWidth/2;
dtXEnd = dtXOrig + dtWidth; dtXEnd = dtXOrig + dtWidth;
cnHeight = (int)(3* charHeight*yRatio);
dtHeight = paneHeight-dtYOrig-cnHeight;
dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio);
stnXOrig = dtXEnd; stnXOrig = dtXEnd;
stnYOrig = dtYOrig; stnYOrig = dtYOrig;
stnWidth = dtWidth; stnWidth = dtWidth;

View file

@ -13,6 +13,7 @@ function setupEnv() {
nasHost=nas1 nasHost=nas1
nasVolName=dataFXA # This is so we can change it for new nas! nasVolName=dataFXA # This is so we can change it for new nas!
lsofCommand="lsof -Pns -p" lsofCommand="lsof -Pns -p"
platformName=$( hostname | cut -f2 -d'-')
if [[ ${logDirectory}/${logName} -ot ${logDirectory}/$( basename $0 .sh ).$(date --date='1 day ago' +%A).log ]] if [[ ${logDirectory}/${logName} -ot ${logDirectory}/$( basename $0 .sh ).$(date --date='1 day ago' +%A).log ]]
then then
@ -100,6 +101,11 @@ function runlsof() {
function captureQpidStat() { function captureQpidStat() {
local returnCode=0 local returnCode=0
local qpidConnLimit=500
case "${platformName}" in
[a-z][a-z][a-z]n ) qpidConnLimit=1000 ; echo -e "\tNOTE: Setting Max qpidd connection to 1000 due to NCEP site" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out ;;
esac
echo -ne "\n| START " >> ${logDirectory}/${nowTimeDate}-qpid-stat.out echo -ne "\n| START " >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
echoDate >> ${logDirectory}/${nowTimeDate}-qpid-stat.out echoDate >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
@ -108,6 +114,22 @@ function captureQpidStat() {
numQpidConnections=$( qpid-stat -c | wc -l ) numQpidConnections=$( qpid-stat -c | wc -l )
(( numQpidConnections-=3 )) (( numQpidConnections-=3 ))
echo -e "Total Number of QPID Connections: ${numQpidConnections}" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out echo -e "Total Number of QPID Connections: ${numQpidConnections}" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
if [[ ${numQpidConnections} -ge $(( qpidConnLimit - 50 )) && ${numQpidConnections} -le $(( qpidConnLimit - 15 )) ]] ; then
echo -e "\tNOTE: Sending Major ITO to NCF because number of connections is between 450 and 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then
opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is between 450-485: Please check system health" severity=Major msg_grp=AWIPS
else
echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
fi
elif [[ ${numQpidConnections} -gt $(( qpidConnLimit - 15 )) ]] ; then
echo -e "\tNOTE: Sending CRITIAL ITO to NCF because number of connections is > 485" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
if [[ -f /opt/OV/bin/OpC/opcmsg ]] ; then
/opt/OV/bin/OpC/opcmsg application=QPIDD object=QPIDD msg_text="Number Of Connections To QPID is > 485 -- Take IMMEDIATE action to prevent system failure" severity=Critical msg_grp=AWIPS
else
echo -e "\tERROR - can not find /opt/OV/bin/OpC/opcmsg on $( hostname )" >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
fi
fi
echo >> ${logDirectory}/${nowTimeDate}-qpid-stat.out echo >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
for cmdArg in "-b" "-c" "-s" "-e" "-q -Smsg" for cmdArg in "-b" "-c" "-s" "-e" "-q -Smsg"