diff --git a/cave/build/static/common/cave/etc/pyViz/GFEPainter.py b/cave/build/static/common/cave/etc/pyViz/GFEPainter.py index f00727ee16..8389f62ea1 100644 --- a/cave/build/static/common/cave/etc/pyViz/GFEPainter.py +++ b/cave/build/static/common/cave/etc/pyViz/GFEPainter.py @@ -1,19 +1,19 @@ ## # This software was developed and / or modified by Raytheon Company, # pursuant to Contract DG133W-05-CQ-1067 with the US Government. -# +# # U.S. EXPORT CONTROLLED TECHNICAL DATA # This software product contains export-restricted data whose # export/transfer/disclosure is restricted by U.S. law. Dissemination # to non-U.S. persons whether in the United States or abroad requires # an export license or other authorization. -# +# # Contractor Name: Raytheon Company # Contractor Address: 6825 Pine Street, Suite 340 # Mail Stop B8 # Omaha, NE 68106 # 402.291.0100 -# +# # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## @@ -38,25 +38,25 @@ from java.util import HashSet # # GFE Painter for painting GFE data from scripts -# -# +# +# # SOFTWARE HISTORY -# +# # Date Ticket# Engineer Description # ------------ ---------- ----------- -------------------------- # 04/01/09 njensen Initial Creation. # 08/20/2012 #1077 randerso Fixed backgroundColor setting # 09/13/2012 #1147 dgilling Allow map labels to be disabled. -# -# +# 11/6/2012 15406 ryu Correction for computing domain from mask +# # import VizPainter class GFEPainter(VizPainter.VizPainter): - - def __init__(self, imageWidth=None, imageHeight=None, expandLeft=25.0, expandRight=25.0, expandTop=25.0, expandBottom=25.0, mask=None, wholeDomain=0, bgColor=None): - self.dataMgr = DataManager.getInstance(None) + + def __init__(self, imageWidth=None, imageHeight=None, expandLeft=25.0, expandRight=25.0, expandTop=25.0, expandBottom=25.0, mask=None, wholeDomain=0, bgColor=None): + self.dataMgr = DataManager.getInstance(None) self.refId = None envelope = None gloc = self.dataMgr.getParmManager().compositeGridLocation() @@ -64,7 +64,7 @@ class GFEPainter(VizPainter.VizPainter): from com.raytheon.uf.common.dataplugin.gfe.reference import ReferenceData_CoordinateType as CoordinateType self.refId = ReferenceID(mask) if wholeDomain == 0: - envelope = self.dataMgr.getRefManager().loadRefSet(self.refId).overallDomain(CoordinateType.LATLON) + envelope = self.dataMgr.getRefManager().loadRefSet(self.refId).overallDomain(CoordinateType.GRID) if imageWidth is not None: imageWidth = Integer(int(imageWidth)) if imageHeight is not None: @@ -75,16 +75,16 @@ class GFEPainter(VizPainter.VizPainter): desc = display.getDescriptor() self.dataMgr.getSpatialDisplayManager().setDescriptor(desc) VizPainter.VizPainter.__init__(self, display, backgroundColor=bgColor) - + gfeSystem = GFESystemResource(self.dataMgr) self.addVizResource(gfeSystem) - desc.getResourceList().getProperties(gfeSystem).setSystemResource(True) + desc.getResourceList().getProperties(gfeSystem).setSystemResource(True) self.primaryRsc = None - + def __del__(self): VizPainter.VizPainter.__del__(self) - + def setupLegend(self, localTime=False, snapshotTime=False, snapshot='', descriptiveName='SHORT', duration='', start='', end='', override={}, lang=''): legend = ImageLegendResource(self.dataMgr) legend.setLocalTime(localTime) @@ -100,22 +100,22 @@ class GFEPainter(VizPainter.VizPainter): legend.setColorOverride(parm, override[parm]) self.addVizResource(legend) self.getDescriptor().getResourceList().getProperties(legend).setSystemResource(True) - + def enableColorbar(self): from com.raytheon.viz.gfe.rsc.colorbar import GFEColorbarResource colorBar = GFEColorbarResource(self.dataMgr) self.addVizResource(colorBar) self.getDescriptor().getResourceList().getProperties(colorBar).setSystemResource(True) - + def __makeGFEResource(self, parm): - parm.getParmState().setPickUpValue(None) + parm.getParmState().setPickUpValue(None) gfeRsc = GFEResource(parm, self.dataMgr) self.addVizResource(gfeRsc) if not parm.getDisplayAttributes().getBaseColor(): from com.raytheon.viz.core import ColorUtil parm.getDisplayAttributes().setBaseColor(ColorUtil.getNewColor(self.getDescriptor())) - return gfeRsc - + return gfeRsc + def addGfeResource(self, parm, colormap=None, colorMin=None, colorMax=None, smooth=False, color=None, lineWidth=None): gfeRsc = self.__makeGFEResource(parm) # jvisType = VisualizationType.valueOf('IMAGE') @@ -127,8 +127,8 @@ class GFEPainter(VizPainter.VizPainter): parm.getDisplayAttributes().setDisplayMask(self.refId) self.primaryRsc = gfeRsc params = gfeRsc.getCapability(ColorMapCapability).getColorMapParameters() - if colormap is not None: - from com.raytheon.uf.viz.core.drawables import ColorMapLoader + if colormap is not None: + from com.raytheon.uf.viz.core.drawables import ColorMapLoader params.setColorMap(ColorMapLoader.loadColorMap(colormap)) if colorMax is not None and colorMin is not None: params.setDataMin(colorMin) @@ -145,9 +145,9 @@ class GFEPainter(VizPainter.VizPainter): gfeRsc.getCapability(ColorableCapability).setColor(color) if lineWidth is not None: gfeRsc.getCapability(OutlineCapability).setOutlineWidth(lineWidth) - + def addMapBackground(self, mapName, color=None, lineWidth=None, - linePattern=None, xOffset=None, yOffset=None, + linePattern=None, xOffset=None, yOffset=None, labelAttribute=None, fontOffset=None): from com.raytheon.uf.viz.core.maps import MapManager rsc = MapManager.getInstance(self.getDescriptor()).loadMapByBundleName(mapName).getResource() @@ -165,10 +165,10 @@ class GFEPainter(VizPainter.VizPainter): if fontOffset is not None: mag = Double(1.26 ** fontOffset) rsc.getCapability(MagnificationCapability).setMagnification(mag) - + def getDataManager(self): return self.dataMgr - + def outputFiles(self, filename, attachLogo=False, logoText=None): rendered = self.getTarget().screenshot() if attachLogo: @@ -176,7 +176,7 @@ class GFEPainter(VizPainter.VizPainter): from com.raytheon.uf.common.localization import PathManagerFactory noaa = 'pyViz/logos/noaalogo2.png' nws = 'pyViz/logos/nwslogo.png' - pathMgr = PathManagerFactory.getPathManager() + pathMgr = PathManagerFactory.getPathManager() noaa = pathMgr.getStaticFile(noaa) nws = pathMgr.getStaticFile(nws) noaaImage = ImageIO.read(noaa) @@ -195,12 +195,12 @@ class GFEPainter(VizPainter.VizPainter): fm = graphics.getFontMetrics() textBounds = fm.getStringBounds(logoText, graphics) graphics.drawString(logoText, int((rendered.getWidth() - textBounds.getWidth()) / 2), \ - int(rendered.getHeight() + (noaaImage.getHeight() / 2) + textBounds.getHeight() / 2)) + int(rendered.getHeight() + (noaaImage.getHeight() / 2) + textBounds.getHeight() / 2)) graphics.drawImage(nwsImage, finalBuf.getWidth() - nwsImage.getWidth(), rendered.getHeight(), None) finalBuf.flush() self.outputImage(finalBuf, filename) else: self.outputImage(rendered, filename) - + def _changeTime(self, time): - pass \ No newline at end of file + pass diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java index 802fcf52bb..6f87d88013 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java @@ -69,8 +69,8 @@ import com.vividsolutions.jts.geom.Coordinate; * 04/08/2008 chammack Initial Port from AWIPS I (minus ISC support) * 07/23/2012 #936 dgilling Reinstate config-handling code to * calcGridLabels(). - * 11/05/2012 #14566 jzeng Reverse the order of grids - * in calcGridLabels () + * 11/05/2012 #14566 jzeng Paint the sample points with the order of grids + * in calcGridLabels () * * * @author chammack @@ -254,12 +254,16 @@ public class SamplePainter { * @param colors * The color list */ - private void calcGridLabels(Coordinate worldLoc, final List grids, + private void calcGridLabels(Coordinate worldLoc, final List Grids, final GridID imageGrid, List sampleLabels, List colors) { - if (grids.isEmpty()) { + if (Grids.isEmpty()) { return; } + + List grids = Grids; + + Collections.reverse(grids); // if list is not defined, then all samples will be painted for // all parms @@ -284,8 +288,6 @@ public class SamplePainter { inGrid = true; } - Collections.reverse(grids); - // get the list of samples that should be painted and in the // order for (GridID grid : grids) { @@ -340,6 +342,7 @@ public class SamplePainter { sampleLabels.add(label); colors.add(labelColor); } + Collections.reverse(grids); } /** diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ifpimage/GfeImageUtil.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ifpimage/GfeImageUtil.java index ff26a863b4..a28844ce15 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ifpimage/GfeImageUtil.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ifpimage/GfeImageUtil.java @@ -1,48 +1,48 @@ /** * This software was developed and / or modified by Raytheon Company, * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * + * * U.S. EXPORT CONTROLLED TECHNICAL DATA * This software product contains export-restricted data whose * export/transfer/disclosure is restricted by U.S. law. Dissemination * to non-U.S. persons whether in the United States or abroad requires * an export license or other authorization. - * + * * Contractor Name: Raytheon Company * Contractor Address: 6825 Pine Street, Suite 340 * Mail Stop B8 * Omaha, NE 68106 * 402.291.0100 - * + * * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ package com.raytheon.viz.gfe.ifpimage; + import org.geotools.coverage.grid.GeneralGridEnvelope; import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.geometry.GeneralEnvelope; import org.opengis.geometry.Envelope; -import org.opengis.referencing.FactoryException; -import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; import com.raytheon.uf.common.geospatial.MapUtil; -import com.vividsolutions.jts.geom.Point; +import com.vividsolutions.jts.geom.Coordinate; /** * Static methods to support IFP Image or generating GFE images off screen. - * + * *
- * 
+ *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Mar 12, 2009            njensen     Initial creation
  * 21May2009          6309 garmendariz Modified path for Geotools 2.6.4
