Merge branch 'omaha_16.1.1' into omaha_16.2.1

Conflicts:
	cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/SmartScript.py
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductAreaComp.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductEditorComp.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java
	cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java
	edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml
	edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py
	edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java
	rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template

Change-Id: Ie790e3a9a0c3829655a5a798a2c8b6740d02be6c

Former-commit-id: 691ca66a6f15c3cfae1bd1c8990644951d68a46f
This commit is contained in:
Ron Anderson 2015-10-14 16:31:41 -05:00
commit d126af0f85
52 changed files with 3560 additions and 2654 deletions

View file

@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -35,19 +34,16 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -91,6 +87,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 23, 2014 3356 njensen Remove unnecessary import * Sep 23, 2014 3356 njensen Remove unnecessary import
* Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed. * Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed.
* Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* *
* *
* </pre> * </pre>
@ -139,34 +136,19 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
private final TableData stationTableData = new TableData( private final TableData stationTableData = new TableData(
CommonConfig.AppName.FOG); CommonConfig.AppName.FOG);
/** All FOG's datauri start with this **/
private final String OBS = "fssobs";
/** List of fogAlg listeners **/ /** List of fogAlg listeners **/
private final List<IFogResourceListener> fogResources = new ArrayList<IFogResourceListener>(); private final List<IFogResourceListener> fogResources = new ArrayList<IFogResourceListener>();
/** regex wild card filter **/
private final String wildCard = "[\\w\\(\\)\\-_:.]+";
/** Geometry of adjacent areas **/
private Geometry geoAdjAreas = null;
/** Data URI pattern for fog **/
private final Pattern fogPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private FogMonitor() { private FogMonitor() {
pluginPatterns.add(fogPattern); pluginPatterns.add(fssPattern);
fogConfig = new FSSObsMonitorConfigurationManager(MonName.fog.name()); fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); createDataStructures();
obData.setThresholdMgr(FogThresholdMgr.getInstance()); processProductAtStartup();
obData.getZoneTableData(); obData.getZoneTableData();
readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG); readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG);
} }
@ -180,12 +162,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
if (monitor == null) { if (monitor == null) {
monitor = new FogMonitor(); monitor = new FogMonitor();
// Pre-populate dialog with an observations from DB // Pre-populate dialog with an observations from DB
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup(MonName.fog.name());
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
} }
@ -209,10 +187,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// [Jan 21, 2010, zhao] // [Jan 21, 2010, zhao]
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance()); obData.setThresholdMgr(FogThresholdMgr.getInstance());
obsData = new ObsData(); obsData = new ObsData();
algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>(); algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>();
for (String zone : MonitoringArea.getPlatformMap().keySet()) { for (String zone : MonitoringArea.getPlatformMap().keySet()) {
obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone)); obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone));
} }
@ -251,7 +227,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (fogPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }
@ -264,7 +240,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
* -- the xml configuration filename * -- the xml configuration filename
*/ */
public void readTableConfig(String file) { public void readTableConfig(String file) {
// TODO update for Maritime
Map<String, List<String>> zones = new HashMap<String, List<String>>(); Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and stations list // create zones and stations list
try { try {
@ -594,35 +569,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
return null; return null;
} }
/**
* Gets adjacent areas.
*/
public void getAdjAreas() {
try {
this.geoAdjAreas = AdjacentWfoMgr.getAdjacentAreas(cwa);
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Gets geometry of adjacent areas.
*
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/**
* Sets the geoAdjAreas
*
* @param geoAdjAreas
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -633,9 +579,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override @Override
protected void processAtStartup(ObReport report) { protected void processAtStartup(ObReport report) {
obData.addReport(report); obData.addReport(report);
String zone = findZone(report.getPlatformId());
getTableData().getArea(zone).addReport(report.getObservationTime(),
report);
} }
/** /**
@ -663,5 +606,4 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 20, 2014 3086 skorolev Cleaned code. * May 20, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -59,10 +58,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
*/ */
private FogThresholdMgr() { private FogThresholdMgr() {
super("DefaultFogDisplayThresholds.xml", super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml", AppName.FOG.name() "DefaultFogMonitorThresholds.xml", AppName.FOG);
.toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
init(); init();
} }
@ -75,7 +71,6 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
if (classInstance == null) { if (classInstance == null) {
classInstance = new FogThresholdMgr(); classInstance = new FogThresholdMgr();
} }
return classInstance; return classInstance;
} }
@ -119,19 +114,4 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.fog.name());
}
return areaConfigMgr;
}
} }

View file

@ -19,15 +19,19 @@
**/ **/
package com.raytheon.uf.viz.monitor.fog.ui.dialogs; package com.raytheon.uf.viz.monitor.fog.ui.dialogs;
import java.io.IOException;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.fog.FogMonitor; import com.raytheon.uf.viz.monitor.fog.FogMonitor;
import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr; import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
@ -51,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 27, 2014 3667 skorolev Cleaned code. * Oct 27, 2014 3667 skorolev Cleaned code.
* Feb 10, 2015 3886 skorolev Changed confirmation message. * Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* *
* </pre> * </pre>
* *
@ -80,19 +85,15 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
* handleOkBtnSelection() * handleOkBtnSelection()
*/ */
@Override @Override
protected void handleOkBtnSelection() { protected void handleOkBtnSelection() throws LocalizationException,
SerializationException, IOException {
if (dataIsChanged()) { if (dataIsChanged()) {
int choice = showMessage(shell, SWT.YES | SWT.NO, int choice = showMessage(shell, SWT.YES | SWT.NO,
"Confirm Cofiguration Changes", "Save changes?"); "Fog Monitor Confirm Changes", "Save changes?");
if (choice == SWT.YES) { if (choice == SWT.YES) {
// Save the config xml file. // Save the config xml file.
resetAndSave(); saveConfigs();
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
*/
FogThresholdMgr.reInitialize(); FogThresholdMgr.reInitialize();
fireConfigUpdateEvent();
// Open Threshold Dialog if zones/stations are added. // Open Threshold Dialog if zones/stations are added.
if ((!configMgr.getAddedZones().isEmpty()) if ((!configMgr.getAddedZones().isEmpty())
|| (!configMgr.getAddedStations().isEmpty())) { || (!configMgr.getAddedStations().isEmpty())) {
@ -102,19 +103,15 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
fogMonitorDlg.setCloseCallback(new ICloseCallback() { fogMonitorDlg.setCloseCallback(new ICloseCallback() {
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
// Clean added zones and stations. Close dialog.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
setReturnValue(true); setReturnValue(true);
close(); close();
} }
}); });
fogMonitorDlg.open(); fogMonitorDlg.open();
} }
// Clean added zones and stations.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
} }
fireConfigUpdateEvent();
resetStatus();
} else { // Return back to continue edit. } else { // Return back to continue edit.
return; return;
} }
@ -150,8 +147,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
@Override @Override
protected FSSObsMonitorConfigurationManager getInstance() { protected FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager( configMgr = FSSObsMonitorConfigurationManager
MonName.fog.name()); .getInstance(MonName.fog);
} }
return configMgr; return configMgr;
} }

View file

@ -60,6 +60,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -163,29 +164,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
} }
} }
/**
* Jan 25, 2010, #4281, zhao, Modified to pass an ObMultiHrsReports object
* to table dialog
*
* @Override public void notify(IMonitorEvent me) { if
* (zoneTable.isDisposed()) return;
*
* if (me.getSource() instanceof FogMonitor) { FogMonitor monitor
* = (FogMonitor)me.getSource();
* this.updateTableDlg(monitor.getObData()); }
*
* //if (me.getSource() instanceof FogMonitor) { //
* IMPORTANT!!!!!! For now we just grab the most recent time from
* the OBSTable // When we have the CAVE rendering working we will
* grab it from the CaveResource! // Date date = new Date(); //
* FogMonitor fog = (FogMonitor)me.getSource(); //
* FogDataGenerator fdg = new FogDataGenerator(); // TableData
* tZoneTableData = fdg.generateZoneData(fog.getTableData(),
* fog.getAlgorithmData(), date); //
* updateZoneTable(tZoneTableData, fog.getStationTableData(),
* date); //} }
*/
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -304,8 +282,8 @@ public class FogZoneTableDlg extends ZoneTableDlg {
@Override @Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager( configMgr = FSSObsMonitorConfigurationManager
MonName.fog.name()); .getInstance(MonName.fog);
} }
return configMgr; return configMgr;
} }

View file

@ -25,26 +25,22 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.FogRecord; import com.raytheon.uf.common.dataplugin.fog.FogRecord;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -87,6 +83,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *
@ -126,12 +123,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private final TableData stationTableData = new TableData( private final TableData stationTableData = new TableData(
CommonConfig.AppName.SAFESEAS); CommonConfig.AppName.SAFESEAS);
/** All SafeSeas datauri start with this */
private final String OBS = "fssobs";
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
/** List of SAFESEAS resource listeners **/ /** List of SAFESEAS resource listeners **/
private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>(); private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>();
@ -144,31 +135,21 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
/** data holder for FOG data **/ /** data holder for FOG data **/
private Map<Date, Map<String, FOG_THREAT>> algorithmData = null; private Map<Date, Map<String, FOG_THREAT>> algorithmData = null;
/** Adjacent areas for current cwa **/
private Geometry geoAdjAreas;
/** List of fogAlg listeners **/ /** List of fogAlg listeners **/
private final List<ISSResourceListener> fogResources = new ArrayList<ISSResourceListener>(); private final List<ISSResourceListener> fogResources = new ArrayList<ISSResourceListener>();
/** Pattern for SAFESEAS **/
private final Pattern ssPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private SafeSeasMonitor() { private SafeSeasMonitor() {
pluginPatterns.add(ssPattern); pluginPatterns.add(fssPattern);
ssAreaConfig = new FSSObsMonitorConfigurationManager(MonName.ss.name()); ssAreaConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); createDataStructures();
obData.setThresholdMgr(SSThresholdMgr.getInstance()); processProductAtStartup();
obData.getZoneTableData();
readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG); readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
} }
/** /**
@ -177,10 +158,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
public static synchronized SafeSeasMonitor getInstance() { public static synchronized SafeSeasMonitor getInstance() {
if (monitor == null) { if (monitor == null) {
monitor = new SafeSeasMonitor(); monitor = new SafeSeasMonitor();
// Pre-populate dialog with an observation (METAR) for KOMA
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup("ss");
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
@ -205,6 +182,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private void createDataStructures() { private void createDataStructures() {
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
obData.setThresholdMgr(SSThresholdMgr.getInstance()); obData.setThresholdMgr(SSThresholdMgr.getInstance());
obData.getZoneTableData();
algorithmData = new HashMap<Date, Map<String, FOG_THREAT>>(); algorithmData = new HashMap<Date, Map<String, FOG_THREAT>>();
} }
@ -273,7 +251,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (ssPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }
@ -594,36 +572,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
return zoneDialog; return zoneDialog;
} }
/**
* Gets adjacent areas
*/
public void getAdjAreas() {
try {
this.setGeoAdjAreas(AdjacentWfoMgr.getAdjacentAreas(cwa));
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Sets geometry of adjacent areas
*
* @param geoAdjAreas
* the geoAdjAreas to set
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
/**
* Gets geometry of adjacent areas
*
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/* /*
* Updates data of Fog monitor * Updates data of Fog monitor
* *
@ -685,5 +633,4 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize(). * Feb 03, 2014 #2757 skorolev Fixed reInitialize().
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -57,9 +56,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
*/ */
public SSThresholdMgr() { public SSThresholdMgr() {
super("DefaultSSDisplayThresholds.xml", super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name() "DefaultSSMonitorThresholds.xml", AppName.SAFESEAS);
.toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
init(); init();
} }
@ -114,18 +111,4 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.ss.name());
}
return areaConfigMgr;
}
} }

View file

@ -19,15 +19,19 @@
**/ **/
package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs; package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs;
import java.io.IOException;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor; import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr; import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
@ -50,7 +54,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 27, 2014 3667 skorolev Cleaned code. * Oct 27, 2014 3667 skorolev Cleaned code.
* Feb 10, 2015 3886 skorolev Changed confirmation message. * Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* *
* *
* </pre> * </pre>
@ -74,19 +79,25 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
SafeSeasMonitor.getInstance(); SafeSeasMonitor.getInstance();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* handleOkBtnSelection()
*/
@Override @Override
protected void handleOkBtnSelection() { protected void handleOkBtnSelection() throws LocalizationException,
SerializationException, IOException {
if (dataIsChanged()) { if (dataIsChanged()) {
int choice = showMessage(shell, SWT.YES | SWT.NO, int choice = showMessage(shell, SWT.YES | SWT.NO,
"Confirm Cofiguration Changes", "Save changes?"); "SAFESEAS Monitor Confirm Changes", "Save changes?");
if (choice == SWT.YES) { if (choice == SWT.YES) {
// Save the config xml file. // Save the config xml file.
resetAndSave(); saveConfigs();
SSThresholdMgr.reInitialize(); SSThresholdMgr.reInitialize();
fireConfigUpdateEvent();
// Open Threshold Dialog if zones/stations are added.
if ((!configMgr.getAddedZones().isEmpty()) if ((!configMgr.getAddedZones().isEmpty())
|| (!configMgr.getAddedStations().isEmpty())) { || (!configMgr.getAddedStations().isEmpty())) {
// Open Threshold Dialog if zones/stations are added.
if (editDialog() == SWT.YES) { if (editDialog() == SWT.YES) {
ssMonitorDlg = new SSDispMonThreshDlg(shell, ssMonitorDlg = new SSDispMonThreshDlg(shell,
CommonConfig.AppName.SAFESEAS, CommonConfig.AppName.SAFESEAS,
@ -94,19 +105,15 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
ssMonitorDlg.setCloseCallback(new ICloseCallback() { ssMonitorDlg.setCloseCallback(new ICloseCallback() {
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
// Clean added zones and stations. Close dialog.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
setReturnValue(true); setReturnValue(true);
close(); close();
} }
}); });
ssMonitorDlg.open(); ssMonitorDlg.open();
} }
// Clean added zones and stations.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
} }
fireConfigUpdateEvent();
resetStatus();
} else { // Return back to continue edit. } else { // Return back to continue edit.
return; return;
} }
@ -142,7 +149,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
@Override @Override
public FSSObsMonitorConfigurationManager getInstance() { public FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
} }
return configMgr; return configMgr;
} }

View file

@ -57,7 +57,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Nov 10, 2012 1297 skorolev Added initiateProdArray * Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -160,8 +161,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
Map<String, FOG_THREAT> fogAlgThreats = monitor Map<String, FOG_THREAT> fogAlgThreats = monitor
.getAlgorithmData(nominalTime); .getAlgorithmData(nominalTime);
obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats)); obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats));
this.updateTableDlg(monitor.getObData().getObHourReports( this.updateTableDlg(obData.getObHourReports(nominalTime));
nominalTime));
} }
} }
} }
@ -329,7 +329,8 @@ public class SSZoneTableDlg extends ZoneTableDlg {
@Override @Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
} }
return configMgr; return configMgr;
} }

View file

@ -25,18 +25,16 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -74,6 +72,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *
@ -105,34 +104,26 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/ */
private ObMultiHrsReports obData; private ObMultiHrsReports obData;
/** All SNOW datauri start with this */
private final String OBS = "fssobs";
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
/** Time which Zone/County dialog shows. **/ /** Time which Zone/County dialog shows. **/
private Date dialogTime = null; private Date dialogTime = null;
/** Array of snow listeners **/ /** Array of snow listeners **/
private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>(); private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>();
/** Pattern for SNOW **/
private final Pattern snowPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private SnowMonitor() { private SnowMonitor() {
pluginPatterns.add(snowPattern); pluginPatterns.add(fssPattern);
snowConfig = new FSSObsMonitorConfigurationManager(MonName.snow.name()); snowConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW); obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
// Set up thresholds.
obData.setThresholdMgr(SnowThresholdMgr.getInstance()); obData.setThresholdMgr(SnowThresholdMgr.getInstance());
// Retrieve existing data.
processProductAtStartup();
obData.getZoneTableData(); obData.getZoneTableData();
} }
@ -144,7 +135,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
public static synchronized SnowMonitor getInstance() { public static synchronized SnowMonitor getInstance() {
if (monitor == null) { if (monitor == null) {
monitor = new SnowMonitor(); monitor = new SnowMonitor();
monitor.processProductAtStartup("snow");
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
@ -236,7 +226,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (snowPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,6 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 21, 2014 3086 skorolev Cleaned code. * May 21, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -56,11 +55,7 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
*/ */
private SnowThresholdMgr() { private SnowThresholdMgr() {
super("DefaultSnowDisplayThresholds.xml", super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name() "DefaultSnowMonitorThresholds.xml", AppName.SNOW);
.toLowerCase());
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
init(); init();
} }
@ -115,18 +110,4 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = new FSSObsMonitorConfigurationManager(
MonName.snow.name());
}
return areaConfigMgr;
}
} }

View file

@ -19,15 +19,19 @@
**/ **/
package com.raytheon.uf.viz.monitor.snow.ui.dialogs; package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
import java.io.IOException;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.snow.SnowMonitor; import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr; import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
@ -50,7 +54,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 27, 2014 3667 skorolev Cleaned code. * Oct 27, 2014 3667 skorolev Cleaned code.
* Feb 10, 2015 3886 skorolev Changed confirmation message. * Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
@ -79,15 +84,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
* handleApplyBtnSelection() * handleApplyBtnSelection()
*/ */
@Override @Override
protected void handleOkBtnSelection() { protected void handleOkBtnSelection() throws LocalizationException,
SerializationException, IOException {
if (dataIsChanged()) { if (dataIsChanged()) {
int choice = showMessage(shell, SWT.YES | SWT.NO, int choice = showMessage(shell, SWT.YES | SWT.NO,
"Confirm Cofiguration Changes", "Save changes?"); "SNOW Monitor Confirm Changes", "Save changes?");
if (choice == SWT.YES) { if (choice == SWT.YES) {
// Save the config xml file. // Save the config xml file.
resetAndSave(); saveConfigs();
SnowThresholdMgr.reInitialize(); SnowThresholdMgr.reInitialize();
fireConfigUpdateEvent();
// Open Threshold Dialog if zones/stations are added. // Open Threshold Dialog if zones/stations are added.
if ((!configMgr.getAddedZones().isEmpty()) if ((!configMgr.getAddedZones().isEmpty())
|| (!configMgr.getAddedStations().isEmpty())) { || (!configMgr.getAddedStations().isEmpty())) {
@ -102,19 +107,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
// Clean added zones and stations. Close dialog.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
setReturnValue(true); setReturnValue(true);
close(); close();
} }
}); });
snowMonitorDlg.open(); snowMonitorDlg.open();
} }
// Clean added zones and stations.
configMgr.getAddedZones().clear();
configMgr.getAddedStations().clear();
} }
fireConfigUpdateEvent();
resetStatus();
} else { // Return back to continue edit. } else { // Return back to continue edit.
return; return;
} }
@ -135,8 +136,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
@Override @Override
protected FSSObsMonitorConfigurationManager getInstance() { protected FSSObsMonitorConfigurationManager getInstance() {
if (configMgr == null) { if (configMgr == null) {
configMgr = new FSSObsMonitorConfigurationManager( configMgr = FSSObsMonitorConfigurationManager
MonName.snow.name()); .getInstance(MonName.snow);
} }
return configMgr; return configMgr;
} }

View file

@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -140,7 +141,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (zoneTable.isDisposed()) { if (zoneTable.isDisposed()) {
return; return;
} }
if (me.getSource() instanceof SnowMonitor) { if (me.getSource() instanceof SnowMonitor) {
SnowMonitor monitor = (SnowMonitor) me.getSource(); SnowMonitor monitor = (SnowMonitor) me.getSource();
Date date = monitor.getDialogTime(); Date date = monitor.getDialogTime();
@ -265,8 +265,8 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
@Override @Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = new FSSObsMonitorConfigurationManager( configMgr = FSSObsMonitorConfigurationManager
MonName.snow.name()); .getInstance(MonName.snow);
} }
return configMgr; return configMgr;
} }

View file

