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">
<dataURI>/convsigmet/%</dataURI>
</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="titleItem" titleText="------ Icing Products ------" />

View file

@ -2,4 +2,5 @@ source.. = src/
output.. = bin/
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/
bin.includes = META-INF/,\
.,\
plugin.xml
plugin.xml,\
config.xml

View file

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

View file

@ -25,6 +25,8 @@ import java.util.Date;
import java.util.List;
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.db.objects.GFERecord.GridType;
@ -64,6 +66,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 01/29/2008 chammack Initial Class Skeleton.
* 03/13/2008 879 rbell Legacy conversion.
* 06/10/2009 2159 rjpeter Updated isValid to call gridSlice.isValid
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* </pre>
*
* @author chammack
@ -337,7 +340,12 @@ public abstract class AbstractGridData implements IGridData {
}
// perform translation
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
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)

View file

@ -30,6 +30,8 @@ import jep.INumpyable;
import org.apache.commons.lang.mutable.MutableByte;
import org.geotools.geometry.jts.JTS;
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.db.objects.GFERecord.GridType;
@ -69,6 +71,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* Tweak doSet() for filtered grids, fix bugs
* 30Jan2013 #15719 jdynina Fixed allowed field size to accept more
* than 128 characters
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
*
* </pre>
*
@ -215,7 +218,8 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
}
@Override
protected boolean translateDataFrom(IGridData sourceGrid) {
protected boolean translateDataFrom(IGridData sourceGrid)
throws FactoryException, TransformException {
if (!(sourceGrid instanceof DiscreteGridData)) {
throw new IllegalArgumentException(
"Expected DiscreteGridData as source.");
@ -587,7 +591,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
// for efficiency.
// Make an array of byte...init to MAX_VALUE
byte newValues[] = new byte[255];
Arrays.fill(newValues, (byte)-1);
Arrays.fill(newValues, (byte) -1);
byte[] gridA = discreteGrid.getBuffer().array();
byte[] pToSetA = pointsToSet.getBuffer().array();
@ -601,7 +605,7 @@ public class DiscreteGridData extends AbstractGridData implements INumpyable {
int dataPointIdx = 0xFF & dataPoint;
if (dataPoint != index) {
// value needs to change
if (newValues[dataPointIdx] == (byte)-1) {
if (newValues[dataPointIdx] == (byte) -1) {
// new key hasn't been found
DiscreteKey combinedKey = DiscreteKey.combine(
dk, getKey()[dataPointIdx]);
@ -718,7 +722,7 @@ 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) {
@ -899,7 +903,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 ((0xFF & bp[i]) > key.size() -1) {
if ((0xFF & bp[i]) > key.size() - 1) {
throw new IllegalArgumentException(
"Illegal discrete grid (bad values) in gridSet()");
}
@ -1054,14 +1058,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++) {
int value = 0xFF & data[j];
if (value > keySize) {
statusHandler.handle(Priority.PROBLEM, emsg + "Data="
+ (int) value + " Min=0 Max=" + (int) keySize);
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
+ " Min=0 Max=" + keySize);
return false;
}
}

View file

@ -27,6 +27,9 @@ import javax.measure.converter.ConversionException;
import javax.measure.converter.UnitConverter;
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.grid.Grid2DBit;
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.
* 03/13/2008 879 rbell Legacy conversion.
* 05/20/2009 #2159 rjpeter Fixed doDelta
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* </pre>
*
* @author chammack
@ -400,7 +404,8 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
}
@Override
protected boolean translateDataFrom(IGridData source) {
protected boolean translateDataFrom(IGridData source)
throws FactoryException, TransformException {
if (!(source instanceof ScalarGridData)) {
throw new IllegalArgumentException(
"Expected ScalarGridData as source.");
@ -446,14 +451,9 @@ public class ScalarGridData extends OrderedGridData implements Cloneable {
RemapGrid remap = new RemapGrid(scalarSource.getParm()
.getGridInfo().getGridLoc(), this.parm.getGridInfo()
.getGridLoc());
try {
Grid2DFloat scalarGrid = remap.remap(scalarSource.getGrid(),
-99999.99f, maxLimit, minLimit, minLimit);
setGrid(scalarGrid);
} catch (Exception e) {
e.printStackTrace();
}
}
return true;
}

View file

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

View file

@ -29,6 +29,8 @@ import jep.INumpyable;
import org.apache.commons.lang.mutable.MutableByte;
import org.geotools.geometry.jts.JTS;
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.db.objects.GFERecord.GridType;
@ -65,6 +67,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* Mar 15, 2011 randerso Initial creation
* Jan 30, 2013 #15719 jdynina Allowed more than 128 chars in wx
* strings
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
*
* </pre>
*
@ -204,7 +207,8 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
}
@Override
protected boolean translateDataFrom(IGridData sourceGrid) {
protected boolean translateDataFrom(IGridData sourceGrid)
throws FactoryException, TransformException {
if (!(sourceGrid instanceof WeatherGridData)) {
throw new IllegalArgumentException(
"Expected WeatherGridData as source.");
@ -567,7 +571,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
// for efficiency.
// Make an array of byte...init to MAX_VALUE
byte newValues[] = new byte[255];
Arrays.fill(newValues, (byte)-1);
Arrays.fill(newValues, (byte) -1);
byte[] gridA = weatherGrid.getBuffer().array();
byte[] pToSetA = pointsToSet.getBuffer().array();
@ -582,7 +586,7 @@ public class WeatherGridData extends AbstractGridData implements INumpyable {
int dataPointIdx = 0xFF & dataPoint;
if (dataPoint != index) {
// value needs to change
if (newValues[dataPointIdx] == (byte)-1) {
if (newValues[dataPointIdx] == (byte) -1) {
// new key hasn't been found
WeatherKey combinedKey = new WeatherKey(wk);
combinedKey.addAll(getKeys()[dataPointIdx]);
@ -721,7 +725,7 @@ 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);
@ -761,7 +765,7 @@ 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) {
@ -876,7 +880,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 ((0xFF & bp[i]) > key.size() -1) {
if ((0xFF & bp[i]) > key.size() - 1) {
throw new IllegalArgumentException(
"Illegal weather grid (bad values) in gridSet()");
}
@ -1025,14 +1029,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++) {
int value = 0xFF & data[j];
if (value > keySize) {
statusHandler.handle(Priority.PROBLEM, emsg + "Data="
+ (int) value + " Min=0 Max=" + (int) keySize);
statusHandler.handle(Priority.PROBLEM, emsg + "Data=" + value
+ " Min=0 Max=" + keySize);
return false;
}
}

View file

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

View file

@ -28,7 +28,6 @@ from datetime import datetime
from time import gmtime,strftime
from java.io import File
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.reference import ReferenceData_CoordinateType as CoordinateType
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
# ------------ ---------- ----------- --------------------------
# 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.GridCoverageFactory;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.geometry.DirectPosition;
import org.opengis.geometry.Envelope;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
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.interpolation.BilinearInterpolation;
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.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;
/**
@ -66,6 +62,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* 5/16/08 875 bphillip Initial Creation.
* 10/10/12 #1260 randerso Added getters for source and destination glocs
* 02/19/13 #1637 randerso Fixed remapping of byte grids
*
* </pre>
*
@ -73,9 +70,6 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
public class RemapGrid {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(RemapGrid.class);
/** The input grid location describing the source data */
private GridLocation sourceGloc;
@ -95,12 +89,23 @@ public class RemapGrid {
* The source grid location describing the source data
* @param destinationGloc
* The destination grid location describing the destination data
* @throws FactoryException
*/
public RemapGrid(GridLocation sourceGloc, GridLocation destinationGloc) {
this.sourceGloc = sourceGloc;
this.destinationGloc = destinationGloc;
this(sourceGloc, destinationGloc, false);
}
/**
* 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,
boolean rescale) {
this.sourceGloc = sourceGloc;
@ -160,12 +165,14 @@ public class RemapGrid {
* @param outputFill
* The output fill value
* @return The remapped Grid2DByte object
* @throws TransformException
* @throws FactoryException
* @throws IllegalArgumentException
* If the input dimensions do not match the source dimensions or
* when problems occur during resampling
*/
public Grid2DByte remap(final Grid2DByte input, byte inputFill,
byte outputFill) {
byte outputFill) throws FactoryException, TransformException {
Grid2DByte retVal = null;
@ -198,7 +205,7 @@ public class RemapGrid {
}
public Grid2DByte remap(final Grid2DByte input, int inputFill,
int outputFill) {
int outputFill) throws FactoryException, TransformException {
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
* location.
* location
*
* @param input
* The input 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()
|| input.getYdim() != sourceGloc.getNy()) {
statusHandler
.handle(Priority.PROBLEM,
"Cannot resample data. Input data dimensions do not match the input grid location");
return input;
}
GridGeometry2D sourceGeometry = MapUtil.getGridGeometry(sourceGloc);
int dx = destinationGloc.getNx();
int dy = destinationGloc.getNy();
Grid2DByte data = new Grid2DByte(dx, dy);
Coordinate srcCoord = null;
int roundedX = 0;
int roundedY = 0;
try {
for (int x = 0; x < dx; x++) {
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));
}
ByteBuffer data = input.getBuffer();
ByteBuffer resampledData = null;
GridGeometry2D destGeometry = MapUtil.getGridGeometry(destinationGloc);
synchronized (this) {
if (interp == null) {
interp = new GridReprojection(sourceGeometry, destGeometry);
interp.computeTransformTable();
}
}
} 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 {
GridGeometry2D destGeom = MapUtil.getGridGeometry(destinationGloc);
GridGeometry2D srcGeom = MapUtil.getGridGeometry(sourceGloc);
Grid2DByte retVal = new Grid2DByte(destinationGloc.getNx(),
destinationGloc.getNy(), resampledData);
MathTransform destToCRS = destGeom.getGridToCRS();
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));
return retVal;
}
/**
@ -550,6 +533,8 @@ public class RemapGrid {
f1 = rasterData.getPixels(rasterData.getMinX(),
rasterData.getMinY(), rasterData.getWidth(),
rasterData.getHeight(), f1);
JAI.getDefaultInstance().getTileCache().flush();
} else {
GridGeometry2D destGeometry = MapUtil
.getGridGeometry(destinationGloc);
@ -569,8 +554,6 @@ public class RemapGrid {
Grid2DFloat retVal = new Grid2DFloat(destinationGloc.getNx(),
destinationGloc.getNy(), f1);
JAI.getDefaultInstance().getTileCache().flush();
return retVal;
}

View file

@ -97,6 +97,7 @@ public class NsharpResourceHandler {
private int dtYOrig = NsharpConstants.DATA_TIMELINE_Y_ORIG;
private int dtWidth = NsharpConstants.DATA_TIMELINE_WIDTH;
private String paneConfigurationName;
private int numTimeLinePerPage=1;
/* Hodograph Modes - definition is based on definitions in globals_xw.h of BigNsharp */
private static final int HODO_NORMAL = 0;
//private static int HODO_EFFECTIVE= 1; not used in BigNsharp source code
@ -324,8 +325,6 @@ public class NsharpResourceHandler {
break;
}
}
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curStnIdPage = totalStnIdPage/numTimeLinePerPage + 1;
setCurSndProfileProp();
setCurrentSoundingLayerInfo();
resetData();
@ -353,8 +352,6 @@ public class NsharpResourceHandler {
break;
}
}
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp();
setCurrentSoundingLayerInfo();
resetData();
@ -1579,21 +1576,7 @@ public class NsharpResourceHandler {
}
//set total time line group and stn id list page number
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
//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;
}
calculateTimeStnBoxData();
/* Chin: TBD: do we need these code?
@ -1607,7 +1590,9 @@ public class NsharpResourceHandler {
}*/
//set data time to descriptor
//this is necessary for looping
// 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()];
//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.
@ -1650,7 +1635,6 @@ public class NsharpResourceHandler {
public void handleUserClickOnStationId(Coordinate c) {
int numStnIdPerPage = (cnYOrig-dtNextPageEnd)/charHeight;
//first to find if it is for change to next page, or change sorting
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
int index =((int)(c.y - dtYOrig))/ charHeight;
@ -1672,7 +1656,7 @@ public class NsharpResourceHandler {
}
// recalculate index for time line
index =((int)(c.y - dtNextPageEnd))/ charHeight +
(curStnIdPage-1)* numStnIdPerPage ;
(curStnIdPage-1)* numTimeLinePerPage ;
if( index < this.stnStateList.size() ){
switch(stnStateList.get(index).getStnState()){
@ -1696,7 +1680,6 @@ public class NsharpResourceHandler {
}
public void handleUserClickOnTimeLine(Coordinate c) {
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
//first to find if it is for change to next/prev page
//System.out.println("numTimeLinePerPage="+numTimeLinePerPage+"gap="+(cnYOrig-dtNextPageEnd));
int index =((int)(c.y - dtYOrig))/ charHeight;
@ -1833,7 +1816,6 @@ public class NsharpResourceHandler {
break;
}
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp();
setCurrentSoundingLayerInfo();
@ -1935,7 +1917,6 @@ public class NsharpResourceHandler {
}
previousTimeLineStateListIndex = currentTimeLineStateListIndex;
currentTimeLineStateListIndex = targetIndex;
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curTimeLinePage = currentTimeLineStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp();
setCurrentSoundingLayerInfo();
@ -2000,7 +1981,6 @@ public class NsharpResourceHandler {
break;
}
}
int numTimeLinePerPage = (cnYOrig-dtNextPageEnd)/charHeight;
curStnIdPage = currentStnStateListIndex/numTimeLinePerPage + 1;
setCurSndProfileProp();
setCurrentSoundingLayerInfo();
@ -2744,7 +2724,8 @@ public class NsharpResourceHandler {
if(insetPaneRsc!=null)
insetPaneRsc.createInsetWireFrameShapes();
if(skewtPaneRsc!=null)
skewtPaneRsc.handleResize();
//CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
}
}
catch(Exception e) {
@ -2813,7 +2794,8 @@ public class NsharpResourceHandler {
nsharpNative.populateSndgData(soundingLys);
//get storm motion wind data after populate sounding from NsharpLib
skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize();
//CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys);
hodoPaneRsc.createRscHodoWindShapeAll();
@ -2851,11 +2833,9 @@ public class NsharpResourceHandler {
nsharpNative.populateSndgData(soundingLys);
//get storm motion wind data after populate sounding from NsharpLib
skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize();
//skewtPaneRsc.createRscPressTempCurveShapeAll();
//skewtPaneRsc.createRscwetBulbTraceShape();
//skewtPaneRsc.createRscVTempTraceShape();
//skewtPaneRsc.createParcelShapes(parcelList);
//CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys);
hodoPaneRsc.createRscHodoWindShapeAll();
@ -2911,7 +2891,8 @@ public class NsharpResourceHandler {
}
if(skewtPaneRsc!=null){
skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize();
//CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
}
if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys);
@ -2951,7 +2932,8 @@ public class NsharpResourceHandler {
}
if(skewtPaneRsc!=null){
skewtPaneRsc.setSoundingLys(soundingLys);
skewtPaneRsc.handleResize();
//CHIN:::fix edit zoom issue skewtPaneRsc.handleResize();
skewtPaneRsc.createRscWireFrameShapes();
}
if(hodoPaneRsc!=null){
hodoPaneRsc.setSoundingLys(soundingLys);
@ -3205,18 +3187,7 @@ public class NsharpResourceHandler {
this.dtWidth = dtWidth;
this.cnYOrig = cnYOrig;
this.dtNextPageEnd = dtNextPage_end;
int 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; //NEW CODE
calculateTimeStnBoxData();
}
/*public void setCharHeight(int charHeight) {
@ -3233,5 +3204,20 @@ public class NsharpResourceHandler {
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 {
PixelExtent extent = new PixelExtent(rect);
RGB color;
target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
//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 y = cnYOrig+1.5*charHeight;
//double xGap = paneWidth/3*xRatio;
@ -135,9 +138,14 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
PixelExtent extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
double x = dtXOrig;
double y = dtYOrig-1.5*charHeight*yRatio;
String s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
double x;
double y;
String s;
if(dtHeight < paneHeight){
//draw time line page title etc. only when pane box height is larger than timeline box height
x = dtXOrig;
y = dtYOrig-1.5*charHeight*yRatio;
s = timeLineStateList.size() + " time lines, page " + curTimeLinePage+"/"+totalTimeLinePage;
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
@ -177,8 +185,13 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
dtXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
}
int numTimeLineToShowPerPage = (cnYOrig-dtNextPageEnd)/charHeight;
if(numTimeLineToShowPerPage <1){
numTimeLineToShowPerPage = dtHeight/charHeight;
if(numTimeLineToShowPerPage <1)
numTimeLineToShowPerPage=1;
}
int startIndex = (curTimeLinePage-1) * numTimeLineToShowPerPage;
if(timeLineStateList!= null){
@ -257,9 +270,14 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
PixelExtent extent = new PixelExtent(rect);
target.setupClippingPlane(extent);
target.drawRect(extent,NsharpConstants.backgroundColor, 1.0f, 1.0f);
double x = stnXOrig;
double y = stnYOrig -1.5*charHeight*yRatio;
String s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
double x;
double y;
String s;
if(dtHeight < paneHeight){
//draw time line page title etc. only when pane box height is larger than timeline box height
x = stnXOrig;
y = stnYOrig -1.5*charHeight*yRatio;
s = stnStateList.size() + " stations, page " + curStnIdPage+"/"+totalStnIdPage;
target.drawString(font10, s, x,
y, 0.0,
IGraphicsTarget.TextStyle.NORMAL,
@ -298,9 +316,14 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
target.drawLine(stnXOrig, y, 0.0,
stnXEnd , y, 0.0,
NsharpConstants.color_white,1, LineStyle.SOLID);
}
int numStnToShow = (cnYOrig-dtNextPageEnd)/charHeight;
if(numStnToShow <1){
numStnToShow = dtHeight/charHeight;
if(numStnToShow <1)
numStnToShow=1;
}
int startIndex = (rscHandler.getCurStnIdPage()-1) * numStnToShow;
int compIndex= 1;
int colorIndex;
@ -453,16 +476,26 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{
float prevWidth = paneWidth;
paneHeight = (int) ext.getHeight();
paneWidth = (int) (ext.getWidth());
xRatio = xRatio* paneWidth/prevWidth;
yRatio = yRatio* paneHeight/prevHeight;
//charHeight = (int)(NsharpConstants.CHAR_HEIGHT_*yRatio);
dtXOrig = (int) (ext.getMinX());
//xRatio = xRatio* paneWidth/prevWidth;
//DEBUGGING yRatio = yRatio* paneHeight/prevHeight;
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());
dtWidth = paneWidth/2;
dtXEnd = dtXOrig + dtWidth;
cnHeight = (int)(3* charHeight*yRatio);
dtHeight = paneHeight-dtYOrig-cnHeight;
dtNextPageEnd = dtYOrig+ (int) (2*charHeight*yRatio);
stnXOrig = dtXEnd;
stnYOrig = dtYOrig;
stnWidth = dtWidth;

View file

@ -13,6 +13,7 @@ function setupEnv() {
nasHost=nas1
nasVolName=dataFXA # This is so we can change it for new nas!
lsofCommand="lsof -Pns -p"
platformName=$( hostname | cut -f2 -d'-')
if [[ ${logDirectory}/${logName} -ot ${logDirectory}/$( basename $0 .sh ).$(date --date='1 day ago' +%A).log ]]
then
@ -100,6 +101,11 @@ function runlsof() {
function captureQpidStat() {
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
echoDate >> ${logDirectory}/${nowTimeDate}-qpid-stat.out
@ -108,6 +114,22 @@ function captureQpidStat() {
numQpidConnections=$( qpid-stat -c | wc -l )
(( numQpidConnections-=3 ))
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
for cmdArg in "-b" "-c" "-s" "-e" "-q -Smsg"