diff --git a/edexOsgi/build.edex/esb/bin/ndmMenuIngester.sh b/build/deploy.edex.awips2/esb/bin/ndmMenuIngester.sh similarity index 100% rename from edexOsgi/build.edex/esb/bin/ndmMenuIngester.sh rename to build/deploy.edex.awips2/esb/bin/ndmMenuIngester.sh diff --git a/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml b/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml index 23f3f1dddd..33b93f5c92 100644 --- a/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml +++ b/build/deploy.edex.awips2/esb/conf/spring/edex-db.xml @@ -22,7 +22,8 @@ com.raytheon.uf.common.dataplugin.text com.raytheon.uf.common.dataplugin.shef - com.raytheon.edex.plugin.shef + com.raytheon.edex.plugin.shef + com.raytheon.uf.common.bmh diff --git a/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/ManageUserDlg.java b/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/ManageUserDlg.java index 38c1da034e..1bacf482b1 100644 --- a/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/ManageUserDlg.java +++ b/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/ManageUserDlg.java @@ -54,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate; * May 23, 2012 mpduff Initial creation * Aug 08, 2012 863 jpiatt Added new interface method. * Jul 28, 2013 2236 mpduff Made resizable. + * May 04, 2015 4419 rferrel Sort {@link #roleDualList}. * * * @@ -208,6 +209,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate { roleConfig.setSelectedList(selectedList); roleConfig.setFullList(fullList); roleConfig.setMenuData(menuData); + roleConfig.setSortList(true); roleDualList = new DualList(stackComp, SWT.NONE, roleConfig, this); @@ -240,6 +242,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate { permConfig.setSelectedList(selectedPermList); permConfig.setFullList(fullPermList); permConfig.setMenuData(menuData2); + permConfig.setSortList(true); permDualList = new DualList(stackComp, SWT.NONE, permConfig, this); diff --git a/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/UserAdminSelectDlg.java b/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/UserAdminSelectDlg.java index c1bfdb5fff..4bdbf2447b 100644 --- a/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/UserAdminSelectDlg.java +++ b/cave/com.raytheon.uf.viz.useradmin/src/com/raytheon/uf/viz/useradmin/ui/UserAdminSelectDlg.java @@ -20,6 +20,7 @@ package com.raytheon.uf.viz.useradmin.ui; import java.util.ArrayList; +import java.util.Arrays; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; @@ -71,6 +72,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * and delete buttons. Give delete dialogs * a title. * Apr 02, 2015 4345 skorolev Fixed dialog to expand vertically properly. + * May 04, 2015 4419 rferrel Sort {@link #userPermList}. * * * @@ -563,7 +565,10 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements rp.add(perm); } - userPermList.setItems(rp.toArray(new String[rp.size()])); + String[] rpArray = rp.toArray(new String[rp.size()]); + Arrays.sort(rpArray); + + userPermList.setItems(rpArray); } } diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteConfigIni.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteConfigIni.java index 9e41793774..e1dd58b42d 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteConfigIni.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteConfigIni.java @@ -65,7 +65,8 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.triggerType; * Feb 16, 2011 7878 rferrel Modifications to use ids.cfg file. * Apr 08, 2011 8856 rferrel Can now make a new station's templates * May 24, 2011 9060 rferrel Limit downloading of localization files. - * Aug 09, 2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR + * Aug 09, 2013 2033 mschenke Switched File.separator to IPathManager.SEPARATOR + * May 04, 2015 17417 yteng Get all sites from product * * * @@ -299,13 +300,10 @@ public class TafSiteConfigIni implements ITafSiteConfig { HierarchicalINIConfiguration config = getProductConfig(product); if (config != null) { config.setDelimiterParsingDisabled(true); - String sites = config.getString("sites.idents"); - if (sites != null) { - String[] idents = config.getString("sites.idents").split( - "\\s*,\\s*", 0); - - for (String id : idents) { - siteList.add(id); + String[] sites = config.getStringArray("sites.idents"); + if (sites != null && sites.length > 0) { + for (String site : sites) { + siteList.add(site); } } } diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py index 2c87670331..2b812b87ca 100644 --- a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py +++ b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/textUtilities/headline/FormatterRunner.py @@ -26,7 +26,6 @@ import JUtil, VarDictGroker import RedirectLogging import UFStatusHandler -from java.io import File # # Runs the text formatter to generate text products # @@ -41,6 +40,9 @@ from java.io import File # 04/16/15 #14946 ryu Fix getTimeZones to return the office TZ if timezone # is not set for any zone in a segment. # 04/20/2015 #4027 randerso Fixes for formatter autotests +# 05/06/2015 #4467 randerso Convert to upper case before writing to files if +# mixed case is not enabled for the product. +# Cleaned up file writing code # # @@ -105,6 +107,33 @@ def executeFromJava(databaseID, site, username, dataMgr, forecastList, logFile, RedirectLogging.restore() return forecasts +def getPid(forecast): + # taken from ProductParser.py + import re + + sl = r'^' # start of line + el = r'\s*?\n' # end of line + id3 = r'[A-Za-z]{3}' # 3 charater word + empty = r'^\s*' + el # empty line + + wmoid = r'(?P[A-Z]{4}\d{2})' # wmoid + fsid = r'(?P[A-Z]{4})' # full station id + pit = r'(?P\d{6})' # product issuance time UTC + ff = r'(?P ' + id3 + ')?' # "funny" field + + # CI block + ci_start = sl + wmoid + ' ' + fsid + ' ' + pit + ff + el + awipsid = r'(?P(?P[A-Z0-9]{3})(?P[A-Z0-9]{1,3}))' + el + ci_block = r'(?P' + ci_start + awipsid + '\n?)' + + ci_re = re.compile(ci_block) + + pid = None + m = ci_re.search(forecast) + if m is not None: + pid = m.group('cat') + + return pid def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, username, dataMgr, serverFile=None, @@ -234,16 +263,31 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, # For each Forecast Type, # Create generate forecast - forecasts = "" + forecasts = "" # returned value + outForecasts = "" # written to output files for forecastType in forecastList: forecast = formatter.getForecast(forecastType, argDict) forecasts = forecasts + forecast + + # Convert data written to files to upper case if required + mixedCase = False + pid = getPid(forecast) + if pid is None: + logger.warning("Unable to determine PID: defaulting to upper case") + else: + from com.raytheon.uf.common.dataplugin.text.db import MixedCaseProductSupport + mixedCase = MixedCaseProductSupport.isMixedCase(pid) + + if mixedCase: + outForecasts = outForecasts + forecast + else: + outForecasts = outForecasts + forecast.upper() logger.info("Text:\n" + str(forecasts)) try: outputFile = argDict["outputFile"] - success = writeToFile(forecasts, outputFile, "w") + success = writeToFile(outForecasts, outputFile, "w") if success == 0: print "Couldn't open output file", outputFile logger.error("Couldn't open output file: ", outputFile) @@ -253,7 +297,7 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, try: outputFile = argDict["serverOutputFile"] - success = writeToFile(forecasts, outputFile, "w") + success = writeToFile(outForecasts, outputFile, "w") if success == 0: print "Couldn't open output file", outputFile logger.error("Couldn't open output file: ", outputFile) @@ -264,7 +308,7 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, try: appendFile = argDict["appendFile"] - success = writeToFile(forecasts, appendFile, "a") + success = writeToFile(outForecasts, appendFile, "a") if success == 0: print "Couldn't open append file", appendFile logger.error("Couldn't write to append file: ", appendFile) @@ -275,7 +319,7 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, try: serverFile = argDict["serverFile"] writeToSite = (username == "SITE") - success = writeToServerFile(forecasts, serverFile, writeToSite) + success = writeToServerFile(outForecasts, serverFile, writeToSite) if success == 0: print "Couldn't open server output file", serverFile logger.error("Couldn't open server output file: ", serverFile) @@ -283,6 +327,8 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode, except: pass + del outForecasts + # Remove any lat/lon areas created temporarily #global LatLonIds #argDict["ifpClient"].deleteReferenceData(LatLonIds) @@ -309,29 +355,37 @@ def getAbsTime(timeStr): return AbsTime.absTimeYMD(year, month, day, hour, minute) def writeToFile(forecasts, outputFile, mode): - if not outputFile is None and outputFile != "": - outfile = open(outputFile, mode) - os.chmod(outputFile, 0644) - if outfile is None: + if outputFile: + logger.info("Writing forecast to " + outputFile) + try: + with open(outputFile, mode) as outfile: + outfile.write(forecasts) + + os.chmod(outputFile, 0644) + except: + logger.exception("Error writing forecast to "+outputFile) return 0 - else: - outfile.write(forecasts) - outfile.close() return 1 def writeToServerFile(forecasts, outputFile, writeToSite): - if not outputFile is None and outputFile != "": - if writeToSite: - ctx = PATH_MGR.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.SITE) - else: - ctx = PATH_MGR.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.USER) - filePath = File.separatorChar.join(["gfe", "text", "PRODGEN", outputFile + ".PRODGEN"]) - lFile = PATH_MGR.getLocalizationFile(ctx, filePath) - javaFile = lFile.getFile() - outfile = open(javaFile.getAbsolutePath(), 'w') - outfile.write(forecasts) - outfile.close() - return lFile.save() + if outputFile: + try: + if writeToSite: + ctx = PATH_MGR.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.SITE) + else: + ctx = PATH_MGR.getContext(LocalizationType.COMMON_STATIC, LocalizationLevel.USER) + filePath = PATH_MGR.SEPARATOR.join(["gfe", "text", "PRODGEN", outputFile + ".PRODGEN"]) + lFile = PATH_MGR.getLocalizationFile(ctx, filePath) + logger.info("Writing forecast to " + str(lFile)) + + from LockingFile import File + with File(lFile.getFile(), "", 'w') as outfile: + outfile.write(forecasts) + + return lFile.save() + except: + logger.exception("Error writing forecast to " + str(lFile)) + return 0 return 1 def getScripts(paths, nameMap, definitionMap): diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsCG1.xml b/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsCG1.xml new file mode 100644 index 0000000000..815bae2ced --- /dev/null +++ b/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsCG1.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsTrackingCG0.xml b/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsTrackingCG0.xml new file mode 100644 index 0000000000..d543c9adb2 --- /dev/null +++ b/cave/com.raytheon.viz.gfe/localization/gfe/weGroups/nwpsTrackingCG0.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/aviation.xml b/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/aviation.xml index 5040f304ef..48d43f5c54 100644 --- a/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/aviation.xml +++ b/cave/com.raytheon.viz.volumebrowser/localization/menus/volumebrowser/fields/planview-timeseries/sfc2d/aviation.xml @@ -19,7 +19,10 @@ further_licensing_information. --> + + + 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 86e743d42b..02c458397c 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 @@ -54,6 +54,7 @@ import com.vividsolutions.jts.geom.LinearRing; import com.vividsolutions.jts.geom.Point; import com.vividsolutions.jts.geom.Polygon; import com.vividsolutions.jts.geom.PrecisionModel; +import com.vividsolutions.jts.geom.TopologyException; import com.vividsolutions.jts.geom.prep.PreparedGeometry; import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; import com.vividsolutions.jts.precision.SimpleGeometryPrecisionReducer; @@ -90,7 +91,9 @@ 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/02/2015 DR 4353 dgilling Fix bad exception handler in hatchWarningArea. - * + * 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. * * * @author mschenke @@ -570,12 +573,27 @@ public class PolygonUtil { GeometryFactory gf = new GeometryFactory(); points.add(new Coordinate(points.get(0))); - truncate(points, 2); Polygon rval = gf.createPolygon(gf.createLinearRing(points .toArray(new Coordinate[points.size()])), null); + if (!rval.isValid()) { + 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) { + resultMessage = " ...fix failed"; + } catch (ClassCastException e) { + resultMessage = " ...resulted in something other than a polygon"; + } + 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); @@ -841,6 +859,7 @@ public class PolygonUtil { int npts = pts.length; double xavg = 0, yavg = 0; int[] yesList = new int[npts]; + boolean[] excludeList = new boolean[npts]; int nyes = 0; int k, k1, k2, kn, y, simple; double bigDis, maxDis, dis, dx, dy, dx0, dy0, bas; @@ -908,7 +927,9 @@ public class PolygonUtil { } if (k == k2) { break; - } + + if (excludeList[k]) + continue; dx = pts[k].x - pts[k1].x; dy = pts[k].y - pts[k1].y; dis = dx * dx0 + dy * dy0; @@ -916,7 +937,8 @@ public class PolygonUtil { dis = -dis; } else { dis -= bas; - } + double newMaxDis = maxDis; + int newSimple = simple; if (dis <= 0) { if (simple == 0) { continue; @@ -924,19 +946,31 @@ public class PolygonUtil { dis = dx * dy0 - dy * dx0; if (dis < 0) { dis = -dis; - } - } else if (simple != 0) { - maxDis = simple = 0; - } - if (dis < maxDis) { + } else if (simple != 0) + newMaxDis = newSimple = 0; + if (dis < newMaxDis) { + maxDis = newMaxDis; continue; } + if (! checkReducePointsValid(pts, yesList, nyes, k)) { + excludeList[k] = true; + continue; + } + simple = newSimple; maxDis = dis; kn = k; } k1 = k2; } + Arrays.fill(excludeList, false); + if (kn < 0) { + statusHandler.debug( + String.format("reducePoints(..., %d): Unable to find a valid point\npoints: %s", + maxNpts, points)); + break; + } + if (simple != 0 && nyes > 2) { if (maxDis * 40 < bigDis) { break; @@ -963,6 +997,24 @@ public class PolygonUtil { points.addAll(Arrays.asList(Arrays.copyOf(pts, npts))); } + private boolean checkReducePointsValid(Coordinate[] pts, int[] yesList, int nyes, int k) { + Coordinate[] verts = new Coordinate[nyes + 2]; + int vi = 0; + for (int i = 0; i < nyes; ++i) { + if (k >= 0 && k < yesList[i]) { + verts[vi++] = pts[k]; + k = -1; + } + verts[vi++] = pts[yesList[i]]; + } + if (k >= 0) { + verts[vi++] = pts[k]; + } + verts[verts.length - 1] = new Coordinate(verts[0]); + GeometryFactory gf = new GeometryFactory(); + return gf.createPolygon(verts).isValid(); + } + /** * A1 ported point reduction method 2 * @@ -1786,9 +1838,8 @@ public class PolygonUtil { if (intersectCoord != null) { index1 = calcShortestDistance(intersectCoord, ls1); index2 = calcShortestDistance(intersectCoord, ls2); - Coordinate c = new Coordinate( - 0.5 * (coord[index1].x + coord[2 + index2].x), - 0.5 * (coord[index1].y + coord[2 + index2].y)); + Coordinate c = new Coordinate(0.5*(coord[index[index1]].x + coord[index[2+index2]].x), + 0.5*(coord[index[index1]].y + coord[index[2+index2]].y)); PolygonUtil.round(c, 2); coord[index[index1]] = new Coordinate(c); coord[index[2 + index2]] = new Coordinate(c); 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 7d6aab1662..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; @@ -159,6 +161,11 @@ import com.vividsolutions.jts.geom.Polygon; * Jul 01, 2014 DR 17450 D. Friedman Use list of templates from backup site. * Jul 21, 2014 3419 jsanchez Created a hidden button to make recreating polygons easier. * Feb 26, 2015 3353 rjpeter Fixed NPE on clear. + * Apr 27, 2015 DR 17359 Qinglu Lin Updated changeTemplate(). The approach for solving slowness issue while switching from + * 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 @@ -169,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. @@ -1111,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) { @@ -1165,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, @@ -1178,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, @@ -1187,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. @@ -1218,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(); @@ -1657,14 +1672,17 @@ public class WarngenDialog extends CaveSWTDialog implements .equalsIgnoreCase(lastAreaSource); boolean snapHatchedAreaToPolygon = isDifferentAreaSources; boolean preservedSelection = !isDifferentAreaSources; - // If template has a different hatched area source from the previous - // template, then the warned area would be based on the polygon and not - // preserved. - try { - warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon, - preservedSelection); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, "WarnGen Error", e1); + if (isDifferentAreaSources || !warngenLayer.getConfiguration() + .getHatchedAreaSource().getAreaSource().toLowerCase().equals("marinezones")) { + // If template has a different hatched area source from the previous + // template, then the warned area would be based on the polygon and not + // preserved. + try { + warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon, + preservedSelection); + } catch (VizException e1) { + statusHandler.handle(Priority.PROBLEM, "WarnGen Error", e1); + } } // Properly sets the "Create Text" button. setInstructions(); 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 ed6c4f7d6e..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,8 @@ 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. * * * @author mschenke @@ -246,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; @@ -490,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); @@ -512,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 @@ -529,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); @@ -549,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); @@ -564,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)) { @@ -575,6 +584,10 @@ public class WarngenLayer extends AbstractStormTrackResource { outputHatchedWarningArea = createWarnedArea( latLonToLocal(outputHatchedArea), latLonToLocal(warningArea)); + if (! outputHatchedArea.isValid()) { + statusHandler.debug(String.format("Input %s redrawn to invalid %s", + inputWarningPolygon, outputHatchedArea)); + } } this.hatchedArea = outputHatchedArea; this.hatchedWarningArea = outputHatchedWarningArea; @@ -587,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; @@ -610,6 +624,7 @@ public class WarngenLayer extends AbstractStormTrackResource { } public synchronized Geometry[] getHatchedAreas() { + long t0 = System.currentTimeMillis(); while (getState() != Job.NONE) { try { join(); @@ -617,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; } @@ -1259,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() { @@ -1459,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(); @@ -1957,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); } /** @@ -2664,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) { @@ -2713,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/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java index f3bfa3e899..9094497fc5 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java @@ -68,6 +68,7 @@ import com.vividsolutions.jts.geom.Geometry; * Mar 04, 2014 2832 njensen Moved disposeInternal() to abstract class * Apr 07, 2014 2959 njensen Correct handling of color change * Apr 14, 2014 DR 17257 D. Friedman Redo time matching on per-minute refresh. + * Apr 28, 2015 ASM #15008 D. Friedman Create polygon for EXTs even if original product is not found. * * * @@ -268,9 +269,11 @@ public class WarningsResource extends AbstractWWAResource { } } } - // create the new polygon for the CON outside of the above - // for loop - if (createShape != null) { + /* Create a new polygon for the follow-up to the original + * product found in the above loop. Also create a polygon + * for EXT actions even if the original was not found. + */ + if (createShape != null || act == WarningAction.EXT) { initShape(target, warnrec); } } else { diff --git a/deltaScripts/14.4.1/DR4462/updateStdTextProducts.sh b/deltaScripts/14.4.1/DR4462/updateStdTextProducts.sh new file mode 100755 index 0000000000..974156a957 --- /dev/null +++ b/deltaScripts/14.4.1/DR4462/updateStdTextProducts.sh @@ -0,0 +1,76 @@ +#!/bin/bash +## +# 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. +## + +# Issue: #4462 Update script to update stdtextprodcts entries with blank site values. +# +# This script will modify table stdtextproducts in the fxatext.public schema. +# +PSQL="/awips2/psql/bin/psql" + +if [ ${#1} != 4 ] ; then + echo "ERROR: First argument must be local site to use in the stdtextproducts table. Example: KOAX" + exit 1 +else + siteId=${1} + siteLtr=${siteId:0:1} +fi + +if [ ! -f ${PSQL} ]; +then + echo "ERROR: The PSQL executable does not exist - ${PSQL}." + echo "FATAL: Update Failed!" + exit 1 +fi + +UPDATE_BY_XXX="update public.stdtextproducts set site = '${siteLtr}' || xxxid where site='' and xxxid not like '% ';" +UPDATE_LOC_SITE="update public.stdtextproducts set site='${siteId}' where site='' and xxxid like '% ';" + +function updateXXXentries +{ + echo "INFO: Updating stdtextproducts using xxxid" +${PSQL} -U awips -d fxatext -a -c "${UPDATE_BY_XXX}" + if [ $? -ne 0 ]; + then + echo "FATAL: Update by xxxid Failed!" + exit 1 + fi + echo "INFO: Completed updating stdtextproducts using xxxid." +} + +function updateSITEentries +{ + echo "INFO: Updating stdtextproduct table's site using local site." +${PSQL} -U awips -d fxatext -a -c "${UPDATE_LOC_SITE}" + if [ $? -ne 0 ]; + then + echo "FATAL: unable to update stdtextproducts using local site." + exit 1 + fi + echo "INFO: Finish updating stdtextproducts using local site." +} + +echo "INFO: start update stdtextproducts" +updateXXXentries +updateSITEentries +echo "INFO: finish update stdtextproducts" +exit 0 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscReceiveSrv.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscReceiveSrv.java index 9e60345b95..c155fe5b86 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscReceiveSrv.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/isc/IscReceiveSrv.java @@ -22,8 +22,8 @@ package com.raytheon.edex.plugin.gfe.isc; import java.io.File; import java.io.FilenameFilter; import java.io.IOException; -import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -31,11 +31,20 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager; import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException; +import com.raytheon.edex.plugin.gfe.server.IFPServer; import com.raytheon.uf.common.dataplugin.gfe.request.IscDataRecRequest; import com.raytheon.uf.common.python.concurrent.IPythonJobListener; import com.raytheon.uf.common.python.concurrent.PythonJobCoordinator; @@ -44,7 +53,6 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.file.FilenameFilters; -import com.raytheon.uf.edex.site.SiteAwareRegistry; /** * ISC data receive service. Takes incoming request and executes iscDataRec @@ -60,6 +68,7 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry; * Mar 12, 2013 #1759 dgilling Re-implement using IscScript. * Mar 14, 2013 #1794 djohnson Consolidate common FilenameFilter implementations. * Dec 10, 2014 #4953 randerso Properly handle single file reception + * May 06, 2015 #4383 dgilling Properly XML parse incoming XML file. * * * @@ -68,9 +77,12 @@ import com.raytheon.uf.edex.site.SiteAwareRegistry; */ public class IscReceiveSrv { + private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(IscReceiveSrv.class); + private static final String ISC_REQUEST = "iscrequest"; + private static final String METHOD_NAME = "main"; private static final FilenameFilter docFileFilter = FilenameFilters @@ -113,6 +125,9 @@ public class IscReceiveSrv { } catch (GfeConfigurationException e) { statusHandler.error("Error getting GFE configuration", e); return; + } catch (SAXException | ParserConfigurationException e) { + statusHandler.error("Error parsing received XML file.", e); + return; } for (Entry siteArgs : siteArgMap.entrySet()) { @@ -132,7 +147,9 @@ public class IscReceiveSrv { } private Map prepareIscDataRec(String[] args) - throws IOException, InterruptedException, GfeConfigurationException { + throws IOException, InterruptedException, + GfeConfigurationException, SAXException, + ParserConfigurationException { Map siteMap = new HashMap(); String[] incomingFiles = args[2].split(","); @@ -145,26 +162,21 @@ public class IscReceiveSrv { xmlFileName = incomingFiles[1]; } - // TODO properly decode the xml final File incomingXMLFile = new File(xmlFileName); - String fileContents = FileUtil.file2String(incomingXMLFile); - Pattern siteTagRegEx = Pattern.compile("(.*?)"); - Matcher matcher = siteTagRegEx.matcher(fileContents); - List siteList = new ArrayList(); - while (matcher.find()) { - siteList.add(matcher.group(1)); - } + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(incomingXMLFile); + doc.getDocumentElement().normalize(); - List activeSites = Arrays.asList(SiteAwareRegistry - .getInstance().getActiveSites()); - if (fileContents.contains("")) { - // Need to copy the request file if more than 1 site is active - // on this EDEX server. Otherwise, the file will be deleted - // after the first site has processed the request file - siteList.remove(siteList.size() - 1); + Collection siteList = getXMLDestinations(doc); + Set activeSites = IFPServer.getActiveSites(); - for (int i = 0; i < siteList.size(); i++) { - final String siteId = siteList.get(i); + if (ISC_REQUEST.equals(doc.getDocumentElement().getNodeName())) { + /* + * This case is for processing an ISC Request/Reply message + * requesting our site's grids. + */ + for (String siteId : siteList) { if (activeSites.contains(siteId)) { if (IFPServerConfigManager.getServerConfig(siteId) .requestISC()) { @@ -180,11 +192,8 @@ public class IscReceiveSrv { } incomingXMLFile.delete(); } else { - // Remove the source site - siteList.remove(0); - Set siteSet = new HashSet(siteList); try { - for (String site : siteSet) { + for (String site : siteList) { if (activeSites.contains(site) && IFPServerConfigManager.getServerConfig(site) .requestISC()) { @@ -272,4 +281,46 @@ public class IscReceiveSrv { return siteMap; } + + private Collection getXMLDestinations(final Document doc) + throws SAXException, IOException, ParserConfigurationException { + Collection destinations = new HashSet<>(); + + // Expected XML format: + // + // + // + //
+ // SITE_ID + //
+ //
+ //
+ NodeList destNodes = doc.getElementsByTagName("destinations"); + if (destNodes.getLength() > 0) { + Node destNode = destNodes.item(0); + + if (destNode.getNodeType() == Node.ELEMENT_NODE) { + Element destElement = (Element) destNode; + + NodeList addrNodes = destElement + .getElementsByTagName("address"); + for (int i = 0; i < addrNodes.getLength(); i++) { + Node addrNode = addrNodes.item(i); + if (addrNode.getNodeType() == Node.ELEMENT_NODE) { + Element addrElement = (Element) addrNode; + + NodeList siteIdNodes = addrElement + .getElementsByTagName("site"); + if (siteIdNodes.getLength() > 0) { + Node siteIDNode = siteIdNodes.item(0); + String siteID = siteIDNode.getTextContent(); + destinations.add(siteID); + } + } + } + } + } + + return destinations; + } } 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/gfe/isc/iscDataRec.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py index 85ce4d43de..56b3dffb7e 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/gfe/isc/iscDataRec.py @@ -200,11 +200,11 @@ def execIscDataRec(MSGID,SUBJECT,FILES): elif SUBJECT == 'GET_ACTIVE_TABLE2': IrtServer.getVTECActiveTable(dataFile, xmlFileBuf) elif SUBJECT in ['ISCGRIDS', 'ISCGRIDS2']: - import localConfig + import serverConfig additionalISCRouting = [] - if localConfig.AdditionalISCRouting: - additionalISCRouting = localConfig.AdditionalISCRouting + if serverConfig.AdditionalISCRouting: + additionalISCRouting = serverConfig.AdditionalISCRouting putISCGrids(dataFile, siteConfig.GFESUITE_SITEID, srcServer.get('site'), additionalISCRouting) elif SUBJECT == 'ISCREQUEST': IrtServer.serviceISCRequest(dataFile) 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): diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/textproducts/templates/product/AreaFcst.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/textproducts/templates/product/AreaFcst.py index e9aae8baf6..0bc56c1e97 100755 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/textproducts/templates/product/AreaFcst.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/textproducts/templates/product/AreaFcst.py @@ -17,6 +17,14 @@ # See the AWIPS II Master Rights File ("Master Rights File.pdf") for # further licensing information. ## +# +# SOFTWARE HISTORY +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# May 01, 2015 17421 ryu Changed analysis methods for StormTotalSnow +# +## + #------------------------------------------------------------------------- # Description: This product creates a ZFP-type series of text phrases # for consecutive time periods for a list of edit areas. It can be @@ -475,7 +483,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis): ("PoP", self._PoP_analysisMethod("Period_1"), [3]), ("PoP", self.binnedPercent, [3]), ("SnowAmt", self.accumMinMax), - ("StormTotalSnow", self.accumMinMax), + ("StormTotalSnow", self.minMax), ("IceAccum", self.accumMinMax), ("SnowLevel", self.avg), ("Wind", self.vectorMedianRange, [6]), @@ -564,7 +572,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis): ("PoP", self._PoP_analysisMethod("Period_2_3"), [6]), ("PoP", self.binnedPercent, [6]), ("SnowAmt", self.accumMinMax), - ("StormTotalSnow", self.accumMinMax), + ("StormTotalSnow", self.minMax), ("IceAccum", self.accumMinMax), ("SnowLevel", self.avg), ("Wind", self.vectorMedianRange, [6]), @@ -791,7 +799,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis): ("PoP", self._PoP_analysisMethod("FirstFcstPeriod"), [6]), ("PoP", self.binnedPercent, [6]), ("SnowAmt", self.accumMinMax), - ("StormTotalSnow", self.accumMinMax), + ("StormTotalSnow", self.minMax), ("IceAccum", self.accumMinMax), ("SnowLevel", self.avg), ("Wind", self.vectorMedianRange, [6]), @@ -852,7 +860,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis): ("PoP", self._PoP_analysisMethod("AreaFcstPeriod"), [6]), ("PoP", self.binnedPercent, [6]), ("SnowAmt", self.accumMinMax), - ("StormTotalSnow", self.accumMinMax), + ("StormTotalSnow", self.minMax), ("IceAccum", self.accumMinMax), ("SnowLevel", self.avg), ("Wind", self.vectorMedianRange, [6]), diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/grid/datasetInfo/gribDatasets_NCEP-7.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/grid/datasetInfo/gribDatasets_NCEP-7.xml index 362c20e288..9fa4326ee6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/grid/datasetInfo/gribDatasets_NCEP-7.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/grid/datasetInfo/gribDatasets_NCEP-7.xml @@ -77,12 +77,12 @@ GFS20-PAC - GFS-PAC-20KM + GFS-PAC-20KM
3
GFS20-PRICO - GFS-PRICO-20KM + GFS-PRICO-20KM
3
diff --git a/edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/TextLightningDecoder.java b/edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/TextLightningDecoder.java index c85564bf5d..6038ae8285 100644 --- a/edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/TextLightningDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/TextLightningDecoder.java @@ -45,6 +45,8 @@ import com.raytheon.uf.common.time.util.TimeUtil; * Feb 12, 2014 2655 njensen Set source * Jun 05, 2014 3226 bclement LightningStikePoint refactor * Jun 10, 2014 3226 bclement fixed source + * May 8, 2015 DR17252 MPorricelli Removed setting of source. + * Source set in TextLightningParser. * * * @@ -57,12 +59,6 @@ public class TextLightningDecoder extends AbstractDecoder implements private String traceId = null; - /* - * inferred from Wufeng Zhou comment in BinLightningDecoderUtil, stands for - * World Wide Lightning Location Network - */ - private static final String SOURCE = "WWLLN"; - /** * Construct a TextLightning decoder. Calling hasNext() after construction * will return false, decode() will return a null. @@ -103,8 +99,6 @@ public class TextLightningDecoder extends AbstractDecoder implements report.setTraceId(traceId); - report.setSource(SOURCE); - return new PluginDataObject[] { report }; } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/impl/BaseLightningPoint.java b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/impl/BaseLightningPoint.java index f336e392b5..fb02050547 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/impl/BaseLightningPoint.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.binlightning/src/com/raytheon/uf/common/dataplugin/binlightning/impl/BaseLightningPoint.java @@ -34,6 +34,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 3, 2014 3226 bclement Initial creation + * May 8, 2015 DR17252 MPorricelli Use HOUR_OF_DAY for setHour * * * @@ -118,7 +119,7 @@ public class BaseLightningPoint { * Hour of the day [0..23]. */ public void setHour(int hour) { - this.time.set(Calendar.HOUR, hour); + this.time.set(Calendar.HOUR_OF_DAY, hour); } /** diff --git a/edexOsgi/com.raytheon.uf.edex.cots.feature/feature.xml b/edexOsgi/com.raytheon.uf.edex.cots.feature/feature.xml index cbddb4b26a..6a65172bb7 100644 --- a/edexOsgi/com.raytheon.uf.edex.cots.feature/feature.xml +++ b/edexOsgi/com.raytheon.uf.edex.cots.feature/feature.xml @@ -162,4 +162,10 @@ install-size="0" version="0.0.0"/> + + diff --git a/edexOsgi/com.raytheon.uf.edex.ndm/modes/ndm-modes.xml b/edexOsgi/com.raytheon.uf.edex.ndm/modes/ndm-modes.xml new file mode 100644 index 0000000000..635e953186 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.edex.ndm/modes/ndm-modes.xml @@ -0,0 +1,29 @@ + + + + + + + ndm-ingest.xml + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java index 3d34715201..d70d68b19e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.text/src/com/raytheon/uf/edex/plugin/text/dao/StdTextProductDao.java @@ -100,6 +100,7 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger; * 10/16/2014 3454 bphillip Upgrading to Hibernate 4 * 10/28/2014 3454 bphillip Fix usage of getSession() * Jan 27, 2015 4031 rferrel Resolve AFOS PILs site conflict using preferredAfosFirstLetter. + * May 05, 2015 4462 rferrel {@link #write(StdTextProduct)} when missing set the textProduct's site. * * * @author garmendariz @@ -220,6 +221,22 @@ public class StdTextProductDao extends CoreDao { prodId.setNnnid(nnn); prodId.setXxxid(xxx); Session session = this.getSession(); + String site = textProduct.getProdId().getSite(); + if ((site == null) || site.trim().isEmpty()) { + // Determine product site. + if (xxx.trim().length() == MAX_FIELD_LENGTH) { + site = SiteMap.getInstance().getSite4LetterId(xxx); + } else { + site = SiteMap.getInstance().getSite4LetterId( + SiteUtil.getSite()); + } + if (logger.isInfoEnabled()) { + logger.info("Write \"" + ccc + nnn + xxx + + "\" setting site to " + site); + } + textProduct.getProdId().setSite(site); + } + try { try { Query query = session.createQuery("SELECT refTime from " diff --git a/nativeLib/org.apache.thrift/lib/libthrift-0.9.0.so b/nativeLib/org.apache.thrift/lib/libthrift-0.9.0.so index fa2aa181f1..2ac48cd088 100755 Binary files a/nativeLib/org.apache.thrift/lib/libthrift-0.9.0.so and b/nativeLib/org.apache.thrift/lib/libthrift-0.9.0.so differ diff --git a/nativeLib/org.apache.thrift/lib/libthriftz-0.9.0.so b/nativeLib/org.apache.thrift/lib/libthriftz-0.9.0.so index 04ff3b1a26..e08a162327 100755 Binary files a/nativeLib/org.apache.thrift/lib/libthriftz-0.9.0.so and b/nativeLib/org.apache.thrift/lib/libthriftz-0.9.0.so differ diff --git a/nativeLib/org.apache.thrift/lib64/libthrift-0.9.0.so b/nativeLib/org.apache.thrift/lib64/libthrift-0.9.0.so index 79bc475b48..a633da447e 100755 Binary files a/nativeLib/org.apache.thrift/lib64/libthrift-0.9.0.so and b/nativeLib/org.apache.thrift/lib64/libthrift-0.9.0.so differ diff --git a/nativeLib/org.apache.thrift/lib64/libthriftz-0.9.0.so b/nativeLib/org.apache.thrift/lib64/libthriftz-0.9.0.so index 7deb90867d..0f8bd5a172 100755 Binary files a/nativeLib/org.apache.thrift/lib64/libthriftz-0.9.0.so and b/nativeLib/org.apache.thrift/lib64/libthriftz-0.9.0.so differ diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template index cc3584eb11..bd74c3f970 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template +++ b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template @@ -39,6 +39,7 @@ #20140612 3230 rferrel Add pattern for URMA. #20150121 4014 dgilling Add pattern for ETSS. #20150202 4066 rferrel Add pattern form Earth Networks Total Lightning: SFPA42 +#20150507 4434 skorolev Add pattern for GFS20 #*************************************************************** # AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw # PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001 @@ -171,6 +172,13 @@ HDS ^(O.[LN].{1,3}) (KWBM|KWBI) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([ HDS ^(OEBA88) KNWC (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})/(F[0-9]{3})/([^/]*) FILE -overwrite -log -close -edex /data_store/\5/(\2:yyyy)(\2:mm)\2/\3/ICE/GRID\7/\9Z_\(10)_\(11)-\1_KNWC_\2\3\4_(seq).\5.%Y%m%d%H +# DR 17480 Add HFR (High Frequency Radar) Pattern +# Note: There isn't much metadata here to work with, if more is needed Unidata should be contacted. +# OUTA98 KWNB 111100 !grib2/ + +ANY ^(OUTA98) KWNB (..)(..)(..)[^!]*!(grib|grib2) + FILE -overwrite -log -close -edex /data_store/\5/(\2:yyyy)(\2:mm)\2/\3/HFR/\1_KWNB_\2\3\4_(seq).\5.%Y%m%d%H + # AWIPS1: GRID ^[YZ][UV]M.98.*KNHC /Grid/SBN/Raw # *** NOT FOUND IN INGEST STREAM *** @@ -799,3 +807,13 @@ NGRID ^(MHU...) (KNHC) (..)(..)(..) # ETSS-AK NGRID ^(MHR...) (KNHC) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/ETSS/NDFD-AK/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H +#NGRID ^(YAU[CDLMPQS][0-2][0-9]) (KWNR) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*) +# FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H + +# GFS20 - Alaska, Puerto Rico, Pacific and CONUS +# YUFC97 KWBC 051200 !grib2/ncep/GFS/#255/201505051200F012/UREL/2 K*m**2*kg-1*s-1 +# ZONK67 KWBC 051200 !grib2/ncep/GFS/#215/201505051200F021/OMEG/675 hPa PRES +# ZVBK86 KWBC 051200 !grib2/ncep/GFS/#217/201505051200F021/VREL/180-150 hPa PDLY + +NGRID ^([YZ][BCE-HMO-Y][BEFN][A-Z][0-9][0-9]) KWBC (..)(..)(..) [^!]*!(grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*) + FILE -overwrite -log -close -edex /data_store/grib2/(\2:yyyy)(\2:mm)\2/\3/\6/GRID\7/\9Z_\(10)_\(11)_\1_KWBC_\2\3\4_(seq).\5.%Y%m%d%H