@ -23,6 +23,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport;
* skorolev Initial creation * skorolev Initial creation
* May 15, 2012 14510 zhao Modified generateObReport() * May 15, 2012 14510 zhao Modified generateObReport()
* Jan 06, 2014 2653 skorolev Included SNOW data into ObReport. * Jan 06, 2014 2653 skorolev Included SNOW data into ObReport.
* Sep 20, 2015 3873 skorolev Added IsStationary and getReportType.
* *
* *
* </pre> * </pre>
@ -46,10 +47,10 @@ public class GenerateFSSObReport {
public static ObReport generateObReport(PluginDataObject report) { public static ObReport generateObReport(PluginDataObject report) {
// Generate the observation report. // Generate the observation report.
ObReport obReport = new ObReport(); ObReport obReport = new ObReport();
FSSObsRecord metar = (FSSObsRecord) report; FSSObsRecord fssData = (FSSObsRecord) report;
try { try {
obReport.setObservationTime(metar.getTimeObs().getTime()); obReport.setObservationTime(fssData.getTimeObs().getTime());
obReport.setRefHour(metar.getRefHour().getTime()); obReport.setRefHour(fssData.getRefHour().getTime());
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.error("Warning: missing obsTime or refHour at getTimeObs() when processing obs data; " .error("Warning: missing obsTime or refHour at getTimeObs() when processing obs data; "
@ -57,63 +58,82 @@ public class GenerateFSSObReport {
+ "; trying to set obsTime and refHour from dataURI"); + "; trying to set obsTime and refHour from dataURI");
obReport.setTimesFromFssobDataURI(report.getDataURI()); obReport.setTimesFromFssobDataURI(report.getDataURI());
} }
obReport.setPlatformId(metar.getPlatformId()); obReport.setPlatformId(fssData.getPlatformId());
obReport.setStationary(true); obReport.setStationary(fssData.getIsStationary());
obReport.setLatitude((float) metar.getLatitude()); obReport.setLatitude((float) fssData.getLatitude());
obReport.setLongitude((float) metar.getLongitude()); obReport.setLongitude((float) fssData.getLongitude());
// Table data: // Table data:
obReport.setCeiling(metar.getCeiling()); obReport.setCeiling(fssData.getCeiling());
obReport.setWindDir(metar.getWindDir()); obReport.setWindDir(fssData.getWindDir());
obReport.setWindSpeed(metar.getWindSpeed()); obReport.setWindSpeed(fssData.getWindSpeed());
obReport.setMaxWindSpeed(metar.getMaxWindSpeed()); obReport.setMaxWindSpeed(fssData.getMaxWindSpeed());
obReport.setWindGust(metar.getWindGust()); obReport.setWindGust(fssData.getWindGust());
obReport.setRelativeHumidity(metar.getRelativeHumidity()); obReport.setRelativeHumidity(fssData.getRelativeHumidity());
try { try {
obReport.setVisibility(metar.getVisibility()); obReport.setVisibility(fssData.getVisibility());
} catch (Exception e) { } catch (Exception e) {
obReport.setVisibility(0); obReport.setVisibility(0);
} }
obReport.setDewpoint(metar.getDewpoint()); obReport.setDewpoint(fssData.getDewpoint());
obReport.setTemperature(metar.getTemperature()); obReport.setTemperature(fssData.getTemperature());
obReport.setDewpointDepr(metar.getDewpointDepr()); obReport.setDewpointDepr(fssData.getDewpointDepr());
obReport.setPresentWx(getPrWX(metar.getPresWeather())); obReport.setPresentWx(getPrWX(fssData.getPresWeather()));
obReport.setHighResWaveHeight(ObConst.MISSING); obReport.setHighResWaveHeight(ObConst.MISSING);
obReport.setWaveSteepness(metar.getWaveSteepness()); obReport.setWaveSteepness(fssData.getWaveSteepness());
obReport.setSeaLevelPress(metar.getSeaLevelPress()); obReport.setSeaLevelPress(fssData.getSeaLevelPress());
obReport.setWavePeriod(metar.getWavePeriod()); obReport.setWavePeriod(fssData.getWavePeriod());
obReport.setWindGust(metar.getWindGust()); obReport.setWindGust(fssData.getWindGust());
obReport.setPSwellHeight(metar.getPrimarySwellWaveHeight().floatValue()); obReport.setPSwellHeight(fssData.getPrimarySwellWaveHeight()
obReport.setPSwellPeriod(metar.getPrimarySwellWavePeriod());
obReport.setPSwellDir(metar.getPrimarySwellWaveDir().floatValue());
obReport.setSSwellHeight(metar.getSecondarySwellWaveHeight()
.floatValue()); .floatValue());
obReport.setSSwellPeriod(metar.getSecondarySwellWavePeriod()); obReport.setPSwellPeriod(fssData.getPrimarySwellWavePeriod());
obReport.setSSwellDir(metar.getSecondarySwellWaveDir().floatValue()); obReport.setPSwellDir(fssData.getPrimarySwellWaveDir().floatValue());
obReport.setPressure(metar.getPressureAltimeter()); obReport.setSSwellHeight(fssData.getSecondarySwellWaveHeight()
obReport.setPressureChange(metar.getPressChange3Hour()); .floatValue());
obReport.setSSwellPeriod(fssData.getSecondarySwellWavePeriod());
obReport.setSSwellDir(fssData.getSecondarySwellWaveDir().floatValue());
obReport.setPressure(fssData.getPressureAltimeter());
obReport.setPressureChange(fssData.getPressChange3Hour());
try { try {
obReport.setPressChangeChar(Short.parseShort(metar obReport.setPressChangeChar(Short.parseShort(fssData
.getPressChangeChar())); .getPressChangeChar()));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
obReport.setPressChangeChar((short) 0); obReport.setPressChangeChar((short) 0);
} }
obReport.setHourlyPrecip(metar.getHourlyPrecip()); obReport.setHourlyPrecip(fssData.getHourlyPrecip());
obReport.setRawMessage(metar.getRawMessage()); obReport.setRawMessage(fssData.getRawMessage());
obReport.setReportType(ReportType.METAR); ReportType reportType = getReportType(fssData.getReportType());
obReport.setSnincrHourly(metar.getSnincrHourly()); obReport.setReportType(reportType);
obReport.setSnincrTotal(metar.getSnincrTotal()); obReport.setSnincrHourly(fssData.getSnincrHourly());
obReport.setFrostbiteTime(metar.getFrostbiteTime()); obReport.setSnincrTotal(fssData.getSnincrTotal());
obReport.setWindChill(metar.getWindChill()); obReport.setFrostbiteTime(fssData.getFrostbiteTime());
obReport.setSnowDepth(metar.getSnowDepth()); obReport.setWindChill(fssData.getWindChill());
obReport.setSeaSurfaceTemp(metar.getSeaSurfaceTemp()); obReport.setSnowDepth(fssData.getSnowDepth());
obReport.setSeaSurfaceTemp(fssData.getSeaSurfaceTemp());
return obReport; return obReport;
} }
private static ReportType getReportType(String reportType) {
if (reportType == null) {
reportType = "";
}
switch (reportType) {
case "1003":
case "1004":
case "1005":
case "1006":
case "1007":
return ReportType.MARITIME;
// TODO:MESONET
default:
return ReportType.METAR;
}
}
/** /**
* Construct Present Weather string. * Construct Present Weather string.
* *

View file

@ -24,10 +24,10 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.events.IMonitorEvent; import com.raytheon.uf.viz.monitor.events.IMonitorEvent;
import com.raytheon.uf.viz.monitor.listeners.IMonitorConfigurationListener; import com.raytheon.uf.viz.monitor.listeners.IMonitorConfigurationListener;
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener; import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
@ -46,7 +46,9 @@ import com.raytheon.viz.alerts.observers.ProductAlertObserver;
* 2/27/2009 2047 grichard Use 'foreach' in 'arrived' methods. * 2/27/2009 2047 grichard Use 'foreach' in 'arrived' methods.
* 3/2/2009 2047 grichard Added stationId resolution method. * 3/2/2009 2047 grichard Added stationId resolution method.
* 3/5/2009 2047 grichard Made plugin and station names arrays. * 3/5/2009 2047 grichard Made plugin and station names arrays.
* Dec 18, 2009 3424 zhao Made addMinitorListener public * Dec 18, 2009 3424 zhao Made addMinitorListener public.
* Sep 20, 2015 3873 skorolev Replaced deprecated NotificationMessage.
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -199,7 +201,6 @@ public abstract class Monitor implements IMonitor, IMonitorThresholdListener,
final Monitor fmonitor = this; final Monitor fmonitor = this;
final String ftype = type; final String ftype = type;
// System.out.println("Listener class: "+type);
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
public void run() { public void run() {

View file

@ -28,11 +28,15 @@ import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.inventory.exception.DataCubeException; import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -41,12 +45,11 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datacube.DataCubeContainer; import com.raytheon.uf.viz.datacube.DataCubeContainer;
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
import com.raytheon.uf.viz.monitor.data.ObReport; import com.raytheon.uf.viz.monitor.data.ObReport;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
import com.vividsolutions.jts.geom.Geometry;
/** /**
* *
@ -62,6 +65,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* Feb 04, 2014 2757 skorolev Added filter for removed stations * Feb 04, 2014 2757 skorolev Added filter for removed stations
* May 08, 2014 3086 skorolev Added current site definition. * May 08, 2014 3086 skorolev Added current site definition.
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals. * Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
* Sep 18, 2015 3873 skorolev Included common definitions.
* *
* </pre> * </pre>
* *
@ -106,6 +110,39 @@ public abstract class ObsMonitor extends Monitor {
/** Current CWA **/ /** Current CWA **/
public static String cwa = LocalizationManager.getInstance().getSite(); public static String cwa = LocalizationManager.getInstance().getSite();
/** Adjacent areas for current cwa **/
private Geometry geoAdjAreas;
/** All FSSObs datauri start with this **/
protected final String OBS = "fssobs";
/** regex wild card filter **/
protected final String wildCard = "[\\w\\(\\)\\-_:.]+";
/** Pattern for FSSObs **/
protected final Pattern fssPattern = Pattern.compile(DataURI.SEPARATOR
+ OBS + DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/**
* Constructor.
*/
public ObsMonitor() {
this.getAdjAreas();
}
/**
* Gets adjacent areas
*/
public void getAdjAreas() {
try {
this.setGeoAdjAreas(AdjacentWfoMgr.getAdjacentAreas(cwa));
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/** /**
* This method processes the incoming messages * This method processes the incoming messages
* *
@ -199,20 +236,13 @@ public abstract class ObsMonitor extends Monitor {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
public void run() { public void run() {
try { try {
// Filter removed stations ObReport result = GenerateFSSObReport
ArrayList<String> zones = MonitoringArea .generateObReport(objectToSend);
.getZoneIds(objectToSend statusHandler.handle(
.getPlatformId()); Priority.INFO,
if (!zones.isEmpty()) { "New FSSrecord ===> "
ObReport result = GenerateFSSObReport + objectToSend.getDataURI());
.generateObReport(objectToSend); process(result);
statusHandler
.handle(Priority.INFO,
"New FSSrecord ===> "
+ objectToSend
.getDataURI());
process(result);
}
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
@ -240,7 +270,7 @@ public abstract class ObsMonitor extends Monitor {
* @param monitorName * @param monitorName
* *
*/ */
public void processProductAtStartup(String monitorName) { public void processProductAtStartup() {
/** /**
* Assume this number for MaxNumObsTimes is larger enough to cover data * Assume this number for MaxNumObsTimes is larger enough to cover data
@ -274,19 +304,14 @@ public abstract class ObsMonitor extends Monitor {
FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes); FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes);
for (FSSObsRecord objectToSend : obsRecords) { for (FSSObsRecord objectToSend : obsRecords) {
// Filter removed stations ObReport result = GenerateFSSObReport
ArrayList<String> zones = MonitoringArea .generateObReport(objectToSend);
.getZoneIds(objectToSend.getPlatformId()); processAtStartup(result);
if (!zones.isEmpty()) {
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
} }
} }
} catch (DataCubeException e) { } catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"No data in database at startup. " + monitorName); "No data in database at startup.");
} }
} }
@ -315,4 +340,19 @@ public abstract class ObsMonitor extends Monitor {
constraints); constraints);
return FSSObsRecordTransform.toFSSObsRecords(pdc); return FSSObsRecordTransform.toFSSObsRecords(pdc);
} }
/**
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/**
* @param geoAdjAreas
* the geoAdjAreas to set
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
} }

View file

@ -22,8 +22,8 @@ package com.raytheon.uf.viz.monitor;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
@ -36,7 +36,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 9, 2010 dhladky Initial creation * Apr 9, 2010 dhladky Initial creation
* Sep 20, 2015 3873 skorolev Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *

View file

@ -21,16 +21,24 @@ package com.raytheon.uf.viz.monitor.data;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.Set;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* This class is a container of ObZoneHourReports objects for a caller-specified * This class is a container of ObZoneHourReports objects for a caller-specified
@ -40,13 +48,14 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec. 1, 2009 3424 zhao Initial creation. * Dec. 1, 2009 3424 zhao Initial creation.
* Oct.29, 2012 1297 skorolev Changed HashMap to Map * Oct.29, 2012 1297 skorolev Changed HashMap to Map
* Oct.31 2012 1297 skorolev Cleaned code. * Oct.31 2012 1297 skorolev Cleaned code.
* Sep 04 2014 3220 skorolev Added updateZones method. * Sep 04 2014 3220 skorolev Added updateZones method.
* Mar 17 2015 3888 dhladky check for nulls * Mar 17 2015 3888 dhladky check for nulls
* Sep 25 2015 3873 skorolev Corrected addReport for moving platforms.
* *
* </pre> * </pre>
* *
@ -73,8 +82,15 @@ public class ObHourReports {
*/ */
private Map<String, ObZoneHourReports> hourReports; private Map<String, ObZoneHourReports> hourReports;
/**
* current threshold manager
*/
private AbstractThresholdMgr thresholdMgr; private AbstractThresholdMgr thresholdMgr;
private Set<String> zones = new HashSet<String>();
private FSSObsMonitorConfigurationManager configMgr;
/** /**
* constructor * constructor
* *
@ -85,10 +101,12 @@ public class ObHourReports {
this.nominalTime = nominalTime; this.nominalTime = nominalTime;
this.appName = appName; this.appName = appName;
this.thresholdMgr = thresholdMgr; this.thresholdMgr = thresholdMgr;
configMgr = this.thresholdMgr.getCfgMgr();
hourReports = new HashMap<String, ObZoneHourReports>(); hourReports = new HashMap<String, ObZoneHourReports>();
Map<String, List<String>> zoneStationMap = MonitoringArea zones.clear();
.getPlatformMap(); zones.addAll(configMgr.getAreaList());
for (String zone : zoneStationMap.keySet()) { for (String zone : zones) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
appName, thresholdMgr)); appName, thresholdMgr));
} }
@ -101,28 +119,80 @@ public class ObHourReports {
*/ */
public void addReport(ObReport report) { public void addReport(ObReport report) {
String station = report.getPlatformId(); String station = report.getPlatformId();
List<String> zones = MonitoringArea.getZoneIds(station); List<String> stationZones = configMgr.getAreaByStationId(station);
if (zones.size() == 0) { // If station has no associated zone:
statusHandler if (stationZones.isEmpty()) {
.error("Error: station: " if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
+ station // Associate moving platform with monitoring zones
+ " is not associated with any zone in the monitoring area"); double shipDist = configMgr.getShipDistance();
return; stationZones.addAll(findZoneForShip(report, shipDist));
} else {
statusHandler
.warn("Error: station: "
+ station
+ " is not associated with any zone in the monitoring area");
return;
}
} }
boolean hasZone = false; // Add station report to all associated zones.
for (String zone : zones) { for (String zone : stationZones) {
if (hourReports.containsKey(zone)) { if (hourReports.containsKey(zone)) {
hasZone = true;
hourReports.get(zone).addReport(report); hourReports.get(zone).addReport(report);
} }
} }
if (hasZone == false) { return;
statusHandler
.error("Error in addreport() of ObHourReports: unable to add obs report to data archive");
}
} }
/** /**
* Find zones to include a moving platform.
*
* @param report
* from moving platform
* @param shipDist
* distance from area configuration file
*/
private Set<String> findZoneForShip(ObReport report, double shipDist) {
double latShip = report.getLatitude();
double lonShip = report.getLongitude();
Set<String> shipZones = new HashSet<String>();
for (String zone : zones) {
try {
// use only marine zones
if (zone.charAt(2) == 'Z') {
Coordinate zcoor = MonitorAreaUtils.getZoneCenter(zone);
double shipToZone = distance(latShip, lonShip, zcoor.y,
zcoor.x);
if (shipToZone <= shipDist) {
// associate moving platform with monitoring zone.
shipZones.add(zone);
statusHandler.handle(Priority.DEBUG,
"<<<======>>>" + zone + "\tplatform = "
+ report.getPlatformId() + "\tdist = "
+ shipToZone + "\t shipDist = "
+ shipDist);
StationIdXML stnXML = new StationIdXML();
stnXML.setName(report.getPlatformId());
stnXML.setType(ReportType.MARITIME.name());
configMgr.getAreaXml(zone).addStationIdXml(stnXML);
}
} else {
continue;
}
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
// Update configuration file.
configMgr.saveConfigXml();
return shipZones;
}
/**
* Gets HourReports
*
* @return hourReports * @return hourReports
*/ */
public Map<String, ObZoneHourReports> getHourReports() { public Map<String, ObZoneHourReports> getHourReports() {
@ -186,8 +256,8 @@ public class ObHourReports {
} }
/** /**
* Returns the ObZoneHourReports object of a caller-specified zone. If such * Gets ObZoneHourReports Returns the ObZoneHourReports object of a
* object not available, returns null. * caller-specified zone. If such object not available, returns null.
* *
* @param zone * @param zone
* @return hour reports * @return hour reports
@ -200,6 +270,8 @@ public class ObHourReports {
} }
/** /**
* Gets NominalTime
*
* @return nominalTime * @return nominalTime
*/ */
public Date getNominalTime() { public Date getNominalTime() {
@ -207,6 +279,8 @@ public class ObHourReports {
} }
/** /**
* Gets AppName
*
* @return appName * @return appName
*/ */
public CommonConfig.AppName getAppName() { public CommonConfig.AppName getAppName() {
@ -215,51 +289,79 @@ public class ObHourReports {
/** /**
* Updates zones in the Hour Reports * Updates zones in the Hour Reports
*
* @param configMgr
*/ */
public void updateZones() { public void updateZones() {
Map<String, List<String>> zoneStationMap = MonitoringArea // Updated list of zones
.getPlatformMap(); List<String> updtZones = configMgr.getAreaList();
// remove zones or stations // remove zones
List<String> hourZones = new CopyOnWriteArrayList<String>( hourReports.keySet().retainAll(updtZones);
hourReports.keySet());
for (String zone : hourZones) {
if (hourReports.keySet().contains(zone)) {
List<String> stations = new CopyOnWriteArrayList<String>(
hourReports.get(zone).getZoneHourReports().keySet());
for (String stn : stations) {
if (zoneStationMap.get(zone) != null) {
if (!zoneStationMap.get(zone).contains(stn)) {
hourReports.get(zone).getZoneHourReports()
.remove(stn);
}
}
}
if (!zoneStationMap.keySet().contains(zone)) {
hourReports.remove(zone);
}
}
}
// add zones // add zones
for (String zone : zoneStationMap.keySet()) { for (String zone : updtZones) {
List<String> stations = new CopyOnWriteArrayList<String>( if (!hourReports.keySet().contains(zone)) {
zoneStationMap.get(zone));
for (String stn : stations) {
if (hourReports.get(zone) != null) {
if (!hourReports.get(zone).getZoneHourReports()
.containsKey(stn)) {
hourReports
.get(zone)
.getZoneHourReports()
.put(stn,
new ObStnHourReports(nominalTime, zone,
stn, appName, thresholdMgr));
}
}
}
if (!hourReports.containsKey(zone)) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
appName, thresholdMgr)); appName, thresholdMgr));
} }
} }
// add and(or) remove stations
for (String zone : updtZones) {
// Updated list of stations in this zone
List<String> updtStns = configMgr.getAreaStations(zone);
// remove stations
hourReports.get(zone).getZoneHourReports().keySet()
.retainAll(updtStns);
// add stations
for (String stn : updtStns) {
if (!hourReports.get(zone).getZoneHourReports()
.containsKey(stn)) {
hourReports
.get(zone)
.getZoneHourReports()
.put(stn,
new ObStnHourReports(nominalTime, zone,
stn, appName, thresholdMgr));
}
}
// update hourReports for current zone
hourReports.get(zone).getZoneHourReports();
}
}
/**
* Distance between two coordinates.
*
* @param lat1
* @param lon1
* @param lat2
* @param lon2
* @return distance in km
*/
public static double distance(double lat1, double lon1, double lat2,
double lon2) {
// Earth's radius of 6378.137 kilometers
float EarthRadius = 6378.137f;
double dLat = toRad(lat2 - lat1);
double dLon = toRad(lon2 - lon1);
lat1 = toRad(lat1);
lat2 = toRad(lat2);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2)
* Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EarthRadius * c;
}
/**
* From grad to radian.
*
* @param value
* @return
*/
private static double toRad(double value) {
return value * Math.PI / 180;
} }
} }

View file

@ -24,15 +24,22 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -50,10 +57,11 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* Dec. 1, 2009 3424 zhao Initial creation. * Dec. 1, 2009 3424 zhao Initial creation.
* Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object * Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object
* Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method * Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method
* Oct.31, 2012 1297 skorolev Clean code. * Oct 31, 2012 1297 skorolev Clean code.
* Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW * Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method. * Sep 04, 2014 3220 skorolev Updated getStationTableData method.
* * Sep 25, 2015 3873 skorolev Added multiHrsTabData.
*
* </pre> * </pre>
* *
* @author zhao * @author zhao
@ -61,6 +69,8 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
*/ */
public class ObMultiHrsReports { public class ObMultiHrsReports {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObMultiHrsReports.class);
/** /**
* Thresholds manager * Thresholds manager
@ -78,17 +88,18 @@ public class ObMultiHrsReports {
private CommonConfig.AppName appName; private CommonConfig.AppName appName;
/** /**
* key is nominal time, value is ObHourReports object * FSSObs records cache. Key is nominal time, value is ObHourReports object
*/ */
private SortedMap<Date, ObHourReports> multiHrsReports; private SortedMap<Date, ObHourReports> multiHrsReports = new TreeMap<Date, ObHourReports>();
/** /**
* The maximum number of most recent hours within which observation reports * Monitor Table data cache. Key is nominal time, value is TableData
* are to be archived. TODO: move MAX_FRAMES to a configuration file?
*/ */
private final int MAX_FRAMES = 64; private ConcurrentHashMap<Date, TableData> multiHrsTabData = new ConcurrentHashMap<Date, TableData>();
private int maxFrames = MAX_FRAMES; private int maxFrames = ObConst.MAX_FRAMES;
private FSSObsMonitorConfigurationManager cfgMgr = null;
/** /**
* Constructor * Constructor
@ -97,28 +108,16 @@ public class ObMultiHrsReports {
*/ */
public ObMultiHrsReports(CommonConfig.AppName appName) { public ObMultiHrsReports(CommonConfig.AppName appName) {
this.appName = appName; this.appName = appName;
multiHrsReports = new TreeMap<Date, ObHourReports>();
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
initFogAlgCellType();
}
}
/** if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
* Add an array of ObReport objects to the ObMultiHrsReports object (Don't if (appName.equals(AppName.FOG)) {
* use! VK) cfgMgr = FSSObsMonitorConfigurationManager
* .getInstance(MonName.fog);
* @param result } else if (appName.equals(AppName.SAFESEAS)) {
*/ cfgMgr = FSSObsMonitorConfigurationManager
public void addReports(ObReport[] results) { .getInstance(MonName.ss);
for (ObReport report : results) {
/**
* DR #8723: if wind speed is zero, wind direction should be N/A,
* not 0
*/
if (report.getWindSpeed() < 0.0001) { // zero wind speed
report.setWindDir(ObConst.MISSING);
} }
addReport(report); initFogAlgCellType();
} }
} }
@ -129,8 +128,6 @@ public class ObMultiHrsReports {
* @return returns multiHrsReports * @return returns multiHrsReports
*/ */
public void addReport(ObReport report) { public void addReport(ObReport report) {
// Date nominalTime = TableUtil
// .getNominalTime(report.getObservationTime());
Date nominalTime = report.getRefHour(); Date nominalTime = report.getRefHour();
/** /**
* DR #8723: if wind speed is zero, wind direction should be N/A, not 0 * DR #8723: if wind speed is zero, wind direction should be N/A, not 0
@ -151,50 +148,56 @@ public class ObMultiHrsReports {
/** /**
* DR15654: set Wind Chill for SNOW * DR15654: set Wind Chill for SNOW
*/ */
if ( appName == AppName.SNOW ) { if (appName == AppName.SNOW) {
if ( report.getTemperature() != ObConst.MISSING && report.getWindSpeed() != ObConst.MISSING ) { if (report.getTemperature() != ObConst.MISSING
report.setWindChill(calcWindChill( report.getTemperature(), report.getWindSpeed() )); && report.getWindSpeed() != ObConst.MISSING) {
report.setWindChill(calcWindChill(report.getTemperature(),
report.getWindSpeed()));
} }
} }
ObHourReports obHourReports;
if (multiHrsReports.containsKey(nominalTime)) { // new nominal time; create a new ObHourReports object
multiHrsReports.get(nominalTime).addReport(report); if (multiHrsReports.isEmpty()
|| !multiHrsReports.containsKey(nominalTime)) {
obHourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
} else { } else {
// new nominal time; create a new ObHourReports object // the map is full; delete the oldest entry
if (multiHrsReports.size() >= maxFrames) { if (multiHrsReports.size() >= maxFrames) {
// the map is full; delete the oldest entry
multiHrsReports.remove(multiHrsReports.firstKey()); multiHrsReports.remove(multiHrsReports.firstKey());
} }
ObHourReports obHourReports = new ObHourReports(nominalTime, // update multiHrsReports with new data
appName, thresholdMgr); obHourReports = multiHrsReports.get(nominalTime);
obHourReports.addReport(report);
multiHrsReports.put(nominalTime, obHourReports);
} }
obHourReports.addReport(report);
// update data cache
multiHrsReports.put(nominalTime, obHourReports);
TableData tblData = obHourReports.getZoneTableData();
multiHrsTabData.put(nominalTime, tblData);
} }
/** /**
* DR 15654: * DR 15654: Wind Chill calculation formula based on
* Wind Chill calculation formula based on * http://www.nws.noaa.gov/om/windchill/ as of Jan. 29, 2013
* http://www.nws.noaa.gov/om/windchill/ *
* as of Jan. 29, 2013 * @param temp
* * in degree F
* @param temperature in degree F * @param windSpd
* @param windSpeed in knots * in knots
* @return wind chill in degree F * @return wind chill in degree F
*/ */
private float calcWindChill(float temp, float windSpd) { private float calcWindChill(float temp, float windSpd) {
if ( temp > 50.0 || windSpd < 3.0 ) { if (temp > 50.0 || windSpd < 3.0) {
return ObConst.MISSING; return ObConst.MISSING;
} }
/** /**
* 1 knots = 1.15078 mph * 1 knots = 1.15078 mph
*/ */
float spd = (float) Math.pow(1.15078*windSpd, 0.16); float spd = (float) Math.pow(1.15078 * windSpd, 0.16);
return 35.74f + 0.6215f*temp - 35.75f*spd + 0.4275f*temp*spd; return 35.74f + 0.6215f * temp - 35.75f * spd + 0.4275f * temp * spd;
} }
/** /**
* Returns a zone TableData object of the latest nominal time. If no data * Returns a zone TableData object of the latest nominal time. If no data
* available (the map is empty), returns an empty zone TableData object * available (the map is empty), returns an empty zone TableData object
* (table cells filled with "N/A"). * (table cells filled with "N/A").
@ -211,26 +214,31 @@ public class ObMultiHrsReports {
/** /**
* Returns a zone TableData object for a caller-specified nominal-time. If * Returns a zone TableData object for a caller-specified nominal-time. If
* no data available, returns an empty/default zone TableData object (table * no data available, returns an empty/default zone TableData object (table
* cells filled with "N/A"). * cells filled with "N/A"). Updates multiHrsTabData table cache.
* *
* @param nominalTime * @param nominalTime
* @return * @return
*/ */
public TableData getZoneTableData(Date nominalTime) { public TableData getZoneTableData(Date nominalTime) {
TableData tabData = null;
if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) { if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) {
return getEmptyZoneTableData(); return getEmptyZoneTableData();
} }
if (appName == AppName.FOG) { if (appName == AppName.FOG) {
return this.getObHourReports(nominalTime).getFogZoneTableData( tabData = this.getObHourReports(nominalTime).getFogZoneTableData(
fogAlgCellType); fogAlgCellType);
} } else if (appName == AppName.SAFESEAS) {
if (appName == AppName.SAFESEAS) { tabData = this.getObHourReports(nominalTime).getSSZoneTableData(
return this.getObHourReports(nominalTime).getSSZoneTableData(
fogAlgCellType); fogAlgCellType);
}
return this.getObHourReports(nominalTime).getZoneTableData(); } else {
// return multiHrsReports.get(nominalTime).getZoneTableData(); tabData = this.getObHourReports(nominalTime).getZoneTableData();
}
// update table data cache
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
} }
/** /**
@ -243,15 +251,27 @@ public class ObMultiHrsReports {
.getSystemTime().getTime()); .getSystemTime().getTime());
ObHourReports hourReports = new ObHourReports(nominalTime, appName, ObHourReports hourReports = new ObHourReports(nominalTime, appName,
thresholdMgr); thresholdMgr);
TableData tabData = null;
if (appName == AppName.FOG) { if (appName == AppName.FOG) {
return hourReports.getFogZoneTableData(fogAlgCellType); tabData = hourReports.getFogZoneTableData(fogAlgCellType);
} else {
tabData = hourReports.getZoneTableData();
} }
return hourReports.getZoneTableData(); // update data cache
multiHrsReports.put(nominalTime, hourReports);
// update cache with empty table data
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
} }
/** /**
* Returns the station TableData object for the latest nominal time. If no * Returns the station TableData object for the latest nominal time. If no
* data available, an empty/default station TableData object is returned * data available, an empty/default station TableData object is returned
*
* @param zone
* @return
*/ */
public TableData getStationTableData(String zone) { public TableData getStationTableData(String zone) {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
@ -264,9 +284,13 @@ public class ObMultiHrsReports {
* Returns a station TableData object for a caller-specified nominal-time * Returns a station TableData object for a caller-specified nominal-time
* and zone ID. If no data available, an empty/default station TableData * and zone ID. If no data available, an empty/default station TableData
* object is returned. * object is returned.
*
* @param nominalTime
* @param zone
* @return
*/ */
public TableData getStationTableData(Date nominalTime, String zone) { public TableData getStationTableData(Date nominalTime, String zone) {
if(zone.equals("")){ if (zone.equals("")) {
return this.getEmptyZoneTableData(); return this.getEmptyZoneTableData();
} }
if (nominalTime == null) { if (nominalTime == null) {
@ -296,6 +320,7 @@ public class ObMultiHrsReports {
* @param zone * @param zone
* @param Station * @param Station
* @param varName * @param varName
* @param productName
* @return ObTrendDataSet object, or null if no data available * @return ObTrendDataSet object, or null if no data available
*/ */
public ObTrendDataSet getTrendDataSet(String zone, String station, public ObTrendDataSet getTrendDataSet(String zone, String station,
@ -304,81 +329,45 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return null; return null;
} }
// Trend plot for the past 24 hours.
// Instead of using present time as the latest time,
// here we use the latest nominal time as the latest time
// and get data within 24 hours before the latest nominal time
// [probably present time should be used as the latest time for trending
// plots-- fix this later]
Date latestNominalTime = multiHrsReports.lastKey();
// determine trending start nominal time
Date startNominalTime = multiHrsReports.firstKey();
// startNominalTime must be within 24 hours before latestNominalTime
long diff = (latestNominalTime.getTime() - startNominalTime.getTime())
/ (60 * 60 * 60); // difference in hour between the two dates
if (diff > 24) {
// find the startNominalTime
Calendar cal = Calendar.getInstance();
cal.setTime(latestNominalTime);
cal.add(Calendar.DAY_OF_YEAR, -1);
Date expectedStartNominalTime = cal.getTime(); // expected, but may
// not exist in
// multiHrsReports
if (multiHrsReports.containsKey(expectedStartNominalTime)) {
startNominalTime = expectedStartNominalTime;
} else {
// this iterator is ordered since multiHrsReports is a sorted
// map
Iterator<Date> iterator = multiHrsReports.keySet().iterator();
while (iterator.hasNext()) {
Date nominalTime = iterator.next();
if (nominalTime.compareTo(expectedStartNominalTime) >= 0) {
startNominalTime = nominalTime;
break;
}
}
}
}
// get data // get data
ObTrendDataSet trendData = new ObTrendDataSet(zone, varName, ObTrendDataSet trendData = new ObTrendDataSet(zone, varName,
productName, appName, thresholdMgr); productName, appName, thresholdMgr);
// trendData.setThresholdMgr(thresholdMgr);
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet() Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator(); .iterator();
Date start = findStartNominalTime();
while (nominalTimeIterator.hasNext()) { while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next(); Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(startNominalTime) >= 0) { if (nominalTime.compareTo(start) >= 0) {
Set<Date> obsTimes = this.getObHourReports(nominalTime) ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone) .getObZoneHourReports(zone)
.getObStnHourReports(station).getObsTimes(); .getObStnHourReports(station);
if (obsTimes != null) { if (stnHrRpts != null) {
for (Date obsTime : obsTimes) { Set<Date> obsTimes = stnHrRpts.getObsTimes();
trendData.addDataPoint(obsTime, if (obsTimes != null) {
new Float(this.getObHourReports(nominalTime) for (Date obsTime : obsTimes) {
.getObZoneHourReports(zone) trendData.addDataPoint(obsTime, new Float(stnHrRpts
.getObStnHourReports(station) .getObReport(obsTime).get(varName)));
.getObReport(obsTime).get(varName))); }
} else {
continue;
} }
} }
} }
} }
return trendData; return trendData;
} }
/** /**
* Gets History Table Data
* *
* @param zone
* : current zone
* @param station * @param station
* station ID * : station ID
* @param obsType * @param obsType
* ObsHistType * : ObsHistType
* @return TableData object for obs history table * @return
*/ */
public TableData getHistTableData(String zone, String station, public TableData getHistTableData(String zone, String station,
ObsHistType obsType) { ObsHistType obsType) {
@ -387,37 +376,69 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return tblData; return tblData;
} }
ArrayList<TableRowData> tblRows = new ArrayList<TableRowData>();
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator();
Date start = findStartNominalTime();
while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(start) >= 0) {
ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station);
if (stnHrRpts != null) {
Set<Date> obsTimes = stnHrRpts.getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
ObReport report = stnHrRpts.getObReport(obsTime);
tblRows.add(TableUtil.getHistTableRowData(appName,
obsType, report));
}
} else {
continue;
}
}
}
}
/**
* sort first column descending in obs time
*/
ArrayList<TableRowData> tblRows2 = new ArrayList<TableRowData>();
for (int i = 0; i < tblRows.size(); i++) {
tblRows2.add(tblRows.get(tblRows.size() - 1 - i));
}
tblData.setTableRows(tblRows2);
return tblData;
}
private Date findStartNominalTime() {
// Trend plot for the past 24 hours. // Trend plot for the past 24 hours.
// Instead of using present time as the latest time, // Instead of using present time as the latest time,
// here we use the latest nominal time as the latest time // here we use the latest nominal time as the latest time
// and get data within 24 hours before the latest nominal time // and get data within 24 hours before the latest nominal time
// [probably present time should be used as the latest time for trending // [probably present time should be used as the latest time for trending
// plots-- fix this later] // plots-- fix this later]
Date latestNominalTime = multiHrsReports.lastKey(); Date latestNominalTime = multiHrsReports.lastKey();
// determine trending start nominal time // determine trending start nominal time
Date startNominalTime = multiHrsReports.firstKey(); Date startNominalTime = multiHrsReports.firstKey();
// startNominalTime must be within 24 hours before latestNominalTime // startNominalTime must be within 24 hours before latestNominalTime
long diff = (latestNominalTime.getTime() - startNominalTime.getTime()) long diff = (latestNominalTime.getTime() - startNominalTime.getTime())
/ (60 * 60 * 60); // difference in hour between the two dates / TimeUtil.MILLIS_PER_HOUR;
// difference in hours between the two dates
if (diff > 24) { if (diff > 24) {
// find the startNominalTime // find the startNominalTime
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(latestNominalTime); cal.setTime(latestNominalTime);
cal.add(Calendar.DAY_OF_YEAR, -1); cal.add(Calendar.DAY_OF_YEAR, -1);
Date expectedStartNominalTime = cal.getTime(); // expected, but may // expected, but may not exist in multiHrsReports
// not exist in Date expectedStartNominalTime = cal.getTime();
// multiHrsReports
if (multiHrsReports.containsKey(expectedStartNominalTime)) { if (multiHrsReports.containsKey(expectedStartNominalTime)) {
startNominalTime = expectedStartNominalTime; startNominalTime = expectedStartNominalTime;
} else { } else {
// this iterator is ordered since multiHrsReports is a sorted // this iterator is ordered since multiHrsReports is a sorted
// map // map
Iterator<Date> iterator = multiHrsReports.keySet().iterator(); Iterator<Date> iterator = multiHrsReports.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Date nominalTime = iterator.next(); Date nominalTime = iterator.next();
if (nominalTime.compareTo(expectedStartNominalTime) >= 0) { if (nominalTime.compareTo(expectedStartNominalTime) >= 0) {
@ -427,81 +448,50 @@ public class ObMultiHrsReports {
} }
} }
} }
return startNominalTime;
// get data
ArrayList<TableRowData> tblRows = new ArrayList<TableRowData>();
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator();
while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(startNominalTime) >= 0) {
Set<Date> obsTimes = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station).getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
ObReport report = getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station)
.getObReport(obsTime);
tblRows.add(TableUtil.getHistTableRowData(appName,
obsType, report));
}
}
}
}
/**
* sort first column descending in obs time
*/
ArrayList<TableRowData> tblRows2 = new ArrayList<TableRowData>();
for (int i = 0; i < tblRows.size(); i++) {
tblRows2.add(tblRows.get(tblRows.size() - 1 - i));
}
tblData.setTableRows(tblRows2);
return tblData;
} }
/** /**
* Returns a SortedMap object <nominal time, ObHourReports object> * Gets table cache
* *
* @return multiHrsReports * @return
*/
public ConcurrentHashMap<Date, TableData> getMultiHrsTabData() {
return multiHrsTabData;
}
/**
* Sets table cache
*
* @param multiHrsTabData
*/
public void setMultiHrsTabData(
ConcurrentHashMap<Date, TableData> multiHrsTabData) {
this.multiHrsTabData = multiHrsTabData;
}
/**
* Gets data cache
*
* @return SortedMap object <nominal time, ObHourReports object>
*/ */
public SortedMap<Date, ObHourReports> getMultiHrsReports() { public SortedMap<Date, ObHourReports> getMultiHrsReports() {
return multiHrsReports; return multiHrsReports;
} }
/** /**
* Returns a SortedMap object (key is nominal time, value is zone TableData * Sets data cache
* object)
* *
* @return * @param multiHrsReports
*/ */
public SortedMap<Date, TableData> getMultiHrsTableData() { public void setMultiHrsReports(
SortedMap<Date, TableData> multiHrsTblData = new TreeMap<Date, TableData>(); SortedMap<Date, ObHourReports> multiHrsReports) {
if (appName == AppName.FOG) { this.multiHrsReports = multiHrsReports;
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(
nominalTime,
multiHrsReports.get(nominalTime).getFogZoneTableData(
fogAlgCellType));
}
return multiHrsTblData;
}
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(nominalTime, multiHrsReports.get(nominalTime)
.getZoneTableData());
}
return multiHrsTblData;
} }
/** /**
* Returns the latest nominal time if the map is not empty; otherwise, * Gets the Latest NominalTime Returns the latest nominal time if the map is
* returns the nominal time of the present date-time * not empty; otherwise, returns the nominal time of the present date-time
* *
* @return * @return
*/ */
@ -517,31 +507,39 @@ public class ObMultiHrsReports {
} }
/** /**
* Returns a set of nominal times * Gets Nominal Times
* *
* @return * @return a set of nominal times
*/ */
public Set<Date> getNominalTimes() { public Set<Date> getNominalTimes() {
return multiHrsReports.keySet(); return multiHrsReports.keySet();
} }
/** /**
* Returns the ObHourReports object of the latest nominal time. If no data * Gets ObHourReports Returns the ObHourReports object of the latest nominal
* available, returns an empty ObHourReports object. * time. If no data available, returns an empty ObHourReports object.
* *
* @return * @return
*/ */
public ObHourReports getObHourReports() { public ObHourReports getObHourReports() {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return new ObHourReports(TableUtil.getNominalTime(SimulatedTime ObHourReports obHrsReps = new ObHourReports(
.getSystemTime().getTime()), appName, thresholdMgr); TableUtil.getNominalTime(SimulatedTime.getSystemTime()
.getTime()), appName, thresholdMgr);
// Save table data cache.
Date refTm = obHrsReps.getNominalTime();
TableData tabData = obHrsReps.getZoneTableData();
multiHrsTabData.clear();
multiHrsTabData.put(refTm, tabData);
return obHrsReps;
} }
return multiHrsReports.get(multiHrsReports.lastKey()); return multiHrsReports.get(multiHrsReports.lastKey());
} }
/** /**
* Returns an ObHourReports object of a caller-specified nominal time. If no * Gets ObHourReports Returns an ObHourReports object of a caller-specified
* data available, returns an empty ObHourReports object. * nominal time. If no data available, returns an empty ObHourReports
* object.
* *
* @param nominalTime * @param nominalTime
* @return * @return
@ -574,6 +572,7 @@ public class ObMultiHrsReports {
} }
/** /**
* Gets Threshold Manager
* *
* @return the threshold manager * @return the threshold manager
*/ */
@ -591,6 +590,7 @@ public class ObMultiHrsReports {
} }
/** /**
* Gets map of types for ALG cell
* *
* @return fogAlgCellType * @return fogAlgCellType
*/ */
@ -603,11 +603,20 @@ public class ObMultiHrsReports {
*/ */
private void initFogAlgCellType() { private void initFogAlgCellType() {
fogAlgCellType = new HashMap<String, CellType>(); fogAlgCellType = new HashMap<String, CellType>();
Set<String> zones = MonitoringArea.getPlatformMap().keySet(); List<String> zones = cfgMgr.getAreaList();
Iterator<String> itr = zones.iterator(); Iterator<String> itr = zones.iterator();
while (itr.hasNext()) { while (itr.hasNext()) {
fogAlgCellType.put(itr.next(), CellType.NotAvailable); fogAlgCellType.put(itr.next(), CellType.NotAvailable);
} }
setFogAlgCellType(fogAlgCellType); setFogAlgCellType(fogAlgCellType);
} }
/**
* Updates table cache
*/
public void updateTableCache() {
for (Date time : multiHrsReports.keySet()) {
getZoneTableData(time);
}
}
} }

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@ import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig; import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
@ -50,6 +51,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules * May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn * Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code. * May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
* Sep 18, 2015 3873 skorolev Added coordinates in the hover text for a newly added zones.Corrected code for Fog and SNOW table data.
* *
* </pre> * </pre>
* *
@ -110,13 +112,23 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
hoverText = getZoneHoverText(areaId); AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
} else { } else {
hoverText = getStationHoverText(areaId); hoverText = getStationHoverText(areaId);
} }
// zone or station ID
tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText, tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText,
CellType.AreaId, false)); CellType.AreaId, false));
@ -131,14 +143,18 @@ public final class TableUtil {
visValue = visValue * 16.0f; // vis in units of "miles/16"; this is visValue = visValue * 16.0f; // vis in units of "miles/16"; this is
// used to compare with Red/Yellow // used to compare with Red/Yellow
// threshold values // threshold values
String mccVIS = "";
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccVIS = MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS
.getXmlKey();
} else {
mccVIS = MonitorConfigConstants.FogMonitor.FOG_MONITOR_METEO_VIS
.getXmlKey();
}
TableCellData visCellData = new TableCellData( TableCellData visCellData = new TableCellData(visString,
visString, tm.getThresholdValueCellType(dataUsageKey, zone, mccVIS,
tm.getThresholdValueCellType( visValue), true);
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS
.getXmlKey(), visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
@ -320,7 +336,8 @@ public final class TableUtil {
* dialog) * dialog)
* @param zone * @param zone
* @param report * @param report
* @param tm Abstract Threshold Manager * @param tm
* Abstract Threshold Manager
* @param fogCellType * @param fogCellType
* @return * @return
*/ */
@ -336,9 +353,19 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
hoverText = getZoneHoverText(areaId); AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
} else { } else {
hoverText = getStationHoverText(areaId); hoverText = getStationHoverText(areaId);
} }
@ -390,42 +417,52 @@ public final class TableUtil {
.getXmlKey(), report .getXmlKey(), report
.getWindDir()), true)); .getWindDir()), true));
} }
String mccWind;
// wind speed
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED
.getXmlKey();
} else {
mccWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_WIND_SPEED
.getXmlKey();
}
tblRowData.setTableCellData(
6,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(dataUsageKey, zone,
mccWind, report.getWindSpeed()), true));
tblRowData // peak wind
.setTableCellData( String mccPeakWind;
6, if (dataUsageKey == DataUsageKey.DISPLAY) {
new TableCellData( mccPeakWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND
Math.round(new Float(report.getWindSpeed())), .getXmlKey();
tm.getThresholdValueCellType( } else {
DataUsageKey.DISPLAY, mccPeakWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_PEAK_WIND
zone, .getXmlKey();
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED }
.getXmlKey(), report tblRowData.setTableCellData(
.getWindSpeed()), true)); 7,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccPeakWind, report.getMaxWindSpeed()),
true));
// wind gust
String mccWindGust;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccWindGust = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED
.getXmlKey();
} else {
mccWindGust = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_GUST_SPEED
.getXmlKey();
}
tblRowData tblRowData.setTableCellData(
.setTableCellData( 8,
7, new TableCellData(Math.round(new Float(report.getWindGust())),
new TableCellData( tm.getThresholdValueCellType(dataUsageKey, zone,
Math.round(new Float(report.getMaxWindSpeed())), mccWindGust, report.getWindGust()), true));
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND
.getXmlKey(), report
.getMaxWindSpeed()), true));
tblRowData
.setTableCellData(
8,
new TableCellData(
Math.round(new Float(report.getWindGust())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED
.getXmlKey(), report
.getWindGust()), true));
// visibility // visibility
float visValue = report.getVisibility(); // vis value in miles (statute float visValue = report.getVisibility(); // vis value in miles (statute
@ -443,20 +480,25 @@ public final class TableUtil {
// to compare with Red/Yellow threshold // to compare with Red/Yellow threshold
// values // values
TableCellData visCellData = new TableCellData( String mccVis;
visString, if (dataUsageKey == DataUsageKey.DISPLAY) {
tm.getThresholdValueCellType( mccVis = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
DataUsageKey.DISPLAY, .getXmlKey();
zone, } else {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS mccVis = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS
.getXmlKey(), visValue), true); .getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, mccVis,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
tblRowData.setTableCellData(9, visCellData); tblRowData.setTableCellData(9, visCellData);
} }
// temperature
tblRowData tblRowData
.setTableCellData( .setTableCellData(
10, 10,
@ -468,7 +510,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP
.getXmlKey(), report .getXmlKey(), report
.getTemperature()), true)); .getTemperature()), true));
// dewpoint
tblRowData tblRowData
.setTableCellData( .setTableCellData(
11, 11,
@ -480,7 +522,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT
.getXmlKey(), report .getXmlKey(), report
.getDewpoint()), true)); .getDewpoint()), true));
// SLP
tblRowData tblRowData
.setTableCellData( .setTableCellData(
12, 12,
@ -492,7 +534,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP
.getXmlKey(), report .getXmlKey(), report
.getSeaLevelPress()), true)); .getSeaLevelPress()), true));
// SST
tblRowData tblRowData
.setTableCellData( .setTableCellData(
13, 13,
@ -504,7 +546,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST
.getXmlKey(), report .getXmlKey(), report
.getSeaSurfaceTemp()), true)); .getSeaSurfaceTemp()), true));
// wave height
tblRowData tblRowData
.setTableCellData( .setTableCellData(
14, 14,
@ -517,7 +559,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT
.getXmlKey(), report .getXmlKey(), report
.getHighResWaveHeight()), true)); .getHighResWaveHeight()), true));
// wave steep
tblRowData tblRowData
.setTableCellData( .setTableCellData(
15, 15,
@ -529,79 +571,102 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP
.getXmlKey(), report .getXmlKey(), report
.getWaveSteepness()), true)); .getWaveSteepness()), true));
// swell height
tblRowData String mccSwell;
.setTableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
16, mccSwell = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT
new TableCellData( .getXmlKey();
Math.round(new Float(report.getPSwellHeight())), } else {
tm.getThresholdValueCellType( mccSwell = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_HT
DataUsageKey.DISPLAY, .getXmlKey();
zone, }
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT tblRowData.setTableCellData(
.getXmlKey(), report 16,
.getPSwellHeight()), true)); new TableCellData(
Math.round(new Float(report.getPSwellHeight())), tm
tblRowData .getThresholdValueCellType(dataUsageKey, zone,
.setTableCellData( mccSwell, report.getPSwellHeight()),
17, true));
new TableCellData( // swell period
Math.round(new Float(report.getPSwellPeriod())), String mccSwellPD;
tm.getThresholdValueCellType( if (dataUsageKey == DataUsageKey.DISPLAY) {
DataUsageKey.DISPLAY, mccSwellPD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD
zone, .getXmlKey();
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD } else {
.getXmlKey(), report mccSwellPD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_PD
.getPSwellPeriod()), true)); .getXmlKey();
}
tblRowData tblRowData.setTableCellData(
.setTableCellData( 17,
18, new TableCellData(
new TableCellData( Math.round(new Float(report.getPSwellPeriod())), tm
Math.round(new Float(report.getPSwellDir())), .getThresholdValueCellType(dataUsageKey, zone,
tm.getThresholdValueCellType( mccSwellPD, report.getPSwellPeriod()),
DataUsageKey.DISPLAY, true));
zone, // swell dir TODO: from only
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM String mccSwellDirFrom;
.getXmlKey(), report if (dataUsageKey == DataUsageKey.DISPLAY) {
.getPSwellDir()), true)); mccSwellDirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM
.getXmlKey();
tblRowData } else {
.setTableCellData( mccSwellDirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM
19, .getXmlKey();
new TableCellData( }
Math.round(new Float(report.getSSwellHeight())), tblRowData.setTableCellData(
tm.getThresholdValueCellType( 18,
DataUsageKey.DISPLAY, new TableCellData(Math.round(new Float(report.getPSwellDir())),
zone, tm.getThresholdValueCellType(dataUsageKey, zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT mccSwellDirFrom, report.getPSwellDir()), true));
.getXmlKey(), report // swell2 height
.getSSwellHeight()), true)); String mccSwell2HT;
if (dataUsageKey == DataUsageKey.DISPLAY) {
tblRowData mccSwell2HT = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT
.setTableCellData( .getXmlKey();
20, } else {
new TableCellData( mccSwell2HT = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_HT
Math.round(new Float(report.getSSwellPeriod())), .getXmlKey();
tm.getThresholdValueCellType( }
DataUsageKey.DISPLAY, tblRowData.setTableCellData(
zone, 19,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD new TableCellData(
.getXmlKey(), report Math.round(new Float(report.getSSwellPeriod())), tm
.getSSwellPeriod()), true)); .getThresholdValueCellType(dataUsageKey, zone,
mccSwell2HT, report.getSSwellPeriod()),
true));
// swell2 period
String mccSwell2PD;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell2PD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD
.getXmlKey();
} else {
mccSwell2PD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_PD
.getXmlKey();
}
tblRowData.setTableCellData(
20,
new TableCellData(
Math.round(new Float(report.getSSwellPeriod())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccSwell2PD, report.getSSwellPeriod()),
true));
// swell2 dir TODO: only from
String mccSwell2DirFrom;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell2DirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM
.getXmlKey();
} else {
mccSwell2DirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM
.getXmlKey();
}
tblRowData tblRowData
.setTableCellData( .setTableCellData(
21, 21,
new TableCellData( new TableCellData(Math.round(new Float(report
Math.round(new Float(report.getPSwellDir())), .getPSwellDir())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(dataUsageKey,
DataUsageKey.DISPLAY, zone, mccSwell2DirFrom,
zone, report.getSSwellDir()), true));
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM // fog
.getXmlKey(), report
.getSSwellDir()), true));
if (isZone) { if (isZone) {
// zone table: fog monitored at zone level // zone table: fog monitored at zone level
tblRowData.setTableCellData(22, new TableCellData("", fogCellType, tblRowData.setTableCellData(22, new TableCellData("", fogCellType,
@ -637,9 +702,19 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
hoverText = getZoneHoverText(areaId); AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
} else { } else {
hoverText = getStationHoverText(areaId); hoverText = getStationHoverText(areaId);
} }
@ -704,54 +779,64 @@ public final class TableUtil {
.getXmlKey(), report .getXmlKey(), report
.getWindDir()), true)); .getWindDir()), true));
} }
// wind speed
tblRowData String wsk;
.setTableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
6, wsk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED
new TableCellData( .getXmlKey();
Math.round(new Float(report.getWindSpeed())), } else {
tm.getThresholdValueCellType( wsk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_WIND_SPEED
DataUsageKey.DISPLAY, .getXmlKey();
zone, }
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED tblRowData.setTableCellData(
.getXmlKey(), report 6,
.getWindSpeed()), true)); new TableCellData(Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(dataUsageKey, zone, wsk,
tblRowData report.getWindSpeed()), true));
.setTableCellData( // wind peak
7, String wpk;
new TableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
Math.round(new Float(report.getMaxWindSpeed())), wpk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND
tm.getThresholdValueCellType( .getXmlKey();
DataUsageKey.DISPLAY, } else {
zone, wpk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_PEAK_WIND
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND .getXmlKey();
.getXmlKey(), report }
.getMaxWindSpeed()), true)); tblRowData.setTableCellData(
7,
tblRowData new TableCellData(
.setTableCellData( Math.round(new Float(report.getMaxWindSpeed())), tm
8, .getThresholdValueCellType(dataUsageKey, zone,
new TableCellData( wpk, report.getMaxWindSpeed()), true));
Math.round(new Float(report.getWindGust())), // wind gust
tm.getThresholdValueCellType( String wgk;
DataUsageKey.DISPLAY, if (dataUsageKey == DataUsageKey.DISPLAY) {
zone, wgk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED .getXmlKey();
.getXmlKey(), report } else {
.getWindGust()), true)); wgk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_GUST_SPEED
.getXmlKey();
tblRowData }
.setTableCellData( tblRowData.setTableCellData(
9, 8,
new TableCellData( new TableCellData(Math.round(new Float(report.getWindGust())),
Math.round(new Float(report.getTemperature())), tm.getThresholdValueCellType(dataUsageKey, zone, wgk,
tm.getThresholdValueCellType( report.getWindGust()), true));
DataUsageKey.DISPLAY, // temperature
zone, String tmprk;
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP if (dataUsageKey == DataUsageKey.DISPLAY) {
.getXmlKey(), report tmprk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP
.getTemperature()), true)); .getXmlKey();
} else {
tmprk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_TEMP
.getXmlKey();
}
tblRowData.setTableCellData(
9,
new TableCellData(
Math.round(new Float(report.getTemperature())), tm
.getThresholdValueCellType(dataUsageKey, zone,
tmprk, report.getTemperature()), true));
tblRowData tblRowData
.setTableCellData( .setTableCellData(
@ -777,13 +862,17 @@ public final class TableUtil {
// used to compare with Red/Yellow // used to compare with Red/Yellow
// threshold values // threshold values
TableCellData visCellData = new TableCellData( String visKey;
visString, if (dataUsageKey == DataUsageKey.DISPLAY) {
tm.getThresholdValueCellType( visKey = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS
DataUsageKey.DISPLAY, .getXmlKey();
zone, } else {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS visKey = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_VIS
.getXmlKey(), visValue), true); .getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, visKey,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
@ -802,14 +891,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP
.getXmlKey(), report .getXmlKey(), report
.getSeaLevelPress()), true)); .getSeaLevelPress()), true));
// wind chill
tblRowData tblRowData
.setTableCellData( .setTableCellData(
13, 13,
new TableCellData( new TableCellData(
Math.round(new Float(report.getWindChill())), Math.round(new Float(report.getWindChill())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(
DataUsageKey.DISPLAY, dataUsageKey,
zone, zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL
.getXmlKey(), report .getXmlKey(), report
@ -838,14 +927,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP
.getXmlKey(), report .getXmlKey(), report
.getHourlyPrecip()), true)); .getHourlyPrecip()), true));
// snow depth
tblRowData tblRowData
.setTableCellData( .setTableCellData(
16, 16,
new TableCellData( new TableCellData(
Math.round(new Float(report.getSnowDepth())), Math.round(new Float(report.getSnowDepth())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(
DataUsageKey.DISPLAY, dataUsageKey,
zone, zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH
.getXmlKey(), report .getXmlKey(), report
@ -884,8 +973,9 @@ public final class TableUtil {
* @param zone * @param zone
* @return * @return
*/ */
private static String getZoneHoverText(String zone) { private static String getZoneHoverText(AreaIdXML zoneXML) {
String zone = zoneXML.getAreaId();
ISpatialQuery sq = null; ISpatialQuery sq = null;
String sql = null; String sql = null;
String hoverText = zone.substring(0, 2) + ", "; String hoverText = zone.substring(0, 2) + ", ";
@ -914,6 +1004,11 @@ public final class TableUtil {
} else { } else {
hoverText += (String) results[0].toString(); hoverText += (String) results[0].toString();
} }
} else {
if (zoneXML.getCLat() != null) {
hoverText += "(" + zoneXML.getCLat() + ", "
+ zoneXML.getCLon() + ")";
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -956,6 +1051,8 @@ public final class TableUtil {
} else if (stnType.intValue() == 1000) { } else if (stnType.intValue() == 1000) {
hoverText = stnId + "#MESONET -- " + stnName; hoverText = stnId + "#MESONET -- " + stnName;
} }
} else {
hoverText = stnId;
} }
} catch (Exception e) { } catch (Exception e) {
@ -976,7 +1073,7 @@ public final class TableUtil {
*/ */
public static CellType getCellTypeForSCA(String zone, ObReport report, public static CellType getCellTypeForSCA(String zone, ObReport report,
AbstractThresholdMgr tm) { AbstractThresholdMgr tm) {
// TODO:
float windSpd = report.getWindSpeed(); float windSpd = report.getWindSpeed();
float windGust = report.getWindGust(); float windGust = report.getWindGust();
float waveHgt = report.getHighResWaveHeight(); float waveHgt = report.getHighResWaveHeight();
@ -1027,7 +1124,7 @@ public final class TableUtil {
*/ */
public static CellType getCellTypeForGaleWarn(String zone, ObReport report, public static CellType getCellTypeForGaleWarn(String zone, ObReport report,
AbstractThresholdMgr tm) { AbstractThresholdMgr tm) {
// TODO:
CellType type = CellType.NotAvailable; CellType type = CellType.NotAvailable;
CellType windSpeedType = tm CellType windSpeedType = tm
.getThresholdValueCellType( .getThresholdValueCellType(
@ -1064,7 +1161,7 @@ public final class TableUtil {
*/ */
public static CellType getCellTypeForStormWarn(String zone, public static CellType getCellTypeForStormWarn(String zone,
ObReport report, AbstractThresholdMgr tm) { ObReport report, AbstractThresholdMgr tm) {
// TODO:
CellType type = CellType.NotAvailable; CellType type = CellType.NotAvailable;
CellType windSpeedType = tm CellType windSpeedType = tm
.getThresholdValueCellType( .getThresholdValueCellType(
@ -1101,7 +1198,7 @@ public final class TableUtil {
*/ */
public static CellType getCellTypeForHFWW(String zone, ObReport report, public static CellType getCellTypeForHFWW(String zone, ObReport report,
AbstractThresholdMgr tm) { AbstractThresholdMgr tm) {
// TODO:
CellType type = CellType.NotAvailable; CellType type = CellType.NotAvailable;
CellType windSpeedType = tm CellType windSpeedType = tm
.getThresholdValueCellType( .getThresholdValueCellType(
@ -1138,16 +1235,31 @@ public final class TableUtil {
*/ */
public static CellType getCellTypeForFog(String zone, ObReport report, public static CellType getCellTypeForFog(String zone, ObReport report,
AbstractThresholdMgr tm) { AbstractThresholdMgr tm) {
// TODO:
float visValue = report.getVisibility();// in miles
if (visValue == ObConst.MISSING) {
return CellType.NotAvailable;
}
visValue = visValue / milesPerNauticalMile; // in nautical miles
return tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey(), visValue);
CellType retVal = CellType.NotAvailable;
DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
float visValue = report.getVisibility();// in miles
if (visValue != ObConst.MISSING) {
visValue = visValue / milesPerNauticalMile; // in nautical miles
String mccSafeseas;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSafeseas = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey();
} else {
mccSafeseas = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS
.getXmlKey();
}
retVal = tm.getThresholdValueCellType(dataUsageKey, zone,
mccSafeseas, visValue);
}
return retVal;
} }
/** /**
@ -1332,7 +1444,6 @@ public final class TableUtil {
CellType type = CellType.NotAvailable; // default, assuming no CellType type = CellType.NotAvailable; // default, assuming no
// observation available // observation available
CellType snowDepth = tm CellType snowDepth = tm
.getThresholdValueCellType( .getThresholdValueCellType(
DataUsageKey.DISPLAY, DataUsageKey.DISPLAY,
@ -1670,5 +1781,5 @@ public final class TableUtil {
CommonTableConfig.obsHistCols.PTend)); CommonTableConfig.obsHistCols.PTend));
return tblRowData; return tblRowData;
} }
// TODO: add MESONET data
} }

View file

@ -19,7 +19,7 @@
**/ **/
package com.raytheon.uf.viz.monitor.listeners; package com.raytheon.uf.viz.monitor.listeners;
import com.raytheon.uf.viz.core.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.INotificationObserver;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
/** /**
@ -32,6 +32,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 29, 2009 dhladky Initial creation * Jan 29, 2009 dhladky Initial creation
* Sep 20, 2015 3873 skorolev Replaced deprecated INotificationObserver
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky

View file

@ -31,8 +31,13 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr; import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
@ -53,6 +58,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager * Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...) * Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
* Sep 18, 2015 3873 skorolev Added getCfgMgr().
* *
* </pre> * </pre>
* *
@ -61,25 +67,28 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
*/ */
public abstract class AbstractThresholdMgr { public abstract class AbstractThresholdMgr {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractThresholdMgr.class);
/** /**
* Monitor Area Configuration Manager. * Monitor Area Configuration Manager.
*/ */
protected FSSObsMonitorConfigurationManager areaConfigMgr; public FSSObsMonitorConfigurationManager areaConfigMgr;
/** /**
* Default file name for the FOG display thresholds. * Default file name for the display thresholds.
*/ */
private String defDisplayThreshName = "Unknown"; private String defDisplayThreshName = "Unknown";
/** /**
* Default file name for the FOG monitor thresholds. * Default file name for the monitor thresholds.
*/ */
private String defMonitorThreshName = "Unknown"; private String defMonitorThreshName = "Unknown";
/** /**
* Application name that will be the starting path for the XML data. * Application name that will be the starting path for the XML data.
*/ */
private final String appName; private final AppName appName;
/** /**
* Full path and file name for the current FOG display file. * Full path and file name for the current FOG display file.
@ -117,10 +126,8 @@ public abstract class AbstractThresholdMgr {
/** current site **/ /** current site **/
protected String site; protected String site;
/* /** threshold usage **/
* TODO : remove this when debugging is complete protected DataUsageKey dataUsageKey;
*/
public ThresholdsXML threshXmlCopy;
/** /**
* Constructor. * Constructor.
@ -129,12 +136,12 @@ public abstract class AbstractThresholdMgr {
* @param defMonitorThreshName * @param defMonitorThreshName
*/ */
public AbstractThresholdMgr(String defDisplayThreshName, public AbstractThresholdMgr(String defDisplayThreshName,
String defMonitorThreshName, String appName) { String defMonitorThreshName, AppName appName) {
this.defDisplayThreshName = defDisplayThreshName; this.defDisplayThreshName = defDisplayThreshName;
this.defMonitorThreshName = defMonitorThreshName; this.defMonitorThreshName = defMonitorThreshName;
this.appName = appName; this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite(); this.site = LocalizationManager.getInstance().getCurrentSite();
this.areaConfigMgr = getMonitorAreaConfigInstance(); this.areaConfigMgr = getCfgMgr();
} }
/** /**
@ -148,7 +155,7 @@ public abstract class AbstractThresholdMgr {
defaultFileNameMgr.readXmlConfig(); defaultFileNameMgr.readXmlConfig();
/* /*
* Setup the Fog display threshold manager * Setup the display threshold manager
*/ */
if (defaultFileNameMgr.getDefaultThresholdFilename() != null if (defaultFileNameMgr.getDefaultThresholdFilename() != null
&& defaultFileNameMgr.getDefaultThresholdFilename().length() > 0) { && defaultFileNameMgr.getDefaultThresholdFilename().length() > 0) {
@ -175,7 +182,7 @@ public abstract class AbstractThresholdMgr {
} }
/* /*
* Setup the Fog monitor threshold manager * Setup the monitor threshold manager
*/ */
currFullMonitorXmlFileName = getMonitorThresholdPath() currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName; + defMonitorThreshName;
@ -201,7 +208,7 @@ public abstract class AbstractThresholdMgr {
LocalizationFile locFile = pm.getLocalizationFile(context, LocalizationFile locFile = pm.getLocalizationFile(context,
pathAndFileName); pathAndFileName);
System.out.println("--- validate path = " statusHandler.handle(Priority.DEBUG, "--- validate path = "
+ locFile.getFile().getAbsolutePath()); + locFile.getFile().getAbsolutePath());
return locFile.getFile().exists(); return locFile.getFile().exists();
@ -235,7 +242,6 @@ public abstract class AbstractThresholdMgr {
return monitorThreshMgr.getYellowValue(areaID, key); return monitorThreshMgr.getYellowValue(areaID, key);
} }
} }
return 0; return 0;
} }
@ -284,30 +290,24 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) { if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (Double.isNaN(value) == true) { if (Double.isNaN(value) == true) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (value == ObConst.MISSING) { if (value == ObConst.MISSING) {
return CellType.NotAvailable; return CellType.NotAvailable;
} }
double red = Double.NaN; double red = Double.NaN;
double yellow = Double.NaN; double yellow = Double.NaN;
if (dataUsage == DataUsageKey.DISPLAY) { if (dataUsage == DataUsageKey.DISPLAY) {
red = displayThreshMgr.getRedValue(areaID, key); red = displayThreshMgr.getRedValue(areaID, key);
yellow = displayThreshMgr.getYellowValue(areaID, key); yellow = displayThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value); return calcCellType(key, red, yellow, value);
} else if (dataUsage == DataUsageKey.MONITOR) { } else if (dataUsage == DataUsageKey.MONITOR) {
red = monitorThreshMgr.getRedValue(areaID, key); red = monitorThreshMgr.getRedValue(areaID, key);
yellow = monitorThreshMgr.getYellowValue(areaID, key); yellow = monitorThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value); return calcCellType(key, red, yellow, value);
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -328,11 +328,9 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) { if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (Double.isNaN(value) == true) { if (Double.isNaN(value) == true) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (value == ObConst.MISSING) { if (value == ObConst.MISSING) {
return CellType.NotAvailable; return CellType.NotAvailable;
} }
@ -357,7 +355,6 @@ public abstract class AbstractThresholdMgr {
return calcDirectionalCellType(redFrom, redTo, yellowFrom, return calcDirectionalCellType(redFrom, redTo, yellowFrom,
yellowTo, value); yellowTo, value);
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -379,25 +376,21 @@ public abstract class AbstractThresholdMgr {
return CellType.R; return CellType.R;
} }
} }
if (redFrom > redTo) { if (redFrom > redTo) {
if (value > redFrom || value < redTo) { if (value > redFrom || value < redTo) {
return CellType.R; return CellType.R;
} }
} }
if (yellowFrom < yellowTo) { if (yellowFrom < yellowTo) {
if (value > yellowFrom && value < yellowTo) { if (value > yellowFrom && value < yellowTo) {
return CellType.Y; return CellType.Y;
} }
} }
if (yellowFrom > yellowTo) { if (yellowFrom > yellowTo) {
if (value > yellowFrom || value < yellowTo) { if (value > yellowFrom || value < yellowTo) {
return CellType.Y; return CellType.Y;
} }
} }
return CellType.G; return CellType.G;
} }
@ -427,7 +420,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) { } else if (value <= yellow) {
return CellType.Y; return CellType.Y;
} }
return CellType.G; return CellType.G;
} else { } else {
if (value < yellow) { if (value < yellow) {
@ -435,7 +427,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= red) { } else if (value <= red) {
return CellType.Y; return CellType.Y;
} }
return CellType.R; return CellType.R;
} }
} else if (redIsHigher == true) { } else if (redIsHigher == true) {
@ -444,7 +435,6 @@ public abstract class AbstractThresholdMgr {
} else if (value < red) { } else if (value < red) {
return CellType.Y; return CellType.Y;
} }
return CellType.R; return CellType.R;
} else if (redIsHigher == false) { } else if (redIsHigher == false) {
if (value <= red) { if (value <= red) {
@ -452,10 +442,8 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) { } else if (value <= yellow) {
return CellType.Y; return CellType.Y;
} }
return CellType.G; return CellType.G;
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -472,11 +460,9 @@ public abstract class AbstractThresholdMgr {
+ defDisplayThreshName; + defDisplayThreshName;
return; return;
} }
if (fileName.endsWith(".xml") == false) { if (fileName.endsWith(".xml") == false) {
fileName.concat(".xml"); fileName.concat(".xml");
} }
if (fileName.compareTo(defDisplayThreshName) == 0) { if (fileName.compareTo(defDisplayThreshName) == 0) {
defaultFileNameMgr.setDefaultThresholdFilename(""); defaultFileNameMgr.setDefaultThresholdFilename("");
} else { } else {
@ -495,9 +481,7 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold(); loadDefaultDisplayThreshold();
return; return;
} }
currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName; currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.readThresholdXml(); displayThreshMgr.readThresholdXml();
} }
@ -511,23 +495,18 @@ public abstract class AbstractThresholdMgr {
if (filename == null || filename.trim().length() == 0) { if (filename == null || filename.trim().length() == 0) {
currFullDisplayXmlFileName = getDisplayThresholdPath() currFullDisplayXmlFileName = getDisplayThresholdPath()
+ defDisplayThreshName; + defDisplayThreshName;
List<String> areaIDs = null; List<String> areaIDs = null;
try { try {
areaIDs = areaConfigMgr.getAreaList(); areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
// Sort the area IDs // Sort the area IDs
Collections.sort(areaIDs); Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY); ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY);
statusHandler.handle(Priority.DEBUG, "---- "
System.out.println("---- " + currFullDisplayXmlFileName); + currFullDisplayXmlFileName);
displayThreshMgr.createConfigFromDefaults( displayThreshMgr.createConfigFromDefaults(
currFullDisplayXmlFileName, areaIDs, threshKeys); currFullDisplayXmlFileName, areaIDs, threshKeys);
} else { } else {
@ -543,21 +522,16 @@ public abstract class AbstractThresholdMgr {
public void loadDefaultMonitorThreshold() { public void loadDefaultMonitorThreshold() {
currFullMonitorXmlFileName = getMonitorThresholdPath() currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName; + defMonitorThreshName;
List<String> areaIDs = null; List<String> areaIDs = null;
try { try {
areaIDs = areaConfigMgr.getAreaList(); areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
// Sort the area IDs // Sort the area IDs
Collections.sort(areaIDs); Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR); ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR);
monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName, monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName,
areaIDs, threshKeys); areaIDs, threshKeys);
} }
@ -572,9 +546,7 @@ public abstract class AbstractThresholdMgr {
if (newFileName.trim().compareTo(defDisplayThreshName) == 0) { if (newFileName.trim().compareTo(defDisplayThreshName) == 0) {
return; return;
} }
currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName; currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.saveThresholdXml(); displayThreshMgr.saveThresholdXml();
} }
@ -601,7 +573,6 @@ public abstract class AbstractThresholdMgr {
if (usageKey == DataUsageKey.DISPLAY) { if (usageKey == DataUsageKey.DISPLAY) {
return defDisplayThreshName; return defDisplayThreshName;
} }
// Return the Monitor threshold file name as the default. // Return the Monitor threshold file name as the default.
return defMonitorThreshName; return defMonitorThreshName;
} }
@ -616,61 +587,60 @@ public abstract class AbstractThresholdMgr {
return defaultFileNameMgr.getDefaultThresholdFilename(); return defaultFileNameMgr.getDefaultThresholdFilename();
} }
/**
* Gets Thresholds XML Data
*
* @param usageKey
* @return
*/
public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) { public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) {
if (usageKey == DataUsageKey.DISPLAY) { if (usageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML(); return displayThreshMgr.getThresholdXML();
} }
return monitorThreshMgr.getThresholdXML(); return monitorThreshMgr.getThresholdXML();
} }
/** /**
* Get the path where the display thresholds XML files are contained. * Gets the path where the display thresholds XML files are contained.
* *
* @return File path. * @return File path.
*/ */
public String getDisplayThresholdPath() { public String getDisplayThresholdPath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("display").append(fs); sb.append("display").append(fs);
return sb.toString(); return sb.toString();
} }
/** /**
* Get the path where the monitor thresholds XML files are contained. * Gets the path where the monitor thresholds XML files are contained.
* *
* @return File path. * @return File path.
*/ */
public String getMonitorThresholdPath() { public String getMonitorThresholdPath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("monitor").append(fs); sb.append("monitor").append(fs);
return sb.toString(); return sb.toString();
} }
/** /**
* Get the path where the XML file containing the user selected default file * Gets the path where the XML file containing the user selected default
* is located. * file is located.
* *
* @return The path of the user selected default file XML. * @return The path of the user selected default file XML.
*/ */
public String getDefaultThresholdFilePath() { public String getDefaultThresholdFilePath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("display").append(fs); sb.append("display").append(fs);
sb.append("defaultThresh").append(fs); sb.append("defaultThresh").append(fs);
return sb.toString(); return sb.toString();
} }
@ -686,7 +656,6 @@ public abstract class AbstractThresholdMgr {
} else if (dataUsageKey == DataUsageKey.MONITOR) { } else if (dataUsageKey == DataUsageKey.MONITOR) {
return monitorThreshMgr.getThresholdsXmlCopy(); return monitorThreshMgr.getThresholdsXmlCopy();
} }
return null; return null;
} }
@ -698,7 +667,6 @@ public abstract class AbstractThresholdMgr {
*/ */
public boolean deleteFile(LocalizationFile fileName) { public boolean deleteFile(LocalizationFile fileName) {
boolean deletedUserSelectedDefault = false; boolean deletedUserSelectedDefault = false;
String fileNameStr = fileName.getFile().getName(); String fileNameStr = fileName.getFile().getName();
/* /*
@ -712,7 +680,6 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold(); loadDefaultDisplayThreshold();
deletedUserSelectedDefault = true; deletedUserSelectedDefault = true;
} }
/* /*
* Delete the file. * Delete the file.
*/ */
@ -721,7 +688,6 @@ public abstract class AbstractThresholdMgr {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return deletedUserSelectedDefault; return deletedUserSelectedDefault;
} }
@ -736,7 +702,6 @@ public abstract class AbstractThresholdMgr {
if (dataUsageKey == DataUsageKey.DISPLAY) { if (dataUsageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML().hasAreaId(areaID); return displayThreshMgr.getThresholdXML().hasAreaId(areaID);
} }
return monitorThreshMgr.getThresholdXML().hasAreaId(areaID); return monitorThreshMgr.getThresholdXML().hasAreaId(areaID);
} }
@ -764,34 +729,17 @@ public abstract class AbstractThresholdMgr {
ArrayList<AreaXML> areasArray = displayXML.getAreas(); ArrayList<AreaXML> areasArray = displayXML.getAreas();
for (AreaXML area : areasArray) { for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId()); statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds(); ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) { for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey()); statusHandler.handle(Priority.DEBUG,
System.out.println(" R " + atXml.getRed()); "****** " + atXml.getKey());
System.out.println(" Y " + atXml.getYellow()); statusHandler.handle(Priority.DEBUG,
} " R " + atXml.getRed());
} statusHandler.handle(Priority.DEBUG,
} " Y " + atXml.getYellow());
public void printDisplayThresholdsXMLCopy() {
if (threshXmlCopy == null) {
threshXmlCopy = displayThreshMgr.getThresholdsXmlCopy();
}
ArrayList<AreaXML> areasArray = threshXmlCopy.getAreas();
for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey());
System.out.println(" R " + atXml.getRed());
System.out.println(" Y " + atXml.getYellow());
} }
} }
} }
@ -801,6 +749,37 @@ public abstract class AbstractThresholdMgr {
* *
* @return manager * @return manager
*/ */
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance(); public FSSObsMonitorConfigurationManager getCfgMgr() {
FSSObsMonitorConfigurationManager mgr = null;
switch (this.appName) {
case FOG:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
break;
case SAFESEAS:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.ss);
break;
case SNOW:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.snow);
break;
default:
statusHandler.error("Unable to handle unknown appName: "
+ this.appName);
break;
}
return mgr;
}
/**
* @return
*/
public DataUsageKey getDataUsageKey() {
return dataUsageKey;
}
/**
* @param dataUsageKey
*/
public void setDataUsageKey(DataUsageKey dataUsageKey) {
this.dataUsageKey = dataUsageKey;
}
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 15, 2009 #3963 lvenable Initial creation * Dec 15, 2009 #3963 lvenable Initial creation
* Dec 4, 2012 #1351 skorolev Cleaned code * Dec 4, 2012 #1351 skorolev Cleaned code
* Sep 18, 2015 #3873 skorolev Added error message for corrupted or empty default threshold file.
* *
* </pre> * </pre>
* *
@ -86,10 +87,11 @@ public class ThresholdMgr {
*/ */
public void readThresholdXml() { public void readThresholdXml() {
try { try {
cfgXML = null; ThresholdsXML newCfgXML = null;
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
File path = pm.getStaticFile(currFullPathAndFileName); File path = pm.getStaticFile(currFullPathAndFileName);
cfgXML = JAXB.unmarshal(path, ThresholdsXML.class); newCfgXML = JAXB.unmarshal(path, ThresholdsXML.class);
this.setThresholdXML(newCfgXML);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler.handle(Priority.ERROR, e.getMessage());
} }
@ -145,7 +147,11 @@ public class ThresholdMgr {
ThresholdsXML.class); ThresholdsXML.class);
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys); createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler
.handle(Priority.ERROR,
"Default threshold configuration file "
+ fullDefaultPathName
+ " is corrupted.\nDelete the files in the folder on the server side and restart CAVE.");
return false; return false;
} }
return true; return true;

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.viz.monitor.ui.dialogs; package com.raytheon.uf.viz.monitor.ui.dialogs;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -42,10 +43,12 @@ import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType; import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -79,6 +82,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code. * Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog. * Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones. * Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
* Sep 18, 2015 3873 skorolev Added formIsValid method.
* *
* </pre> * </pre>
* *
@ -230,6 +234,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** Flag set when user wants to close with unsaved modifications. */ /** Flag set when user wants to close with unsaved modifications. */
protected boolean closeFlag = false; protected boolean closeFlag = false;
private final static String INVALID_AREA_MSG = "Invalid Area ID = '%s' entered.\n"
+ "Please enter a correctly formatted Area ID:\n"
+ "Zone ID must have six characters.\n"
+ "A third character should be C for county and Z for marine zone.\n"
+ "Use only capital characters.";
private final static String INVALID_COORD_MSG = "Invalid Lat/Lon entered:\n"
+ "Latitude = '%s'\n"
+ "Longitude = '%s'\n"
+ "Please enter correctly formatted Lat and Lon values:\n"
+ "Latitude should be between -90,90.\n"
+ "Longitude should be between -180,180.";
private final static String MODIFY_THRESHOLD_MSG = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
/** /**
* Constructor. * Constructor.
* *
@ -782,7 +803,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
okBtn.addSelectionListener(new SelectionAdapter() { okBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
handleOkBtnSelection(); try {
handleOkBtnSelection();
} catch (LocalizationException | SerializationException
| IOException e) {
statusHandler.handle(Priority.PROBLEM,
"There is a problem saving changes. ", e);
}
} }
}); });
@ -878,6 +905,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Handles the Add New button click. * Handles the Add New button click.
*/ */
private void handleAddNewAction() { private void handleAddNewAction() {
// Zone configure
if (zoneRdo.getSelection() == true) { if (zoneRdo.getSelection() == true) {
if (addNewZoneDlg == null) { if (addNewZoneDlg == null) {
addNewZoneDlg = new AddNewZoneDlg(shell, appName, this); addNewZoneDlg = new AddNewZoneDlg(shell, appName, this);
@ -893,9 +921,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}); });
} }
addNewZoneDlg.open(); addNewZoneDlg.open();
} else { } else { // Station configure
if (associatedList.getSelectionIndex() != -1) { if (maRegionalList.getSelectionIndex() != -1) {
String area = associatedList.getItem(associatedList String area = maRegionalList.getItem(maRegionalList
.getSelectionIndex()); .getSelectionIndex());
if (addNewStnDlg == null) { if (addNewStnDlg == null) {
addNewStnDlg = new AddNewStationDlg(shell, appName, area, addNewStnDlg = new AddNewStationDlg(shell, appName, area,
@ -916,9 +944,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
MessageBox messageBox = new MessageBox(shell, MessageBox messageBox = new MessageBox(shell,
SWT.ICON_INFORMATION | SWT.NONE); SWT.ICON_INFORMATION | SWT.NONE);
messageBox.setText("Selection error."); messageBox.setText("Selection error.");
messageBox.setMessage("Please select associated zone."); messageBox.setMessage("Please select a monitoring zone.");
messageBox.open(); messageBox.open();
associatedList.select(0); maRegionalList.select(0);
} }
} }
} }
@ -935,8 +963,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) { if (returnValue instanceof String) {
// Update the edit dialog // Update the edit dialog
String selectedZone = returnValue.toString();
maZones.remove(selectedZone);
populateLeftLists(); populateLeftLists();
} }
editDlg = null; editDlg = null;
@ -1096,7 +1122,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
monitorAreaList monitorAreaList
.setItems(maZones.toArray(new String[maZones.size()])); .setItems(maZones.toArray(new String[maZones.size()]));
monitorAreaList.setSelection(maZones.indexOf(zone)); monitorAreaList.setSelection(maZones.indexOf(zone));
handleMonitorAreaListSelection();
additionalZones.remove(zone); additionalZones.remove(zone);
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR); : ZoneType.REGULAR);
@ -1104,6 +1129,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
configMgr.getAddedZones().add(zone); configMgr.getAddedZones().add(zone);
} }
configMgr.removeAdjArea(zone); configMgr.removeAdjArea(zone);
handleMonitorAreaListSelection();
} else { // Station mode } else { // Station mode
if (associatedList.getSelectionCount() == 0) { if (associatedList.getSelectionCount() == 0) {
showMessage(shell, SWT.ERROR, "Selection Needed", showMessage(shell, SWT.ERROR, "Selection Needed",
@ -1148,6 +1174,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
monitorAreaList.remove(monitorAreaList.getSelectionIndex()); monitorAreaList.remove(monitorAreaList.getSelectionIndex());
associatedList.removeAll(); associatedList.removeAll();
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
// entry is a zone to remove.
if (!additionalZones.contains(entry)) { if (!additionalZones.contains(entry)) {
additionalZones.add(entry); additionalZones.add(entry);
} }
@ -1165,6 +1192,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
entry.charAt(2) == 'Z' ? ZoneType.MARITIME entry.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR); : ZoneType.REGULAR);
} else { // Station mode } else { // Station mode
// entry is a station to remove.
additionalStns.add(entry); additionalStns.add(entry);
Collections.sort(additionalStns); Collections.sort(additionalStns);
additionalList.setItems(additionalStns additionalList.setItems(additionalStns
@ -1307,7 +1335,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Handles the monitor area list selection. * Handles the monitor area list selection.
*/ */
private void handleMonitorAreaListSelection() { private void handleMonitorAreaListSelection() {
if (monitorAreaList.getSelectionIndex() == -1) { if (monitorAreaList.getSelectionIndex() < 0) {
return; return;
} }
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
@ -1343,11 +1371,15 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} }
/** /**
* Reset and Saving configuration parameters. * Save configuration parameters.
*
* @throws SerializationException
* @throws LocalizationException
* @throws IOException
*/ */
protected void resetAndSave() { protected void saveConfigs() throws LocalizationException,
SerializationException, IOException {
getValues(); getValues();
resetStatus();
configMgr.saveConfigXml(); configMgr.saveConfigXml();
configMgr.saveAdjacentAreaConfigXml(); configMgr.saveAdjacentAreaConfigXml();
} }
@ -1363,8 +1395,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** /**
* Handles OK button. Save changes and close the dialog (or just close if * Handles OK button. Save changes and close the dialog (or just close if
* there are no changes). * there are no changes).
*
* @throws IOException
* @throws SerializationException
* @throws LocalizationException
*/ */
protected abstract void handleOkBtnSelection(); protected abstract void handleOkBtnSelection()
throws LocalizationException, SerializationException, IOException;
/** /**
* Adds a new zone to monitor area and refresh GUI * Adds a new zone to monitor area and refresh GUI
@ -1416,6 +1453,21 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return false; return false;
} }
public boolean formIsValid(String area, String latString, String lonString) {
boolean retVal = true;
if (area.equals("") || area.length() != 6
|| (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
displayInputErrorMsg(String.format(INVALID_AREA_MSG, area));
retVal = false;
}
if (latString == null || latString.isEmpty() || lonString == null
|| lonString.isEmpty()) {
latLonErrorMsg(latString, lonString);
retVal = false;
}
return retVal;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -1465,16 +1517,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void latLonErrorMsg(String latStr, String lonStr) { public void latLonErrorMsg(String latStr, String lonStr) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK); | SWT.OK);
messageBox.setText("Invalid Lat/Lon"); messageBox.setMessage(INVALID_COORD_MSG);
StringBuilder errMsg = new StringBuilder("Invalid Lat/Lon entered:");
errMsg.append("\nLatitude = ");
errMsg.append(latStr);
errMsg.append("\nLongitude = ");
errMsg.append(lonStr);
errMsg.append("\nPlease enter correctly formatted Lat and Lon values:");
errMsg.append("\nLatitude should be between -90,90.");
errMsg.append("\nLongitude should be between -180,180.");
messageBox.setMessage(errMsg.toString());
messageBox.open(); messageBox.open();
} }
@ -1482,7 +1525,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Reset data status. * Reset data status.
*/ */
protected void resetStatus() { protected void resetStatus() {
this.timeWindowChanged = false; this.timeWindowChanged = false;
this.maZonesRemoved = false; this.maZonesRemoved = false;
this.maStationsRemoved = false; this.maStationsRemoved = false;
@ -1512,11 +1554,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* @return * @return
*/ */
protected int editDialog() { protected int editDialog() {
String message = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO, int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO,
"Edit Thresholds Now?", message); "Edit Thresholds Now?", MODIFY_THRESHOLD_MSG);
return yesno; return yesno;
} }
@ -1538,6 +1577,35 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return state; return state;
} }
public java.util.List<String> getMaZones() {
return maZones;
}
public java.util.List<String> getMaStations() {
return maStations;
}
public java.util.List<String> getAdditionalZones() {
return additionalZones;
}
public java.util.List<String> getAdditionalStns() {
return additionalStns;
}
/**
* Displays Input Error Message
*
* @param msg
*/
public void displayInputErrorMsg(String msg) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK);
messageBox.setText("Invalid input");
messageBox.setMessage(msg);
messageBox.open();
}
/** /**
* Gets Configuration manager. * Gets Configuration manager.
* *

View file

@ -54,7 +54,10 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
@ -96,6 +99,7 @@ import com.vividsolutions.jts.io.ParseException;
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager. * May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method. * Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* Nov 03, 2014 3741 skorolev Updated zoom procedures. * Nov 03, 2014 3741 skorolev Updated zoom procedures.
* Sep 25, 2015 3873 skorolev Added center definition for moving platforms.
* *
* </pre> * </pre>
* *
@ -191,6 +195,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private final DateFormat dFormat = new SimpleDateFormat( private final DateFormat dFormat = new SimpleDateFormat(
"E MMM dd HH:mm:ss yyyy"); "E MMM dd HH:mm:ss yyyy");
public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** list of variables to plot. **/ /** list of variables to plot. **/
public List<String> prodArray; public List<String> prodArray;
@ -653,6 +659,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
initiateProdArray(); initiateProdArray();
dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station
+ "#" + dataSrc; + "#" + dataSrc;
if (graphType == GraphType.Trend) { if (graphType == GraphType.Trend) {
TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle); TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle);
if (tpd == null) { if (tpd == null) {
@ -812,11 +819,29 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
try { try {
Coordinate stnCenter = MonitorAreaUtils Coordinate stnCenter = MonitorAreaUtils
.getStationCenter(selectedStation); .getStationCenter(selectedStation);
if (stnCenter != null) { if (stnCenter == null) {
zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL); // Center for moving platforms.
SimpleDateFormat datef = new SimpleDateFormat(datePattern);
datef.setTimeZone(TimeZone.getTimeZone("GMT"));
String sql = "select longitude, latitude from fssobs where stationid = '"
+ selectedStation + "'";
List<Object[]> results = DirectDbQuery.executeQuery(sql,
"metadata", QueryLanguage.SQL);
double x;
double y;
if (!results.isEmpty()) {
x = Double.parseDouble(results.get(0)[0].toString());
y = Double.parseDouble(results.get(0)[1].toString());
stnCenter = new Coordinate();
stnCenter.x = x;
stnCenter.y = y;
}
} }
} catch (SpatialException | ParseException e) { zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL);
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e); } catch (SpatialException | ParseException | VizException e) {
statusHandler.handle(Priority.ERROR,
"Unable to find the station center for station: "
+ selectedStation, e);
} }
} }
@ -943,20 +968,30 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
int stInd = name.indexOf("_"); int stInd = name.indexOf("_");
if (prod.size() > 1) { if (prod.size() > 1) {
varName = name.substring(0, stInd); varName = name.substring(0, stInd);
if (varName.equals("SCA")) { switch (varName) {
case "SCA":
varName = "Small Craft Advisory"; varName = "Small Craft Advisory";
} else if (varName.equals("GALE")) { break;
case "GALE":
varName = "Gale Warning"; varName = "Gale Warning";
} else if (varName.equals("STORM")) { break;
case "STORM":
varName = "Storm Warning"; varName = "Storm Warning";
} else if (varName.equals("HURRICANE")) { break;
case "HURRICANE":
varName = "Hurricane Force Wind Warning"; varName = "Hurricane Force Wind Warning";
} else if (varName.equals("BLIZ")) { break;
case "BLIZ":
varName = "Blizzard Warning"; varName = "Blizzard Warning";
} else if (varName.equals("FRZ")) { break;
case "FRZ":
varName = "Freezing Precipitation"; varName = "Freezing Precipitation";
} else if (varName.equals("HSW")) { break;
case "HSW":
varName = "Heavy Snow Warning"; varName = "Heavy Snow Warning";
break;
default:
statusHandler.error("Invalid name for variable " + varName);
} }
} else { } else {
varName = name.substring(stInd + 1); varName = name.substring(stInd + 1);

View file

@ -21,8 +21,10 @@ package com.raytheon.uf.viz.monitor.util;
import java.util.HashMap; import java.util.HashMap;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
/** /**
* TODO Add Description * Monitor Configuration Constants.
* *
* <pre> * <pre>
* *
@ -30,57 +32,59 @@ import java.util.HashMap;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 16, 2009 2076 avarani Initial creation * Mar 16, 2009 2076 avarani Initial creation
* Sep 18, 2015 3873 skorolev Corrected appName.
* *
* </pre> * </pre>
* *
* @author avarani * @author avarani
* @version 1.0 * @version 1.0
*/ */
public class MonitorConfigConstants public class MonitorConfigConstants {
{
private static HashMap<String, Boolean> ryHigherMapSS; private static HashMap<String, Boolean> ryHigherMapSS;
private static HashMap<String, Boolean> ryHigherMapSnow; private static HashMap<String, Boolean> ryHigherMapSnow;
private static HashMap<String, Boolean> ryHigherMapFog; private static HashMap<String, Boolean> ryHigherMapFog;
private static boolean rankSwellPeriodHigh = false; private static boolean rankSwellPeriodHigh = false;
/* /*
* SAFESEAS * SAFESEAS
*/ */
public static enum SafeSeasDisplay public static enum SafeSeasDisplay {
{ SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), SS_DISP_PROD_SCA_GUST_SPEED(
SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), "Display.Product.SCA.gust_speed"), SS_DISP_PROD_SCA_PEAK_WIND(
SS_DISP_PROD_SCA_GUST_SPEED("Display.Product.SCA.gust_speed"), "Display.Product.SCA.peak_wind_speed"), SS_DISP_PROD_SCA_WAVE_HT(
SS_DISP_PROD_SCA_PEAK_WIND("Display.Product.SCA.peak_wind_speed"), "Display.Product.SCA.wave_height"), SS_DISP_PROD_GALE_WIND_SPEED(
SS_DISP_PROD_SCA_WAVE_HT("Display.Product.SCA.wave_height"), "Display.Product.Gale.wind_speed"), SS_DISP_PROD_GALE_GUST_SPEED(
SS_DISP_PROD_GALE_WIND_SPEED("Display.Product.Gale.wind_speed"), "Display.Product.Gale.gust_speed"), SS_DISP_PROD_GALE_PEAK_WIND(
SS_DISP_PROD_GALE_GUST_SPEED("Display.Product.Gale.gust_speed"), "Display.Product.Gale.peak_wind_speed"), SS_DISP_PROD_STORM_WIND_SPEED(
SS_DISP_PROD_GALE_PEAK_WIND("Display.Product.Gale.peak_wind_speed"), "Display.Product.Storm.wind_speed"), SS_DISP_PROD_STORM_GUST_SPEED(
SS_DISP_PROD_STORM_WIND_SPEED("Display.Product.Storm.wind_speed"), "Display.Product.Storm.gust_speed"), SS_DISP_PROD_STORM_PEAK_WIND(
SS_DISP_PROD_STORM_GUST_SPEED("Display.Product.Storm.gust_speed"), "Display.Product.Storm.peak_wind_speed"), SS_DISP_PROD_HFWW_WIND_SPEED(
SS_DISP_PROD_STORM_PEAK_WIND("Display.Product.Storm.peak_wind_speed"), "Display.Product.Hurricane.wind_speed"), SS_DISP_PROD_HFWW_GUST_SPEED(
SS_DISP_PROD_HFWW_WIND_SPEED("Display.Product.Hurricane.wind_speed"), "Display.Product.Hurricane.gust_speed"), SS_DISP_PROD_HFWW_PEAK_WIND(
SS_DISP_PROD_HFWW_GUST_SPEED("Display.Product.Hurricane.gust_speed"), "Display.Product.Hurricane.peak_wind_speed"), SS_DISP_WIND_WIND_SPEED(
SS_DISP_PROD_HFWW_PEAK_WIND("Display.Product.Hurricane.peak_wind_speed"), "Display.Wind.wind_speed"), SS_DISP_WIND_PEAK_WIND(
SS_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), "Display.Wind.peak_wind_speed"), SS_DISP_WIND_GUST_SPEED(
SS_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), "Display.Wind.gust_speed"), SS_DISP_WIND_DIR_FROM(
SS_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), "Display.Wind.dirFrom"), SS_DISP_WIND_DIR_TO(
SS_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), "Display.Wind.dirTo"), SS_DISP_METEO_VIS(
SS_DISP_WIND_DIR_TO("Display.Wind.dirTo"), "Display.Meteo.visibility"), SS_DISP_METEO_TEMP(
SS_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.temperature"), SS_DISP_METEO_DEWPT(
SS_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), SS_DISP_METEO_SLP(
SS_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.slp"), SS_DISP_METEO_SST(
SS_DISP_METEO_SLP("Display.Meteo.slp"), "Display.Meteo.sea_surface_temp"), SS_DISP_METEO_WAVE_HT(
SS_DISP_METEO_SST("Display.Meteo.sea_surface_temp"), "Display.Meteo.wave_height"), SS_DISP_METEO_WAVE_STEEP(
SS_DISP_METEO_WAVE_HT("Display.Meteo.wave_height"), "Display.Meteo.wave_steepness"), SS_DISP_SWELL_PRIM_HT(
SS_DISP_METEO_WAVE_STEEP("Display.Meteo.wave_steepness"), "Display.Swell.Primary.height"), SS_DISP_SWELL_PRIM_PD(
SS_DISP_SWELL_PRIM_HT("Display.Swell.Primary.height"), "Display.Swell.Primary.period"), SS_DISP_SWELL_PRIM_DIR_FROM(
SS_DISP_SWELL_PRIM_PD("Display.Swell.Primary.period"), "Display.Swell.Primary.dirFrom"), SS_DISP_SWELL_PRIM_DIR_TO(
SS_DISP_SWELL_PRIM_DIR_FROM("Display.Swell.Primary.dirFrom"), "Display.Swell.Primary.dirTo"), SS_DISP_SWELL_SEC_HT(
SS_DISP_SWELL_PRIM_DIR_TO("Display.Swell.Primary.dirTo"), "Display.Swell.Secondary.height"), SS_DISP_SWELL_SEC_PD(
SS_DISP_SWELL_SEC_HT("Display.Swell.Secondary.height"), "Display.Swell.Secondary.period"), SS_DISP_SWELL_SEC_DIR_FROM(
SS_DISP_SWELL_SEC_PD("Display.Swell.Secondary.period"), "Display.Swell.Secondary.dirFrom"), SS_DISP_SWELL_SEC_DIR_TO(
SS_DISP_SWELL_SEC_DIR_FROM("Display.Swell.Secondary.dirFrom"), "Display.Swell.Secondary.dirTo");
SS_DISP_SWELL_SEC_DIR_TO("Display.Swell.Secondary.dirTo");
String XMLKey; String XMLKey;
@ -92,22 +96,21 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum SafeSeasMonitor public static enum SafeSeasMonitor {
{ SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SS_MON_METEO_PEAK_WIND(
SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), "Monitor.Meteo.peak_wind_speed"), SS_MON_METEO_GUST_SPEED(
SS_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), "Monitor.Meteo.gust_speed"), SS_MON_METEO_WAVE_HT(
SS_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), "Monitor.Meteo.wave_height"), SS_MON_METEO_VIS(
SS_MON_METEO_WAVE_HT("Monitor.Meteo.wave_height"), "Monitor.Meteo.visibility"), SS_MON_SWELL_PRIM_HT(
SS_MON_METEO_VIS("Monitor.Meteo.visibility"), "Monitor.Swell.Primary.height"), SS_MON_SWELL_PRIM_PD(
SS_MON_SWELL_PRIM_HT("Monitor.Swell.Primary.height"), "Monitor.Swell.Primary.period"), SS_MON_SWELL_PRIM_DIR_FROM(
SS_MON_SWELL_PRIM_PD("Monitor.Swell.Primary.period"), "Monitor.Swell.Primary.dirFrom"), SS_MON_SWELL_PRIM_DIR_TO(
SS_MON_SWELL_PRIM_DIR_FROM("Monitor.Swell.Primary.dirFrom"), "Monitor.Swell.Primary.dirTo"), SS_MON_SWELL_SEC_HT(
SS_MON_SWELL_PRIM_DIR_TO("Monitor.Swell.Primary.dirTo"), "Monitor.Swell.Secondary.height"), SS_MON_SWELL_SEC_PD(
SS_MON_SWELL_SEC_HT("Monitor.Swell.Secondary.height"), "Monitor.Swell.Secondary.period"), SS_MON_SWELL_SEC_DIR_FROM(
SS_MON_SWELL_SEC_PD("Monitor.Swell.Secondary.period"), "Monitor.Swell.Secondary.dirFrom"), SS_MON_SWELL_SEC_DIR_TO(
SS_MON_SWELL_SEC_DIR_FROM("Monitor.Swell.Secondary.dirFrom"), "Monitor.Swell.Secondary.dirTo");
SS_MON_SWELL_SEC_DIR_TO("Monitor.Swell.Secondary.dirTo");
String XMLKey; String XMLKey;
@ -121,34 +124,33 @@ public class MonitorConfigConstants
} }
/* /*
* SNOW * SNOW
*/ */
public static enum SnowDisplay public static enum SnowDisplay {
{ SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), SNOW_DISP_PROD_BLIZZ_WIND_SPEED(
SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), "Display.Product.Blizzard.wind_speed"), SNOW_DISP_PROD_BLIZZ_GUST_SPEED(
SNOW_DISP_PROD_BLIZZ_WIND_SPEED("Display.Product.Blizzard.wind_speed"), "Display.Product.Blizzard.gust_speed"), SNOW_DISP_PROD_BLIZZ_PEAK_WIND(
SNOW_DISP_PROD_BLIZZ_GUST_SPEED("Display.Product.Blizzard.gust_speed"), "Display.Product.Blizzard.peak_wind_speed"), SNOW_DISP_PROD_FRZ_TEMP(
SNOW_DISP_PROD_BLIZZ_PEAK_WIND("Display.Product.Blizzard.peak_wind_speed"), "Display.Product.Freezing_Precip.temperature"), SNOW_DISP_PROD_FRZ_HOURLY_PRECIP(
SNOW_DISP_PROD_FRZ_TEMP("Display.Product.Freezing_Precip.temperature"), "Display.Product.Freezing_Precip.hourly_precip"), SNOW_DISP_PROD_HSW_SNINCR_HOURLY(
SNOW_DISP_PROD_FRZ_HOURLY_PRECIP("Display.Product.Freezing_Precip.hourly_precip"), "Display.Product.Heavy_Snow_Warning.snincr_hourly"), SNOW_DISP_PROD_HSW_SNINCR_TOTAL(
SNOW_DISP_PROD_HSW_SNINCR_HOURLY("Display.Product.Heavy_Snow_Warning.snincr_hourly"), "Display.Product.Heavy_Snow_Warning.snincr_total"), SNOW_DISP_PROD_HSW_SNOW_DEPTH(
SNOW_DISP_PROD_HSW_SNINCR_TOTAL("Display.Product.Heavy_Snow_Warning.snincr_total"), "Display.Product.Heavy_Snow_Warning.snow_depth"), SNOW_DISP_WIND_WIND_SPEED(
SNOW_DISP_PROD_HSW_SNOW_DEPTH("Display.Product.Heavy_Snow_Warning.snow_depth"), "Display.Product.Wind.wind_speed"), SNOW_DISP_WIND_PEAK_WIND(
SNOW_DISP_WIND_WIND_SPEED("Display.Product.Wind.wind_speed"), "Display.Product.Wind.peak_wind_speed"), SNOW_DISP_WIND_GUST_SPEED(
SNOW_DISP_WIND_PEAK_WIND("Display.Product.Wind.peak_wind_speed"), "Display.Product.Wind.gust_speed"), SNOW_DISP_WIND_DIR_FROM(
SNOW_DISP_WIND_GUST_SPEED("Display.Product.Wind.gust_speed"), "Display.Product.Wind.dirFrom"), SNOW_DISP_WIND_DIR_TO(
SNOW_DISP_WIND_DIR_FROM("Display.Product.Wind.dirFrom"), "Display.Product.Wind.dirTo"), SNOW_DISP_METEO_TEMP(
SNOW_DISP_WIND_DIR_TO("Display.Product.Wind.dirTo"), "Display.Meteo.temperature"), SNOW_DISP_METEO_DEWPT(
SNOW_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), SNOW_DISP_METEO_VIS(
SNOW_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.visibility"), SNOW_DISP_METEO_SLP(
SNOW_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.slp"), SNOW_DISP_METEO_HOURLY_PRECIP(
SNOW_DISP_METEO_SLP("Display.Meteo.slp"), "Display.Meteo.hourly_precip"), SNOW_DISP_METEO_WIND_CHILL(
SNOW_DISP_METEO_HOURLY_PRECIP("Display.Meteo.hourly_precip"), "Display.Meteo.wind_chill"), SNOW_DISP_METEO_FROSTBITE(
SNOW_DISP_METEO_WIND_CHILL("Display.Meteo.wind_chill"), "Display.Meteo.frostbite_time"), SNOW_DISP_METEO_SNOW_DEPTH(
SNOW_DISP_METEO_FROSTBITE("Display.Meteo.frostbite_time"), "Display.Meteo.snow_depth"), SNOW_DISP_METEO_SNINCR_HOURLY(
SNOW_DISP_METEO_SNOW_DEPTH("Display.Meteo.snow_depth"), "Display.Meteo.snincr_hourly"), SNOW_DISP_METEO_SNINCR_TOTAL(
SNOW_DISP_METEO_SNINCR_HOURLY("Display.Meteo.snincr_hourly"), "Display.Meteo.snincr_total");
SNOW_DISP_METEO_SNINCR_TOTAL("Display.Meteo.snincr_total");
String XMLKey; String XMLKey;
@ -160,16 +162,15 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum SnowMonitor public static enum SnowMonitor {
{ SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SNOW_MON_METEO_PEAK_WIND(
SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), "Monitor.Meteo.peak_wind_speed"), SNOW_MON_METEO_GUST_SPEED(
SNOW_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), "Monitor.Meteo.gust_speed"), SNOW_MON_METEO_TEMP(
SNOW_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), "Monitor.Meteo.temperature"), SNOW_MON_METEO_WIND_CHILL(
SNOW_MON_METEO_TEMP("Monitor.Meteo.temperature"), "Monitor.Meteo.wind_chill"), SNOW_MON_METEO_VIS(
SNOW_MON_METEO_WIND_CHILL("Monitor.Meteo.wind_chill"), "Monitor.Meteo.visibility"), SNOW_MON_METEO_SNOW_DEPTH(
SNOW_MON_METEO_VIS("Monitor.Meteo.visibility"), "Monitor.Meteo.snow_depth");
SNOW_MON_METEO_SNOW_DEPTH("Monitor.Meteo.snow_depth");
String XMLKey; String XMLKey;
@ -183,19 +184,18 @@ public class MonitorConfigConstants
} }
// FOG // FOG
public static enum FogDisplay public static enum FogDisplay {
{ FOG_DISP_METEO_VIS("Display.Meteo.visibility"), FOG_DISP_METEO_CEILING(
FOG_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.ceiling"), FOG_DISP_METEO_TEMP(
FOG_DISP_METEO_CEILING("Display.Meteo.ceiling"), "Display.Meteo.temperature"), FOG_DISP_METEO_DEWPT(
FOG_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), FOG_DISP_METEO_T_TD(
FOG_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.t_td"), FOG_DISP_METEO_REL_HUMIDITY(
FOG_DISP_METEO_T_TD("Display.Meteo.t_td"), "Display.Meteo.relative_humidity"), FOG_DISP_WIND_WIND_SPEED(
FOG_DISP_METEO_REL_HUMIDITY("Display.Meteo.relative_humidity"), "Display.Wind.wind_speed"), FOG_DISP_WIND_PEAK_WIND(
FOG_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), "Display.Wind.peak_wind_speed"), FOG_DISP_WIND_GUST_SPEED(
FOG_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), "Display.Wind.gust_speed"), FOG_DISP_WIND_DIR_FROM(
FOG_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), "Display.Wind.dirFrom"), FOG_DISP_WIND_DIR_TO(
FOG_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), "Display.Wind.dirTo");
FOG_DISP_WIND_DIR_TO("Display.Wind.dirTo");
String XMLKey; String XMLKey;
@ -207,11 +207,10 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum FogMonitor public static enum FogMonitor {
{
FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity"); FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity");
String XMLKey; String XMLKey;
FogMonitor(String s) { FogMonitor(String s) {
@ -222,340 +221,248 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static Boolean rValueIsHigher(String key, String appName) public static Boolean rValueIsHigher(String key, AppName appName) {
{ if (appName.equals(AppName.SAFESEAS)) {
if ( appName.equals("safeseas") ) { if (ryHigherMapSS == null) {
if ( ryHigherMapSS == null ) { createRYHigherMapSS();
createRYHigherMapSS(); }
}
if (ryHigherMapSS.containsKey(key) == true) {
if ( ryHigherMapSS.containsKey(key) == true ) { return ryHigherMapSS.get(key);
return ryHigherMapSS.get(key); }
} } else if (appName.equals(AppName.SNOW)) {
} else if ( appName.equals("snow") ) { if (ryHigherMapSnow == null) {
if ( ryHigherMapSnow == null ) { createRYHigherMapSnow();
createRYHigherMapSnow(); }
}
if (ryHigherMapSnow.containsKey(key) == true) {
if ( ryHigherMapSnow.containsKey(key) == true ) { return ryHigherMapSnow.get(key);
return ryHigherMapSnow.get(key); }
} } else if (appName.equals(AppName.FOG)) {
} else if ( appName.equals("fog") ) { if (ryHigherMapFog == null) {
if ( ryHigherMapFog == null ) { createRYHigherMapFog();
createRYHigherMapFog(); }
}
if (ryHigherMapFog.containsKey(key) == true) {
if ( ryHigherMapFog.containsKey(key) == true ) { return ryHigherMapFog.get(key);
return ryHigherMapFog.get(key); }
} } else {
} else { // do nothing here
// do nothing here }
}
return false; return false;
} }
private static void createRYHigherMapSS() private static void createRYHigherMapSS() {
{
ryHigherMapSS = new HashMap<String, Boolean>(); ryHigherMapSS = new HashMap<String, Boolean>();
/* /*
* SafeSeas Display * SafeSeas Display
*/ */
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_GUST_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_PEAK_WIND.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapSS
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED.getXmlKey(), true); .put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey(), null); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey(), null); ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_PROD_STORM_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_STORM_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey(),
null);
ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey(), true); ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey(), false); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey(), null); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh); rankSwellPeriodHigh);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey(), null); SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(),
rankSwellPeriodHigh);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey(),
null);
/* /*
* SafeSeas Monitor // TODO * SafeSeas Monitor
*/ */
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(), false); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(), false); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(), null); false);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(), false); SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(), null); null);
ryHigherMapSS
.put(SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(),
false);
ryHigherMapSS.put(
SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(),
null);
} }
private static void createRYHigherMapSnow() private static void createRYHigherMapSnow() {
{ ryHigherMapSnow = new HashMap<String, Boolean>();
ryHigherMapSnow = new HashMap<String, Boolean>();
/* /*
* Snow Display * Snow Display
*/ */
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey(), true); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey(), null); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey(), null); SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), false); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey(), false); SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey(),
null);
ryHigherMapSnow
.put(SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey(), null);
ryHigherMapSnow
.put(SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey(),
false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(), false); SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey(), true); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey(),
true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey(), true);
/* /*
* Snow Monitor * Snow Monitor
*/ */
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_SPEED.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_SPEED.getXmlKey(),
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_PEAK_WIND.getXmlKey(), true); true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_GUST_SPEED.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_TEMP.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_TEMP.getXmlKey(), false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_CHILL.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_CHILL.getXmlKey(),
false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_VIS.getXmlKey(), false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(),
true);
} }
private static void createRYHigherMapFog() private static void createRYHigherMapFog() {
{ ryHigherMapFog = new HashMap<String, Boolean>();
ryHigherMapFog = new HashMap<String, Boolean>();
/* /*
* Fog Display * Fog Display
*/ */
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey(), false); ryHigherMapFog
.put(FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey(), false); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey(),
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(),
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_GUST_SPEED.getXmlKey(), true); true);
ryHigherMapFog
.put(FogDisplay.FOG_DISP_WIND_PEAK_WIND.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey(), null); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey(), null);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey(), null); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey(), null);
/* /*
* Fog Monitor * Fog Monitor
*/ */
ryHigherMapFog.put(FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey(), false); ryHigherMapFog.put(FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey(), false);
} }
// FOG Parameters
// public static final String FOG_IR_MIN = "fog.ir.min";
// public static final String FOG_IR_DELTA_YELLOW_LOW = "fog.ir.delta.yellow.low";
// public static final String FOG_IR_DELTA_YELLOW_HIGH = "fog.ir.delta.yellow.high";
// public static final String FOG_IR_DELTA_RED_LOW = "fog.ir.delta.red.low";
// public static final String FOG_IR_DELTA_RED_HIGH = "fog.ir.delta.red.high";
// public static final String FOG_IR_MAX = "fog.ir.max";
// public static final String FOG_IR_ICE_SNOW = "fog.ir.ice_snow_threshold";
// public static final String FOG_IR_CLOUD = "fog.ir.cloud_threshold";
// public static final String FOG_IR_CLOUD_FREE = "fog.ir.cloud_free_threshold";
// public static final String FOG_VIS_MIN = "fog.vis.min";
// public static final String FOG_VIS_YELLOW_LOW = "fog.vis.yellow.low";
// public static final String FOG_VIS_YELLOW_HIGH = "fog.vis.yellow.high";
// public static final String FOG_VIS_RED_LOW = "fog.vis.red.low";
// public static final String FOG_VIS_RED_HIGH = "fog.vis.red.high";
// public static final String FOG_VIS_MAX = "fog.vis.max";
// public static final String FOG_VIS_SMOOTHNESS = "fog.vis.smoothness_threshold";
// public static final String FOG_VIS_TWILIGHT_ANG = "fog.vis.twilight_threshold";
// public static final String FOG_VIS_FRACTAL_DIM = "fog.vis.fractal_dim_threshold";
// public static final String FOG_SCALE_STATE = "fog.scale_state";
// public static final String FOG_ICE_SNOW = "fog.ice_snow";
// public static final String FOG_CLOUD = "fog.cloud";
// public static final String FOG_CLOUD_FREE = "fog.cloud_free";
// public static final String FOG_SMOOTHNESS = "fog.smoothness";
// public static final String FOG_ADJACENCY = "fog.adjacency";
// public static final String FOG_ADJACENCY_THRESH = "fog.adjacency_threshold";
// public static final String FOG_TWILIGHT_ANG = "fog.twilight_ang";
// public static final String FOG_FRACTAL_DIM = "fog.fractal_dim";
//
// public static enum FogParameters {
// FOG_IR_MIN(MonitorConfigConstants.FOG_IR_MIN),
// FOG_IR_DELTA_YELLOW_LOW(MonitorConfigConstants.FOG_IR_DELTA_YELLOW_LOW),
// FOG_IR_DELTA_YELLOW_HIGH(MonitorConfigConstants.FOG_IR_DELTA_YELLOW_HIGH),
// FOG_IR_DELTA_RED_LOW(MonitorConfigConstants.FOG_IR_DELTA_RED_LOW),
// FOG_IR_DELTA_RED_HIGH(MonitorConfigConstants.FOG_IR_DELTA_RED_HIGH),
// FOG_IR_MAX(MonitorConfigConstants.FOG_IR_MAX),
// FOG_IR_ICE_SNOW(MonitorConfigConstants.FOG_IR_ICE_SNOW),
// FOG_IR_CLOUD(MonitorConfigConstants.FOG_IR_CLOUD),
// FOG_IR_CLOUD_FREE(MonitorConfigConstants.FOG_IR_CLOUD_FREE),
// FOG_VIS_MIN(MonitorConfigConstants.FOG_VIS_MIN),
// FOG_VIS_YELLOW_LOW(MonitorConfigConstants.FOG_VIS_YELLOW_LOW),
// FOG_VIS_YELLOW_HIGH(MonitorConfigConstants.FOG_VIS_YELLOW_HIGH),
// FOG_VIS_RED_LOW(MonitorConfigConstants.FOG_VIS_RED_LOW),
// FOG_VIS_RED_HIGH(MonitorConfigConstants.FOG_VIS_RED_HIGH),
// FOG_VIS_MAX(MonitorConfigConstants.FOG_VIS_MAX),
// FOG_VIS_SMOOTHNESS(MonitorConfigConstants.FOG_VIS_SMOOTHNESS),
// FOG_VIS_TWILIGHT_ANG(MonitorConfigConstants.FOG_VIS_TWILIGHT_ANG),
// FOG_VIS_FRACTAL_DIM(MonitorConfigConstants.FOG_VIS_FRACTAL_DIM),
// FOG_SCALE_STATE(MonitorConfigConstants.FOG_SCALE_STATE),
// FOG_ICE_SNOW(MonitorConfigConstants.FOG_ICE_SNOW),
// FOG_CLOUD(MonitorConfigConstants.FOG_CLOUD),
// FOG_CLOUD_FREE(MonitorConfigConstants.FOG_CLOUD_FREE),
// FOG_SMOOTHNESS(MonitorConfigConstants.FOG_SMOOTHNESS),
// FOG_ADJACENCY(MonitorConfigConstants.FOG_ADJACENCY),
// FOG_ADJACENCY_THRESH(MonitorConfigConstants.FOG_ADJACENCY_THRESH),
// FOG_TWILIGHT_ANG(MonitorConfigConstants.FOG_TWILIGHT_ANG),
// FOG_FRACTAL_DIM(MonitorConfigConstants.FOG_FRACTAL_DIM);
//
// String XMLKey;
//
// FogParameters(String s) {
// XMLKey = s;
// }
//
// @Override
// public String toString() {
// return XMLKey;
// }
// }
// SCAN
// public static final String SCAN_PLUGIN_NAME = "pluginName";
// public static final String SCAN_STATION_NAME = "stationName";
// public static final String SCAN_CELL_TABLE_ATTRIB = "cellTableAttributes";
// public static final String SCAN_MESO_TABLE_ATTRIB = "mesoTableAttributes";
// public static final String SCAN_TVS_TABLE_ATTRIB = "tvsTableAttributes";
//
// public static final String[] CELL_TABLE = { "cellTable", "time", "radar",
// "ident", "azm", "rng", "rank", "tvs", "mdaSR", "posh", "poh", "hsize",
// "vil", "dbz", "dbzHt", "top", "dir", "spd", "azm15", "rng15", "azm30",
// "rng30", "azm45", "rng45", "azm60", "rng60", "mvtErr", "mvtMn", "lat",
// "lon", "polh", "svrwx", "hvyPr", "pPos", "cgRate", "vcp", "cape",
// "sreh", "county" };
//
// public static final String[] MESO_TABLE = { "mesoTable", "time", "radar",
// "strmID","ident", "azm", "rng", "mdaSR", "class", "llVr", "llgtg",
// "base", "depth", "relDep", "maxVr", "htMxVr", "tvs", "dir", "spd",
// "msi","lat", "lon", "county" };
//
// public static final String[] TVS_TABLE = { "tvsTable", "time", "radar",
// "strmID", "ident", "type", "azm", "rng", "avgDv", "llDv", "maxDv",
// "mxDvHt", "base", "depth", "top", "shear", "shrHt", "lat", "lon", "county" };
//
public static final String[] TABLE_FIELDS = { "low", "mid", "upp", "rank", public static final String[] TABLE_FIELDS = { "low", "mid", "upp", "rank",
"trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range", "alarm", "trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range",
"aAlarm", "units" }; "alarm", "aAlarm", "units" };
public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate", public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate",
"qpe", "guidance", "ratio", "diff" }; "qpe", "guidance", "ratio", "diff" };
//
// public static enum ScanTables {
// CELL, MESO, TVS;
// }
//
// public static enum cellTable {
// TIME(1), RADAR(2), IDENT(3), AZM(4), RNG(5), RANK(6), TVS(7), MDASR(8),
// POSH(9), POH(10), HSIZE(11), VIL(12), DBZ(13), DBZHT(14), TOP(15), DIR(16),
// SPD(17), AZM15(18), RNG15(19), AZM30(20), RNG30(21), AZM45(22), RNG45(23),
// AZM60(24), RNG60(25), MVTERR(26), MVTMN(27), LAT(28), LON(29), POLH(30),
// SVRWX(31), HVYPR(32), PPOS(33), CGRATE(34), VCP(35), CAPE(36), SREH(37),
// COUNTY(38);
//
// int index;
//
// cellTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return CELL_TABLE[index];
// }
//
// public String toString(tableFields field) {
// return CELL_TABLE[0] + "." + CELL_TABLE[index] + "." + field.toString();
// }
// }
//
// public static enum mesoTable {
// TIME(1), RADAR(2), STRMID(3), IDENT(4), AZM(5), RNG(6), MDASR(7), CLASS(8),
// LLVR(9), LLGTG(10), BASE(11), DEPTH(12), RELDEP(13), MAXVR(14), HTMXVR(15),
// TVS(16), DIR(18), SPD(19), MSI(20), LAT(21), LON(22), COUNTY(23);
//
// int index;
//
// mesoTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return MESO_TABLE[index];
// }
//
// public String toString(tableFields t) {
// return MESO_TABLE[0] + "." + MESO_TABLE[index] + "." + t.toString();
// }
// }
//
// public static enum tvsTable {
// TIME(1), RADAR(2), STRMID(3), IDENT(4), TYPE(5), AM(6), RNG(7), AVGDV(8),
// LLDV(9), MAXDV(10), MXDVHT(11), BASE(12), DEPTH(13), TOP(14), SHEAR(15),
// SHRHT(16), LAT(17), LON(18), COUNTY(19);
//
// int index;
//
// tvsTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return TVS_TABLE[index];
// }
//
// public String toString(tableFields t) {
// return TVS_TABLE[0] + "." + TVS_TABLE[index] + "." + t.toString();
// }
// }
//
public static enum tableFields { public static enum tableFields {
LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), MIN(
MIN(8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13); 8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13);
int index; int index;
@ -568,8 +475,7 @@ public class MonitorConfigConstants
return TABLE_FIELDS[index]; return TABLE_FIELDS[index];
} }
} }
public static enum ffmpTable { public static enum ffmpTable {
NAME(1), RATE(2), QPE(3), QPF(4), GUIDANCE(5), RATIO(6), DIFF(7); NAME(1), RATE(2), QPE(3), QPF(4), GUIDANCE(5), RATIO(6), DIFF(7);
@ -585,12 +491,11 @@ public class MonitorConfigConstants
} }
public String toString(tableFields field) { public String toString(tableFields field) {
return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "." + field.toString(); return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "."
+ field.toString();
} }
} }
// Other Constants // Other Constants
public static final String AREA_IDS_KEY = "AreaIDs."; public static final String AREA_IDS_KEY = "AreaIDs.";
@ -603,30 +508,33 @@ public class MonitorConfigConstants
public static final String STATIONS_KEY = "Stations"; public static final String STATIONS_KEY = "Stations";
public static final String COLUMN_LIST_KEY = "ColumnList"; public static final String COLUMN_LIST_KEY = "ColumnList";
public static final String SCAN_RADAR_ICAO = "radarIcao"; public static final String SCAN_RADAR_ICAO = "radarIcao";
public static final String SCAN_WMO_NUMBER = "wmoNumber"; public static final String SCAN_WMO_NUMBER = "wmoNumber";
public static final String SCAN_START_INTERVAL = "startInterval"; public static final String SCAN_START_INTERVAL = "startInterval";
public static final String SCAN_CELL_TILT = "cellTilt"; public static final String SCAN_CELL_TILT = "cellTilt";
public static final String SCAN_DMD_TILT = "dmdTilt"; public static final String SCAN_DMD_TILT = "dmdTilt";
private MonitorConfigConstants() { private MonitorConfigConstants() {
// no instantiation // no instantiation
} }
public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) { public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) {
MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh; MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh;
if ( ryHigherMapSS != null ) { if (ryHigherMapSS != null) {
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh); SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
} rankSwellPeriodHigh);
} ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(),
rankSwellPeriodHigh);
}
}
public static boolean isRankSwellPeriodHigh() { public static boolean isRankSwellPeriodHigh() {
return rankSwellPeriodHigh; return rankSwellPeriodHigh;
} }
} }

