diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java index 53e963aaeb..b8ae4bd55c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/comm/WarningSender.java @@ -35,7 +35,9 @@ import javax.jms.Session; import com.raytheon.uf.common.dataplugin.text.request.InsertStdTextProductRequest; import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.comm.JMSConnection; @@ -60,6 +62,7 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; * 02Aug2010 2187 cjeanbap Update variable/method signature to be consistent. * 04Oct2010 7193 cjeanbap Add time-to-live value to MessageProducer. * Sep 13, 2013 2368 rjpeter Set delivery mode to PERSISTENT. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author mschenke @@ -70,6 +73,9 @@ public class WarningSender implements IWarngenObserver { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WarningSender.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + private final String hostName = null; private boolean notifyError; @@ -105,8 +111,8 @@ public class WarningSender implements IWarngenObserver { long t0 = System.currentTimeMillis(); String siteNode = SiteAbbreviationUtil.getSiteNode(LocalizationManager .getInstance().getCurrentSite()); - statusHandler.debug("Get site node time: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Get site node time", + System.currentTimeMillis() - t0); if (host == null) { statusHandler.handle(Priority.ERROR, "Text Workstation host not set in preferences."); @@ -144,7 +150,7 @@ public class WarningSender implements IWarngenObserver { m.setJMSDeliveryMode(DeliveryMode.PERSISTENT); mp.send(m); long t1 = System.currentTimeMillis(); - statusHandler.debug(id + " sent to text workstation in " + perfLog.log(id + " sent to text workstation in " + (t1 - t0) + "ms in " + (connectCount + 1) + (connectCount > 0 ? " tries" : " try")); messageNotSent = false; @@ -260,8 +266,8 @@ public class WarningSender implements IWarngenObserver { ThriftClient.sendRequest(new InsertStdTextProductRequest(id, warning, operationalMode)); - statusHandler.debug(id + " saved to textdb in " - + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration(id + " save to textdb", + System.currentTimeMillis() - t0); } public static String getCurTimeString() { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/AbstractDbSourceDataAdaptor.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/AbstractDbSourceDataAdaptor.java index 6c9a995470..18bd1023d3 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/AbstractDbSourceDataAdaptor.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/AbstractDbSourceDataAdaptor.java @@ -27,6 +27,8 @@ import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode; import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.geospatial.SpatialQueryResult; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory; import com.raytheon.viz.core.map.GeoUtil; @@ -53,6 +55,7 @@ import com.vividsolutions.jts.geom.Point; * Feb 12, 2013 1600 jsanchez Used adjustAngle method from AbstractStormTrackResource. * Mar 5, 2013 1600 jsanchez Used AdjustAngle instead of AbstractStormTrackResource to handle angle adjusting. * Mar 26, 2013 1819 jsanchez Allowed points to be not be based on point source inclusion constraints. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @@ -61,6 +64,9 @@ import com.vividsolutions.jts.geom.Point; */ abstract public class AbstractDbSourceDataAdaptor { + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + private static final String transformedKey = "com.raytheon.transformed"; private static final String GEOM_FIELD = "the_geom"; @@ -176,8 +182,8 @@ abstract public class AbstractDbSourceDataAdaptor { ptFields.toArray(new String[ptFields.size()]), searchArea, filter, SearchMode.INTERSECTS); } - System.out.println("Retrieve location data for '" + pointSource - + "' = " + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Retrieve location data for '" + pointSource + "'", + System.currentTimeMillis() - t0); } catch (SpatialException e) { throw new VizException("Error querying " + pointSource + " table: " + e.getLocalizedMessage(), e); 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 fa73aa4e3e..b3e9a15b0f 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 @@ -44,7 +44,9 @@ import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode; import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.geospatial.SpatialQueryResult; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.exception.VizException; @@ -87,6 +89,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometry; * Sep 14, 2014 ASM #641 dhuffman Filtered out cases where Areas do not match Zones by using * refactored WarngenLayer::filterArea. * Mar 9, 2014 ASM #17190 D. Friedman Use fipsField and areaField for unique area ID. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author chammack @@ -96,6 +99,9 @@ public class Area { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(Area.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + /** * If an area greater than this percentage of the area is covered, no * direction is included @@ -167,6 +173,7 @@ public class Area { // Query for points within polygon SpatialQueryResult[] ptFeatures = null; + long t0 = System.currentTimeMillis(); if (pointField != null) { try { ptFeatures = SpatialQueryFactory.create().query(pointSource, @@ -177,6 +184,8 @@ public class Area { e); } } + perfLog.logDuration("affected areas '" + areaConfig.getVariable() + + "' spatial query", System.currentTimeMillis() - t0); Abbreviation abbreviation = null; @@ -194,6 +203,7 @@ public class Area { List uniqueAreaIDs = new ArrayList(); List areas = new ArrayList(); + long t0f = System.currentTimeMillis(); for (GeospatialData regionFeature : countyMap.values()) { Geometry regionGeom = regionFeature.geometry; PreparedGeometry preparedRegionGeom = regionFeature.prepGeom; @@ -284,6 +294,8 @@ public class Area { areas.add(area); } } + perfLog.logDuration("affected areas '" + areaConfig.getVariable() + + "' features", System.currentTimeMillis() - t0f); // Perform Sort if (fields.size() > 0) { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java index e931a5ad9b..8882ce83b9 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java @@ -91,6 +91,7 @@ import com.vividsolutions.jts.precision.SimpleGeometryPrecisionReducer; * hatched area would be retained after redrawing. * 07/22/2014 DR 17475 Qinglu Lin Updated createPolygonByPoints() and created second createPolygonByPoints(). * 04/29/2015 DR 17310 D. Friedman Use Geometry.buffer() to fix self-intersections. Fix bug in alterVertexes. + * 05/07/2015 DR 17438 D. Friedman Clean up debug and performance logging. * 05/08/2015 DR 17310 D. Friedman Prevent reducePoints from generating invalid polygons. * * @@ -550,20 +551,23 @@ public class PolygonUtil { .toArray(new Coordinate[points.size()])), null); if (!rval.isValid()) { - System.out.format("Polygon %s is invalid. Attempting to fix...\n", rval); + statusHandler.handle(Priority.DEBUG, String.format( + "Polygon %s is invalid. Attempting to fix...", rval)); + String resultMessage = null; try { Polygon p2 = (Polygon) rval.buffer(0.0); rval = gf.createPolygon((LinearRing) p2.getExteriorRing()); + resultMessage = String.format(" ...fixed. Result: %s", rval); } catch (TopologyException e) { - System.out.format("...fix failed\n"); + resultMessage = " ...fix failed"; } catch (ClassCastException e) { - System.out.format("...resulted in something other than a polygon\n"); + resultMessage = " ...resulted in something other than a polygon"; } - System.out.format("...fixed. Result: %s\n", rval); + statusHandler.handle(Priority.DEBUG, resultMessage); } if (rval.isValid() == false) { - System.out.println("Fixing intersected segments"); + statusHandler.handle(Priority.DEBUG, "Fixing intersected segments"); Coordinate[] coords = rval.getCoordinates(); adjustVertex(coords); PolygonUtil.round(coords, 2); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java index eeb8e77e25..e075d2dbe4 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/WatchUtil.java @@ -51,7 +51,9 @@ import com.raytheon.uf.common.dataquery.requests.DbQueryRequest; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.util.TimeUtil; @@ -86,6 +88,7 @@ import com.vividsolutions.jts.geom.Polygon; * extension of a watch to counties which are of same/different fe_area. * Sep 25, 2014 ASM #16783 D. Friedman Do not use VTEC action to determine Watch uniqueness. * Apr 28, 2015 RODO #4027 randerso Expunged Calendar from ActiveTableRecord + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author jsanchez @@ -96,6 +99,9 @@ public class WatchUtil { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WatchUtil.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + private static final UnitConverter milesToKilometer = NonSI.MILE .getConverterTo(SI.KILOMETER); @@ -230,8 +236,8 @@ public class WatchUtil { Polygon watchArea = (Polygon) warningPolygon .buffer(milesToKilometer.convert(watchAreaBuffer) / KmToDegrees); - System.out.println("create watch area buffer time: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Create watch area buffer time", + System.currentTimeMillis() - t0); HashSet validUgcZones = new HashSet( warngenLayer.getUgcsForWatches(watchArea, GeoFeatureType.COUNTY)); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java index 99948d854f..270aa2ad0c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/Wx.java @@ -64,7 +64,9 @@ import com.raytheon.uf.common.geospatial.ISpatialQuery.SearchMode; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.geospatial.SpatialQueryResult; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.exception.VizException; @@ -118,6 +120,7 @@ import com.vividsolutions.jts.geom.Point; * Dec 4, 2013 2604 jsanchez Refactored GisUtil. * Apr 29, 2014 3033 jsanchez Updated method to retrieve files in localization. * Jun 17, 2014 DR 17390 Qinglu Lin Updated getClosestPoints(). + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author chammack @@ -127,6 +130,9 @@ public class Wx { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(Wx.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + private long wwaStopTime; private long wwaStartTime; @@ -531,8 +537,8 @@ public class Wx { pathcasts.remove(pathcasts.size() - 1); } - System.out.println("Time to get pathcast = " - + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration("Get pathcast", + System.currentTimeMillis() - t0); return pathcasts.toArray(new PathCast[pathcasts.size()]); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, @@ -608,8 +614,8 @@ public class Wx { + variable + "'", t); } } - System.out.println("Time to get closestPoints = " - + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration("Get closestPoints", + System.currentTimeMillis() - t0); return pointsMap; } @@ -729,8 +735,8 @@ public class Wx { localizedSite)); } long t1 = System.currentTimeMillis(); - System.out.println("getClosestPoint.dbQuery took " + (t1 - t0) - + " for point source " + pointConfig.getPointSource()); + perfLog.logDuration("getClosestPoints.dbQuery for point source " + + pointConfig.getPointSource(), t1 - t0); } // Convert searchArea to a local projection diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 1dc47d40da..fe10ca0460 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -67,7 +67,9 @@ import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; import com.raytheon.uf.common.dataplugin.warning.config.BulletActionGroup; import com.raytheon.uf.common.dataplugin.warning.config.DamInfoBullet; import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.SimulatedTime; @@ -163,6 +165,7 @@ import com.vividsolutions.jts.geom.Polygon; * one marine product to another is to skip computing hatching area. The hatching area might * not be as expected if percentage/area is different between the two products. But the * chance for that to occur is trivial. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author chammack @@ -173,6 +176,9 @@ public class WarngenDialog extends CaveSWTDialog implements private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WarngenDialog.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + /* * This flag allows a hidden button to appear to help recreating warning * polygons that had issues in the feed. @@ -1115,6 +1121,7 @@ public class WarngenDialog extends CaveSWTDialog implements * Action for OK button */ private void okPressed() { + final long t0okPressed = System.currentTimeMillis(); if (checkDamSelection() == false) { return; } else if (warngenLayer.getWarningArea() == null) { @@ -1169,9 +1176,9 @@ public class WarngenDialog extends CaveSWTDialog implements @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + long t0 = System.currentTimeMillis(); try { monitor.beginTask("Generating product", 1); - long t0 = System.currentTimeMillis(); String result = TemplateRunner.runTemplate( warngenLayer, startTime.getTime(), endTime.getTime(), selectedBullets, @@ -1182,8 +1189,6 @@ public class WarngenDialog extends CaveSWTDialog implements while (m.find()) { totalSegments++; } - System.out.println("Time to run template = " - + (System.currentTimeMillis() - t0)); } catch (Exception e) { statusHandler.handle( Priority.PROBLEM, @@ -1191,19 +1196,23 @@ public class WarngenDialog extends CaveSWTDialog implements + e.getLocalizedMessage(), e); } finally { monitor.done(); + perfLog.logDuration("Run template", + System.currentTimeMillis() - t0); + perfLog.logDuration("click to finish template", + System.currentTimeMillis() - t0okPressed); } } }); - System.out.println(WarningSender.getCurTimeString() - + ": Creating Transmitting Warning Job"); + statusHandler.handle(Priority.DEBUG, + "Creating Transmitting Warning Job"); new Job("Transmitting Warning") { @Override protected IStatus run(IProgressMonitor monitor) { - System.out.println(WarningSender.getCurTimeString() - + ": Transmitting Warning Job Running"); + statusHandler.debug( + ": Transmitting Warning Job Running"); // Launch the text editor display as the warngen editor // dialog using the result aka the warngen text product. @@ -1222,6 +1231,8 @@ public class WarngenDialog extends CaveSWTDialog implements "Error sending warning: " + e.getLocalizedMessage(), e); } + perfLog.logDuration("click to finish sending", + System.currentTimeMillis() - t0okPressed); return Status.OK_STATUS; } }.schedule(); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index 0334180577..b7c3ca7dd7 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -81,7 +81,9 @@ import com.raytheon.uf.common.jms.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.NotificationException; import com.raytheon.uf.common.jms.notification.NotificationMessage; import com.raytheon.uf.common.site.SiteMap; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; @@ -236,6 +238,7 @@ import com.vividsolutions.jts.io.WKTReader; * 02/09/2015 3954 dlovely Only draw "W" if the county is displayed. * 02/25/2014 3353 rjpeter Fix synchronized use case, updated to not create dialog before init is finished. * 04/24/2015 ASM #17394 D. Friedman Fix geometries that become invalid in local coordinate space. + * 05/07/2015 ASM #17438 D. Friedman Clean up debug and performance logging. * 05/08/2015 ASM #17310 D. Friedman Log input polygon when output of AreaHatcher is invalid. * * @@ -247,6 +250,9 @@ public class WarngenLayer extends AbstractStormTrackResource { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WarngenLayer.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + String uniqueFip = null; String backupOfficeShort = null; @@ -491,9 +497,11 @@ public class WarngenLayer extends AbstractStormTrackResource { } if ((warningArea != null) && (warningPolygon != null)) { + long t0 = System.currentTimeMillis(); Polygon inputWarningPolygon = warningPolygon; Polygon outputHatchedArea = null; Geometry outputHatchedWarningArea = null; + String adjustmentMessage = null; try { warningPolygon = PolygonUtil .removeDuplicateCoordinate(warningPolygon); @@ -513,11 +521,12 @@ public class WarngenLayer extends AbstractStormTrackResource { GeometryFactory gf = new GeometryFactory(); LinearRing lr = gf.createLinearRing(coords); outputHatchedArea = gf.createPolygon(lr, null); + long tadj0 = System.currentTimeMillis(); int adjustPolygon_counter = 0; while (!outputHatchedArea.isValid() && (adjustPolygon_counter < 1)) { - System.out.println("Calling adjustPolygon #" - + adjustPolygon_counter); + adjustmentMessage = "adjustPolygon #" + + adjustPolygon_counter; PolygonUtil.adjustPolygon(coords); PolygonUtil.round(coords, 2); coords = PolygonUtil @@ -530,16 +539,11 @@ public class WarngenLayer extends AbstractStormTrackResource { } int counter = 0; if (!outputHatchedArea.isValid() && (counter < 2)) { - System.out - .println("calling adjustVertex & alterVertexes: loop #" - + counter); int adjustVertex_counter = 0; lr = gf.createLinearRing(coords); outputHatchedArea = gf.createPolygon(lr, null); while (!outputHatchedArea.isValid() && (adjustVertex_counter < 5)) { - System.out.println(" Calling adjustVertex #" - + adjustVertex_counter); coords = PolygonUtil.adjustVertex(coords); coords = PolygonUtil .removeDuplicateCoordinate(coords); @@ -550,12 +554,8 @@ public class WarngenLayer extends AbstractStormTrackResource { adjustVertex_counter += 1; } int inner_counter = 0; - System.out.println(""); while (!outputHatchedArea.isValid() && (inner_counter < 5)) { - System.out - .println(" Calling alterVertexes #" - + inner_counter); coords = PolygonUtil.alterVertexes(coords); coords = PolygonUtil .removeDuplicateCoordinate(coords); @@ -565,7 +565,15 @@ public class WarngenLayer extends AbstractStormTrackResource { outputHatchedArea = gf.createPolygon(lr, null); inner_counter += 1; } + counter += 1; + adjustmentMessage = String.format( + "adjustVertex & alterVertexes: %d, %d", + adjustVertex_counter, inner_counter); + } + if (adjustmentMessage != null) { + perfLog.logDuration("Vertex adjustments", System.currentTimeMillis() - tadj0); + statusHandler.debug(adjustmentMessage); } for (Coordinate c : outputHatchedArea.getCoordinates()) { if (Double.isNaN(c.x) || Double.isNaN(c.y)) { @@ -592,9 +600,10 @@ public class WarngenLayer extends AbstractStormTrackResource { * priority in getHatchedAreas(). */ statusHandler.handle(Priority.DEBUG, String.format( - "Error redrawing polygon: %s\n Input: %s\n", - e.getLocalizedMessage(), inputWarningPolygon), e); + "Error redrawing polygon: %s\n Input: %s\nAdjustments: %s\n", + e.getLocalizedMessage(), inputWarningPolygon, adjustmentMessage), e); } + perfLog.logDuration("AreaHatcher total", System.currentTimeMillis() - t0); } return Status.OK_STATUS; @@ -615,6 +624,7 @@ public class WarngenLayer extends AbstractStormTrackResource { } public synchronized Geometry[] getHatchedAreas() { + long t0 = System.currentTimeMillis(); while (getState() != Job.NONE) { try { join(); @@ -622,6 +632,10 @@ public class WarngenLayer extends AbstractStormTrackResource { return new Geometry[] { null, null }; } } + long t1 = System.currentTimeMillis(); + if (t1 - t0 > 250) { + perfLog.logDuration("Wait for AreaHatcher", t1 - t0); + } if (getResult() == null) { return null; } @@ -1264,8 +1278,8 @@ public class WarngenLayer extends AbstractStormTrackResource { this.configuration = config; }// end synchronize - System.out.println("Total time to init warngen config = " - + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration("Init warngen config", + System.currentTimeMillis() - t0); } private void initializeGeomUpdateObserver() { @@ -1464,8 +1478,8 @@ public class WarngenLayer extends AbstractStormTrackResource { gData.localGridGeometry = new GeneralGridGeometry(range, ge); - System.out.println("Time to lookup geospatial data " - + (System.currentTimeMillis() - tq0)); + perfLog.logDuration("Lookup geospatial data", + System.currentTimeMillis() - tq0); siteMap.put(currKey, gData); GeospatialData[] timezones = GeospatialFactory.getTimezones(); @@ -1962,8 +1976,8 @@ public class WarngenLayer extends AbstractStormTrackResource { : null); updateWarnedAreaState(newWarningArea, snapHatchedAreaToPolygon); - System.out.println("determining hatchedArea took " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Determining hatchedArea", + System.currentTimeMillis() - t0); } /** @@ -2669,8 +2683,8 @@ public class WarngenLayer extends AbstractStormTrackResource { return true; } + long t0 = System.currentTimeMillis(); try { - long t0 = System.currentTimeMillis(); Polygon hatched = state.getWarningPolygon(); Geometry hatchedArea = state.getWarningArea(); if (areaHatcher != null) { @@ -2718,13 +2732,13 @@ public class WarngenLayer extends AbstractStormTrackResource { issueRefresh(); result = false; } - System.out.println("Time to createWarningPolygon: " - + (System.currentTimeMillis() - t0) + "ms"); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, "Error hatching polygon", e); result = false; } + perfLog.logDuration("redrawBoxFromHatched", + System.currentTimeMillis() - t0); issueRefresh(); } return result; 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 1b0f478f8a..fbead3eb97 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 @@ -62,7 +62,9 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.site.SiteMap; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.DataTime; @@ -145,6 +147,7 @@ import com.vividsolutions.jts.io.WKTReader; * Aug 28, 2014 ASM #15551 Qinglu Lin Replaced 1200 PM/1200 AM by NOON/MIDNIGHT, removed days in * included tornado/severe thunderstorm watch message. * Sep 18, 2014 ASM #15465 Qinglu Lin For backup, get officeShort and officeLoc from backup WFO's config.xml. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author njensen @@ -155,6 +158,9 @@ public class TemplateRunner { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(TemplateRunner.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + private static final String LOGIN_NAME_KEY = "LOGNAME"; private static final Pattern BBB_PATTERN = Pattern @@ -295,15 +301,15 @@ public class TemplateRunner { t0 = System.currentTimeMillis(); areas = area.findAffectedAreas(config, warnPolygon, warningArea, threeLetterSiteId); - System.out.println("Time to get areas = " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("runTemplate get areas", + System.currentTimeMillis() - t0); context.put(config.getHatchedAreaSource().getVariable(), areas); t0 = System.currentTimeMillis(); intersectAreas = area.findInsectingAreas(config, warnPolygon, warningArea, threeLetterSiteId, warngenLayer); - System.out.println("Time to get intersecting areas = " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("runTemplate get intersecting areas", + System.currentTimeMillis() - t0); for (String ia : intersectAreas.keySet()) { context.put(ia, intersectAreas.get(ia)); } @@ -380,9 +386,8 @@ public class TemplateRunner { "Either timezoneGeom or/and warningArea is null. " + "Timezone cannot be determined."); } - System.out - .println("Time to do size computation = " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("runTemplate size computation", + System.currentTimeMillis() - t0); if (totalSize > minSize) { timeZones.add(oneLetterTZ[i]); } @@ -544,8 +549,8 @@ public class TemplateRunner { context.put("eventLocation", coords); t0 = System.currentTimeMillis(); ToolsDataManager.getInstance().setStormTrackData(std); - System.out.println("save storm track data: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Save storm track data", + System.currentTimeMillis() - t0); } else { // Retrieve the old Warning // Example: s[0-5] = T.CON-KLWX.SV.W.0123 @@ -601,8 +606,8 @@ public class TemplateRunner { std.setMotionSpeed(oldWarn.getMotspd()); t0 = System.currentTimeMillis(); ToolsDataManager.getInstance().setStormTrackData(std); - System.out.println("save storm track data: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Save storm track data", + System.currentTimeMillis() - t0); } } @@ -859,8 +864,7 @@ public class TemplateRunner { WatchUtil watchUtil = new WatchUtil(warngenLayer); List watches = watchUtil.getWatches(config, warnPolygon, simulatedTime); - System.out.println("getWatches time: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("getWatches", System.currentTimeMillis() - t0); if (watches != null && watches.isEmpty() == false) { context.put("watches", watches); } @@ -875,8 +879,7 @@ public class TemplateRunner { long tz0 = System.currentTimeMillis(); String script = createScript(warngenLayer.getTemplateName() + ".vm", context); - System.out.println("velocity time: " - + (System.currentTimeMillis() - tz0)); + perfLog.logDuration("velocity", System.currentTimeMillis() - tz0); String text = script.toString(); WarningTextHandler handler = WarningTextHandlerFactory.getHandler( diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WarningTextHandler.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WarningTextHandler.java index cf8ae197dd..94f572c7b5 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WarningTextHandler.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/text/WarningTextHandler.java @@ -23,6 +23,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.viz.warngen.gis.AffectedAreas; /** @@ -36,6 +38,7 @@ import com.raytheon.viz.warngen.gis.AffectedAreas; * ------------ ---------- ----------- -------------------------- * Sep 24, 2012 15322 jsanchez Initial creation * Jan 8, 2013 15664 Qinglu Lin Appended WarningAction to handle()'s parameter list, etc. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @@ -43,6 +46,8 @@ import com.raytheon.viz.warngen.gis.AffectedAreas; * @version 1.0 */ public class WarningTextHandler { + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); private AbstractLockingBehavior lockingBehavior; @@ -69,8 +74,8 @@ public class WarningTextHandler { text = clean(text); - System.out.println("Time to handle the text: " - + (System.currentTimeMillis() - t0)); + perfLog.logDuration("Handle the text", + System.currentTimeMillis() - t0); return text; } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java index 599a55c3e3..1e5df4a944 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/util/CurrentWarnings.java @@ -41,7 +41,9 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.site.SiteMap; +import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.ISimulatedTimeChangeListener; @@ -78,6 +80,7 @@ import com.vividsolutions.jts.geom.Geometry; * Aug 14, 2013 DR 16483 Qinglu Lin Fixed no option issue in WarnGen dropdown menu after * issuance of an CANCON and restart of CAVE. * Oct 16, 2013 2439 rferrel Restrict retrieval of warnings to prevent getting future warnings. + * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * * * @author mschenke @@ -88,6 +91,9 @@ public class CurrentWarnings { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(CurrentWarnings.class); + private static final IPerformanceStatusHandler perfLog = PerformanceStatus + .getHandler("WG:"); + public static interface IWarningsArrivedListener { public void warningsArrived(); } @@ -244,8 +250,8 @@ public class CurrentWarnings { long t0 = System.currentTimeMillis(); List warnings = requestRecords(constraints); - System.out.println("Time to request CurrentWarnings records: " - + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration("Request CurrentWarnings records", + System.currentTimeMillis() - t0); processRecords(warnings); } @@ -542,8 +548,8 @@ public class CurrentWarnings { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } - System.out.println("Time to prepare " + records.size() - + " records = " + (System.currentTimeMillis() - t0) + "ms"); + perfLog.logDuration("Prepare " + records.size() + " records", + System.currentTimeMillis() - t0); } return prepared; diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml index f3e2c619a2..f9734eb489 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml @@ -97,9 +97,8 @@ gfs161 gfs161 ruc130 - rtmaNDFD + rtmaNDFD urmaNDFD - rtmaNDFD aKrtmaNDFD NamDNG5 GlobalWave @@ -143,8 +142,6 @@ sref243 RTGSST235 gfsGuide232 - rtmaNDFD - rtmaNDFD aKrtmaNDFD aKrtmaNDFD HIrtmaNDFD diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml index 37660c460b..d1329c5e28 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml @@ -333,6 +333,7 @@ tp6c6 tp6c7 tp6c8 + tccerranl tpmean6 tpsprd6 tpecmwf diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py index 500cbcbe19..0c0c79238b 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py @@ -65,7 +65,7 @@ # being off # being off # 04/20/2015 #4414 dgilling Add missing NWPSTrkngCG0 weather elements. -# +# 05/12/2015 #17144 bhunder Added RTMA model ######################################################################## #---------------------------------------------------------------------------- @@ -316,6 +316,8 @@ VisUnc = ("VisUnc", SCALAR, "SM", "Vsby Anl Uncertainty", 10.0, 0.0, 2, NO) PressUnc = ("PressUnc", SCALAR, "Pa", "Press Anl Uncertainty", 110000.0, 0.0, 2, NO) Pressure = ("Pressure", SCALAR, "Pa", "Pressure", 110000.0, 0.0, 2, NO) WGustUnc = ("WGustUnc", SCALAR, "kts", "WGust Anl Uncertainty", 12.0, 0.0, 0, NO) +# DR 17144 +SkyUnc = ("SkyUnc", SCALAR, "%", "Sky Uncertainty", 100.0, 0.0, 0, NO) # NamDNG5 parms QPF3 = ("QPF3", SCALAR, "in", "3HR QPF", 3.0, 0.0, 2, YES) @@ -1307,7 +1309,8 @@ elif SID in CONUS_EAST_SITES: ('nwpsCG1', 'nwpsCG1'), ('nwpsTrkngCG0', 'nwpsTrkngCG0'), 'MOSGuide', - 'RTMA', + ##############DR17144 + ('RTMA25', 'RTMA'), 'NamDNG5', ('TPCWindProb','TPCProb'), ('SREF212', 'SREF'), @@ -1384,7 +1387,8 @@ else: #######DCS3501 WEST_CONUS ('nwpsCG1', 'nwpsCG1'), ('nwpsTrkngCG0', 'nwpsTrkngCG0'), 'MOSGuide', - 'RTMA', + #######DR17144 + ('RTMA25', 'RTMA'), 'NamDNG5', ('TPCWindProb','TPCProb'), ('SREF212', 'SREF'), @@ -2065,17 +2069,17 @@ TPCTCM_MODEL = [([HiWind], TC3)] # RTMA database parameter groupings #if SID in ALASKA_SITES: - not sure if this is right -# DCS17288 +# DCS17288/DR17144 if SID in ALASKA_SITES or SID in ["HFO", "SJU"]: RTMAPARMS = [([Temp,Td,RH,Wind,Vis,Pressure,WindGust],TC1), ([MinT],MinTTC), ([MaxT],MaxTTC), ([MinRH],MinRHTC), ([MaxRH],MaxRHTC), - ([TUnc,TdUnc,WSpdUnc,WDirUnc,VisUnc,PressUnc,WGustUnc],TC1)] + ([TUnc,TdUnc,WSpdUnc,WDirUnc,VisUnc,PressUnc,WGustUnc,SkyUnc],TC1)] else: RTMAPARMS = [([Temp,Td,RH,Wind,QPE,Sky,Vis,Pressure,WindGust],TC1), ([MinT],MinTTC), ([MaxT],MaxTTC), ([MinRH],MinRHTC), ([MaxRH],MaxRHTC), - ([TUnc,TdUnc,WSpdUnc,WDirUnc,VisUnc,PressUnc,WGustUnc],TC1)] + ([TUnc,TdUnc,WSpdUnc,WDirUnc,VisUnc,PressUnc,WGustUnc,SkyUnc],TC1)] # NamDNG5 database parameter groupings NamDNG5PARMS = [([Temp, Td, RH, Wind, Sky, WindGust, Vis], TC3), diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/rtmaNDFD.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/rtmaNDFD.xml index 8a832a55da..6aec41fd6a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/rtmaNDFD.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/rtmaNDFD.xml @@ -100,6 +100,21 @@ EA + + tccerranl + Total Cloud Cover error analysis + % + percent + ErrorAnalysisCloud + 0.0 + 100.0 + -99999.0 + 0 + EA + + EA + + tp total precipitation diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py index f7eb5a0f7e..a830f17cb1 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/Init.py @@ -1065,25 +1065,21 @@ class Forecaster(GridUtilities): LogStream.logEvent(msg) try: - rval = apply(mthd, tuple(gargs)) + rval = apply(mthd, tuple(gargs)) - if rval is not None: - if type(rval) is not ndarray: - if type(rval) is not tuple: - jrval = rval - rval = rval.__numpy__ - if len(rval) == 1: - if rval[0].dtype != int8: + if type(rval) is not ndarray and rval is not None: + if type(rval) is not tuple: + jrval = rval + rval = rval.__numpy__ + if len(rval) == 1: + if rval[0].dtype != int8: # scalar rval = rval[0] - else: + else: # discrete or weather keys = JUtil.javaObjToPyVal(jrval.getKeyList()) rval.append(keys) - cache[we] = (rval, time) - - else: - cache[we] = (None, time) + cache[we] = (rval, time) if rval is not None and cache['mtime'][0] is not None and doStore: parm = self.__getNewWE(we) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/RTMA.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/RTMA.py index f709309b83..0de064b338 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/RTMA.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/smartinit/RTMA.py @@ -52,6 +52,12 @@ class RTMAForecaster(Forecaster): grid = tcc_EA return clip(grid, 0, 100) ##-------------------------------------------------------------------------- +## Sky Analysis Uncertainty +##-------------------------------------------------------------------------- + def calcSkyUnc(self, tccerranl_EA): + grid = tccerranl_EA + return clip(grid, 0, 100) +##-------------------------------------------------------------------------- ## T - change K to F ##-------------------------------------------------------------------------- def calcT(self, t_FHAG2):