- * 
+ * 11/6/2012    15406      ryu         Modified computing domain from mask
+ *
  * 
- * + * * @author njensen * @version 1.0 */ @@ -57,25 +57,15 @@ public class GfeImageUtil { Envelope envelope = null; GridGeometry2D newGridGeometry = null; - try { - if (env != null) { - Point[] points = new Point[2]; - points[0] = MapUtil.getPoint(env.getMinY(), env.getMinX()); - points[1] = MapUtil.getPoint(env.getMaxY(), env.getMaxX()); - envelope = MapUtil.extractProjectedEnvelope(gloc.getCrs(), - points, MapUtil.getTransformFromLatLon(gloc.getCrs())); - } - } catch (TransformException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (FactoryException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - if (envelope == null) { - GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gloc); - envelope = gridGeometry.getEnvelope(); - } + if (env != null) { + Coordinate ll = new Coordinate(env.getMinX(), env.getMinY()); + Coordinate ur = new Coordinate(env.getMaxX(), env.getMaxY()); + envelope = MapUtil.convertToNativeEnvelope(ll, ur, gloc); + } + + if (envelope == null) { + GridGeometry2D gridGeometry = MapUtil.getGridGeometry(gloc); + envelope = gridGeometry.getEnvelope(); } double dLeft = envelope.getSpan(0) * percentLeft; diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java index adcdb70247..b63d3dc5df 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java @@ -128,6 +128,9 @@ import com.raytheon.viz.hydrocommon.util.DbUtils; * 06 Nov 2012 15399 wkwock Fix refine the plot algorithm and sampling algorithm * 06 Nov 2012 15459 lbousaidi update data when page/up or page/down is pressed without having * to click in graph button again. + * 06 Nov 2012 15400 lbousaidi Changed logic in buildPointString routine, added discharge2stage + * to display stage value, also added checking for rating curve for both + * stage and discharge. * @author lvenable * @version 1.0 * @@ -1599,31 +1602,57 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements double yValue = pixel2y(graphData, y); String units = FEET; boolean isRiverData = true; + boolean isStage= true; ArrayList traces = graphData.getTraces(); for (TraceData trace : traces) { if (!trace.getPe().toUpperCase().startsWith("H") && !trace.getPe().toUpperCase().startsWith("Q")) { isRiverData = false; } - } - - if (isRiverData) { - sb.append(" value=" + twoDecimalFormat.format(yValue) + " " - + units + " "); - - double q = StageDischargeUtils.stage2discharge(lid, yValue); - if (q != HydroConstants.MISSING_VALUE) { - units = CFS; - if (q > 10000) { - units = KCFS; - q = q / 1000; - } - sb.append(String.format("%8.1f", q) + " " + units); + if (trace.getPe().toUpperCase().startsWith("Q")) { + isStage=false; } - } else { - units = INCH; - sb.append(" value=" + twoDecimalFormat.format(yValue) + " " - + units + " "); + } + + if (isRiverData) { + + if (isStage) { + /** + * Convert the stage to discharge for the location and stage value passed in. + */ + double q = StageDischargeUtils.stage2discharge(lid, yValue); + //check for rating curve + if (q != HydroConstants.RATING_CONVERT_FAILED) { + if (q > 10000) { + units = KCFS; + q = q / 1000; + }else { + units = CFS; + } + sb.append(" value=" + twoDecimalFormat.format(yValue) + + " " + FEET + " "); + sb.append(String.format("%8.1f", q) + " " + units); + }else { + sb.append(" value=" + twoDecimalFormat.format(yValue)); + } + + }else { + /** + * Convert the discharge to stage for the location and discharge value passed in. + */ + double q = StageDischargeUtils.discharge2stage(lid, yValue); + //check for rating curve + if (q != HydroConstants.RATING_CONVERT_FAILED) { + sb.append(" value=" + twoDecimalFormat.format(yValue) + + " " + CFS + " "); + sb.append(String.format("%8.1f", q) + " " + FEET); + }else { + sb.append(" value=" + twoDecimalFormat.format(yValue)); + } + } + + }else { + sb.append(" value=" + twoDecimalFormat.format(yValue)); } return sb.toString(); diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/graph/TimeSeriesGraphCanvas.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/graph/TimeSeriesGraphCanvas.java index d2bc279daf..f38c587e1a 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/graph/TimeSeriesGraphCanvas.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/graph/TimeSeriesGraphCanvas.java @@ -63,7 +63,8 @@ import com.raytheon.viz.hydrocommon.HydroConstants; * July 12 2011 9709 djingtao draw right Y axis for showPP is true. add new * function adjust_pcymax() * Aug. 10, 2011 10457 djingtao allow the red rubberband box to be drawn for setMissing in Edit - * Jul. 24, 2012 15195 mpduff Fix x axis scales. + * Jul. 24, 2012 15195 mpduff Fix x axis scales. + * 06 Nov 2012 15399 wkwock Fix refine the plot algorithm and sampling algorithm * * * @@ -500,11 +501,11 @@ public class TimeSeriesGraphCanvas extends Canvas { int x = -999; int dy = 5; int dx = 4; - long startMillis = gd.getXMin().getTime(); + long startMillis = ((long)Math.ceil(gd.getXMin().getTime()/HydroConstants.MILLIS_PER_HOUR))*HydroConstants.MILLIS_PER_HOUR; long endMillis = gd.getXMax().getTime(); for (long i = startMillis; i <= endMillis; i += HydroConstants.MILLIS_PER_HOUR) { - x = x2pixel(gd, i); + x = x2pixel(gd, i+59000); //59 seconds for better sampling Date d = SimulatedTime.getSystemTime().getTime(); d.setTime(i); dy = 5; @@ -667,8 +668,8 @@ public class TimeSeriesGraphCanvas extends Canvas { long xMin = gd.getXMin().getTime(); long xMax = gd.getXMax().getTime(); long xDiff = xMax - xMin; - long millisPerPixel = xDiff / graphAreaWidth; - long millisTime = (xpix - GRAPHBORDER_LEFT) * millisPerPixel + xMin; + double millisPerPixel = xDiff / graphAreaWidth; + long millisTime = (long)(xpix * millisPerPixel) + xMin; Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal.setTimeInMillis(millisTime); diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19AReport.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19AReport.java index 4bc32ad21f..dd253bcd36 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19AReport.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19AReport.java @@ -39,6 +39,7 @@ import com.raytheon.viz.hydrocommon.whfslib.GeoUtil; * Sep 18, 2009 2260 mpduff Initial creation * Apr 25, 2012 14499 wkwock Refine format, query, etc * Sep 11, 2012 13781 wkwock add print menu + * Oct 19, 2012 15454 wkwock Fix missing River mile, Zero Datum, Check bar * * * @@ -141,14 +142,14 @@ public class E19AReport extends E19Report { buffer.append(String.format("STATION NO: %-11s\n", locData.getLocation().getSn())); String mile = null; - if (data.getRiverstat().getDa() != HydroConstants.MISSING_VALUE) { + if (data.getRiverstat().getMile() != HydroConstants.MISSING_VALUE) { mile = String.format("%8.2f", data.getRiverstat().getMile()); } else { mile = " "; } String wstg = null; - if (data.getRiverstat().getFs() != HydroConstants.MISSING_VALUE) { + if (data.getRiverstat().getWstg() != HydroConstants.MISSING_VALUE) { wstg = String.format("%8.2f", data.getRiverstat().getWstg()); } else { wstg = " "; @@ -158,14 +159,14 @@ public class E19AReport extends E19Report { buffer.append(String.format(" USGS NO: %-11s\n", data.getRiverstat().getGsno())); String zd = null; - if (data.getRiverstat().getDa() != HydroConstants.MISSING_VALUE) { + if (data.getRiverstat().getZd() != HydroConstants.MISSING_VALUE) { zd = String.format("%8.3f", data.getRiverstat().getZd()); } else { zd = " "; } String bf = null; - if (data.getRiverstat().getFs() != HydroConstants.MISSING_VALUE) { + if (data.getRiverstat().getBf() != HydroConstants.MISSING_VALUE) { bf = String.format("%8.2f", data.getRiverstat().getBf()); } else { bf = " "; @@ -175,7 +176,7 @@ public class E19AReport extends E19Report { buffer.append(String.format(" NESS ID: %-8s\n", dataDcpTelem.getDcp().getGoes())); String cb = null; - if (data.getRiverstat().getDa() != HydroConstants.MISSING_VALUE) { + if (data.getRiverstat().getCb() != HydroConstants.MISSING_VALUE) { cb = String.format("%8.3f", data.getRiverstat().getCb()); } else { cb = " "; @@ -277,7 +278,7 @@ public class E19AReport extends E19Report { buffer.append(" LATEST GAGE TYPE START DATE OWNER OF GAGE\n"); if (dataG.getGageList() != null && dataG.getGageList().size() > 0) { - Gage gage=dataG.getGageList().get(dataG.getGageList().size()-1); + Gage gage=dataG.getGageList().get(0); buffer.append(String.format(" %-11s %10s %-11s\n", gage.getType(), sdf.format(gage.getBegin()), gage.getOwner())); } diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19Report.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19Report.java index a19a09f4f2..6114c0a8c2 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19Report.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/E19Report.java @@ -46,6 +46,7 @@ import com.raytheon.viz.hydrocommon.whfslib.GeoUtil; * ------------ ---------- ----------- -------------------------- * Sep 18, 2009 2260 mpduff Initial creation * Apr 25, 2012 14499 wkwock Refine format, query, etc + * Oct 14, 2012 15454 wkwock Fix can not generate e19 if damage filed is empty * * * @@ -1392,9 +1393,13 @@ public class E19Report extends TextReport { tmp1 = String.format("%7.2f", floodList.get(floodIndex).getStage()); } - thisLineStr=" " + tmp1 + " - " + lines[lineIndex]; + if (lines==null || lines[lineIndex]==null) { + thisLineStr=" " + tmp1 + " -"; + } else { + thisLineStr=" " + tmp1 + " - " + lines[lineIndex]; + } }else { - thisLineStr=" " + lines[lineIndex]; + thisLineStr=" "; } int spaces = flood_filler - thisLineStr.length(); @@ -1410,7 +1415,7 @@ public class E19Report extends TextReport { lineIndex++; - if (lineIndex == lines.length - 1) { // No more lines in this record + if (lines !=null && lineIndex == lines.length - 1) { // No more lines in this record floodIndex++; // Get the next record if ((floodList.size() > floodIndex) && (floodList.get(floodIndex) != null)) { diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/TextReportDataManager.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/TextReportDataManager.java index 959177258c..d3aeb4af11 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/TextReportDataManager.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/textreport/TextReportDataManager.java @@ -48,6 +48,7 @@ import com.raytheon.viz.hydrocommon.textreport.TextReportData.StaffGageData; * Nov 09, 2010 5416 lbousaid changed gageQuery * Dec 08, 2011 11728 lbousaidi changed the routines that retrieve data * Apr 25, 2012 14499 wkwock Refine format, query, etc + * Nov 06, 2012 15454 wkwock Fix query for get data from gage table * * * @@ -356,7 +357,7 @@ public class TextReportDataManager extends HydroDataManager { public TextReportData getGageQueryList(String lid) { TextReportData data = new TextReportData(); String gageQuery = "select gbegin, type, owner, remark, maint, gend from gage where lid = '" - + lid + "' order by gbegin,type"; + + lid + "' and gend is null ORDER BY gbegin desc"; ArrayList rs = runQuery(gageQuery); ArrayList gageList = new ArrayList(); int i = 0; diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveLevel2Data.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveLevel2Data.java index 9eb70d0010..eab564312b 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveLevel2Data.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/SaveLevel2Data.java @@ -75,6 +75,7 @@ import com.raytheon.viz.mpe.util.WriteQPFGrids; * ------------ ---------- ----------- -------------------------- * Mar 24, 2009 snaples Initial creation * Sep 19, 2011 10955 rferrel Use RunProcess + * Nov 06, 2012 15481 wkwock Fix save 6 hours precipitation files * * * @@ -649,6 +650,81 @@ public class SaveLevel2Data { } } + //save for each 6 hour periods + for (l = 0; l < 5; l++) { + + if (DailyQcUtils.pdata[j].used[l] == 0 || qctype_flag[0] == -1) { + continue; + } + + /* + * this needs to be fixed to ensure that the gridded temperature + * files are named correctly. + */ + if (l < 2) { + old_time = DailyQcUtils.pdata[j].data_time; + Calendar od = Calendar.getInstance(); + od.setTime(old_time); + od.add(Calendar.SECOND, -86400); + old_time = od.getTime(); + } else { + old_time = DailyQcUtils.pdata[j].data_time; + } + + gm.setTime(old_time); + + if (l < 4) { + ll = 0; + } else { + ll = 1; + } + + RenderPcp rcp = new RenderPcp(); + rcp.render_pcp(j, l, ll, max_stations, + DailyQcUtils.precip_stations, hrap_grid, + DailyQcUtils.pdata, DailyQcUtils.pcp_in_use); + + String dbuf = String.format("%s%s_%04d%02d%02d", grid_file, + timefile[2][l], gm.get(Calendar.YEAR), + gm.get(Calendar.MONTH) + 1, + gm.get(Calendar.DAY_OF_MONTH)); + + /* output grid to file in ascii xmrg format */ + WriteQPFGrids wqg = new WriteQPFGrids(); + wqg.write_qpf_grids(dbuf); + + if (DailyQcUtils.mpe_dqc_save_grib == true) { + WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); + String ncfile = String.format("%s.nc", dbuf); + wng.write_dqc_netcdf_grids(ncfile, l, 1, 1, + ga.getCommonGridAttributes(), datavals); + WriteDQCGribGrids wgg = new WriteDQCGribGrids(); + String fname_grib = String.format("%s.grb", dbuf); + int status = wgg + .write_dqc_grib_grids(ncfile, fname_grib, 1); + if (status != 0) { + statusHandler + .handle(Priority.WARN, + String.format( + "problem with writing GRIB file in write_dqc_grib_grids. status=%d\n", + status)); + } + + } + + if (l < 4) { + num = j * 4 + 3 - l; + } else { + num = 40 + j; + } + + /* Create the MAP. */ + CreateMap cm = new CreateMap(); + cm.create_map(num); + + } + + //save the whole days for (l = 0; l < 5; l++) { if (DailyQcUtils.pdata[j].used[l] == 0 || qctype_flag[0] == -1) { @@ -698,25 +774,6 @@ public class SaveLevel2Data { ga.getCommonGridAttributes(), datavals); } - if (DailyQcUtils.mpe_dqc_save_grib == true) { - WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); - String ncfile = String.format("%s.nc", dbuf); - wng.write_dqc_netcdf_grids(ncfile, l, 1, 1, - ga.getCommonGridAttributes(), datavals); - WriteDQCGribGrids wgg = new WriteDQCGribGrids(); - String fname_grib = String.format("%s.grb", dbuf); - int status = wgg - .write_dqc_grib_grids(ncfile, fname_grib, 1); - if (status != 0) { - statusHandler - .handle(Priority.WARN, - String.format( - "problem with writing GRIB file in write_dqc_grib_grids. status=%d\n", - status)); - } - - } - if (l < 4) { num = j * 4 + 3 - l; } else { diff --git a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/AutoDailyQC.java b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/AutoDailyQC.java index 939e879817..60d2a9c946 100644 --- a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/AutoDailyQC.java +++ b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/util/AutoDailyQC.java @@ -308,6 +308,8 @@ public class AutoDailyQC { } } + num_period_qc=5; + //for the 6 hours periods for (int l = 0; l < 5; l++) { if (DailyQcUtils.pdata[i].used[l] == 0) { continue; @@ -343,6 +345,79 @@ public class AutoDailyQC { WriteQPFGrids wq = new WriteQPFGrids(); wq.write_qpf_grids(dbuf); + /* output grid to file in grib format */ + + // create netCDF file from data, write it out then call + // nc2grib against it making a grib file, when done + // remove the unneeded netCDF file. + if (DailyQcUtils.mpe_dqc_save_grib == true) { + WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); + String ncfile = String.format("%s.nc", dbuf); + wng.write_dqc_netcdf_grids(ncfile, 0, 1, 1, + ga.getCommonGridAttributes(), datavals); + WriteDQCGribGrids wgg = new WriteDQCGribGrids(); + String fname_grib = String.format("%s.grb", dbuf); + int status = wgg.write_dqc_grib_grids(ncfile, + fname_grib, 1); + File nfile = new File(ncfile); + nfile.delete(); + nfile = null; + if (status != 0) { + System.out + .println(String + .format("\n problem with writing GRIB file in write_dqc_grib_grids. status=%d\n", + status)); + } + + } + + int num; + if (l < 4) { + num = i * 4 + 3 - l; + } else { + num = i + 40; + } + + /* create the MAP */ + CreateMap cm = new CreateMap(); + cm.create_map(num); + } + //for (int l = 0; l < 5; l++) { + for (int l = 0; l < num_period_qc; l++) { + if (DailyQcUtils.pdata[i].used[l] == 0) { + continue; + } + + if (l < 2) { + otime.setTime(DailyQcUtils.pdata[i].data_time); + otime.add(Calendar.SECOND, -86400); + } else { + otime.setTime(DailyQcUtils.pdata[i].data_time); + } + + int ll; + if (l < 4) { + ll = 0; + } else { + ll = 1; + } + RenderPcp rp = new RenderPcp(); + rp.render_pcp(i, l, ll, + DailyQcUtils.precip_stations.size(), + DailyQcUtils.precip_stations, + DailyQcUtils.getHrap_grid(), + DailyQcUtils.pdata, DailyQcUtils.pcp_in_use); + + /* output grid to file in Ascii format */ + dbuf = String.format("%s%s_%04d%02d%02d", + DailyQcUtils.grid_file, + DailyQcUtils.timefile[2][l], + otime.get(Calendar.YEAR), + otime.get(Calendar.MONTH) + 1, + otime.get(Calendar.DAY_OF_MONTH)); + WriteQPFGrids wq = new WriteQPFGrids(); + wq.write_qpf_grids(dbuf); + /* output grid to file in NetCDF format */ if (DailyQcUtils.mpe_dqc_save_netcdf == true) { WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); @@ -351,42 +426,6 @@ public class AutoDailyQC { ga.getCommonGridAttributes(), datavals); } - /* output grid to file in grib format */ - - // create netCDF file from data, write it out then call - // nc2grib against it making a grib file, when done - // remove the unneeded netCDF file. - if (DailyQcUtils.mpe_dqc_save_grib == true) { - WriteDQCNetCDFGrids wng = new WriteDQCNetCDFGrids(); - String ncfile = String.format("%s.nc", dbuf); - wng.write_dqc_netcdf_grids(ncfile, 0, 1, 1, - ga.getCommonGridAttributes(), datavals); - WriteDQCGribGrids wgg = new WriteDQCGribGrids(); - String fname_grib = String.format("%s.grb", dbuf); - int status = wgg.write_dqc_grib_grids(ncfile, - fname_grib, 1); - File nfile = new File(ncfile); - nfile.delete(); - nfile = null; - if (status != 0) { - System.out - .println(String - .format("\n problem with writing GRIB file in write_dqc_grib_grids. status=%d\n", - status)); - } - - } - - int num; - if (l < 4) { - num = i * 4 + 3 - l; - } else { - num = i + 40; - } - - /* create the MAP */ - CreateMap cm = new CreateMap(); - cm.create_map(num); } } diff --git a/cave/com.raytheon.viz.satellite/localization/bundles/DefaultCompositeSatellite.xml b/cave/com.raytheon.viz.satellite/localization/bundles/DefaultCompositeSatellite.xml index 94627ee57d..d9877662e1 100644 --- a/cave/com.raytheon.viz.satellite/localization/bundles/DefaultCompositeSatellite.xml +++ b/cave/com.raytheon.viz.satellite/localization/bundles/DefaultCompositeSatellite.xml @@ -15,7 +15,8 @@ + isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true" + inclusionFactor="${inclusionFactor;0.4}"> * @@ -82,6 +83,9 @@ public class SatBestResResourceData extends AbstractRequestableResourceData { @XmlElement(name = "resource") protected ResourceList resourceList = new ResourceList(); + @XmlAttribute + protected Double inclusionFactor; + private ResourcePair resourceToDraw; /** @@ -156,12 +160,14 @@ public class SatBestResResourceData extends AbstractRequestableResourceData { Map percentOfIntersection = new HashMap(); if (disclosedResource != null) { + final double inclusionPercentageToUse = inclusionFactor != null ? + inclusionFactor : DESIRED_PERCENTAGE; // check inclusion percentage of the disclosed resource Double inclusion = getInclusionPercentage(descriptor, disclosedResource, extent); if (inclusion != Double.NaN) { percentOfIntersection.put(disclosedResource, inclusion); - if (inclusion < DESIRED_PERCENTAGE) { + if (inclusion < inclusionPercentageToUse) { disclosedResource = null; } } else { @@ -335,7 +341,7 @@ public class SatBestResResourceData extends AbstractRequestableResourceData { for (Polygon last : prevs) { // Don't want to double include percentage areas - totalPercentage -= last.intersection(polygon).intersection(extent) + totalPercentage -= last.intersection(polygon) .getArea() / extent.getArea(); } } @@ -347,4 +353,12 @@ public class SatBestResResourceData extends AbstractRequestableResourceData { } return totalPercentage; } + + public Double getInclusionFactor() { + return inclusionFactor; + } + + public void setInclusionFactor(Double inclusionFactor) { + this.inclusionFactor = inclusionFactor; + } } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 6ed0692300..07e85110ff 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -302,6 +302,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 12OCT2012 15418 D.Friedman Do not store product when sending in operational mode. * Do not use changed BBB from OUPResponse. * 17OCT2012 1229 rferrel Changes for non-blocking SWTMessageBox. + * 05Nov2012 15560 S. Naples Added check to see if we are in edit mode before capturing keys. * * * @author lvenable @@ -3530,6 +3531,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, textEditor.addVerifyKeyListener(new VerifyKeyListener() { public void verifyKey(VerifyEvent event) { + // Ignore edit keys when not in edit mode. + if (textEditor.getEditable() == false){ + return; + } if (event.keyCode == SWT.DEL || event.character == SWT.BS || event.keyCode == SWT.SHIFT) { // Do nothing... diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java index b07f02c0cf..fd13486582 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/qc/TextSegmentCheck.java @@ -52,6 +52,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil; * Add vtec to checkHeadline signature * 20 JUL 2012 15006 mgamazaychikov Do not perform search for a list of * county/zones names in the MWS segment heading. + * 07 NOV 2012 15003 mgamazaychikov Do not perform QC check on standalone MWS headline. * * * @@ -500,18 +501,13 @@ public class TextSegmentCheck implements IQCCheck { return errorMsg; } /* - * DR15003 standalone MWS can have no headline. + * DR15003: no headline QC on standalone MWS. * To distinguish between standalone and follow up MWS * the VTEC check is performed as standalone MWS * do not contain VTEC */ if (nnn.equals("MWS") && vtec == null) { - if (headline.length() == 0) { - return errorMsg; - } else if (!headline.endsWith("...")) { - errorMsg += "Headline should end with '...'.\n"; - } - return errorMsg; + return ""; } if (headline.length() == 0) { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Area.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Area.java index c91d8e255d..ea42c71a28 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Area.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Area.java @@ -71,6 +71,7 @@ import com.vividsolutions.jts.geom.Geometry; * Apr 13, 2012 #14691 Qinglu lin Added code for two more fe_area: er and nr. * May 4, 2012 #14887 Qinglu lin Changed 0.25 to 0.60 for DEFAULT_PORTION_TOLERANCE; * added code to pass a Envelope calculatePortion(). + * Nov 9, 2012 DR 15430 D. Friedman Extracted method converFeAreaToPartList. * * * @@ -229,67 +230,7 @@ public class Area { .get(parentAreaField)); String feArea = (String) regionFeature.attributes .get("FE_AREA"); - final List partList = new ArrayList(); - if (feArea == null) { - // Marine warnings - partList.add(""); - } else { - if (feArea.equals("pa")) - partList.add("PA"); - else if (feArea.equals("mi")) - partList.add("MI"); - else if (feArea.equals("pd")) - partList.add("PD"); - else if (feArea.equals("up")) - partList.add("UP"); - else if (feArea.equals("bb")) - partList.add("BB"); - else if (feArea.equals("er")) - partList.add("ER"); - else if (feArea.equals("eu")) - partList.add("EU"); - else if (feArea.equals("sr")) - partList.add("SR"); - else if (feArea.equals("nr")) - partList.add("NR"); - else if (feArea.equals("wu")) - partList.add("WU"); - else if (feArea.equals("ds")) - partList.add("DS"); - else if (feArea.equals("ne")) - partList.add("NE"); - else if (feArea.equals("nw")) - partList.add("NW"); - else if (feArea.equals("se")) - partList.add("SE"); - else if (feArea.equals("sw")) - partList.add("SW"); - else { - for (int i = 0; i < feArea.length(); i++) { - char c = feArea.charAt(i); - switch (c) { - case 'c': - partList.add("CENTRAL"); - break; - case 'w': - partList.add("WEST"); - break; - case 'n': - partList.add("NORTH"); - break; - case 'e': - partList.add("EAST"); - break; - case 's': - partList.add("SOUTH"); - break; - default: - break; - } - } - } - } - area.partOfParentRegion = partList; + area.partOfParentRegion = converFeAreaToPartList(feArea); } // Search against point matches @@ -390,5 +331,69 @@ public class Area { } return retVal; } + + public static List converFeAreaToPartList(String feArea) { + final List partList = new ArrayList(); + if (feArea == null) { + // Marine warnings + partList.add(""); + } else { + if (feArea.equals("pa")) + partList.add("PA"); + else if (feArea.equals("mi")) + partList.add("MI"); + else if (feArea.equals("pd")) + partList.add("PD"); + else if (feArea.equals("up")) + partList.add("UP"); + else if (feArea.equals("bb")) + partList.add("BB"); + else if (feArea.equals("er")) + partList.add("ER"); + else if (feArea.equals("eu")) + partList.add("EU"); + else if (feArea.equals("sr")) + partList.add("SR"); + else if (feArea.equals("nr")) + partList.add("NR"); + else if (feArea.equals("wu")) + partList.add("WU"); + else if (feArea.equals("ds")) + partList.add("DS"); + else if (feArea.equals("ne")) + partList.add("NE"); + else if (feArea.equals("nw")) + partList.add("NW"); + else if (feArea.equals("se")) + partList.add("SE"); + else if (feArea.equals("sw")) + partList.add("SW"); + else { + for (int i = 0; i < feArea.length(); i++) { + char c = feArea.charAt(i); + switch (c) { + case 'c': + partList.add("CENTRAL"); + break; + case 'w': + partList.add("WEST"); + break; + case 'n': + partList.add("NORTH"); + break; + case 'e': + partList.add("EAST"); + break; + case 's': + partList.add("SOUTH"); + break; + default: + break; + } + } + } + } + return partList; + } } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java index 7298b7e4bb..d56029b705 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java @@ -22,12 +22,10 @@ package com.raytheon.viz.warngen.template; import java.awt.geom.Point2D; import java.io.StringWriter; import java.text.DateFormat; -import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; -import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -35,9 +33,11 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.TimeZone; +import java.util.TreeMap; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -45,14 +45,12 @@ import javax.measure.converter.UnitConverter; import javax.measure.unit.NonSI; import javax.measure.unit.SI; -import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.Validate; import org.apache.velocity.Template; import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.velocity.app.VelocityEngine; import org.apache.velocity.tools.generic.ListTool; -import org.geotools.referencing.GeodeticCalculator; import com.raytheon.uf.common.activetable.ActiveTableMode; import com.raytheon.uf.common.activetable.ActiveTableRecord; @@ -60,11 +58,11 @@ import com.raytheon.uf.common.activetable.GetActiveTableRequest; import com.raytheon.uf.common.activetable.GetActiveTableResponse; import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; +import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration; +import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration.AreaType; import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration; +import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData; import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil; -import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode; -import com.raytheon.uf.common.geospatial.SpatialQueryFactory; -import com.raytheon.uf.common.geospatial.SpatialQueryResult; import com.raytheon.uf.common.site.SiteMap; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -75,7 +73,6 @@ import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.awipstools.common.StormTrackData; @@ -101,11 +98,11 @@ import com.raytheon.viz.warngen.util.FollowUpUtil; import com.raytheon.viz.warngen.util.WarnGenMathTool; import com.raytheon.viz.warngen.util.WatchUtil; import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch; +import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch.Portion; import com.raytheon.viz.warnings.DateUtil; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.Polygon; -import com.vividsolutions.jts.geom.prep.PreparedGeometry; import com.vividsolutions.jts.io.WKTReader; /** @@ -129,6 +126,7 @@ import com.vividsolutions.jts.io.WKTReader; * Aug 29, 2011 15351 jsanchez Set the timezone for TML time. * Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript. * Sep 18, 2012 15332 jsanchez Used a new warning text handler. + * Nov 9, 1202 DR 15430 D. Friedman Improve watch inclusion. * * * @author njensen @@ -742,7 +740,7 @@ public class TemplateRunner { try { t0 = System.currentTimeMillis(); WatchUtil watches = getWatches(warngenLayer, config, warnPolygon, - fourLetterSiteId); + fourLetterSiteId, simulatedTime); System.out.println("getWatches time: " + (System.currentTimeMillis() - t0)); if (watches != null) { @@ -837,12 +835,13 @@ public class TemplateRunner { * ([template_name_site.xml]) * @param polygon * The Geometry surrounded by the warning polygon. + * @param simulatedTime * @return * @throws Exception */ private static WatchUtil getWatches(WarngenLayer warngenLayer, WarngenConfiguration config, Geometry polygon, - String fourLetterSiteId) throws Exception { + String fourLetterSiteId, Date simulatedTime) throws Exception { Validate.isTrue(config.getHatchedAreaSource() .getIncludedWatchAreaBuffer() >= 0, "IncludedWatchAreaBuffer can not be negative"); @@ -877,8 +876,27 @@ public class TemplateRunner { GetActiveTableResponse resp = (GetActiveTableResponse) ThriftClient .sendRequest(req); long t1 = System.currentTimeMillis(); - java.util.List activeTable = resp - .getActiveTable(); + java.util.List respList = resp.getActiveTable(); + ArrayList activeTable = new ArrayList( + respList.size()); + // Filter out entries representing non-active events. + for (ActiveTableRecord ar : respList) { + if ("CAN".equals(ar.getAct()) || "EXP".equals(ar.getAct())) + continue; + if (ar.getEndTime() == null) { + statusHandler.handle(Priority.ERROR, String.format( + "Watch %s has null end time; not included.", + ar.getVtecstr())); + continue; + } + // From A1 SELSparagraphs.C processWOU + if (simulatedTime.before(new Date(ar.getStartTime().getTime() + .getTime() - 180 * 1000)) + || simulatedTime.after(ar.getEndTime().getTime())) + continue; + + activeTable.add(ar); + } System.out.println("getWatches.getActiveTable time: " + (t1 - t0) + ", found " @@ -902,96 +920,293 @@ public class TemplateRunner { t1 = System.currentTimeMillis(); System.out.println("getWatches.createWatchGeometry time: " + (t1 - t0)); - SpatialQueryResult[] parentRegionFeatures = null; - try { - String field = "the_geom"; - t0 = System.currentTimeMillis(); - List results = DbMapQueryFactory.getMapQuery( - "mapdata.states", field).getLevels(); - Collections.sort(results, Collections.reverseOrder()); - Double decimationTolerance = null; - for (Double result : results) { - if (result <= 0.064) { - decimationTolerance = result; - } - } - - if (decimationTolerance != null) { - DecimalFormat df = new DecimalFormat("0.######"); - String suffix = "_" - + StringUtils.replaceChars(df.format(results - .get(results.size() - 1)), '.', '_'); - parentRegionFeatures = SpatialQueryFactory.create() - .query("states", field + suffix, - new String[] { "Name" }, watchArea, - null, false, SearchMode.INTERSECTS); - } else { - parentRegionFeatures = SpatialQueryFactory.create() - .query("states", new String[] { "Name" }, - watchArea, null, false, - SearchMode.INTERSECTS); - } - - t1 = System.currentTimeMillis(); - System.out.println("getWatches.stateSpatialQuery time: " - + (t1 - t0) + ", found " - + parentRegionFeatures.length + " states"); - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error querying state geometries", e); - return null; - } - - rval = new WatchUtil(); - WeatherAdvisoryWatch watch = null; - long cumulativeIntersect = 0; - long cumulativeCalcPortion = 0; - GeodeticCalculator gc = new GeodeticCalculator(); - - // For each State in our watchArea... - for (int j = 0; j < parentRegionFeatures.length; j++) { - Geometry parentGeom = parentRegionFeatures[j].geometry; - List prepGeoms = new ArrayList(); - GeometryUtil.recursivePreparedGeometry(parentGeom, - prepGeoms); - - for (ActiveTableRecord atr : activeTable) { - // Get the intersection of watchArea with State. - watch = new WeatherAdvisoryWatch(); - watch.setEndTime(atr.getEndTime().getTime()); - watch.setPhensig(atr.getPhensig()); - - // If State intersections intersects with out ATR - // record, add watch - t0 = System.currentTimeMillis(); - boolean intersects = GeometryUtil.intersects(prepGeoms, - atr.getGeometry()); - t1 = System.currentTimeMillis(); - cumulativeIntersect = (t1 - t0); - - if (intersects) { - watch.setParentRegion(parentRegionFeatures[j].attributes - .get("Name").toString()); - - t0 = System.currentTimeMillis(); - watch.setPartOfParentRegion(GisUtil - .asStringList(GisUtil.calculatePortion( - parentGeom, atr.getGeometry(), gc))); - t1 = System.currentTimeMillis(); - cumulativeCalcPortion = (t1 - t0); - rval.addWaw(watch); - } - } - } - - System.out.println("getWatches.cumulativeIntersect: " - + cumulativeIntersect); - System.out.println("getWatches.cumulativeCalcPortion: " - + cumulativeCalcPortion); + t0 = System.currentTimeMillis(); + rval = processATEntries(activeTable, warngenLayer); + System.out.println("getWatches.createPoritions time: " + + (t1 - t0)); } } return rval; } + + private static class WatchWork { + public WeatherAdvisoryWatch waw; + public boolean valid; + public ArrayList ugcZone = new ArrayList(); + + public WatchWork(WeatherAdvisoryWatch waw) { + this.waw = waw; + } + } + + /** + * Create the list of objects representing active watches that will be + * passed to the template context. + * + * @param activeTable + * List of entries for active watches + * @param warngenLayer + * @return + */ + private static WatchUtil processATEntries( + List activeTable, WarngenLayer warngenLayer) { + WatchUtil rval = new WatchUtil(); + TreeMap map = new TreeMap(); + + AreaSourceConfiguration asc = null; + for (AreaSourceConfiguration a : warngenLayer.getConfiguration() + .getAreaSources()) { + if (a.getType() == AreaType.HATCHING) { + asc = a; + break; + } + } + if (asc == null) { + statusHandler + .handle(Priority.ERROR, + "Cannot process watches: missing HATCHING area source configuration"); + return rval; + } + GeospatialData[] geoData = warngenLayer.getGeodataFeatures(asc + .getAreaSource() + "." + warngenLayer.getLocalizedSite()); + if (geoData == null || geoData.length == 0) { + statusHandler.handle(Priority.ERROR, + "Cannot process watches: cannot get geospatial data"); + return rval; + } + + // For each watch event, get the end time and list of active zones + for (ActiveTableRecord ar : activeTable) { + /* + * Currently reports all zones in the watch even if a given zone is + * not in the warning polygon. If the logic is changed to only show + * the portions of the watch near our warning polygon, perform the + * isEmpty check here. + */ + WeatherAdvisoryWatch waw = new WeatherAdvisoryWatch(); + waw.setPhensig(ar.getPhensig()); + try { + waw.setEventId(Integer.parseInt(ar.getEtn())); + } catch (RuntimeException e) { + statusHandler.handle(Priority.ERROR, String.format( + "Watch %s has null end time; not included.", + ar.getVtecstr())); + continue; + } + + WatchWork work = map.get(waw); + if (work == null) { + waw.setEndTime(ar.getEndTime().getTime()); + work = new WatchWork(waw); + map.put(waw, work); + } + // TODO: Building geometry just to perform this test is probably + // inefficient with the post-DR-15430 logic... + if (!ar.getGeometry().isEmpty()) + work.valid = true; + + work.ugcZone.add(ar.getUgcZone()); + } + + for (WatchWork work : map.values()) { + /* + * If none of the areas in the watch were neer our warning polygon, + * do not included it. + */ + if (!work.valid) + continue; + if (determineAffectedPortions(work.ugcZone, asc, geoData, work.waw)); + rval.addWaw(work.waw); + } + + return rval; + } + + /** + * Given the list of counties in a watch, fill out the "portions" part of + * the given WeatherAdvisoryWatch + * + * @param ugcs + * @param asc + * @param geoData + * @param waw + */ + private static boolean determineAffectedPortions(List ugcs, + AreaSourceConfiguration asc, GeospatialData[] geoData, + WeatherAdvisoryWatch waw) { + + // Maps state abbreviation to unique fe_area values + HashMap> map = new HashMap>(); + + for (String ugc : ugcs) { + for (Entry e : FipsUtil.parseCountyHeader(ugc).entrySet()) { + String stateAbbrev = e.getKey(); + if (e.getValue().length != 1) // either zero or more than one + // would be wrong + statusHandler.handle(Priority.ERROR, + "Invalid ugczone in active table entry"); + Set feAreas = map.get(stateAbbrev); + if (feAreas == null) { + feAreas = new HashSet(); + map.put(stateAbbrev, feAreas); + } + try { + feAreas.add(getFeArea(stateAbbrev, e.getValue()[0], asc, + geoData)); + } catch (RuntimeException exc) { + statusHandler.handle(Priority.ERROR, "Error generating included watches.", exc); + return false; + } + } + } + + ArrayList portions = new ArrayList(map.size()); + for (Entry> e : map.entrySet()) { + Portion portion = new Portion(); + try { + portion.parentRegion = getStateName(e.getKey(), asc, geoData) + .toUpperCase(); + } catch (RuntimeException exc) { + statusHandler.handle(Priority.ERROR, "Error generating included watches.", exc); + return false; + } + portion.partOfParentRegion = Area + .converFeAreaToPartList(mungeFeAreas(e.getValue())); + System.out.format("Munged %s to %s (%s)\n", e.getValue(), + mungeFeAreas(e.getValue()), portion.partOfParentRegion); + portions.add(portion); + } + waw.setPortions(portions); + // Set legacy values + if (portions.size() > 0) { + waw.setParentRegion(portions.get(0).parentRegion); + waw.setPartOfParentRegion(portions.get(0).partOfParentRegion); + } + + return true; + } + + // Based on AWIPS 1 SELSparagraphs.C SELSparagraphs::processWOU(). + private static String mungeFeAreas(Set feAreas) { + String abrev = ""; + // If eight or more portions, don't qualify area of state + int m = feAreas.size(); + if (m < 8) { + String partAbrev = ""; + /* + * TODO: Unused variables should be removed if we are not going to + * improve this in A2. + */ + @SuppressWarnings("unused") + int nw, nc, ne, wc, cc, ec, sw, sc, se, pa; + int eee, www, nnn, sss, ee, ww, nn, ss; + + // Identify individual sub areas of this state affected + nw = nc = ne = wc = cc = ec = sw = sc = se = pa = 0; + eee = www = nnn = sss = ee = ww = nn = ss = 0; + for (String part : feAreas) { + if ("pa".equals(part)) { + pa = 1; + continue; + } else if ("nn".equals(part)) + nnn = nn = 1; + else if ("ss".equals(part)) + sss = ss = 1; + else if ("ee".equals(part)) + eee = ee = 1; + else if ("ww".equals(part)) + www = ww = 1; + else if ("nw".equals(part)) + nnn = www = nw = 1; + else if ("nc".equals(part)) + nnn = nc = 1; + else if ("ne".equals(part)) + nnn = eee = ne = 1; + else if ("wc".equals(part)) + www = wc = 1; + else if ("cc".equals(part)) { + cc = 1; + continue; + } else if ("ec".equals(part)) + eee = ec = 1; + else if ("sw".equals(part)) + sss = www = sw = 1; + else if ("sc".equals(part)) + sss = sc = 1; + else if ("se".equals(part)) + sss = eee = se = 1; + partAbrev = part; + } + // decide how to describe these subareas. + if (ne > 0 && nw > 0) + nn = 1; + if (se > 0 && sw > 0) + ss = 1; + if (se > 0 && ne > 0) + ee = 1; + if (sw > 0 && nw > 0) + ww = 1; + if (nnn > 0 && sss > 0 && eee > 0 && www > 0) + return abrev; + if (nn > 0 && ss > 0 || ee > 0 && ww > 0) + return abrev; + if (nnn + sss + eee + www == 3) { + if (www == 0) { + abrev = "e"; + } else if (eee == 0) { + abrev = "w"; + } else if (nnn == 0) { + abrev = "s"; + } else if (sss == 0) { + abrev = "n"; + } + return abrev; + } + if (nnn == sss && eee == www || cc == m) { + abrev = "c"; + return abrev; + } + if (pa != 0 && cc == 0) { + abrev = "pa"; + if (--m <= 0) { + return abrev; + } + } + if (m == 1 + cc) { + abrev += partAbrev + " "; + return abrev; + } + if (nnn != sss) { + abrev += nnn != 0 ? "n" : "s"; + } + if (eee != www) { + abrev += eee != 0 ? "e" : "w"; + } + } + return abrev; + } + + private static String getStateName(String key, AreaSourceConfiguration asc, + GeospatialData[] geoData) { + for (GeospatialData g : geoData) { + if (key.equals((String) g.attributes.get("STATE"))) + return (String) g.parent.attributes.get("NAME"); + } + return null; + } + + private static String getFeArea(String stateAbbrev, String ugc, + AreaSourceConfiguration asc, GeospatialData[] geoData) { + for (GeospatialData g : geoData) { + if (stateAbbrev.equals((String) g.attributes.get("STATE")) + && ((String) g.attributes.get(asc.getFipsField())) + .endsWith(ugc)) + return (String) g.attributes.get(asc.getFeAreaField()); + } + + return null; + } + } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/WeatherAdvisoryWatch.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/WeatherAdvisoryWatch.java index 7d035d06dc..06afc5544b 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/WeatherAdvisoryWatch.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/WeatherAdvisoryWatch.java @@ -31,6 +31,7 @@ import java.util.List; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 1, 2009 bwoodle Initial creation + * Nov 9, 2012 DR 15430 D. Friedman Support proper watch inclusion language * * * @@ -39,13 +40,45 @@ import java.util.List; */ public class WeatherAdvisoryWatch implements Comparable { + + public static class Portion { + public String parentRegion; + public List partOfParentRegion; + + public String getParentRegion() { + return parentRegion; + } + + public void setParentRegion(String parentRegion) { + this.parentRegion = parentRegion; + } + + public List getPartOfParentRegion() { + return partOfParentRegion; + } + + public void setPartOfParentRegion(List partOfParentRegion) { + this.partOfParentRegion = partOfParentRegion; + } + } + + /* TODO: NOTE: There is no site field. We currently only process + * WCNs for the site and not WOUs from the SPC. + */ + private String phensig; + + private int eventId; private Date endTime; + + private List portions; + @Deprecated private String parentRegion; + @Deprecated private List partOfParentRegion; public String getPhensig() { @@ -64,23 +97,59 @@ public class WeatherAdvisoryWatch implements Comparable { this.endTime = endTime; } + @Deprecated public String getParentRegion() { return parentRegion; } + @Deprecated public void setParentRegion(String parentRegion) { this.parentRegion = parentRegion; } + @Deprecated public List getPartOfParentRegion() { return partOfParentRegion; } + @Deprecated public void setPartOfParentRegion(List partOfParentRegion) { this.partOfParentRegion = partOfParentRegion; } + + @Override + public boolean equals(Object obj) { + return obj instanceof WeatherAdvisoryWatch && + this.compareTo((WeatherAdvisoryWatch) obj) == 0; + } public int compareTo(WeatherAdvisoryWatch waw) { - return this.parentRegion.compareTo(waw.getParentRegion()); + if (this.phensig == null) + return waw.phensig == null ? 0 : -1; + else if (waw.phensig == null) + return 1; + else { + int c = this.phensig.compareTo(waw.phensig); + if (c == 0) + return this.eventId - waw.eventId; + else + return c; + } + } + + public int getEventId() { + return eventId; + } + + public void setEventId(int eventId) { + this.eventId = eventId; + } + + public List getPortions() { + return portions; + } + + public void setPortions(List portions) { + this.portions = portions; } } diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/VM_global_library.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/VM_global_library.vm index 04ffc77be2..c5346631de 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/VM_global_library.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/VM_global_library.vm @@ -2,7 +2,8 @@ ##### Qinglu Lin 04-04-2012 DR 14691. ##### Qinglu Lin 06-18-2012 DR 15043. Use duration in secondBullet. ##### Qinglu Lin 07-31-2012 DR 15217. Use roundAndPad for movement direction in DEG. -##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime. +##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime. +##### D. Friedman 11-09-2012 DR 15430. Rework included watches. #################################################################################################### Mile Marker Test Code macro "mmarkers" use (called out of VM_global_library.vm): @@ -146,52 +147,66 @@ ${drainage.name}## #macro(inserttorwatches $watches $list $secondtimezone $dateUtil $timeFormat) #set($torWatches = ${watches.getTorWatches()}) -#if(${list.size($torWatches)} > 0) -A TORNADO WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${watches.getLatestTorTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## +#set($torWatchAlso = "") +#set($torWatchFirst = 1) +#foreach(${watch} in ${torWatches}) +#if($torWatchFirst) +#set($torWatchFirst = 0) + ## +#end +A TORNADO WATCH ${torWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## ${dateUtil.period(${watches.getLatestTorTime()},${timeFormat.plain}, 15, ${localtimezone})}## #if(${secondtimezone}) -/${dateUtil.format(${list.get($torWatches, 0).endTime}, ${timeFormat.plain}, 15, ${secondtimezone})}/## +/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/## #end FOR ## -#set($numWatches = ${list.size($torWatches)}) +#set($numPortions = ${list.size(${watch.getPortions()})}) #set($count = 0) -#foreach(${watch} in ${torWatches}) +#foreach(${portion} in ${watch.getPortions()}) #set($count = $count + 1) -#areaFormat(${watch.partOfParentRegion} true false) ${watch.parentRegion}## -#if($count == $numWatches - 1) +#areaFormat(${portion.partOfParentRegion} true false) ${portion.parentRegion}## +#if($count == $numPortions - 1) AND ## -#elseif($count < $numWatches) +#elseif($count < $numPortions) ...## #end #end -. - +#set($torWatchAlso = "ALSO ") +.## #end + #end #macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat) #set($svrWatches = ${watches.getSvrWatches()}) -#if(${list.size($svrWatches)} > 0) -A SEVERE THUNDERSTORM WATCH REMAINS IN EFFECT UNTIL ${dateUtil.format(${watches.getLatestSvrTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## +#set($svrWatchAlso = "") +#set($svrWatchFirst = 1) +#foreach(${watch} in ${svrWatches}) +#if($svrWatchFirst) +#set($svrWatchFirst = 0) + ## +#end +A SEVERE THUNDERSTORM WATCH ${svrWatchAlso}REMAINS IN EFFECT UNTIL ${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${localtimezone})}## ${dateUtil.period(${watches.getLatestSvrTime()},${timeFormat.plain}, 15, ${localtimezone})}## #if(${secondtimezone}) -/${dateUtil.format(${list.get($svrWatches, 0).endTime}, ${timeFormat.plain}, 15, ${secondtimezone})}/## +/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/## #end FOR ## -#set($numWatches = ${list.size($svrWatches)}) +#set($numPortions = ${list.size(${watch.getPortions()})}) #set($count = 0) -#foreach(${watch} in ${svrWatches}) +#foreach(${portion} in ${watch.getPortions()}) #set($count = $count + 1) -#areaFormat(${watch.partOfParentRegion} true false) ${watch.parentRegion}## -#if($count == $numWatches - 1) +#areaFormat(${portion.partOfParentRegion} true false) ${portion.parentRegion}## +#if($count == $numPortions - 1) AND ## -#elseif($count < $numWatches) +#elseif($count < $numPortions) ...## #end #end -. - +#set($svrWatchAlso = "ALSO ") +.## #end + #end #macro(printcoords $coordinates $list) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/QPE-TIR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/QPE-TIR.xml index c7f0099b67..870da6f0cc 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/QPE-TIR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/QPE-TIR.xml @@ -21,8 +21,8 @@ 250160 QPF Grid for TIR (Ohio Basin RFC Wilmington, Ohio) - 36.19 - -91.347 + 36.203 + -91.320 LowerLeft 250 260 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ALR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ALR.xml index 02458353e2..a7cbdfd9fd 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ALR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ALR.xml @@ -21,13 +21,13 @@ 240161 HRAP Grid for ALR (Southeast RFC Peachtree, Georgia) - 27.033 - -91.417 + 27.045 + -91.395 LowerLeft 335 412 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240FWR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240FWR.xml index df3c9b52af..495933a930 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240FWR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240FWR.xml @@ -21,13 +21,13 @@ 240162 HRAP Grid for WFR (West Gulf RFC Fort Worth, Texas) - 24.852 - -108.99 + 24.869 + -108.973 LowerLeft 425 390 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240KRF.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240KRF.xml index 0d017b4d6c..261f55028e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240KRF.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240KRF.xml @@ -21,13 +21,13 @@ 240156 HRAP Grid for KRF (Missouri Basin RFC Pleasant Hill, Missouri) - 37.275 - -112.71 + 37.296 + -112.690 LowerLeft 485 325 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240MSR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240MSR.xml index 7ef47368a8..a36a96c94f 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240MSR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240MSR.xml @@ -21,13 +21,13 @@ 240157 HRAP Grid for MSR (North Central RFC Chanhassen, Minnesota) - 37.87 - -105.515 + 37.889 + -105.492 LowerLeft 450 350 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ORN.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ORN.xml index d7fac5060d..50622aef0c 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ORN.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240ORN.xml @@ -21,13 +21,13 @@ 240154 HRAP Grid for ORN (Lower Mississippi RFC Slidel, Louisiana) - 28.686 - -98.791 + 28.701 + -98.770 LowerLeft 419 419 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240PTR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240PTR.xml index 24d3d3d777..3099a2a978 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240PTR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240PTR.xml @@ -21,13 +21,13 @@ 240159 HRAP Grid for PTR (Northwest RFC Portland, Oregon) - 37.952 - -124.207 + 38.00 + -124.179 LowerLeft 400 378 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RHA.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RHA.xml index 9a10f332de..45eba05bf8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RHA.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RHA.xml @@ -21,13 +21,13 @@ 240155 HRAP Grid for RHA (Middle Atlantic RFC State College, PA) - 38.025 - -83.346 + 38.035 + -83.315 LowerLeft 200 200 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RSA.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RSA.xml index 2d7448ec79..fb2f699e83 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RSA.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240RSA.xml @@ -21,13 +21,13 @@ 240153 HRAP Grid for RSA (California-Nevada RFC Sacramento, California) - 30.91 - -120.872 + 30.931 + -120.858 LowerLeft 235 335 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240STR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240STR.xml index 3ffbd406f8..54a1c186d6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240STR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240STR.xml @@ -21,13 +21,13 @@ 240152 HRAP Grid for STR (Colorado Basin RFC Salt Lake City, Utah) - 30.027 - -114.429 + 30.047 + -114.413 LowerLeft 260 360 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TAR.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TAR.xml index 0c1b755afd..74f436e850 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TAR.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TAR.xml @@ -21,13 +21,13 @@ 240158 HRAP Grid for TAR (Northeast RFC Taunton, Massachusetts) - 42.057 - -80.004 + 42.066 + -79.970 LowerLeft 180 235 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TUA.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TUA.xml index 3672af9564..6ec23b38f8 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TUA.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/grids/grid240TUA.xml @@ -21,13 +21,13 @@ 240150 HRAP Grid for TUA (Arkansas-Red River RFC Tulsa, Oklahoma) - 33.603 - -106.455 + 33.621 + -106.434 LowerLeft 335 159 - 4.762 - 4.762 + 4.7625 + 4.7625 km 6371229.0 6371229.0 diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java index 5d9e57d475..cae2d27ec7 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java @@ -94,6 +94,7 @@ import com.vividsolutions.jts.geom.Polygon; * reprojectGeometry. * 06/19/2012 14988 D. Friedman Make oversampling more like AWIPS 1 * 09/18/2012 #1091 randerso corrected getBoundingEnvelope + * 11/06/2012 15406 ryu Added convertToNativeEnvelope() * * * @@ -269,6 +270,55 @@ public class MapUtil { return generalEnvelope; } + /** + * Construct a native envelope from the grid domain represented + * by the lower left and the upper right corners. + * + * @param ll + * lower left of the grid envelope + * @param ur + * upper right of the grid envelope + * @param gloc + * grid location object + * @return a native envelope + * + */ + public static GeneralEnvelope convertToNativeEnvelope( + Coordinate ll, Coordinate ur, ISpatialObject gloc) { + GeneralEnvelope generalEnvelope = new GeneralEnvelope(2); + generalEnvelope.setCoordinateReferenceSystem(gloc.getCrs()); + + double minX = Double.POSITIVE_INFINITY; + double maxX = Double.NEGATIVE_INFINITY; + double minY = Double.POSITIVE_INFINITY; + double maxY = Double.NEGATIVE_INFINITY; + + for (Coordinate p : new Coordinate[]{ll, ur}) { + Coordinate translated = gridCoordinateToNative(p, + PixelOrientation.CENTER, gloc); + double x = translated.x; + double y = translated.y; + + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + + generalEnvelope.setRange(0, minX, maxX); + generalEnvelope.setRange(1, minY, maxY); + + return generalEnvelope; + } + /** * Reproject a grid coverage into a different coordinate reference system * diff --git a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataThriftContainer.java b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataThriftContainer.java index b3e0517aa8..4e090a00f2 100644 --- a/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataThriftContainer.java +++ b/edexOsgi/com.raytheon.uf.common.pointdata/src/com/raytheon/uf/common/pointdata/PointDataThriftContainer.java @@ -45,6 +45,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; * ------------ ---------- ----------- -------------------------- * Jan 14, 2010 chammack Initial creation * + * 10/30/2012 15448 Xiaochuan Check if container != null first in from(). + * * * * @author chammack @@ -156,36 +158,40 @@ public class PointDataThriftContainer implements ISerializableObject { List floatTypes = new ArrayList(); List stringTypes = new ArrayList(); List longTypes = new ArrayList(); - - for (Map.Entry> v : container.pointDataTypes - .entrySet()) { - AbstractPointDataObject o = v.getValue(); - if (o instanceof IntPointDataObject) { - intTypes.add((IntPointDataObject) o); - } else if (o instanceof FloatPointDataObject) { - floatTypes.add((FloatPointDataObject) o); - } else if (o instanceof StringPointDataObject) { - stringTypes.add((StringPointDataObject) o); - } else if (o instanceof LongPointDataObject) { - longTypes.add((LongPointDataObject) o); - } else { - throw new UnsupportedOperationException("Got type: " + + if( container != null ) + { + for (Map.Entry> v : container.pointDataTypes + .entrySet()) { + AbstractPointDataObject o = v.getValue(); + if (o instanceof IntPointDataObject) { + intTypes.add((IntPointDataObject) o); + } else if (o instanceof FloatPointDataObject) { + floatTypes.add((FloatPointDataObject) o); + } else if (o instanceof StringPointDataObject) { + stringTypes.add((StringPointDataObject) o); + } else if (o instanceof LongPointDataObject) { + longTypes.add((LongPointDataObject) o); + } else { + throw new UnsupportedOperationException("Got type: " + o.getClass().getName() + ". Code must be updated to support new type"); - } + } + + } + + pdtc.intData = intTypes + .toArray(new IntPointDataObject[intTypes.size()]); + pdtc.floatData = floatTypes.toArray(new FloatPointDataObject[floatTypes + .size()]); + pdtc.stringData = stringTypes + .toArray(new StringPointDataObject[stringTypes.size()]); + pdtc.longData = longTypes.toArray(new LongPointDataObject[longTypes + .size()]); + + pdtc.size = container.getAllocatedSz(); } - - pdtc.intData = intTypes - .toArray(new IntPointDataObject[intTypes.size()]); - pdtc.floatData = floatTypes.toArray(new FloatPointDataObject[floatTypes - .size()]); - pdtc.stringData = stringTypes - .toArray(new StringPointDataObject[stringTypes.size()]); - pdtc.longData = longTypes.toArray(new LongPointDataObject[longTypes - .size()]); - - pdtc.size = container.getAllocatedSz(); - + return pdtc; } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.vaa/utility/common_static/base/purge/vaaPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.vaa/utility/common_static/base/purge/vaaPurgeRules.xml new file mode 100644 index 0000000000..1182b36c71 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.plugin.vaa/utility/common_static/base/purge/vaaPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 24 + =00-01:00:00 + 00-01:00:00 + + diff --git a/rpms/awips2.core/Installer.httpd-pypies/component.spec b/rpms/awips2.core/Installer.httpd-pypies/component.spec index d4f304df99..6f972341f7 100644 --- a/rpms/awips2.core/Installer.httpd-pypies/component.spec +++ b/rpms/awips2.core/Installer.httpd-pypies/component.spec @@ -8,7 +8,7 @@ Summary: Pypies Apache HTTP Server Name: awips2-httpd-pypies Version: 2.2.3 # This Is Officially Release: 22%{?dist} -Release: 28%{?dist} +Release: 29%{?dist} URL: http://httpd.apache.org/ Prefix: /awips2/httpd_pypies Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.gz diff --git a/rpms/awips2.core/Installer.ldm/component.spec b/rpms/awips2.core/Installer.ldm/component.spec index ca151e229e..536a480d9a 100644 --- a/rpms/awips2.core/Installer.ldm/component.spec +++ b/rpms/awips2.core/Installer.ldm/component.spec @@ -5,7 +5,7 @@ Name: awips2-ldm Summary: AWIPS II LDM Distribution Version: 6.8.1 -Release: 23 +Release: 24 Group: AWIPSII BuildRoot: /tmp URL: N/A diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum index 7e316fd229..74ceead833 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.gum @@ -59,12 +59,14 @@ EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" +EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" # # readnoaaport shared memory readers EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" +EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo index 7e316fd229..74ceead833 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.hfo @@ -59,12 +59,14 @@ EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" +EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" # # readnoaaport shared memory readers EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" +EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp index 7e316fd229..74ceead833 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.pbp @@ -59,12 +59,14 @@ EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" +EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" # # readnoaaport shared memory readers EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" +EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh index 40bda8660d..42da2e133d 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh +++ b/rpms/awips2.core/Installer.ldm/patch/etc/ldmd.conf.vrh @@ -59,12 +59,14 @@ EXEC "dvbs_multicast -b 40000 -m 224.0.1.1" EXEC "dvbs_multicast -b 40000 -m 224.0.1.2" EXEC "dvbs_multicast -b 40000 -m 224.0.1.3" EXEC "dvbs_multicast -b 40000 -m 224.0.1.4" +EXEC "dvbs_multicast -b 40000 -m 224.0.1.5" # # readnoaaport shared memory readers EXEC "readnoaaport -m 224.0.1.1 -n -u 3 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.2 -n -u 4 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.3 -n -u 5 -t mhs -r 1" EXEC "readnoaaport -m 224.0.1.4 -n -u 6 -t mhs -r 1" +EXEC "readnoaaport -m 224.0.1.5 -n -u 7 -t mhs -r 1" # # rtstats uses the LDM to send product latency statistics to the UPC. # For more info on rtstats please see the man page. diff --git a/rpms/build/i386/build.sh b/rpms/build/i386/build.sh index 5e976c9f7b..ca743fa7da 100644 --- a/rpms/build/i386/build.sh +++ b/rpms/build/i386/build.sh @@ -311,6 +311,12 @@ if [ "${1}" = "-ade" ]; then exit 1 fi + # Build the source jar file + ade_work_dir="/home/dmsys/Dim12/build/AWIPS2/AWIPS2-ADE-OB12.11.2-CM" + cd $ade_work_dir + ./build_source_jar.sh + cp -v /tmp/awips2-ade-baseline-SOURCES.jar ${WORKSPACE}/${ade_directory} + # Tar the directory. pushd . > /dev/null 2>&1 cd ${WORKSPACE}