View file

@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.requests;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import com.raytheon.rcm.config.RcmResourceProvider;
import com.raytheon.uf.viz.radarapps.core.LocalizationRcmResourceProvider;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
*/ */
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() { public Activator() {
} }
/* @Override
* (non-Javadoc) public void start(BundleContext context) throws Exception {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) super.start(context);
*/ plugin = this;
public void start(BundleContext context) throws Exception { RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
super.start(context); }
plugin = this;
}
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.rps;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import com.raytheon.rcm.config.RcmResourceProvider;
import com.raytheon.uf.viz.radarapps.core.LocalizationRcmResourceProvider;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
*/ */
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() { public Activator() {
} }
/* @Override
* (non-Javadoc) public void start(BundleContext context) throws Exception {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) super.start(context);
*/ plugin = this;
public void start(BundleContext context) throws Exception { RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
super.start(context); }
plugin = this;
}
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -30,6 +30,13 @@
# #
# Author: lefebvre/mathewson # Author: lefebvre/mathewson
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/30/15 18141 ryu Allow processing for TCV issued by CPHC
########################################################################
# The MenuItems list defines the GFE menu item(s) under which the # The MenuItems list defines the GFE menu item(s) under which the
# Procedure is to appear. # Procedure is to appear.
@ -40,6 +47,7 @@ from numpy import *
import SmartScript import SmartScript
import AbsTime import AbsTime
import HazardUtils import HazardUtils
import VTECPartners
import LogStream, logging import LogStream, logging
import UFStatusHandler import UFStatusHandler
@ -89,7 +97,7 @@ class Procedure (SmartScript.SmartScript):
continue continue
# only look at the KNHC records # only look at the KNHC records
if v['officeid'] != 'KNHC': if v['officeid'] not in VTECPartners.VTEC_TPC_SITE:
continue continue
key = (v['phen'], v['sig'], v['etn']) key = (v['phen'], v['sig'], v['etn'])

View file

@ -35,10 +35,12 @@ import javax.measure.converter.UnitConverter;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.eclipse.core.commands.Command; import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.State; import org.eclipse.core.commands.State;
import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
@ -46,6 +48,7 @@ import org.eclipse.ui.commands.ICommandService;
import org.eclipse.ui.handlers.HandlerUtil; import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.handlers.RadioState; import org.eclipse.ui.handlers.RadioState;
import org.eclipse.ui.handlers.RegistryToggleState; import org.eclipse.ui.handlers.RegistryToggleState;
import org.eclipse.ui.operations.RedoActionHandler;
import com.raytheon.uf.common.colormap.ColorMap; import com.raytheon.uf.common.colormap.ColorMap;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
@ -81,6 +84,7 @@ import com.raytheon.viz.mpe.MPECommandConstants;
import com.raytheon.viz.mpe.MPEDateFormatter; import com.raytheon.viz.mpe.MPEDateFormatter;
import com.raytheon.viz.mpe.core.MPEDataManager; import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.core.MPEDataManager.MPERadarLoc; import com.raytheon.viz.mpe.core.MPEDataManager.MPERadarLoc;
import com.raytheon.viz.mpe.ui.actions.ClearMPEData;
import com.raytheon.viz.mpe.ui.dialogs.hourlyradar.RadarDataManager; import com.raytheon.viz.mpe.ui.dialogs.hourlyradar.RadarDataManager;
import com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay; import com.raytheon.viz.mpe.ui.displays.MPEMapRenderableDisplay;
import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource; import com.raytheon.viz.mpe.ui.rsc.MPEFieldResource;
@ -111,6 +115,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Jun 30, 2014 17457 snaples Added default case to switch in getXmrgfile. * Jun 30, 2014 17457 snaples Added default case to switch in getXmrgfile.
* Jul 8, 2015 16790 snaples Updated setCurrentEditDate to refresh resources when dateMap is stale. * Jul 8, 2015 16790 snaples Updated setCurrentEditDate to refresh resources when dateMap is stale.
* Jul 29, 2015 17471 snaples Updated editTime to ensure that it always references "GMT" timezone. * Jul 29, 2015 17471 snaples Updated editTime to ensure that it always references "GMT" timezone.
* Sep 29, 2015 16790 snaples Fixed issue with date not following the CAVE time when changed, and fixed time matching issue.
* *
* </pre> * </pre>
* *
@ -663,24 +668,10 @@ public class MPEDisplayManager {
* @return * @return
*/ */
public boolean setCurrentEditDate(Date newDate, boolean force) { public boolean setCurrentEditDate(Date newDate, boolean force) {
MPEDataManager dm = MPEDataManager.getInstance();
// check for date in valid range
if ((newDate.before(dm.getEarliestDate())
|| newDate.after(dm.getLatestDate())) || force ) {
IEditorPart editor = EditorUtil.getActiveEditor();
if (editor instanceof IDisplayPaneContainer) {
IDisplayPaneContainer container = (IDisplayPaneContainer) editor;
for (IDisplayPane pane : container.getDisplayPanes()) {
pane.clear();
}
}
}
if (editTime.equals(newDate) == false) { if (editTime.equals(newDate) == false) {
// new time, check for save // new time, check for save
if (force == false && !isDataSaved()) { if (!isDataSaved()) {
if (!okToProceed("Data Not Saved")) { if (!okToProceed("Data Not Saved")) {
return false; return false;
} }
@ -692,6 +683,12 @@ public class MPEDisplayManager {
if (display.getContainer() != null) { if (display.getContainer() != null) {
stopLooping(display.getContainer()); stopLooping(display.getContainer());
} }
try {
display.getDescriptor().redoTimeMatching();
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
"Error in redoTimeMatching for MPEDisplayManager", e);
}
setCurrentDisplayedDate(newDate); setCurrentDisplayedDate(newDate);
if (displayedFieldResource == null) { if (displayedFieldResource == null) {

View file

@ -26,6 +26,8 @@ import java.util.Date;
import java.util.Map; import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
@ -51,6 +53,7 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEDateInfo;
import com.raytheon.viz.mpe.ui.MPEDisplayManager; import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.TransmitBestEstimateQPEProvider; import com.raytheon.viz.mpe.ui.TransmitBestEstimateQPEProvider;
import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider; import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider;
import com.raytheon.viz.mpe.ui.actions.ClearMPEData;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.editor.IMultiPaneEditor;
@ -71,6 +74,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* if hour is greater than 18Z. * if hour is greater than 18Z.
* Jan 05, 2015 14246 lbousaidi enable Transmit Best Estimate QPE. * Jan 05, 2015 14246 lbousaidi enable Transmit Best Estimate QPE.
* Jul 8, 2015 16790 snaples Updated call to setCurrentEditDate to pass force variable. * Jul 8, 2015 16790 snaples Updated call to setCurrentEditDate to pass force variable.
* Sep 29, 2015 17975 snaples Fixed issue with Hydro date not following the CAVE time when changed.
* *
* </pre> * </pre>
* *
@ -161,26 +165,18 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
displayMgr = MPEDisplayManager.getInstance(pane); displayMgr = MPEDisplayManager.getInstance(pane);
dataMgr = MPEDataManager.getInstance(); dataMgr = MPEDataManager.getInstance();
dateMap = dataMgr.getDateMap(true); dateMap = dataMgr.getDateMap(false);
qcEnable = MPEDisplayManager.isMpeQcOptionEnabled(); qcEnable = MPEDisplayManager.isMpeQcOptionEnabled();
cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
hydroCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); hydroCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
prevDate = displayMgr.getCurrentEditDate(); prevDate = displayMgr.getCurrentEditDate();
cal.setTime(prevDate); cal.setTime(prevDate);
if( prevHydDate == null ){
prevHydDate = displayMgr.getCurrentEditDate();
hydroCal.setTime(prevHydDate); hydroCal.setTime(displayMgr.getCurrentEditDate());
if ( cal.get(Calendar.HOUR_OF_DAY) >= 18 ){ if ( hydroCal.get(Calendar.HOUR_OF_DAY) >= 18 ){
hydroCal.add(Calendar.DATE, 1); hydroCal.add(Calendar.DATE, 1);
}
}else{
hydroCal.setTime(prevHydDate);
} }
} }
/* /*
@ -551,20 +547,13 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
} }
Calendar aCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); Calendar aCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
aCal.setTime(dataMgr.getLatestDate()); aCal.setTime(displayMgr.getCurrentEditDate());
if ( cal.get(Calendar.HOUR_OF_DAY) >= 18 ){ if ( aCal.get(Calendar.HOUR_OF_DAY) >= 18 ){
aCal.add(Calendar.DATE, 1); aCal.add(Calendar.DATE, 1);
} }
if (hydroCal.getTime().before(dataMgr.getEarliestDate())
|| hydroCal.getTime().after(aCal.getTime())) {
hydroCal.setTime(prevHydDate);
}
prevDate = cal.getTime(); prevDate = cal.getTime();
prevHydDate = hydroCal.getTime();
yearText.setText(Integer.toString(cal.get(Calendar.YEAR))); yearText.setText(Integer.toString(cal.get(Calendar.YEAR)));
monthText.setText(Integer.toString(cal.get(Calendar.MONTH) + 1)); monthText.setText(Integer.toString(cal.get(Calendar.MONTH) + 1));
daySpinner.setSelection(cal.get(Calendar.DAY_OF_MONTH)); daySpinner.setSelection(cal.get(Calendar.DAY_OF_MONTH));

View file

@ -81,6 +81,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 15 2013 DCS 167 cgobs DualPol capabilities * Dec 15 2013 DCS 167 cgobs DualPol capabilities
* Jul 29, 2015 17471 snaples Added logging for Radar Bias results table query. * Jul 29, 2015 17471 snaples Added logging for Radar Bias results table query.
* Aug 11, 2015 4500 rjpeter Fix type casts. * Aug 11, 2015 4500 rjpeter Fix type casts.
* Sep 29, 2015 17975 snaples Fixed an issue with getDateMap query sometimes throwing errors.
*
* </pre> * </pre>
* *
* @author randerso * @author randerso
@ -728,18 +730,20 @@ public class MPEDataManager {
private void getDates(boolean update) { private void getDates(boolean update) {
String starttime = ""; String starttime = "";
String endtime = "";
if (update && latestAvailableDate != null) { if (update && latestAvailableDate != null) {
starttime = sdf.format(latestAvailableDate); starttime = sdf.format(latestAvailableDate);
} else { } else {
dateMap = new HashMap<Date, MPEDateInfo>(); dateMap = new HashMap<Date, MPEDateInfo>();
starttime = sdf.format(getEarliestDate()); starttime = sdf.format(getEarliestDate());
} }
endtime = sdf.format(getLatestDate());
String sqlQuery = "select obstime,last_save_time,last_exec_time,auto_save from rwresult where rfc='" String sqlQuery = "select obstime,last_save_time,last_exec_time,auto_save from rwresult where rfc='"
+ RFC + RFC
+ "' and obstime between '" + "' and obstime between '"
+ starttime + starttime
+ "' and '" + "' and '"
+ sdf.format(getLatestDate()) + "'"; + endtime + "'";
try { try {
List<Object[]> results = DirectDbQuery.executeQuery(sqlQuery, List<Object[]> results = DirectDbQuery.executeQuery(sqlQuery,

View file

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<svg width="80" height="80" <svg width="100" height="100"
viewBox="0 0 80 80" viewBox="0 0 100 100"
overflow="visible" overflow="visible"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);"> xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View file

@ -94,6 +94,7 @@ import com.vividsolutions.jts.precision.SimpleGeometryPrecisionReducer;
* 04/29/2015 DR 17310 D. Friedman Use Geometry.buffer() to fix self-intersections. Fix bug in alterVertexes. * 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/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. * 05/08/2015 DR 17310 D. Friedman Prevent reducePoints from generating invalid polygons.
* 09/22/2015 DR 18033 Qinglu Lin Updated removeOverlaidLinesegments(), removed one computeSlope().
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -1554,7 +1555,7 @@ public class PolygonUtil {
slope1 = slope; slope1 = slope;
count += 1; count += 1;
} else { } else {
if (Math.abs(Math.abs(slope) - Math.abs(slope1)) <= min) { if (Math.abs(slope - slope1) <= min) {
count += 1; count += 1;
} else { } else {
count = 0; count = 0;
@ -1879,16 +1880,6 @@ public class PolygonUtil {
} }
} }
static public double computeSlope(Coordinate[] coords, int i, int j) {
double min = 1.0E-08;
double dx = coords[i].x - coords[j].x;
double slope = 0.0;
if (Math.abs(dx) > min) {
slope = (coords[i].y - coords[j].y) / dx;
}
return slope;
}
/** /**
* Create a polygon whose two diagonal coordinates are a and b. * Create a polygon whose two diagonal coordinates are a and b.
**/ **/

View file

@ -19,6 +19,11 @@
**/ **/
package com.raytheon.viz.warngen.gui; package com.raytheon.viz.warngen.gui;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
@ -27,6 +32,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction; import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.input.EditableManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/** /**
* Simple action for loading the warngen layer * Simple action for loading the warngen layer
@ -40,6 +46,7 @@ import com.raytheon.viz.ui.input.EditableManager;
* Oct 10, 2010 6990 Qinglu Lin Used D. Friedman short solution, * Oct 10, 2010 6990 Qinglu Lin Used D. Friedman short solution,
* with minor changes. * with minor changes.
* Aug 15, 2013 DR 16418 D. Friedman Always show the dialog. * Aug 15, 2013 DR 16418 D. Friedman Always show the dialog.
* Sep 22, 2015 4859 dgilling Prevent dialog from showing in DRT mode.
* *
* </pre> * </pre>
* *
@ -78,4 +85,17 @@ public class WarngenAction extends AbstractGenericToolAction<WarngenLayer> {
layer.showDialog(true); layer.showDialog(true);
return layer; return layer;
} }
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
SimulatedTimeOperations
.displayFeatureLevelWarning(shell, "WarnGen");
return null;
}
return super.execute(arg0);
}
} }

View file

@ -72,6 +72,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.PerformanceStatus;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.ISimulatedTimeChangeListener;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
@ -88,6 +89,7 @@ import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.input.EditableManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.warngen.Activator; import com.raytheon.viz.warngen.Activator;
import com.raytheon.viz.warngen.WarngenConstants; import com.raytheon.viz.warngen.WarngenConstants;
import com.raytheon.viz.warngen.comm.WarningSender; import com.raytheon.viz.warngen.comm.WarningSender;
@ -167,13 +169,14 @@ import com.vividsolutions.jts.geom.Polygon;
* chance for that to occur is trivial. * chance for that to occur is trivial.
* May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging. * May 7, 2015 ASM #17438 D. Friedman Clean up debug and performance logging.
* Jun 05, 2015 DR 17428 D. Friedman Fixed duration-related user interface issues. Added duration logging. * Jun 05, 2015 DR 17428 D. Friedman Fixed duration-related user interface issues. Added duration logging.
* Sep 22, 2015 4859 dgilling Prevent product generation in DRT mode.
* </pre> * </pre>
* *
* @author chammack * @author chammack
* @version 1 * @version 1
*/ */
public class WarngenDialog extends CaveSWTDialog implements public class WarngenDialog extends CaveSWTDialog implements
IWarningsArrivedListener { IWarningsArrivedListener, ISimulatedTimeChangeListener {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(WarngenDialog.class); .getHandler(WarngenDialog.class);
@ -334,10 +337,13 @@ public class WarngenDialog extends CaveSWTDialog implements
warngenLayer = layer; warngenLayer = layer;
CurrentWarnings.addListener(this); CurrentWarnings.addListener(this);
new TemplateRunnerInitJob().schedule(); new TemplateRunnerInitJob().schedule();
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this);
} }
@Override @Override
protected void disposed() { protected void disposed() {
SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this);
if (bulletListFont != null) { if (bulletListFont != null) {
bulletListFont.dispose(); bulletListFont.dispose();
} }
@ -876,6 +882,13 @@ public class WarngenDialog extends CaveSWTDialog implements
okButton.addSelectionListener(new SelectionAdapter() { okButton.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
Shell shell = getShell();
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Create WarnGen product");
return;
}
okPressed(); okPressed();
} }
@ -1109,8 +1122,9 @@ public class WarngenDialog extends CaveSWTDialog implements
durList.add(data.displayString); durList.add(data.displayString);
} }
// Add the default duration to the list if what was missing // Add the default duration to the list if what was missing
if (! isDefaultDurationInList && defaultDuration != null) { if (!isDefaultDurationInList && defaultDuration != null) {
durationList.setData(defaultDuration.displayString, defaultDuration); durationList
.setData(defaultDuration.displayString, defaultDuration);
durList.add(0, defaultDuration.displayString); durList.add(0, defaultDuration.displayString);
} }
@ -1190,8 +1204,9 @@ public class WarngenDialog extends CaveSWTDialog implements
long t0 = System.currentTimeMillis(); long t0 = System.currentTimeMillis();
try { try {
monitor.beginTask("Generating product", 1); monitor.beginTask("Generating product", 1);
statusHandler.debug("using startTime " + startTime.getTime() statusHandler.debug("using startTime "
+ " endTime " + endTime.getTime()); + startTime.getTime() + " endTime "
+ endTime.getTime());
String result = TemplateRunner.runTemplate( String result = TemplateRunner.runTemplate(
warngenLayer, startTime.getTime(), warngenLayer, startTime.getTime(),
endTime.getTime(), selectedBullets, endTime.getTime(), selectedBullets,
@ -1224,8 +1239,7 @@ public class WarngenDialog extends CaveSWTDialog implements
new Job("Transmitting Warning") { new Job("Transmitting Warning") {
@Override @Override
protected IStatus run(IProgressMonitor monitor) { protected IStatus run(IProgressMonitor monitor) {
statusHandler.debug( statusHandler.debug(": Transmitting Warning Job Running");
": Transmitting Warning Job Running");
// Launch the text editor display as the warngen editor // Launch the text editor display as the warngen editor
// dialog using the result aka the warngen text product. // dialog using the result aka the warngen text product.
@ -1694,10 +1708,12 @@ public class WarngenDialog extends CaveSWTDialog implements
.equalsIgnoreCase(lastAreaSource); .equalsIgnoreCase(lastAreaSource);
boolean snapHatchedAreaToPolygon = isDifferentAreaSources; boolean snapHatchedAreaToPolygon = isDifferentAreaSources;
boolean preservedSelection = !isDifferentAreaSources; boolean preservedSelection = !isDifferentAreaSources;
if (isDifferentAreaSources || !warngenLayer.getConfiguration() if (isDifferentAreaSources
.getHatchedAreaSource().getAreaSource().toLowerCase().equals("marinezones")) { || !warngenLayer.getConfiguration().getHatchedAreaSource()
.getAreaSource().toLowerCase().equals("marinezones")) {
// If template has a different hatched area source from the previous // If template has a different hatched area source from the previous
// template, then the warned area would be based on the polygon and not // template, then the warned area would be based on the polygon and
// not
// preserved. // preserved.
try { try {
warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon, warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon,
@ -1776,7 +1792,8 @@ public class WarngenDialog extends CaveSWTDialog implements
FollowupData data = (FollowupData) updateListCbo FollowupData data = (FollowupData) updateListCbo
.getData(updateListCbo.getItem(updateListCbo .getData(updateListCbo.getItem(updateListCbo
.getSelectionIndex())); .getSelectionIndex()));
statusHandler.debug("updateListSelected: " + (data != null ? data.getDisplayString() : "(null)")); statusHandler.debug("updateListSelected: "
+ (data != null ? data.getDisplayString() : "(null)"));
Mode currMode = warngenLayer.getStormTrackState().mode; Mode currMode = warngenLayer.getStormTrackState().mode;
if (data != null) { if (data != null) {
// does not refesh if user selected already highlighted option // does not refesh if user selected already highlighted option
@ -1928,7 +1945,8 @@ public class WarngenDialog extends CaveSWTDialog implements
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
int duration = (Integer) returnValue; int duration = (Integer) returnValue;
statusHandler.debug("changeSelected.dialogClosed: " + duration); statusHandler.debug("changeSelected.dialogClosed: "
+ duration);
if (duration != -1) { if (duration != -1) {
durationList.setEnabled(false); durationList.setEnabled(false);
endTime.add(Calendar.MINUTE, duration); endTime.add(Calendar.MINUTE, duration);
@ -2643,13 +2661,13 @@ public class WarngenDialog extends CaveSWTDialog implements
} }
private void restoreDuration(int duration) { private void restoreDuration(int duration) {
warngenLayer.getStormTrackState().duration = warngenLayer.getStormTrackState().duration = warngenLayer
warngenLayer.getStormTrackState().newDuration = duration; .getStormTrackState().newDuration = duration;
warngenLayer.getStormTrackState().geomChanged = true; warngenLayer.getStormTrackState().geomChanged = true;
} }
private int getSelectedDuration() { private int getSelectedDuration() {
Exception excToReport= null; Exception excToReport = null;
DurationData data = null; DurationData data = null;
try { try {
data = (DurationData) durationList.getData(durationList data = (DurationData) durationList.getData(durationList
@ -2669,12 +2687,33 @@ public class WarngenDialog extends CaveSWTDialog implements
} }
duration = 30; duration = 30;
} }
statusHandler.handle(Priority.WARN, statusHandler
"Unable to determine duration from selection in WarnGen dialog. Using default of " .handle(Priority.WARN,
+ duration + " minutes.", excToReport); "Unable to determine duration from selection in WarnGen dialog. Using default of "
+ duration + " minutes.", excToReport);
} }
statusHandler.debug("selected duration is " + duration); statusHandler.debug("selected duration is " + duration);
return duration; return duration;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.time.ISimulatedTimeChangeListener#timechanged()
*/
@Override
public void timechanged() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
if ((getShell().isVisible())
&& (!SimulatedTimeOperations.isTransmitAllowed())) {
SimulatedTimeOperations.displayFeatureLevelWarning(
getShell(), "WarnGen");
}
}
});
}
} }

View file

@ -231,6 +231,7 @@
<alias base="FFG-TAR">RFCFFG_ParameterInfo</alias> <alias base="FFG-TAR">RFCFFG_ParameterInfo</alias>
<alias base="FFG-TIR">RFCFFG_ParameterInfo</alias> <alias base="FFG-TIR">RFCFFG_ParameterInfo</alias>
<alias base="FFG-TUA">RFCFFG_ParameterInfo</alias> <alias base="FFG-TUA">RFCFFG_ParameterInfo</alias>
<alias base="NationalBlend">NationalBlend</alias>
<alias base="PGBlended">PGBlended</alias> <alias base="PGBlended">PGBlended</alias>
<alias base="PGBlended-Night">PGBlended</alias> <alias base="PGBlended-Night">PGBlended</alias>
<alias base="NCOM-USEAST">ncom</alias> <alias base="NCOM-USEAST">ncom</alias>

View file

@ -11,8 +11,10 @@
Feb 24, 2015 DR 16671 byin Added HPBL for RUC13 Feb 24, 2015 DR 16671 byin Added HPBL for RUC13
May 21, 2015 DR 17515 bhunder Added parameters for URMA25 May 21, 2015 DR 17515 bhunder Added parameters for URMA25
Jun 29, 2015 #4537 rferrel Added parameters for HRRR. Jun 29, 2015 #4537 rferrel Added parameters for HRRR.
Oct 08, 2015 #4958 dgilling Added parameters for NationalBlend.
--> -->
<aliasList caseSensitive="true" namespace="gfeParamName"> <aliasList caseSensitive="true" namespace="gfeParamName">
<alias base="APTMP">aptmp</alias>
<alias base="AV">av</alias> <alias base="AV">av</alias>
<alias base="CAPE">cape</alias> <alias base="CAPE">cape</alias>
<alias base="CFRZR">cfrzr</alias> <alias base="CFRZR">cfrzr</alias>

View file

@ -27,8 +27,8 @@
# #
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# 01/14/13 njensen Initial Creation. # 01/14/2013 #1497 njensen Initial Creation.
# # 10/12/2015 #4967 randerso Updated for new JEP API
# #
# #
@ -67,6 +67,8 @@ def __getMaskIndiciesForJava(mask):
return xcoords, ycoords return xcoords, ycoords
# Originally added for use by BOX SmartInitUtils.SIU_fillEditArea() to speed up their smartInits
# Should be used by other smartInits that need similar functionality
def fillEditArea(grid, fillMask, borderMask): def fillEditArea(grid, fillMask, borderMask):
editPointsX, editPointsY = __getMaskIndiciesForJava(fillMask) editPointsX, editPointsY = __getMaskIndiciesForJava(fillMask)
borderPointsX, borderPointsY = __getMaskIndiciesForJava(borderMask) borderPointsX, borderPointsY = __getMaskIndiciesForJava(borderMask)
@ -74,7 +76,7 @@ def fillEditArea(grid, fillMask, borderMask):
gridObj = JavaSmartUtils.fillEditArea(grid, grid.shape[1], grid.shape[0], \ gridObj = JavaSmartUtils.fillEditArea(grid, grid.shape[1], grid.shape[0], \
editPointsY, editPointsX, borderPointsY, borderPointsX) editPointsY, editPointsX, borderPointsY, borderPointsX)
retObj = gridObj.__numpy__[0] retObj = gridObj.getNDArray()
return retObj return retObj

View file

@ -67,8 +67,9 @@
# 05/12/2015 #17144 bhunder Added RTMA model # 05/12/2015 #17144 bhunder Added RTMA model
# 05/29/2015 17496 ryu Changed parm definitions for Wave1-10 and Period1-10. # 05/29/2015 17496 ryu Changed parm definitions for Wave1-10 and Period1-10.
# #
# 05/29/2015 #17144 bhunder Added weather Params for URMA25 and OCONUS RTMA # 05/29/2015 #17144 bhunder Added weather Params for URMA25 and OCONUS RTMA
# 09/02/2015 #4819 rferrel Added HWRF. # 09/02/2015 #4819 rferrel Added HWRF.
# 10/07/2015 #4958 dgilling Added support for NationalBlend D2D data.
#################################################################################################### ####################################################################################################
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -1364,6 +1365,7 @@ elif SID in CONUS_EAST_SITES:
('FFG-TAR', 'FFGTAR'), ('FFG-TAR', 'FFGTAR'),
('FFG-TIR', 'FFGTIR'), ('FFG-TIR', 'FFGTIR'),
('FFG-TUA', 'FFGTUA'), ('FFG-TUA', 'FFGTUA'),
'NationalBlend',
'PGBlended', 'PGBlended',
'PGBlended-Night', 'PGBlended-Night',
('NCOM-USEAST', 'NCOMUSEAST'), ('NCOM-USEAST', 'NCOMUSEAST'),
@ -1448,6 +1450,7 @@ else: #######DCS3501 WEST_CONUS
('FFG-TAR', 'FFGTAR'), ('FFG-TAR', 'FFGTAR'),
('FFG-TIR', 'FFGTIR'), ('FFG-TIR', 'FFGTIR'),
('FFG-TUA', 'FFGTUA'), ('FFG-TUA', 'FFGTUA'),
'NationalBlend',
'PGBlended', 'PGBlended',
'PGBlended-Night', 'PGBlended-Night',
('NCOM-SOCAL', 'NCOMSOCAL'), ('NCOM-SOCAL', 'NCOMSOCAL'),

View file

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<gridParamInfo xmlns:ns2="group">
<valtimeMINUSreftime>
<fcst>0</fcst>
<fcst>10800</fcst>
<fcst>21600</fcst>
<fcst>32400</fcst>
<fcst>43200</fcst>
<fcst>54000</fcst>
<fcst>64800</fcst>
<fcst>75600</fcst>
<fcst>86400</fcst>
<fcst>97200</fcst>
<fcst>108000</fcst>
<fcst>118800</fcst>
<fcst>129600</fcst>
<fcst>140400</fcst>
<fcst>151200</fcst>
<fcst>162000</fcst>
<fcst>172800</fcst>
<fcst>183600</fcst>
<fcst>194400</fcst>
<fcst>205200</fcst>
<fcst>216000</fcst>
<fcst>226800</fcst>
<fcst>237600</fcst>
<fcst>248400</fcst>
<fcst>259200</fcst>
<fcst>270000</fcst>
<fcst>280800</fcst>
<fcst>291600</fcst>
<fcst>302400</fcst>
<fcst>313200</fcst>
<fcst>324000</fcst>
<fcst>334800</fcst>
<fcst>345600</fcst>
<fcst>356400</fcst>
<fcst>367200</fcst>
<fcst>378000</fcst>
<fcst>388800</fcst>
<fcst>399600</fcst>
<fcst>410400</fcst>
<fcst>421200</fcst>
<fcst>432000</fcst>
<fcst>442800</fcst>
<fcst>453600</fcst>
<fcst>464400</fcst>
<fcst>475200</fcst>
<fcst>486000</fcst>
<fcst>496800</fcst>
<fcst>507600</fcst>
<fcst>518400</fcst>
<fcst>529200</fcst>
<fcst>540000</fcst>
<fcst>550800</fcst>
<fcst>561600</fcst>
<fcst>572400</fcst>
<fcst>583200</fcst>
<fcst>594000</fcst>
<fcst>604800</fcst>
<fcst>615600</fcst>
<fcst>626400</fcst>
<fcst>637200</fcst>
<fcst>648000</fcst>
<fcst>658800</fcst>
<fcst>669600</fcst>
<fcst>680400</fcst>
<fcst>691200</fcst>
</valtimeMINUSreftime>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>t</short_name>
<long_name>temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>T</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>2 FHAG</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>dpt</short_name>
<long_name>Dewpoint Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>Td</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 2</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>mnt12hr</short_name>
<long_name>Minimum Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>minT</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 2</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>mxt12hr</short_name>
<long_name>Maximum Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>maxT</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 2</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>pop</short_name>
<long_name>Probability of 12hr precip</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>12hrPcpProb</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>tcc</short_name>
<long_name>Total Cloud Cover</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>totalCldCvr</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>0</n3D>
<levelsDesc>SFC</levelsDesc>
<levels>
<level>SFC</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>ws</short_name>
<long_name>Wind Speed</long_name>
<units>m/s</units>
<udunits>meter/sec</udunits>
<uiname>windSpeed</uiname>
<valid_range>-150.0</valid_range>
<valid_range>150.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 10</levelsDesc>
<levels>
<level>FHAG10</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>wd</short_name>
<long_name>Wind Direction</long_name>
<units>degreeTrue</units>
<udunits>degree_True</udunits>
<uiname>windDir</uiname>
<valid_range>0.0</valid_range>
<valid_range>360.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 10</levelsDesc>
<levels>
<level>FHAG10</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>rh</short_name>
<long_name>Relative Humidity</long_name>
<units>%</units>
<udunits>percent</udunits>
<uiname>rh</uiname>
<valid_range>0.0</valid_range>
<valid_range>100.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>FHAG 2</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
<gridParameterInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="parameterInfo">
<short_name>aptmp</short_name>
<long_name>Apparent Temperature</long_name>
<units>K</units>
<udunits>degree_Kelvin</udunits>
<uiname>aptmp</uiname>
<valid_range>180.0</valid_range>
<valid_range>330.0</valid_range>
<fillValue>-999999.0</fillValue>
<n3D>1</n3D>
<levelsDesc>2 FHAG</levelsDesc>
<levels>
<level>FHAG2</level>
</levels>
</gridParameterInfo>
</gridParamInfo>

View file

@ -21,8 +21,10 @@ package com.raytheon.uf.common.monitor.config;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -49,7 +51,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
/** /**
* Monitor configuration manager. * Fog, SAFESEAS and SNOW Monitor configuration manager.
* *
* <pre> * <pre>
* *
@ -68,6 +70,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one. * May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
* Sep 04 2014 3220 skorolev Added fileUpdated method. * Sep 04 2014 3220 skorolev Added fileUpdated method.
* Feb 24 2015 3220 dhladky Made sure config file is read in on change. * Feb 24 2015 3220 dhladky Made sure config file is read in on change.
* Sep 17 2015 3873 skorolev Corrected getInstance, addArea, addAdjArea and added getAdjAreaConfigXml.
* *
* </pre> * </pre>
* *
@ -108,9 +111,6 @@ public class FSSObsMonitorConfigurationManager implements
/** Name of plugin */ /** Name of plugin */
private static String pluginName = null; private static String pluginName = null;
/** Monitor name */
private static String monitorName = null;
/** Name of area configuration file */ /** Name of area configuration file */
private String configFileName = null; private String configFileName = null;
@ -128,28 +128,29 @@ public class FSSObsMonitorConfigurationManager implements
ss, fog, snow ss, fog, snow
}; };
/** Default value for Timewindow in hours */
private static final double DEFAULT_TIME = 2;
/** Localization Area Configuration File. */ /** Localization Area Configuration File. */
private LocalizationFile lacf = null; private LocalizationFile lacf = null;
/** Configuration XML is updated and saved */ /** Configuration XML is updated and saved */
protected boolean isPopulated; protected boolean isPopulated;
/** Singleton instance of this class */ /** Map for current configuration managers. */
private static FSSObsMonitorConfigurationManager instance = null; private final static Map<MonName, FSSObsMonitorConfigurationManager> instanceMap = new HashMap<>();
/** /**
* Private Constructor * Private Constructor
* *
* @param monitorName * @param monitorName
*/ */
public FSSObsMonitorConfigurationManager(String monitorName) { private FSSObsMonitorConfigurationManager(MonName monitorName) {
setMonitorName(monitorName);
setPopulated(false);
// Avoid confusion in file path // Avoid confusion in file path
if (monitorName == MonName.ss.name()) { if (monitorName == MonName.ss) {
pluginName = "safeseas"; pluginName = "safeseas";
} else { } else {
pluginName = monitorName; pluginName = monitorName.name();
} }
/** Path to Monitoring Area Configuration XML. */ /** Path to Monitoring Area Configuration XML. */
setConfigFileName(pluginName + File.separatorChar + "monitoringArea" setConfigFileName(pluginName + File.separatorChar + "monitoringArea"
@ -162,19 +163,21 @@ public class FSSObsMonitorConfigurationManager implements
configXml = new MonAreaConfigXML(); configXml = new MonAreaConfigXML();
adjAreaConfigXml = new MonAreaConfigXML(); adjAreaConfigXml = new MonAreaConfigXML();
readConfigXml(); readConfigXml();
setPopulated(false);
} }
/** /**
* Get an instance of Configuration manager for FSSObs monitors. * Returns instance of current monitor.
* *
* @param monitor * @param monitor
* Name of monitor * @return
* @return Instance of manager
*/ */
public static synchronized FSSObsMonitorConfigurationManager getInstance( public static synchronized FSSObsMonitorConfigurationManager getInstance(
String monitor) { MonName monitor) {
FSSObsMonitorConfigurationManager instance = instanceMap.get(monitor);
if (instance == null) { if (instance == null) {
instance = new FSSObsMonitorConfigurationManager(monitor); instance = new FSSObsMonitorConfigurationManager(monitor);
instanceMap.put(monitor, instance);
} }
return instance; return instance;
} }
@ -188,6 +191,7 @@ public class FSSObsMonitorConfigurationManager implements
public void readConfigXml() { public void readConfigXml() {
boolean monitorAreaFileExists = true; boolean monitorAreaFileExists = true;
boolean adjacentAreaFileExists = true; boolean adjacentAreaFileExists = true;
// Read area configuration XML file.
try { try {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext( LocalizationContext lc = pm.getContext(
@ -198,7 +202,6 @@ public class FSSObsMonitorConfigurationManager implements
MonAreaConfigXML configXmltmp = jaxb MonAreaConfigXML configXmltmp = jaxb
.unmarshalFromXmlFile(monitorAreaFilePath.toString()); .unmarshalFromXmlFile(monitorAreaFilePath.toString());
configXml = configXmltmp; configXml = configXmltmp;
setPopulated(true);
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.WARN, .handle(Priority.WARN,
@ -208,7 +211,7 @@ public class FSSObsMonitorConfigurationManager implements
+ ""); + "");
monitorAreaFileExists = false; monitorAreaFileExists = false;
} }
// Read adjacent area configuration XML file.
try { try {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
String adjacentAreaFilePath = pm.getFile( String adjacentAreaFilePath = pm.getFile(
@ -218,7 +221,6 @@ public class FSSObsMonitorConfigurationManager implements
MonAreaConfigXML configXmltmp = jaxb MonAreaConfigXML configXmltmp = jaxb
.unmarshalFromXmlFile(adjacentAreaFilePath.toString()); .unmarshalFromXmlFile(adjacentAreaFilePath.toString());
adjAreaConfigXml = configXmltmp; adjAreaConfigXml = configXmltmp;
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.WARN, .handle(Priority.WARN,
@ -276,9 +278,7 @@ public class FSSObsMonitorConfigurationManager implements
configXml.addAreaId(zoneXml); configXml.addAreaId(zoneXml);
} }
} }
// Default value for Timewindow. configXml.setTimeWindow(DEFAULT_TIME);
int defaultVal = 2;
configXml.setTimeWindow(defaultVal);
saveConfigXml(); saveConfigXml();
} }
// Check for an adjacent area config file, if one does not exist, // Check for an adjacent area config file, if one does not exist,
@ -491,8 +491,10 @@ public class FSSObsMonitorConfigurationManager implements
for (AreaIdXML area : areaList) { for (AreaIdXML area : areaList) {
if (area.getAreaId().equals(areaId)) { if (area.getAreaId().equals(areaId)) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
results.add(station.getName() + "#" + station.getType()); for (StationIdXML station : stationList) {
results.add(station.getName() + "#" + station.getType());
}
} }
} }
} }
@ -512,8 +514,10 @@ public class FSSObsMonitorConfigurationManager implements
for (AreaIdXML area : areaList) { for (AreaIdXML area : areaList) {
if (area.getAreaId().equals(areaId)) { if (area.getAreaId().equals(areaId)) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
results.add(station.getName() + "#" + station.getType()); for (StationIdXML station : stationList) {
results.add(station.getName() + "#" + station.getType());
}
} }
} }
} }
@ -533,8 +537,10 @@ public class FSSObsMonitorConfigurationManager implements
for (AreaIdXML area : areaList) { for (AreaIdXML area : areaList) {
if (area.getAreaId().equals(areaId)) { if (area.getAreaId().equals(areaId)) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
results.add(station.getName()); for (StationIdXML station : stationList) {
results.add(station.getName());
}
} }
} }
} }
@ -553,9 +559,11 @@ public class FSSObsMonitorConfigurationManager implements
List<AreaIdXML> areaList = configXml.getAreaIds(); List<AreaIdXML> areaList = configXml.getAreaIds();
for (AreaIdXML area : areaList) { for (AreaIdXML area : areaList) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
if (station.getName().equals(stationId)) { for (StationIdXML station : stationList) {
results.add(area.getAreaId()); if (station.getName().equals(stationId)) {
results.add(area.getAreaId());
}
} }
} }
} }
@ -572,9 +580,11 @@ public class FSSObsMonitorConfigurationManager implements
List<String> stations = new ArrayList<String>(); List<String> stations = new ArrayList<String>();
for (AreaIdXML area : areaXml) { for (AreaIdXML area : areaXml) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
stations.add(station.getName() + "#" + station.getType() + "#" for (StationIdXML station : stationList) {
+ area.getAreaId()); stations.add(station.getName() + "#" + station.getType()
+ "#" + area.getAreaId());
}
} }
} }
return stations; return stations;
@ -590,8 +600,10 @@ public class FSSObsMonitorConfigurationManager implements
Set<String> stations = new HashSet<String>(); Set<String> stations = new HashSet<String>();
for (AreaIdXML area : areaXml) { for (AreaIdXML area : areaXml) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
stations.add(station.getName()); for (StationIdXML station : stationList) {
stations.add(station.getName());
}
} }
} }
return stations; return stations;
@ -639,10 +651,12 @@ public class FSSObsMonitorConfigurationManager implements
for (AreaIdXML areaXml : areaList) { for (AreaIdXML areaXml : areaList) {
if (areaXml.getAreaId().equals(area)) { if (areaXml.getAreaId().equals(area)) {
List<StationIdXML> stationList = areaXml.getStationIds(); List<StationIdXML> stationList = areaXml.getStationIds();
for (int i = 0; i < stationList.size(); i++) { if (!stationList.isEmpty()) {
if (stationList.get(i).getName().equals(station)) { for (int i = 0; i < stationList.size(); i++) {
stationList.remove(i); if (stationList.get(i).getName().equals(station)) {
areaXml.getStationIds(); stationList.remove(i);
areaXml.getStationIds();
}
} }
} }
} }
@ -659,11 +673,13 @@ public class FSSObsMonitorConfigurationManager implements
List<AreaIdXML> areaList = configXml.getAreaIds(); List<AreaIdXML> areaList = configXml.getAreaIds();
for (AreaIdXML areaXml : areaList) { for (AreaIdXML areaXml : areaList) {
List<StationIdXML> stationList = areaXml.getStationIds(); List<StationIdXML> stationList = areaXml.getStationIds();
for (int i = 0; i < stationList.size(); i++) { if (!stationList.isEmpty()) {
StationIdXML stationXml = stationList.get(i); for (int i = 0; i < stationList.size(); i++) {
if (stationXml.getName().equals(station)) { StationIdXML stationXml = stationList.get(i);
stationList.remove(i); if (stationXml.getName().equals(station)) {
i--; stationList.remove(i);
i--;
}
} }
} }
} }
@ -841,9 +857,11 @@ public class FSSObsMonitorConfigurationManager implements
for (AreaIdXML area : areaList) { for (AreaIdXML area : areaList) {
if (area.getAreaId().equals(theZone)) { if (area.getAreaId().equals(theZone)) {
List<StationIdXML> stationList = area.getStationIds(); List<StationIdXML> stationList = area.getStationIds();
for (StationIdXML station : stationList) { if (!stationList.isEmpty()) {
if (station.getName().equals(theStation)) { for (StationIdXML station : stationList) {
return station.getType(); if (station.getName().equals(theStation)) {
return station.getType();
}
} }
} }
} }
@ -937,24 +955,6 @@ public class FSSObsMonitorConfigurationManager implements
} }
} }
/**
* Gets Monitor Name.
*
* @return monitor name
*/
public String getMonitorName() {
return monitorName;
}
/**
* Sets Monitor Name.
*
* @param monitorName
*/
public void setMonitorName(String monitorName) {
FSSObsMonitorConfigurationManager.monitorName = monitorName;
}
/** /**
* Flag is true if config file updated and saved. * Flag is true if config file updated and saved.
* *
@ -1011,4 +1011,8 @@ public class FSSObsMonitorConfigurationManager implements
adjAreaConfigXml.addAreaId(area); adjAreaConfigXml.addAreaId(area);
} }
} }
public List<MonitorConfigListener> getListeners() {
return listeners;
}
} }

View file

@ -19,7 +19,6 @@
**/ **/
package com.raytheon.uf.common.monitor.data; package com.raytheon.uf.common.monitor.data;
/** /**
* Constants for Observations within the Decision Assistance Tool Suite that * Constants for Observations within the Decision Assistance Tool Suite that
* hark back to the SAFESEAS.H C++ header file. * hark back to the SAFESEAS.H C++ header file.
@ -33,6 +32,7 @@ package com.raytheon.uf.common.monitor.data;
* Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to * Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to
* VarName for SWELL * VarName for SWELL
* Nov 06, 2013 2493 bsteffen Remove unused constants. * Nov 06, 2013 2493 bsteffen Remove unused constants.
* Sep 18, 2015 3873 skorolev Added constants for Maritime data
* *
* </pre> * </pre>
* *
@ -46,6 +46,12 @@ public final class ObConst {
private ObConst() { private ObConst() {
} }
/**
* The maximum number of most recent hours within which observation reports
* are to be archived.
*/
public static final int MAX_FRAMES = 64;
// Time Window in units of hours // Time Window in units of hours
public static final int THREAT_INTERVAL_HOURS = 2; public static final int THREAT_INTERVAL_HOURS = 2;
@ -76,6 +82,24 @@ public final class ObConst {
public static final String SKC_SKY_STRING = "SKC"; public static final String SKC_SKY_STRING = "SKC";
public static final String SYNOPTIC_SHIP = "1003";
public static final String SYNOPTIC_CMAN = "1004";
public static final String SYNOPTIC_MOORED_BUOY = "1005";
public static final String DRIFTING_BUOY = "1006";
public static final String SYNOPTIC_MAROB = "1007";
public static final String METAR = "METAR";
public static final String SPECI = "SPECI";
public static final String MARITIME = "MARITIME";
public static final String MESONET = "MESONET";
// Chosen Application Key // Chosen Application Key
public enum ChosenAppKey { public enum ChosenAppKey {
SNOW, FOG, SAFESEAS SNOW, FOG, SAFESEAS
@ -107,7 +131,7 @@ public final class ObConst {
SYNOPTIC_MAROB, SYNOPTIC_MAROB,
MARINE, MARITIME,
METAR, METAR,

View file

@ -28,6 +28,7 @@
# 06/11/13 #2083 randerso Fixed getISCSites to look in configured # 06/11/13 #2083 randerso Fixed getISCSites to look in configured
# 02/20/2014 #2824 randerso Added log message when no localVTECPartners file is found # 02/20/2014 #2824 randerso Added log message when no localVTECPartners file is found
# Apr 25, 2015 4952 njensen Updated for new JEP API # Apr 25, 2015 4952 njensen Updated for new JEP API
# 09/30/2015 18141 ryu Added PHFO to VTEC_TPC_SITE
# #
#VTEC_Partners.py - configuration file to control filtering and merging #VTEC_Partners.py - configuration file to control filtering and merging
@ -40,7 +41,7 @@ VTEC_TABLE_REQUEST_SITES = []
# Name of site identifier for SPC and TCV bulletins. 4-characters. # Name of site identifier for SPC and TCV bulletins. 4-characters.
VTEC_SPC_SITE = ['KWNS'] VTEC_SPC_SITE = ['KWNS']
VTEC_TPC_SITE = ['KNHC'] VTEC_TPC_SITE = ['KNHC', 'PHFO']
# The following list is a set of office identifiers which is used # The following list is a set of office identifiers which is used
# in the ingestAT/MergeVTEC software to filter out records from offices # in the ingestAT/MergeVTEC software to filter out records from offices

View file

@ -67,6 +67,7 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil;
* Configuration Manager has not read a * Configuration Manager has not read a
* FFMPRunConfig.xml file. * FFMPRunConfig.xml file.
* Sep 04, 2014 3220 skorolev Updated menu creation for Fog, Safeseas and Snow monitors. * Sep 04, 2014 3220 skorolev Updated menu creation for Fog, Safeseas and Snow monitors.
* Sep 18, 2015 3873 skorolev Corrected Fog, Safeseas and Snow monitor's names.
* *
* </pre> * </pre>
* *
@ -483,26 +484,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
*/ */
private void createSafeseasMenu() { private void createSafeseasMenu() {
FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss.name()); .getInstance(MonName.ss);
Set<String> ssStns = ssConfig.getStationIDs(); Set<String> ssStns = ssConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : ssStns) { for (String s : ssStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String ssStations = stations.toString(); stations.append(s);
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile(); }
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String ssStations = stations.toString();
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
safeMenuContributionFile.contribution[0] = processOtherContribution( safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
ssStations, "menus/safeseas/baseSafeSeas.xml", safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?before=EndOfMaritime", "SAFESEAS", safeMenuContributionFile.contribution[0] = processOtherContribution(
safeMenuContributionFile.contribution[0]); ssStations, "menus/safeseas/baseSafeSeas.xml",
toXml(safeMenuContributionFile, "menus" + File.separator "menu:obs?before=EndOfMaritime", "SAFESEAS",
+ "safeseas" + File.separator + "index.xml"); safeMenuContributionFile.contribution[0]);
ssConfig = null; toXml(safeMenuContributionFile, "menus" + File.separator + "safeseas"
+ File.separator + "index.xml");
ssConfig = null;
} }
/** /**
@ -510,26 +511,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
*/ */
private void createFogMenu() { private void createFogMenu() {
FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog.name()); .getInstance(MonName.fog);
Set<String> fogStns = fogConfig.getStationIDs(); Set<String> fogStns = fogConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : fogStns) { for (String s : fogStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String fogStations = stations.toString(); stations.append(s);
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile(); }
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String fogStations = stations.toString();
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
fogMenuContributionFile.contribution[0] = processOtherContribution( fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
fogStations, "menus/fog/baseFog.xml", fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor", fogMenuContributionFile.contribution[0] = processOtherContribution(
fogMenuContributionFile.contribution[0]); fogStations, "menus/fog/baseFog.xml",
toXml(fogMenuContributionFile, "menus" + File.separator + "fog" "menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
+ File.separator + "index.xml"); fogMenuContributionFile.contribution[0]);
fogConfig = null; toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
+ File.separator + "index.xml");
fogConfig = null;
} }
/** /**
@ -537,26 +538,26 @@ public class DatMenuUtil extends AbstractMenuUtil {
*/ */
private void createSnowMenu() { private void createSnowMenu() {
FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow.name()); .getInstance(MonName.snow);
Set<String> snowStns = snowConfig.getStationIDs(); Set<String> snowStns = snowConfig.getStationIDs();
StringBuilder stations = new StringBuilder(); StringBuilder stations = new StringBuilder();
for (String s : snowStns) { for (String s : snowStns) {
if (stations.length() > 0) { if (stations.length() > 0) {
stations.append(","); stations.append(",");
}
stations.append(s);
} }
String snowStations = stations.toString(); stations.append(s);
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile(); }
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; String snowStations = stations.toString();
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
snowMenuContributionFile.contribution[0] = processOtherContribution( snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
snowStations, "menus/snow/baseSnow.xml", snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
"menu:obs?after=SNOWPLACEHOLDER", "SNOW", snowMenuContributionFile.contribution[0] = processOtherContribution(
snowMenuContributionFile.contribution[0]); snowStations, "menus/snow/baseSnow.xml",
toXml(snowMenuContributionFile, "menus" + File.separator + "snow" "menu:obs?after=SNOWPLACEHOLDER", "SNOW",
+ File.separator + "index.xml"); snowMenuContributionFile.contribution[0]);
snowConfig = null; toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
+ File.separator + "index.xml");
snowConfig = null;
} }
/** /**

View file

@ -8,7 +8,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.12.1153", Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.12.1153",
com.raytheon.edex.common;bundle-version="1.12.1153", com.raytheon.edex.common;bundle-version="1.12.1153",
com.raytheon.uf.common.dataplugin.fssobs;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.fssobs;bundle-version="1.0.0",
com.raytheon.uf.edex.decodertools com.raytheon.uf.edex.decodertools,
com.raytheon.uf.common.monitor
Export-Package: com.raytheon.uf.edex.plugin.fssobs, Export-Package: com.raytheon.uf.edex.plugin.fssobs,
com.raytheon.uf.edex.plugin.fssobs.common com.raytheon.uf.edex.plugin.fssobs.common
Import-Package: com.raytheon.uf.common.monitor.config, Import-Package: com.raytheon.uf.common.monitor.config,
@ -17,8 +18,11 @@ Import-Package: com.raytheon.uf.common.monitor.config,
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.pointdata.spatial, com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.status, com.raytheon.uf.common.status,
com.raytheon.uf.common.wxmath,
com.raytheon.uf.edex.dat.utils, com.raytheon.uf.edex.dat.utils,
com.raytheon.uf.edex.menus, com.raytheon.uf.edex.menus,
com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.plugin.fssobs,
com.raytheon.uf.edex.pointdata, com.raytheon.uf.edex.pointdata,
javax.measure.converter,
javax.measure.unit,
org.apache.commons.logging org.apache.commons.logging

View file

@ -20,14 +20,21 @@
package com.raytheon.uf.edex.plugin.fssobs; package com.raytheon.uf.edex.plugin.fssobs;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.site.SiteUtil;
import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.edex.urifilter.URIFilter;
import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.edex.urifilter.URIGenerateMessage;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent; import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
import com.raytheon.uf.common.monitor.events.MonitorConfigListener; import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -37,6 +44,7 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator; import com.raytheon.uf.edex.cpgsrv.CompositeProductGenerator;
import com.raytheon.uf.edex.dat.utils.DatMenuUtil; import com.raytheon.uf.edex.dat.utils.DatMenuUtil;
import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig; import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* Generates a FSSObs Record. * Generates a FSSObs Record.
@ -51,6 +59,7 @@ import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig;
* May 23, 2014 3086 skorolev Cleaned code. * May 23, 2014 3086 skorolev Cleaned code.
* Aug 18, 2014 3530 bclement removed constructDataURI() call * Aug 18, 2014 3530 bclement removed constructDataURI() call
* Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one. * Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one.
* Sep 18, 2015 3873 skorolev Added moving platforms testing.
* *
* </pre> * </pre>
* *
@ -69,10 +78,14 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
/** Product */ /** Product */
private static final String productType = "fssobs"; private static final String productType = "fssobs";
/** Sets of all stations to filter for */ /** Stations to filter */
private HashSet<String> allStations = null; private Set<String> allStations = new HashSet<String>();
private FSSObsMonitorConfigurationManager currManager = null; public FSSObsMonitorConfigurationManager fogmcm = null;
public FSSObsMonitorConfigurationManager ssmcm = null;
public FSSObsMonitorConfigurationManager snowmcm = null;
/** /**
* Public construction * Public construction
@ -92,29 +105,84 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
public void generateProduct(URIGenerateMessage genMessage) { public void generateProduct(URIGenerateMessage genMessage) {
FSSObsConfig fss_config = null; FSSObsConfig fss_config = null;
boolean isStationary = true;
try { try {
fss_config = new FSSObsConfig(genMessage, this); fss_config = new FSSObsConfig(genMessage, this);
this.setPluginDao(new FSSObsDAO(productType)); this.setPluginDao(new FSSObsDAO(productType));
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
} }
FSSObsRecord[] fssRecs = new FSSObsRecord[genMessage.getUris().length]; List<FSSObsRecord> fssRecs = new ArrayList<FSSObsRecord>();
int i = 0;
for (String uri : genMessage.getUris()) { for (String uri : genMessage.getUris()) {
// Test if moving platforms are within configuration distance
if (uri.contains(ObConst.SYNOPTIC_SHIP)
|| uri.contains(ObConst.DRIFTING_BUOY)
|| uri.contains(ObConst.SYNOPTIC_MAROB)) {
isStationary = false;
try {
if (!isNearZone(uri)) {
continue;
}
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
}
FSSObsRecord fssObsRec = new FSSObsRecord(); FSSObsRecord fssObsRec = new FSSObsRecord();
fssObsRec.setIsStationary(isStationary);
fssObsRec = fss_config.getTableRow(uri); fssObsRec = fss_config.getTableRow(uri);
FSSObsDataTransform.buildView(fssObsRec); FSSObsDataTransform.buildView(fssObsRec);
fssRecs[i] = fssObsRec; fssRecs.add(fssObsRec);
i++;
} }
if (fssRecs.length > 0) { if (!fssRecs.isEmpty()) {
this.setPluginDataObjects(fssRecs); this.setPluginDataObjects((PluginDataObject[]) fssRecs
.toArray(new PluginDataObject[fssRecs.size()]));
statusHandler.handle(Priority.INFO, "===> Successfully generated " statusHandler.handle(Priority.INFO, "===> Successfully generated "
+ fssRecs.length + " records."); + fssRecs.size() + " records.");
} }
} }
/**
* Test distance between moving platform and zone centroud.
*
* @param uri
* @return
* @throws SpatialException
*/
private boolean isNearZone(String uri) throws SpatialException {
boolean retVal = false;
Set<String> marineZone = new HashSet<String>();
for (String z : getSSConfig().getAreaList()) {
if (z.charAt(2) == 'Z') {
marineZone.add(z);
}
}
for (String z : getFogConfig().getAreaList()) {
if (z.charAt(2) == 'Z') {
marineZone.add(z);
}
}
double ssShipDist = getSSConfig().getShipDistance();
double fogShipDist = getFogConfig().getShipDistance();
// take the biggest distance
double configDist = ssShipDist > fogShipDist ? ssShipDist : fogShipDist;
if (configDist != 0.0) {
String[] items = uri.split("/");
double latShip = Double.parseDouble(items[6]);
double lonShip = Double.parseDouble(items[7]);
for (String zone : marineZone) {
Coordinate coor = MonitorAreaUtils.getZoneCenter(zone);
double shipTozone = distance(latShip, lonShip, coor.y, coor.x);
if (shipTozone < configDist) {
retVal = true;
}
}
}
return retVal;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -125,7 +193,6 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
protected void createFilters() { protected void createFilters() {
filters = new URIFilter[1]; filters = new URIFilter[1];
filters[0] = new FSSObsURIFilter(genName, allStations); filters[0] = new FSSObsURIFilter(genName, allStations);
allStations = null;
} }
/* /*
@ -138,14 +205,9 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
protected void configureFilters() { protected void configureFilters() {
statusHandler.handle(Priority.INFO, getGeneratorName() statusHandler.handle(Priority.INFO, getGeneratorName()
+ " process Filter Config..."); + " process Filter Config...");
allStations = new HashSet<String>(); allStations.addAll(getFogConfig().getStations());
allStations.addAll(getSSConfig().getStations());
for (MonName mname : MonName.values()) { allStations.addAll(getSnowConfig().getStations());
currManager = new FSSObsMonitorConfigurationManager(mname.name());
currManager.addListener(this);
allStations.addAll(currManager.getStations());
currManager = null;
}
} }
/** /**
@ -187,4 +249,79 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
dmu.createMenus(); dmu.createMenus();
} }
} }
/**
* Distance between two coordinates.
*
* @param lat1
* @param lon1
* @param lat2
* @param lon2
* @return distance in km
*/
public static double distance(double lat1, double lon1, double lat2,
double lon2) {
// Earth's radius of 6378.137 kilometers
float EarthRadius = 6378.137f;
double dLat = toRad(lat2 - lat1);
double dLon = toRad(lon2 - lon1);
lat1 = toRad(lat1);
lat2 = toRad(lat2);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2)
* Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EarthRadius * c;
}
/**
* From grad to radian.
*
* @param value
* @return
*/
private static double toRad(double value) {
return value * Math.PI / 180;
}
/**
* Gets Fog Monitor Configuration Manager.
*
* @return fogmcm
*/
public FSSObsMonitorConfigurationManager getFogConfig() {
if (fogmcm == null) {
fogmcm = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
fogmcm.addListener(this);
}
return fogmcm;
}
/**
* Gets Safeseas Monitor Configuration Manager.
*
* @return ssmcm
*/
public FSSObsMonitorConfigurationManager getSSConfig() {
if (ssmcm == null) {
ssmcm = FSSObsMonitorConfigurationManager.getInstance(MonName.ss);
ssmcm.addListener(this);
}
return ssmcm;
}
/**
* Gets Snow Monitor Configuration Manager.
*
* @return snowmcm
*/
public FSSObsMonitorConfigurationManager getSnowConfig() {
if (snowmcm == null) {
snowmcm = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
}
return snowmcm;
}
} }

View file

@ -3,12 +3,15 @@ package com.raytheon.uf.edex.plugin.fssobs;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.raytheon.edex.urifilter.URIFilter; import com.raytheon.edex.urifilter.URIFilter;
import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage; import com.raytheon.uf.common.dataplugin.message.DataURINotificationMessage;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -23,6 +26,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 5, 2012 #1351 skorolev Cleaned code * Dec 5, 2012 #1351 skorolev Cleaned code
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin * Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
* Sep 04, 2014 3220 skorolev Removed CWA from filter. * Sep 04, 2014 3220 skorolev Removed CWA from filter.
* Sep 17, 2015 3873 skorolev Added pattern for moving platforms.
* *
* </pre> * </pre>
* *
@ -30,6 +34,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0 * @version 1.0
*/ */
public class FSSObsURIFilter extends URIFilter { public class FSSObsURIFilter extends URIFilter {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(URIFilter.class);
/** Station ID **/ /** Station ID **/
private String stn; private String stn;
@ -41,28 +47,26 @@ public class FSSObsURIFilter extends URIFilter {
private HashMap<String, Pattern> patternKeys = null; private HashMap<String, Pattern> patternKeys = null;
/** METAR Pattern **/ /** METAR Pattern **/
private Pattern MetarPattern = null; private Pattern metarPattern = null;
/** Maritime Pattern **/ /** Maritime Pattern **/
private Pattern MaritimePattern = null; private Pattern maritimePattern = null;
/** Mesowest Pattern **/ /** Mesowest Pattern **/
private Pattern MesowestPattern = null; private Pattern mesowestPattern = null;
/** Pattern for moving platforms **/
private Pattern movingPattern = null;
/** Current data type #METAR, #Maritime or #Mesonet **/ /** Current data type #METAR, #Maritime or #Mesonet **/
private String dataType; private String dataType;
/** All filtered stations */ /** All filtered stations */
private HashSet<String> stations = null; private Set<String> stations = null;
/** Date format **/ /** Date format **/
private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S"; private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S";
/** Station type **/
private enum StnType {
METAR, MARITIME, MESONET
};
/** /**
* Constructor * Constructor
* *
@ -72,7 +76,7 @@ public class FSSObsURIFilter extends URIFilter {
* @param stations * @param stations
* for FSSObs filter * for FSSObs filter
*/ */
public FSSObsURIFilter(String name, HashSet<String> stations) { public FSSObsURIFilter(String name, Set<String> stations) {
super(name); super(name);
logger.info("FSSObsFilter " + name + " Filter construction..."); logger.info("FSSObsFilter " + name + " Filter construction...");
setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" }); setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" });
@ -96,19 +100,30 @@ public class FSSObsURIFilter extends URIFilter {
String[] tokens = pat.split(st); String[] tokens = pat.split(st);
setStn(tokens[0]); setStn(tokens[0]);
setDataType(tokens[1]); setDataType(tokens[1]);
if (getDataType().equals(StnType.METAR.name())) { switch (getDataType()) {
case ObConst.METAR:
setMetarPattern(); setMetarPattern();
getMatchURIs().put(getMetarPattern(), 0l); getMatchURIs().put(getMetarPattern(), 0l);
} break;
if (getDataType().equals(StnType.MARITIME.name())) { case ObConst.MARITIME:
setMaritimePattern(); setMaritimePattern();
getMatchURIs().put(getMaritimePattern(), 0l); getMatchURIs().put(getMaritimePattern(), 0l);
} break;
if (getDataType().equals(StnType.MESONET.name())) { case ObConst.MESONET:
setMesowestPattern(); setMesowestPattern();
getMatchURIs().put(getMesowestPattern(), 0l); getMatchURIs().put(getMesowestPattern(), 0l);
break;
default:
statusHandler.error("Get unknown data type " + getDataType());
break;
} }
} }
String[] repTyps = { ObConst.SYNOPTIC_SHIP, ObConst.DRIFTING_BUOY,
ObConst.SYNOPTIC_MAROB };
for (String rt : repTyps) {
setMovingPattern(rt);
getMatchURIs().put(getMovingPattern(), 0l);
}
} }
/** /**
@ -194,7 +209,6 @@ public class FSSObsURIFilter extends URIFilter {
return key; return key;
} }
} }
return null; return null;
} }
@ -265,7 +279,7 @@ public class FSSObsURIFilter extends URIFilter {
* @return MetarPattern * @return MetarPattern
*/ */
public Pattern getMetarPattern() { public Pattern getMetarPattern() {
return MetarPattern; return metarPattern;
} }
/** /**
@ -273,7 +287,7 @@ public class FSSObsURIFilter extends URIFilter {
*/ */
public void setMetarPattern() { public void setMetarPattern() {
// "/obs/2010-11-01_14:15:00.0/METAR<SPECI???>/null/K0A9/36.371/-82.173" // "/obs/2010-11-01_14:15:00.0/METAR<SPECI???>/null/K0A9/36.371/-82.173"
MetarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator metarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator
+ wildCard + uriSeperator + "null" + uriSeperator + getStn() + wildCard + uriSeperator + "null" + uriSeperator + getStn()
+ uriSeperator); + uriSeperator);
} }
@ -284,15 +298,15 @@ public class FSSObsURIFilter extends URIFilter {
* @return MaritimePattern * @return MaritimePattern
*/ */
public Pattern getMaritimePattern() { public Pattern getMaritimePattern() {
return MaritimePattern; return maritimePattern;
} }
/** /**
* Sets Maritime Pattern * Sets Maritime Pattern
*/ */
public void setMaritimePattern() { public void setMaritimePattern() {
// /sfcobs/2010-10-28_10:36:00.0/1004/null/BEPB6/32.373/-64.703 // /sfcobs/2010-10-28_10:36:00.0/1004[5]/null/BEPB6/32.373/-64.703
MaritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator maritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator
+ wildCard + uriSeperator + "null" + uriSeperator + getStn() + wildCard + uriSeperator + "null" + uriSeperator + getStn()
+ uriSeperator); + uriSeperator);
} }
@ -303,7 +317,7 @@ public class FSSObsURIFilter extends URIFilter {
* @return the mesowestPattern * @return the mesowestPattern
*/ */
public Pattern getMesowestPattern() { public Pattern getMesowestPattern() {
return MesowestPattern; return mesowestPattern;
} }
/** /**
@ -313,12 +327,34 @@ public class FSSObsURIFilter extends URIFilter {
* the mesowestPattern to set * the mesowestPattern to set
*/ */
public void setMesowestPattern() { public void setMesowestPattern() {
// There is no dataURI for ldadmesonet data
// /ldadmesonet/2011-06-29_22:10:00.0/mesonet/NWSRAWS/RINN4/41.1181/-74.2403 // /ldadmesonet/2011-06-29_22:10:00.0/mesonet/NWSRAWS/RINN4/41.1181/-74.2403
MesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard mesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard
+ uriSeperator + wildCard + uriSeperator + wildCard + uriSeperator + wildCard + uriSeperator + wildCard
+ uriSeperator + getStn()); + uriSeperator + getStn());
} }
/**
* Gets pattern for moving platforms and MAROBs
*
* @return
*/
public Pattern getMovingPattern() {
return movingPattern;
}
/**
* Sets pattern for ships "1003", drifting buoys "1006" and MAROBs "1007".
*
* @param reportType
*/
public void setMovingPattern(String reportType) {
// /sfcobs/2010-10-28_10:36:00.0/1003<6,7>/null/BEPB6/32.373/-64.703
this.movingPattern = Pattern.compile("/sfcobs/" + wildCard
+ uriSeperator + reportType + uriSeperator + wildCard
+ uriSeperator);
}
/** /**
* Gets station name * Gets station name
* *

View file

@ -19,24 +19,31 @@
**/ **/
package com.raytheon.uf.edex.plugin.fssobs; package com.raytheon.uf.edex.plugin.fssobs;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Scanner; import java.util.Scanner;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.ISpatialQuery; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.wxmath.CalcRH;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
import com.raytheon.uf.edex.pointdata.PointDataQuery; import com.raytheon.uf.edex.pointdata.PointDataQuery;
/** /**
* Get METAR and Maritime data records * Utilities for FSSObs data records.
* *
* <pre> * <pre>
* *
@ -52,6 +59,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
* Jan 06, 2014 2653 skorolev Corrected decoding of snincrHourly and snincrTotal. * Jan 06, 2014 2653 skorolev Corrected decoding of snincrHourly and snincrTotal.
* Apr 28, 2014 3086 skorolev Updated getStations method. * Apr 28, 2014 3086 skorolev Updated getStations method.
* Sep 04, 2014 3220 skorolev Removed getStations method. * Sep 04, 2014 3220 skorolev Removed getStations method.
* Sep 18, 2015 3873 skorolev Removed identical constant definitions.
* *
* </pre> * </pre>
* *
@ -63,40 +71,70 @@ public class FSSObsUtils {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FSSObsUtils.class); .getHandler(FSSObsUtils.class);
/** Centigrade -> Kelvin */ /** FAHRENHEIT -> CELSIUS */
public static final float TMCK = 273.15f; private static final UnitConverter fToC = NonSI.FAHRENHEIT
.getConverterTo(SI.CELSIUS);
/** /** CELSIUS --> KELVIN */
* Value of missed data. private static final UnitConverter cToK = SI.CELSIUS
*/ .getConverterTo(SI.KELVIN);
public static final float MISSING = -9999.0f;
/** /** Knots --> kilometers per hour */
* The constant representing the sky condition for sky clear private static final UnitConverter knotToKph = NonSI.KNOT
*/ .getConverterTo(NonSI.KILOMETERS_PER_HOUR);
private static final int SKC_SKY_CONDITION = 9999999;
/** private static final float defaultCeiling = 1e20f;
* The constant representing the sky condition for clear sky
*/
private static final int CLR_SKY_CONDITION = 8888888;
/** Plug-in name **/ // ----------- Constants required for Frostbite time calculation.---------:
private enum Plgn {
obs, sfcobs, ldadmesonet // Temperature must be lower than -4.8C (23F) to avoid a calculation error
}; private static final float frostbiteTempMax = -4.8f;
private static final float f1 = -24.5f;
private static final float f2 = 0.667f;
private static final float f3 = 2111f;
private static final float f4 = -1.668f;
// ----------- Constants required for Wind Chill -------------:
private static float wctMax = 16.0f;
private static float defaultWct = 1e37f;
private static float windSpdMin = 6.4f;
private static float windSpdMax = 128.75f;
private static float wc1 = 0.16f;
private static float wc2 = 13.12f;
private static float wc3 = 0.6215f;
private static float wc4 = 11.37f;
private static float wc5 = 0.3965f;
/** plug-in for METAR data */
private static final String OBS = "obs";
/** plug-in for MARITIME data */
private static final String SFCOBS = "sfcobs";
/** plug-in for MESONET data */
private static final String LDADMESONET = "ldadmesonet";
/** Selected column in database **/ /** Selected column in database **/
private static String slct = "dataURI"; private static final String SLCT = "dataURI";
/** Equal sign **/ /** Equal sign **/
private static String equ = "="; private static final String EQU = "=";
/** Database **/ /** Database **/
private static String db = "metadata"; private static final String METADATA = "metadata";
/** SQL expression **/
private static String sqlexp = "select name from common_obs_spatial where ( catalogtype=1 or catalogtype=33 or catalogtype = 32 or catalogtype = 1000) and stationid = '";
/** /**
* Constructor * Constructor
@ -118,9 +156,9 @@ public class FSSObsUtils {
PointDataQuery request = null; PointDataQuery request = null;
PointDataContainer result = null; PointDataContainer result = null;
try { try {
request = new PointDataQuery(Plgn.obs.toString()); request = new PointDataQuery(OBS);
request.requestAllLevels(); request.requestAllLevels();
request.addParameter(slct, uri, equ); request.addParameter(SLCT, uri, EQU);
request.setParameters(FSSObsDataTransform.OBS_PARAMS_LIST); request.setParameters(FSSObsDataTransform.OBS_PARAMS_LIST);
result = request.execute(); result = request.execute();
if (result != null) { if (result != null) {
@ -133,21 +171,34 @@ public class FSSObsUtils {
} }
/** /**
* Gets station name from database. * Gets descriptive station name from database. Returns Null if not found.
* *
* @param stnId * @param stnId
* @return station name * @return station name
*/ */
public static String getStationName(String stnId) { public static String getStationName(String stnId) {
CoreDao dao = null;
dao = new CoreDao(DaoConfig.forDatabase(METADATA));
String retVal = null; String retVal = null;
ISpatialQuery sq = null; /**
String sql = sqlexp + stnId + "'"; * SQL expression METAR CAT_TYPE_ICAO = 1; Known ship identifications -
* Mobile no lat/lon CAT_TYPE_SHIP_MOB = 30 Drifting buoy locations
* CAT_TYPE_BUOY_MOB = 31; Moored (Fixed) buoy locations
* CAT_TYPE_BUOY_FXD = 32; Coastal Marine (CMAN) locations CAT_TYPE_CMAN
* = 33; CAT_TYPE_MESONET = 1000; MESONET_NWSFAA = 1001?;
*/
String sql = "select name from common_obs_spatial where catalogtype in (1, 30, 31, 32, 33, 1000) and stationid = :stationid";
try { try {
sq = SpatialQueryFactory.create(); Map<String, Object> paramMap = new HashMap<>(1, 1);
Object[] results = sq.dbRequest(sql, db); paramMap.put("stationid", stnId);
retVal = (String) results[0]; Object[] results = dao.executeSQLQuery(sql, paramMap);
if (results.length > 0) {
retVal = (String) results[0];
}
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler.handle(Priority.ERROR,
"Could not get station name for station id: " + stnId, e);
} }
return retVal; return retVal;
} }
@ -165,8 +216,8 @@ public class FSSObsUtils {
PointDataQuery request = null; PointDataQuery request = null;
PointDataContainer result = null; PointDataContainer result = null;
try { try {
request = new PointDataQuery(Plgn.sfcobs.toString()); request = new PointDataQuery(SFCOBS);
request.addParameter(slct, uri, equ); request.addParameter(SLCT, uri, EQU);
request.setParameters(FSSObsDataTransform.SFCOBS_PARAMS_LIST); request.setParameters(FSSObsDataTransform.SFCOBS_PARAMS_LIST);
result = request.execute(); result = request.execute();
if (result != null) { if (result != null) {
@ -195,9 +246,8 @@ public class FSSObsUtils {
try { try {
Map<String, RequestConstraint> rcMap = RequestConstraint Map<String, RequestConstraint> rcMap = RequestConstraint
.toConstraintMapping(DataURIUtil.createDataURIMap(uri)); .toConstraintMapping(DataURIUtil.createDataURIMap(uri));
// Not actually in db
rcMap.remove("pluginName"); rcMap.remove("pluginName");
request = new PointDataQuery(Plgn.ldadmesonet.toString()); request = new PointDataQuery(LDADMESONET);
for (Entry<String, RequestConstraint> entry : rcMap.entrySet()) { for (Entry<String, RequestConstraint> entry : rcMap.entrySet()) {
RequestConstraint rc = entry.getValue(); RequestConstraint rc = entry.getValue();
String value = rc.getConstraintValue(); String value = rc.getConstraintValue();
@ -209,7 +259,6 @@ public class FSSObsUtils {
if (result != null) { if (result != null) {
recFromMesowest = FSSObsDataTransform recFromMesowest = FSSObsDataTransform
.fromLdadmesowestRecord(result); .fromLdadmesowestRecord(result);
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
@ -228,18 +277,18 @@ public class FSSObsUtils {
* @return -- time in minutes * @return -- time in minutes
*/ */
public static float calcFrostbiteTime(float windspeedKPH, float temperatureC) { public static float calcFrostbiteTime(float windspeedKPH, float temperatureC) {
float fbMinutes = MISSING; float fbMinutes = ObConst.MISSING;
// Temperature must be lower than -4.8C (23F) to avoid a calculation // Temperature must be lower than -4.8C (23F) to avoid a calculation
// error (a negative number to -1.668 power is NAN) // error (a negative number to -1.668 power is NAN)
if (temperatureC < -4.8) if (temperatureC < frostbiteTempMax)
fbMinutes = ((-24.5f * ((0.667f * windspeedKPH) + 4.8f)) + 2111f) fbMinutes = ((f1 * ((f2 * windspeedKPH) + frostbiteTempMax)) + f3)
* (float) Math.pow((-4.8 - temperatureC), -1.668); * (float) Math.pow((frostbiteTempMax - temperatureC), f4);
else else
return MISSING; return ObConst.MISSING;
// Check for frost bite boundaries // Check for frost bite boundaries
if (!(fbMinutes <= 30 && windspeedKPH > 25.0 && windspeedKPH <= 80.5)) if (!(fbMinutes <= 30 && windspeedKPH > 25.0 && windspeedKPH <= 80.5))
fbMinutes = MISSING; fbMinutes = ObConst.MISSING;
return fbMinutes; return fbMinutes;
} }
@ -255,19 +304,18 @@ public class FSSObsUtils {
public static float calcWindChill(float temp, float windSpd) { public static float calcWindChill(float temp, float windSpd) {
float spd; float spd;
/* arbitrarily do the calculation only for temps at or below 60F */ /* arbitrarily do the calculation only for temps at or below 60F */
if (temp > 16.) if (temp > wctMax)
return 1e37f; return defaultWct;
/* no chilling if speed < 4 mph = 6.44km/h */ /* no chilling if speed < 4 mph = 6.44km/h */
if (windSpd < 6.4) if (windSpd < windSpdMin)
return temp; return temp;
/* peg speed at 80 mph (= 128.75 km/h) */ /* peg speed at 80 mph (= 128.75 km/h) */
if (windSpd > 128.75) if (windSpd > windSpdMax)
spd = 128.75f; spd = 128.75f;
else else
spd = windSpd; spd = windSpd;
spd = (float) Math.pow(spd, 0.16); spd = (float) Math.pow(spd, wc1);
float windChillTemp = 13.12f + 0.6215f * temp - 11.37f * spd + 0.3965f float windChillTemp = wc2 + wc3 * temp - wc4 * spd + wc5 * temp * spd;
* temp * spd;
return windChillTemp; return windChillTemp;
} }
@ -275,7 +323,8 @@ public class FSSObsUtils {
* This method calculates a floating point number representing the ceiling. * This method calculates a floating point number representing the ceiling.
* By definition, the ceiling is the lowest overcast or broken cloud layer, * By definition, the ceiling is the lowest overcast or broken cloud layer,
* so the method looks for the lowest layer that matches a BKN or OVC * so the method looks for the lowest layer that matches a BKN or OVC
* condition, and returns that layer. * condition, and returns that
* layer(http://www.srh.noaa.gov/srh/dad/sfc/chapter5.pdf).
* *
* @param skyCov * @param skyCov
* -- the set of sky coverage data * -- the set of sky coverage data
@ -283,29 +332,31 @@ public class FSSObsUtils {
*/ */
public static float findMetarCeilingFromLayers(String[] skyCov, public static float findMetarCeilingFromLayers(String[] skyCov,
Number[] levels) { Number[] levels) {
float ceiling = 1e20f; float ceiling = defaultCeiling;
// Find a ceiling in a METAR report. for (int i = 0; i < skyCov.length; i++) {
try { String sc = skyCov[i];
for (int i = 0; i < skyCov.length; i++) { // SCT = scattered ???
String sc = skyCov[i]; switch (sc) {
// SCT ??? case "CLR":
if (sc.equals("CLR")) { ceiling = ObConst.CLR_SKY_CONDITION;
ceiling = CLR_SKY_CONDITION; break;
break; case "SKC":
} else if (sc.equals("SKC")) { ceiling = ObConst.SKC_SKY_CONDITION;
ceiling = SKC_SKY_CONDITION; break;
break; case "BKN":
} else if ((sc.equals("BKN")) || (sc.equals("OVC"))) { case "OVC":
if (levels[i] != null) { if (levels[i] != null) {
ceiling = levels[i].floatValue() / 100f; ceiling = levels[i].floatValue() / 100f;
break;
}
} }
break;
case "":
break;
default:
statusHandler.error("Get unknown sky cover " + sc);
break;
} }
} catch (RuntimeException e) {
// ignore cloud cover that is null
} }
return ceiling >= 1e20f ? MISSING : ceiling; return ceiling >= defaultCeiling ? ObConst.MISSING : ceiling;
} }
/** /**
@ -313,26 +364,18 @@ public class FSSObsUtils {
* Fahrenheit. * Fahrenheit.
* *
* @param dewpoint * @param dewpoint
* in F * in Farenheit
* @param temperature * @param temperature
* in F * in Farenheit
* @return -- calculated Relative Humidity in % * @return -- calculated Relative Humidity in %
*/ */
public static Float getRH(float dewpoint, float temperature) { public static Float getRH(float dewpoint, float temperature) {
float retVal = MISSING; float retVal = ObConst.MISSING;
// From http://www.hpc.ncep.noaa.gov/html/dewrh.shtml if (dewpoint != ObConst.MISSING && temperature != ObConst.MISSING) {
// to Celsius // convert to Celsius:
if (dewpoint != MISSING && temperature != MISSING) { float temp = (float) fToC.convert(temperature);
float temp = (100f / (212f - 32f)) * (temperature - 32f); float dwpt = (float) fToC.convert(dewpoint);
float dwpt = (100f / (212f - 32f)) * (dewpoint - 32f); retVal = CalcRH.calcrh(temp, dwpt);
// saturation vapor pressure
float c = (float) (6.11 * Math.pow(10,
((7.5 * temp / (237.7 + temp)))));
// actual vapor pressure
float d = (float) (6.11 * Math.pow(10,
((7.5 * dwpt / (237.7 + dwpt)))));
// relative humidity
retVal = (d / c) * 100;
} }
return retVal; return retVal;
} }
@ -351,7 +394,7 @@ public class FSSObsUtils {
// is set at 40F and wind speed between 14 and 43 knts) : // is set at 40F and wind speed between 14 and 43 knts) :
float[] retVal = new float[5]; float[] retVal = new float[5];
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
retVal[i] = MISSING; retVal[i] = ObConst.MISSING;
} }
float temp = tableRow.getTemperature(); float temp = tableRow.getTemperature();
float windspd = tableRow.getWindSpeed(); float windspd = tableRow.getWindSpeed();
@ -381,36 +424,13 @@ public class FSSObsUtils {
} }
} }
sc.close(); sc.close();
if ((temp != MISSING) && (temp < 4.4f) if (temp != ObConst.MISSING && windspd != ObConst.MISSING) {
// 277.6 K = 40 F = 4.44444 C float speedKPH = (float) knotToKph.convert(windspd);
&& (windspd != MISSING)
&& (windspd <= 43.0f && windspd >= 14.0f)) {
float speedKPH = windspd * 1.6f;
// in Kelvin // in Kelvin
retVal[3] = calcWindChill(temp, speedKPH) + TMCK; retVal[3] = (float) cToK.convert(calcWindChill(
(float) fToC.convert(temp), speedKPH));
// in minutes // in minutes
retVal[4] = calcFrostbiteTime(speedKPH, temp); retVal[4] = calcFrostbiteTime(speedKPH, (float) fToC.convert(temp));
}
return retVal;
}
/**
* Routine to calculate dewpoint depression from temperature and relative
* humidity.
*
* @param TK
* - temperature in K
* @param RH
* - relative humidity in %
* @return dewpoint depression in C
*/
public static float getDpDepression(float TK, float RH) {
float retVal = MISSING;
if (RH != MISSING && TK != MISSING) {
float rhqc = Math.min(100.0f, Math.max(1.0f, RH));
float b = (float) (0.0091379024f * TK + 6106.396f / TK - Math
.log(rhqc / 100.0f));
retVal = (float) (TK - (b - Math.sqrt((b * b - 223.1986)) / 0.0182758048f));
} }
return retVal; return retVal;
} }

View file

@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.edex.urifilter.URIGenerateMessage;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -44,6 +45,7 @@ import com.raytheon.uf.edex.plugin.fssobs.FSSObsUtils;
* Nov 19, 2010 skorolev Initial creation * Nov 19, 2010 skorolev Initial creation
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Aug 30, 2013 2298 rjpeter Make getPluginName abstract
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUse from data set. * Sep 04, 2014 3220 skorolev Removed cwa and monitorUse from data set.
* Sep 18, 2015 3873 skorolev Removed identical constant definitions.
* *
* </pre> * </pre>
* *
@ -106,19 +108,19 @@ public class FSSObsConfig {
e); e);
} }
} }
if (tableRow.getRelativeHumidity() == FSSObsUtils.MISSING) { if (tableRow.getRelativeHumidity() == ObConst.MISSING) {
Float RH = FSSObsUtils.getRH(tableRow.getDewpoint(), Float RH = FSSObsUtils.getRH(tableRow.getDewpoint(),
tableRow.getTemperature()); tableRow.getTemperature());
tableRow.setRelativeHumidity(RH); tableRow.setRelativeHumidity(RH);
} }
float[] snowData = FSSObsUtils.getSnowData(tableRow); float[] snowData = FSSObsUtils.getSnowData(tableRow);
if ((tableRow.getTemperature() != FSSObsUtils.MISSING) if ((tableRow.getTemperature() != ObConst.MISSING)
&& (tableRow.getDewpoint() != FSSObsUtils.MISSING)) { && (tableRow.getDewpoint() != ObConst.MISSING)) {
// TODO to check if this is correct. calcdpd() in Meteolib // TODO to check if this is correct. calcdpd() in Meteolib
tableRow.setDewpointDepr(tableRow.getTemperature() tableRow.setDewpointDepr(tableRow.getTemperature()
- tableRow.getDewpoint()); - tableRow.getDewpoint());
} else { } else {
tableRow.setDewpointDepr(FSSObsUtils.MISSING); tableRow.setDewpointDepr(ObConst.MISSING);
} }
tableRow.setSnincrHourly(snowData[0]); tableRow.setSnincrHourly(snowData[0]);
tableRow.setSnincrTotal(snowData[1]); tableRow.setSnincrTotal(snowData[1]);

View file

@ -43,6 +43,8 @@
#20150820 DR 17915 mporricelli Add pattern for GFS229 (1 deg GFS) #20150820 DR 17915 mporricelli Add pattern for GFS229 (1 deg GFS)
#20150827 4687 skorolev Add pattern for ECMWF station-based MOS text bulletins #20150827 4687 skorolev Add pattern for ECMWF station-based MOS text bulletins
#20150930 4930 rferrel Corrected patterns for intlsigmets. #20150930 4930 rferrel Corrected patterns for intlsigmets.
#20151008 4958 dgilling Add pattern for NationalBlend
#*************************************************************** #***************************************************************
# AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw # AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw
# PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001 # PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001
@ -849,6 +851,10 @@ ANY ^(NWUS64) KWNS (..)(..)(..)
EXP (.*wcl_decrypted.*) EXP (.*wcl_decrypted.*)
FILE -overwrite -log -close -edex \1 FILE -overwrite -log -close -edex \1
# DR 4958: NationalBlend model
NGRID ^(L[ABCDEFGHRTW]AZ9[0-9]) (KWEA) (..)(..)(..)[^!]*!(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
# === Encrypted ECMWF station-based MOS text bulletins # === Encrypted ECMWF station-based MOS text bulletins
# FOUS39 KWNO 050000 /pMETWC1 # FOUS39 KWNO 050000 /pMETWC1
# FEAK48 KWNO 041200 /pMEXAFC # FEAK48 KWNO 041200 /pMEXAFC