From a2c9879dbce90bfcd9112690f8a7a094ab4f6bcc Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Wed, 9 Sep 2015 11:27:51 -0500 Subject: [PATCH 01/14] Omaha #4858: Do not allow GFE to publish grids, transmit/generate text products or use ISC mode when DRT mode is enabled for operational mode. Change-Id: Iefe86516fa941d6043b12fa6c7cebdd0803feff6 Former-commit-id: 5461d2ce24a95372902d58c8c8d43963d93ccd36 --- .../gfe/userPython/utilities/SmartScript.py | 12 +- cave/com.raytheon.viz.gfe/plugin.xml | 34 +++- .../gfe/actions/FormatterlauncherAction.java | 13 +- .../viz/gfe/actions/IscSendEnableHandler.java | 52 +++-- .../actions/ShowIscRequestReplyDialog.java | 96 ++++++++++ .../gfe/actions/ShowProductScriptsDialog.java | 18 +- .../viz/gfe/actions/ShowPublishDialog.java | 24 ++- .../gfe/actions/ShowSendIscGridsDialog.java | 99 ++++++++++ .../raytheon/viz/gfe/core/DataManager.java | 68 ++++++- .../raytheon/viz/gfe/core/parm/ParmOp.java | 23 ++- .../viz/gfe/dialogs/ProductScriptsDialog.java | 67 ++++--- .../formatterlauncher/ProductAreaComp.java | 22 ++- .../formatterlauncher/ProductEditorComp.java | 11 +- .../formatterlauncher/StoreTransmitDlg.java | 16 +- .../viz/gfe/dialogs/isc/SendISCDialog.java | 13 +- .../raytheon/viz/gfe/menu/ISCMenuEnabler.java | 177 ------------------ .../perspective/GFEPerspectiveManager.java | 53 ++++-- .../viz/gfe/textformatter/FormatterUtil.java | 26 ++- .../viz/warngen/gui/WarngenAction.java | 16 +- 19 files changed, 537 insertions(+), 303 deletions(-) create mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowIscRequestReplyDialog.java create mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java delete mode 100644 cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/menu/ISCMenuEnabler.java diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/SmartScript.py b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/SmartScript.py index 5ea6d69c43..c2c0aaed78 100644 --- a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/SmartScript.py +++ b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/utilities/SmartScript.py @@ -65,6 +65,7 @@ # time regardless of setting of os.environ['TZ'] # Jan 13, 2015 3955 randerso Added optional parameter to availableParms to specify desired databases. # Fixed createGrid to accept a DatabaseID for model +# Sep 11, 2015 4858 dgilling Remove notification processing from publishElements. ######################################################################## import types, string, time, sys from math import * @@ -1915,16 +1916,7 @@ class SmartScript(BaseTool.BaseTool): cgr = CommitGridRequest(parm.getParmID(), publishTimeRange.toJavaObj()) requests.add(cgr) - resp = self.__dataMgr.getClient().commitGrid(requests) - r = resp.getPayload() - size = r.size() - for x in range(size): - notify = r.get(x) - pid = notify.getParmId() - p = self.__parmMgr.getParm(pid) - if not p: - p = self.__parmMgr.addParm(pid, False, False) - p.inventoryArrived(notify.getReplacementTimeRange(), notify.getHistories()) + self.__parmOp.publish(requests) def combineMode(self): from com.raytheon.viz.gfe.core.parm import ParmState diff --git a/cave/com.raytheon.viz.gfe/plugin.xml b/cave/com.raytheon.viz.gfe/plugin.xml index 4beb0e8e84..f9ccdabbb3 100644 --- a/cave/com.raytheon.viz.gfe/plugin.xml +++ b/cave/com.raytheon.viz.gfe/plugin.xml @@ -149,6 +149,12 @@ + + + + + + + + + + + + + + + + @@ -1303,7 +1327,15 @@ name="com.raytheon.viz.gfe.separator2" visible="true"> - + + + diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java index 60bac4802b..bf7967d576 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java @@ -28,6 +28,7 @@ import org.eclipse.ui.PlatformUI; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Displays Formatter Launcher dialog. @@ -42,6 +43,8 @@ import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; * Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog. * Apr 24, 2013 1936 dgilling Pass DataManager to * FormatterLauncherDialog via constructor. + * Sep 15, 2015 4858 dgilling Prevent dialog from being launched in DRT + * mode. * * * @@ -62,10 +65,16 @@ public class FormatterlauncherAction extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "Formatter Launcher"); + return null; + } if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); DataManager dm = DataManagerUIFactory.getCurrentInstance(); dialog = new FormatterLauncherDialog(shell, dm); dialog.setBlockOnOpen(false); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/IscSendEnableHandler.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/IscSendEnableHandler.java index 080e0fb74e..5aca08793c 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/IscSendEnableHandler.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/IscSendEnableHandler.java @@ -24,15 +24,23 @@ import java.util.Map; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; import org.eclipse.ui.commands.IElementUpdater; import org.eclipse.ui.menus.UIElement; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.core.msgs.ISCSendStatusChangedMsg; import com.raytheon.viz.gfe.core.msgs.Message; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** - * TODO Add Description + * Menu handler for enabling and disabling send of ISC grids from GFE client. * *
  * 
@@ -40,6 +48,7 @@ import com.raytheon.viz.gfe.core.msgs.Message;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Mar 25, 2010            randerso     Initial creation
+ * Sep 15, 2015  #4858     dgilling     Add isEnabled.
  * 
  * 
* @@ -50,36 +59,43 @@ import com.raytheon.viz.gfe.core.msgs.Message; public class IscSendEnableHandler extends AbstractHandler implements IElementUpdater { - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. - * ExecutionEvent) - */ + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(getClass()); + @Override public Object execute(ExecutionEvent event) throws ExecutionException { - DataManager dm = DataManager.getCurrentInstance(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "ISC Send Enable"); + return null; + } + + DataManager dm = DataManagerUIFactory.getCurrentInstance(); if (dm != null) { boolean newState = !Message.inquireLastMessage( ISCSendStatusChangedMsg.class).isEnabled(); - dm.enableISCsend(newState); + try { + dm.enableISCsend(newState); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + } } return null; } - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.commands.IElementUpdater#updateElement(org.eclipse.ui. - * menus.UIElement, java.util.Map) - */ + @Override + public boolean isEnabled() { + DataManager dm = DataManagerUIFactory.getCurrentInstance(); + return (dm != null) ? CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) + && dm.requestISC() : false; + } + @Override public void updateElement(UIElement element, Map parameters) { element.setChecked(Message.inquireLastMessage( ISCSendStatusChangedMsg.class).isEnabled()); } - } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowIscRequestReplyDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowIscRequestReplyDialog.java new file mode 100644 index 0000000000..6d88d5b06c --- /dev/null +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowIscRequestReplyDialog.java @@ -0,0 +1,96 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.viz.gfe.actions; + +import org.eclipse.core.commands.AbstractHandler; +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.viz.core.mode.CAVEMode; +import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; +import com.raytheon.viz.gfe.dialogs.isc.ISCRequestReplyDlg; +import com.raytheon.viz.ui.dialogs.ICloseCallback; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; + +/** + * Action to launch ISC request/reply dialog. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Sep 15, 2015  #4858     dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public class ShowIscRequestReplyDialog extends AbstractHandler { + + private ISCRequestReplyDlg iscRequestDlg; + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "ISC Request/Reply"); + return null; + } + + if (iscRequestDlg == null || iscRequestDlg.getShell() == null + || iscRequestDlg.isDisposed()) { + iscRequestDlg = new ISCRequestReplyDlg(shell); + iscRequestDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + iscRequestDlg = null; + + } + }); + iscRequestDlg.open(); + } else { + iscRequestDlg.bringToTop(); + } + + return null; + } + + @Override + public boolean isEnabled() { + DataManager dm = DataManagerUIFactory.getCurrentInstance(); + if (dm != null) { + return (!dm.sendIscOnSave() || !dm.sendIscOnPublish()) + && CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) + && dm.requestISC(); + } + + return false; + } +} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java index 93b5ba9975..da2a424b6b 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java @@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Action to launch product generation script dialog. @@ -35,8 +37,9 @@ import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 6, 2008 Eric Babin Initial Creation + * Mar 6, 2008 Eric Babin Initial Creation * Oct 25, 2012 12878 rferrel Changes for non-blocking ProductScriptsDialog. + * Sep 21, 2015 4858 dgilling Disable in DRT mode. * * * @@ -56,15 +59,20 @@ public class ShowProductScriptsDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - DataManager dm = DataManager.getCurrentInstance(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "Product Scripts dialog"); + return null; + } + + DataManager dm = DataManagerUIFactory.getCurrentInstance(); if (dm == null) { return null; } if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - dialog = new ProductScriptsDialog(shell, dm); dialog.setBlockOnOpen(false); dialog.open(); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java index 8ce0df6218..7fb19b69b9 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java @@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.dialogs.PublishDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Action to launch publish to official dialog. @@ -35,8 +37,10 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 6, 2008 Eric Babin Initial Creation + * Mar 6, 2008 Eric Babin Initial Creation * Oct 25, 2012 1287 rferrel Changes for non-blocking PublishDialog. + * Sep 09, 2015 4858 dgilling Don't allow publishing when + * SimulatedTime is enabled. * * * @@ -45,6 +49,7 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog; */ public class ShowPublishDialog extends AbstractHandler { + private PublishDialog dialog; /* @@ -56,17 +61,21 @@ public class ShowPublishDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - DataManager dm = DataManager.getCurrentInstance(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "Publish Grids to Official"); + return null; + } + DataManager dm = DataManagerUIFactory.getCurrentInstance(); if (dm == null) { return null; } if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - - PublishDialog dialog = new PublishDialog(shell, dm); + dialog = new PublishDialog(shell, dm); dialog.setBlockOnOpen(false); dialog.open(); } else { @@ -87,12 +96,11 @@ public class ShowPublishDialog extends AbstractHandler { return false; } - DataManager dm = DataManager.getCurrentInstance(); + DataManager dm = DataManagerUIFactory.getCurrentInstance(); if (dm != null) { return !dm.getParmManager().getMutableDatabase() .equals(dm.getParmManager().getProductDB()); } return false; } - } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java new file mode 100644 index 0000000000..17e22a4626 --- /dev/null +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java @@ -0,0 +1,99 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.viz.gfe.actions; + +import org.eclipse.core.commands.AbstractHandler; +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.viz.core.mode.CAVEMode; +import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; +import com.raytheon.viz.gfe.dialogs.isc.SendISCDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; + +/** + * Action to launch Send ISC grids dialog. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Sep 15, 2015  #4858     dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public class ShowSendIscGridsDialog extends AbstractHandler { + + private SendISCDialog dialog; + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. + * ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "Send ISC grids"); + return null; + } + + DataManager dm = DataManagerUIFactory.getCurrentInstance(); + if (dm == null) { + return null; + } + + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dialog = new SendISCDialog(shell, dm); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } + + return null; + } + + @Override + public boolean isEnabled() { + DataManager dm = DataManagerUIFactory.getCurrentInstance(); + if (dm != null) { + return (!dm.sendIscOnSave() || !dm.sendIscOnPublish()) + && CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) + && dm.requestISC(); + } + + return false; + } +} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java index 7f5c9126a3..7635de468d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/DataManager.java @@ -48,6 +48,8 @@ import com.raytheon.uf.common.python.PythonScript; 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.common.time.ISimulatedTimeChangeListener; +import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.exception.VizException; @@ -75,6 +77,8 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolFactory; import com.raytheon.viz.gfe.smarttool.script.SmartToolJobPool; import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController; import com.raytheon.viz.gfe.textformatter.TextProductManager; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * DataManager is the central singleton in GFE upon which other managers are @@ -104,6 +108,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * 09/09/2014 3592 randerso Added call to SampleSetManager.dispose() * 10/30/2014 3775 randerso Added parmCacheInit to initStatus * 04/20/2015 4027 randerso Let TextProductManager know we are not running in a GUI + * 09/15/2015 4858 dgilling Disable ISC when DRT mode is enabled. * * * @@ -111,7 +116,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * @version 1.0 */ -public class DataManager { +public class DataManager implements ISimulatedTimeChangeListener { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(DataManager.class); @@ -204,6 +209,8 @@ public class DataManager { private final SmartToolJobPool toolJobPool; + private boolean previousIscSendState; + public IISCDataAccess getIscDataAccess() { return iscDataAccess; } @@ -270,8 +277,14 @@ public class DataManager { // set the ISC send state, which initially sends the message new ISCSendStatusChangedMsg(false).send(); // initial state - if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)) { - enableISCsend(true); + if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) + && ((SimulatedTime.getSystemTime().isRealTime())) + || (SimulatedTimeOperations.isTransmitAllowedinSimulatedTime())) { + try { + enableISCsend(true); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + } } // this.queryString = "siteID='" + this.getSiteID() + "'"; this.router.start(); @@ -282,6 +295,11 @@ public class DataManager { this.autoSaveJob = new AutoSaveJob(this); new ParmEvictor(); + + if (CAVEMode.getMode() == CAVEMode.OPERATIONAL) { + SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this); + } + this.previousIscSendState = clientISCSendStatus(); } /** @@ -333,6 +351,11 @@ public class DataManager { killPoolsThread.setDaemon(false); killPoolsThread.start(); + if (CAVEMode.getMode() == CAVEMode.OPERATIONAL) { + SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener( + this); + } + NotificationManagerJob.removeObserver("edex.alerts.gfe", router); } @@ -684,8 +707,15 @@ public class DataManager { * Sets the overall isc send capability for this user. * * @param state + * @throws SimulatedTimeProhibitedOperationException */ - public void enableISCsend(boolean state) { + public void enableISCsend(boolean state) + throws SimulatedTimeProhibitedOpException { + if (state && !SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("ISC Send"); + } + if (state == iscSendState) { return; // do nothing } @@ -721,4 +751,34 @@ public class DataManager { public SmartToolJobPool getSmartToolJobPool() { return toolJobPool; } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.time.ISimulatedTimeChangeListener#timechanged() + */ + @Override + public void timechanged() { + boolean tryToEnable = SimulatedTimeOperations.isTransmitAllowed(); + boolean newState; + if (tryToEnable) { + newState = previousIscSendState; + } else { + newState = false; + previousIscSendState = clientISCSendStatus(); + } + + try { + enableISCsend(newState); + } catch (SimulatedTimeProhibitedOpException e) { + /* + * We should never hit this state...but better to log something just + * in case. + */ + statusHandler.handle(Priority.WARN, + "ISC send status got into an invalid state trying to change state to " + + newState, e); + } + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmOp.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmOp.java index be29b4044c..fd1f6351d7 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmOp.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/parm/ParmOp.java @@ -69,6 +69,8 @@ import com.raytheon.viz.gfe.core.internal.IFPClient; import com.raytheon.viz.gfe.core.parm.Parm.InterpState; import com.raytheon.viz.gfe.core.parm.ParmState.InterpMode; import com.raytheon.viz.gfe.core.wxvalue.WxValue; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * A ParmOp provides global functions to affect all parms. @@ -89,6 +91,8 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue; * overlapping grids since this is now done on * the server side * 08/20/2014 #1664 randerso Fixed invalid thread access + * 09/15/2015 #4858 dgilling Disable publish and ISC send when DRT + * mode is enabled. * * * @@ -478,9 +482,17 @@ public class ParmOp { * Publish * * @param req + * @throws SimulatedTimeProhibitedOperationException */ - public void publish(List req) { + public void publish(List req) + throws SimulatedTimeProhibitedOpException { CAVEMode mode = CAVEMode.getMode(); + + if (!SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("Publish GFE grids"); + } + if (mode.equals(CAVEMode.PRACTICE) || mode.equals(CAVEMode.TEST)) { statusHandler.handle(Priority.EVENTA, "PUBLISH Simulated. "); return; @@ -1057,10 +1069,17 @@ public class ParmOp { * This function is called to send grids. * * @param req + * @throws SimulatedTimeProhibitedOperationException */ - public void sendISC(List req) { + public void sendISC(List req) + throws SimulatedTimeProhibitedOpException { CAVEMode mode = CAVEMode.getMode(); + if (!SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("Send ISC grids"); + } + if (mode.equals(CAVEMode.PRACTICE) || mode.equals(CAVEMode.TEST)) { statusHandler.handle(Priority.EVENTA, "SEND ISC Simulated. "); return; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java index c02a3506d1..b2be2290ca 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java @@ -54,6 +54,7 @@ import com.raytheon.viz.gfe.smartscript.FieldDefinition.FieldType; import com.raytheon.viz.gfe.tasks.TaskManager; import com.raytheon.viz.gfe.ui.runtimeui.ValuesDialog; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; import com.raytheon.viz.ui.widgets.ToggleSelectList; /** @@ -63,18 +64,19 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Mar 7, 2008 Eric Babin Initial Creation + * Mar 7, 2008 Eric Babin Initial Creation * Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog. * Oct 25, 2012 1287 rferrel Code changes for non-blocking PublishDialog. * Nov 30, 2012 15575 ryu Added variable replacement for SelectedStart, * SelectedEnd, and home * Nov 13, 2012 1298 rferrel Code changes for non-blocking UserEntryDialog. - * Jan 9, 2013 15635 jdynina Allowed to mix and match entry dialogs. Changed order - * of dialogs to match A1 displaying entry fields first. + * Jan 9, 2013 15635 jdynina Allowed to mix and match entry dialogs. Changed order + * of dialogs to match A1 displaying entry fields first. * Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs. - * Oct 23, 2013 DR16203 equintin Restore the "-c" argument when the command + * Oct 23, 2013 DR16203 equintin Restore the "-c" argument when the command * for Png Images... is rebuilt after * return from the dialog. + * Sep 15, 2015 4858 dgilling Disable all features in DRT mode. * * * @@ -87,7 +89,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ProductScriptsDialog.class); - + private final int RUN_ID = IDialogConstants.CLIENT_ID + 1; private String[] scripts; @@ -146,7 +148,12 @@ public class ProductScriptsDialog extends CaveJFACEDialog { @Override protected void buttonPressed(int buttonId) { if (buttonId != IDialogConstants.CANCEL_ID) { - runScripts(); + if (SimulatedTimeOperations.isTransmitAllowed()) { + runScripts(); + } else { + SimulatedTimeOperations.displayFeatureLevelWarning(getShell(), + "Run Product Scripts"); + } } super.buttonPressed(buttonId); } @@ -209,7 +216,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { cmd = cmd.replace("{ztime}", curGMTTime); cmd = cmd.replace("{home}", gfeHome); cmd = cmd.replace("{prddir}", prddir); - + // The user is prompted to enter the value with which to replace // the // following variables: @@ -228,7 +235,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { int entryIdx = cmd.indexOf("{entry:"); if (entryIdx >= 0) { run = true; - + int endEntryIdx = cmd.indexOf("}", entryIdx); String[] entry = cmd.substring(entryIdx + 1, endEntryIdx) .split(":"); @@ -240,12 +247,11 @@ public class ProductScriptsDialog extends CaveJFACEDialog { // Keep this a blocking dialog so the loop will only display // one dialog at a time. - fieldDefs.add(new FieldDefinition((Object) entry[1], - entry[1], FieldType.ALPHANUMERIC, - (Object) entry[2], Arrays.asList(Arrays.asList( - configFile).toArray( - new Object[configFile.length])), - (float) 1.0, (int) 3)); + fieldDefs.add(new FieldDefinition(entry[1], entry[1], + FieldType.ALPHANUMERIC, entry[2], Arrays + .asList(Arrays.asList(configFile).toArray( + new Object[configFile.length])), + (float) 1.0, 3)); if (start == 0) { start = entryIdx; @@ -253,8 +259,9 @@ public class ProductScriptsDialog extends CaveJFACEDialog { start = entryIdx; } - if (entry[1].equals("ConfigFile")) { //DR 16203 eeq 10/23/2013 - endIdx = endEntryIdx; + if (entry[1].equals("ConfigFile")) { // DR 16203 eeq + // 10/23/2013 + endIdx = endEntryIdx; } } @@ -277,15 +284,15 @@ public class ProductScriptsDialog extends CaveJFACEDialog { fieldDefs .add(new FieldDefinition( - (Object) entry[1], + entry[1], entry[1], FieldType.RADIO, - (Object) fields[0], + fields[0], Arrays.asList(Arrays .asList(fields) .toArray( new Object[fields.length])), - (float) 1.0, (int) 3)); + (float) 1.0, 3)); if (start == 0) { start = entryIdx; } else if ((start > 0) && (start > entryIdx) @@ -318,7 +325,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { fieldDefs .add(new FieldDefinition( - (Object) entry[1], + entry[1], entry[1], FieldType.CHECK, (Object) null, @@ -326,7 +333,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { .asList(fields) .toArray( new Object[fields.length])), - (float) 1.0, (int) 3)); + (float) 1.0, 3)); if (start == 0) { start = entryIdx; } else if ((start > 0) && (start > entryIdx) @@ -356,16 +363,17 @@ public class ProductScriptsDialog extends CaveJFACEDialog { if (dlgOpen <= 0) { Map map = scriptDlg.getValues(); - + String returnMsg = ""; - + for (Map.Entry entry : map.entrySet()) { returnMsg = returnMsg + entry.getValue().toString() + " "; } - + if (endIdx > 0) { - cmd = cmd.replace(cmd.substring(start, endIdx+2), returnMsg); + cmd = cmd.replace(cmd.substring(start, endIdx + 2), + returnMsg); } else { start = start - 3; cmd = cmd.substring(0, start) + returnMsg; @@ -374,7 +382,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { } TaskManager.getInstance().createScriptTask(name, cmd); - + } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); @@ -403,7 +411,12 @@ public class ProductScriptsDialog extends CaveJFACEDialog { publishToOfficialButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - launchPublishToOfficial(); + if (SimulatedTimeOperations.isTransmitAllowed()) { + launchPublishToOfficial(); + } else { + SimulatedTimeOperations.displayFeatureLevelWarning( + getShell(), "Publish Grids to Official"); + } } }); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductAreaComp.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductAreaComp.java index d34b4a5f82..630686cf78 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductAreaComp.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductAreaComp.java @@ -35,6 +35,8 @@ import org.eclipse.swt.widgets.ProgressBar; import org.eclipse.swt.widgets.TabFolder; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; @@ -44,6 +46,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager; import com.raytheon.viz.gfe.textformatter.FormatterUtil; import com.raytheon.viz.gfe.textformatter.TextProductFinishListener; import com.raytheon.viz.gfe.textformatter.TextProductManager; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * Composite containing the product area and its controls. @@ -58,7 +61,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * 2 SEP 2011 10654 gzhou Delete running/pending task and close tab. * 23 MAY 2012 14859 ryu Select VTEC formatting in practice mode * based on VTECMessageType setting. - * 10 AUG 2012 15178 mli Add autoWrite and autoStore capability + * 10 AUG 2012 15178 mli Add autoWrite and autoStore capability * 26 SEP 2012 15423 ryu Fix product correction in practice mode * 15 MAY 2013 1842 dgilling Change constructor signature to accept a * DataManager instance. @@ -68,6 +71,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; * Passed dataMgr instance to FormatterUtil.runFormatterScript * 12 FEB 2014 2801 randerso Added prompting if formatter is run against non-normal database * 20 APR 2015 4027 randerso Fixes for GFE formatter auto tests to support mixed case WA + * 15 SEP 2015 4858 dgilling Handle exception from runFormatterScript. * * * @@ -77,6 +81,10 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager; */ public class ProductAreaComp extends Composite implements TextProductFinishListener, ITransmissionState { + + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(getClass()); + /** * Zone combiner image. */ @@ -404,10 +412,14 @@ public class ProductAreaComp extends Composite implements // Get the source database zoneCombiner.applyZoneCombo(); - FormatterUtil.runFormatterScript(dataMgr, - textProductMgr, productName, - dbId.toString(), vtecMode, - ProductAreaComp.this); + try { + FormatterUtil.runFormatterScript(dataMgr, + textProductMgr, productName, + dbId.toString(), vtecMode, + ProductAreaComp.this); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + } } } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductEditorComp.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductEditorComp.java index 24b932c211..0f86a5075d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductEditorComp.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/ProductEditorComp.java @@ -119,6 +119,7 @@ import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnu import com.raytheon.viz.gfe.product.ProductFileUtil; import com.raytheon.viz.gfe.product.TextDBUtil; import com.raytheon.viz.ui.dialogs.ICloseCallback; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Composite containing the product editor controls. @@ -145,7 +146,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Changes for non-blocking FindReplaceDlg. * Changes for non-blocking StoreTransmitDlg. * Changes for non-blocking WrapLengthDialog. - * 08 Feb 2013 12851 jzeng Add menuToAddTo in create*Menu + * 08 Feb 2013 12851 jzeng Add menuToAddTo in create*Menu * Create createEditorPopupMenu() * Add mouselistener in createTextControl() for StyledText * 28 Feb 2013 15889 ryu Removed detachAttributionPhrase and getVTECActionCodes @@ -168,6 +169,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * 04/20/2015 4027 randerso Renamed ProductStateEnum with an initial capital * Expunged Calendar from ActiveTableRecord * 08/10/2015 4721 randerso Changed getNNNid() to use the productID field (not textdbPil) + * 09/15/2015 4858 dgilling Disable store/transmit in DRT mode. * * * @author lvenable @@ -1082,9 +1084,14 @@ public class ProductEditorComp extends Composite implements * dialog. AUTOSTORE: implement autoStore */ private void storeTransmit(Action action) { + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayFeatureLevelWarning(getShell(), + "Text Product Store/Transmit"); + brain(); + return; + } ProductDataStruct pds = textComp.getProductDataStruct(); - if (pds == null) { String msg = "There is no product to transmit.\n\nAction cancelled."; MessageBox mb = new MessageBox(getShell(), SWT.OK diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java index 0485f26f6c..3dcb257751 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java @@ -60,6 +60,8 @@ import com.raytheon.viz.gfe.product.TextDBUtil; import com.raytheon.viz.gfe.vtec.GFEVtecUtil; import com.raytheon.viz.texteditor.util.VtecObject; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * Display the Store/Transmit dialog. @@ -89,6 +91,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Feb 26, 2015 4126 randerso Ensure transmit/store is properly cancelled if dialog is closed * Code cleanup * Apr 20, 2015 4027 randerso Renamed ProductStateEnum with an initial capital + * Sep 15, 2015 4858 dgilling Disable store/transmit in DRT mode. * * * @@ -432,6 +435,11 @@ public class StoreTransmitDlg extends CaveSWTDialog { transmitProduct(true); } } else { + if (!SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("Store/Transmit GFE text products"); + } + if (isStoreDialog) { TextDBUtil.storeProduct(pid, productText, parentEditor.isTestVTEC()); @@ -443,7 +451,11 @@ public class StoreTransmitDlg extends CaveSWTDialog { statusHandler.handle(Priority.CRITICAL, "Error preparing product for transmission.", e); sendTransmissionStatus(ConfigData.ProductStateEnum.Failed); - StoreTransmitDlg.this.parentEditor.revive(); + parentEditor.revive(); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + sendTransmissionStatus(ConfigData.ProductStateEnum.Failed); + parentEditor.brain(); } } @@ -621,7 +633,7 @@ public class StoreTransmitDlg extends CaveSWTDialog { } catch (VizException e) { statusHandler.handle(Priority.CRITICAL, "Error sending product", e); sendTransmissionStatus(ConfigData.ProductStateEnum.Failed); - this.parentEditor.revive(); + parentEditor.revive(); } SEQ_NUMBER++; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/isc/SendISCDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/isc/SendISCDialog.java index eee0c7bd8f..a3c4dbea30 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/isc/SendISCDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/isc/SendISCDialog.java @@ -44,6 +44,8 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.server.request.SendISCRequest; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.PythonPreferenceStore; @@ -52,6 +54,7 @@ import com.raytheon.viz.gfe.core.IParmManager; import com.raytheon.viz.gfe.core.ISelectTimeRangeManager; import com.raytheon.viz.gfe.core.parm.ParmOp; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; import com.raytheon.viz.ui.widgets.ToggleSelectList; /** @@ -66,6 +69,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * 08/20/09 1995 lvenable Initial creation * 09/02/09 #1370 randerso Make the same as PublishDialog * 10/26/2012 1287 rferrel Code cleanup for non-blocking dialog. + * 09/15/2015 4858 dgilling Handle exception from ParmOp.sendISC. * * * @@ -74,6 +78,9 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; */ public class SendISCDialog extends CaveJFACEDialog { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(getClass()); + private final int MAX_LIST_HEIGHT = 10; private final PythonPreferenceStore prefs = Activator.getDefault() @@ -438,7 +445,11 @@ public class SendISCDialog extends CaveJFACEDialog { // LogStream.logUse("Send ISC: ", requests); // send the data by calling the parm op command - parmOp.sendISC(requests); + try { + parmOp.sendISC(requests); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + } } protected TimeRange getTR(ParmID parm) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/menu/ISCMenuEnabler.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/menu/ISCMenuEnabler.java deleted file mode 100644 index 22c74f3edc..0000000000 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/menu/ISCMenuEnabler.java +++ /dev/null @@ -1,177 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.gfe.menu; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IContributionItem; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.CompoundContributionItem; - -import com.raytheon.viz.core.mode.CAVEMode; -import com.raytheon.viz.gfe.core.DataManager; -import com.raytheon.viz.gfe.core.DataManagerUIFactory; -import com.raytheon.viz.gfe.core.msgs.ISCSendStatusChangedMsg; -import com.raytheon.viz.gfe.core.msgs.Message; -import com.raytheon.viz.gfe.dialogs.isc.ISCRequestReplyDlg; -import com.raytheon.viz.gfe.dialogs.isc.SendISCDialog; - -/** - * Menu handler for enabling and disabling ISC related menu items - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 20, 2011            bphillip     Initial creation
- * Oct 25, 2012 1287       rferrel     Changes for non-blocking SendISCDialog
- *                                      and ISCRequestReplyDlg.
- * Aug 29, 2014 3527       mapeters     Check for current DataManager instance to not 
- *                                      be null before requesting ISC, updated deprecated
- *                                      {@link DataManager#getCurrentInstance()} calls.
- * 
- * 
- * - * @author bphillip - * @version 1.0 - */ - -public class ISCMenuEnabler extends CompoundContributionItem { - private SendISCDialog sendISCDlg; - - private ISCRequestReplyDlg iscRequestDlg; - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() - */ - @Override - protected IContributionItem[] getContributionItems() { - ActionContributionItem sendIntersiteItem = new ActionContributionItem( - new Action("Send Intersite Grids") { - public void run() { - Shell shell = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(); - - DataManager dm = DataManagerUIFactory - .getCurrentInstance(); - if (dm == null) { - return; - } - - if (sendISCDlg == null || sendISCDlg.getShell() == null - || sendISCDlg.isDisposed()) { - sendISCDlg = new SendISCDialog(shell, dm); - sendISCDlg.setBlockOnOpen(false); - sendISCDlg.open(); - } else { - sendISCDlg.bringToTop(); - } - } - - @Override - public boolean isEnabled() { - DataManager dm = DataManagerUIFactory - .getCurrentInstance(); - if (dm == null) { - return false; - } else { - return (!dm.sendIscOnSave() || !dm - .sendIscOnPublish()) - && CAVEMode.getMode().equals( - CAVEMode.OPERATIONAL) - && dm.requestISC(); - } - } - }); - - ActionContributionItem iscRequestReplyItem = new ActionContributionItem( - new Action("ISC Request/Reply") { - @Override - public boolean isEnabled() { - DataManager dm = DataManagerUIFactory - .getCurrentInstance(); - if (dm == null) { - return false; - } else { - return CAVEMode.getMode().equals( - CAVEMode.OPERATIONAL) - && dm.requestISC(); - } - } - - @Override - public void run() { - if (iscRequestDlg == null - || iscRequestDlg.getShell() == null - || iscRequestDlg.isDisposed()) { - Shell shell = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getShell(); - iscRequestDlg = new ISCRequestReplyDlg(shell); - iscRequestDlg.open(); - } else { - iscRequestDlg.bringToTop(); - } - } - - }); - - ActionContributionItem iscSendEnableItem = new ActionContributionItem( - new Action("ISC Send Enable", IAction.AS_CHECK_BOX) { - - @Override - public boolean isEnabled() { - return getIscEnabled(); - } - - public void run() { - DataManager dm = DataManagerUIFactory - .getCurrentInstance(); - if (dm != null) { - boolean newState = !Message.inquireLastMessage( - ISCSendStatusChangedMsg.class).isEnabled(); - dm.enableISCsend(newState); - } - } - - private boolean getIscEnabled() { - DataManager dm = DataManagerUIFactory - .getCurrentInstance(); - return (dm != null) ? CAVEMode.getMode().equals( - CAVEMode.OPERATIONAL) - && dm.requestISC() : false; - } - - public boolean isChecked() { - return Message.inquireLastMessage( - ISCSendStatusChangedMsg.class).isEnabled(); - } - }); - - return new IContributionItem[] { sendIntersiteItem, - iscRequestReplyItem, iscSendEnableItem }; - } -} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java index 4f666f77fb..9b97cb1a09 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java @@ -19,6 +19,7 @@ **/ package com.raytheon.viz.gfe.perspective; +import java.util.Arrays; import java.util.List; import org.eclipse.core.commands.Command; @@ -44,6 +45,7 @@ import org.eclipse.ui.keys.IBindingService; 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.common.time.ISimulatedTimeChangeListener; import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; @@ -53,7 +55,6 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.maps.MapManager; -import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.PythonPreferenceStore; import com.raytheon.viz.gfe.actions.FormatterlauncherAction; @@ -69,13 +70,14 @@ import com.raytheon.viz.ui.cmenu.ZoomMenuAction; import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.perspectives.AbstractCAVEPerspectiveManager; import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * Manages the life cycle of the GFE Perspectives - * + * * Installs a perspective watcher that handles the transitions in and out of the * GFE perspectives. - * + * *
  * SOFTWARE HISTORY
  * Date         Ticket#     Engineer    Description
@@ -91,17 +93,26 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
  * Dec 09, 2013     #2367   dgilling    Remove shutdown of ProcedureJob and
  *                                      SmartToolJob.
  * Jan 14, 2014      2594   bclement    added low memory notification
- * Aug 31, 2015    #17970   yteng       Notify user to close GFE if not in real-time
+ * Sep 21, 2015      4858   dgilling    Display warning message when DRT mode is enabled.
  * 
* * @author randerso * @version 1.0 */ -public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { +public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager + implements ISimulatedTimeChangeListener { + private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(GFEPerspectiveManager.class); + private static final String PERSPECTIVE_NAME = "GFE"; + + private static final List FEATURES_DISABLED_IN_SIM_TIME = Arrays + .asList("ISC send", "Publishing grids", + "Running text formatters and/or transmitting products", + "Running scripts from the Product Scripts Dialog"); + /** The GFE Perspective Class */ public static final String GFE_PERSPECTIVE = "com.raytheon.viz.ui.GFEPerspective"; @@ -179,21 +190,16 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { + GFESpatialDisplayManager.class.getName()); } } + + SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this); } @Override public void activate() { - - if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) && - !SimulatedTime.getSystemTime().isRealTime() - && !CAVEMode.getFlagInDRT()) { - UFStatus.getHandler().handle( - Priority.WARN, - "CAVE in OPERATIONAL mode and CAVE clock is not set to real-time. Please close all GFE sessions, if any."); - } - super.activate(); + displaySimulatedTimeWarning(); + // Hack to disable editor closing IWorkbenchPage activePage = perspectiveWindow.getActivePage(); if (activePage != null) { @@ -227,6 +233,8 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { public void close() { super.close(); + SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this); + try { DataManager dm = DataManagerUIFactory .findInstance(perspectiveWindow); @@ -423,4 +431,21 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { + "\n\nConsider saving Fcst grids to free up memory."; } + @Override + public void timechanged() { + String activePerspective = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getPerspective() + .getId(); + if (GFE_PERSPECTIVE.equals(activePerspective)) { + displaySimulatedTimeWarning(); + } + } + + private void displaySimulatedTimeWarning() { + if (!SimulatedTimeOperations.isTransmitAllowed()) { + SimulatedTimeOperations.displayPerspectiveLevelWarning( + perspectiveWindow.getShell(), PERSPECTIVE_NAME, + FEATURES_DISABLED_IN_SIM_TIME); + } + } } \ No newline at end of file diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java index 74e651fa61..f48d91461d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java @@ -23,14 +23,14 @@ import java.text.SimpleDateFormat; import java.util.TimeZone; import com.raytheon.uf.common.activetable.ActiveTableMode; -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.TimeRange; import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData; import com.raytheon.viz.gfe.tasks.TaskManager; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * Utilities for text formatter @@ -46,6 +46,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager; * Removed call to TextProductManager.reloadModule * Apr 20, 2015 4027 randerso Renamed ProductStateEnum with an initial capital * Fixed hard coded active table mode in runFormatterScript + * Sep 15, 2015 4858 dgilling Prevent formatters from being run in DRT mode. * * * @@ -54,11 +55,10 @@ import com.raytheon.viz.gfe.tasks.TaskManager; */ public class FormatterUtil { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(FormatterUtil.class); - public static String[] VTEC_MODES = { "Normal: NoVTEC", "Normal: O-Vtec", - "Normal: E-Vtec", "Normal: X-Vtec", "Test: NoVTEC", "Test: T-Vtec" }; + public static final String[] VTEC_MODES = { "Normal: NoVTEC", + "Normal: O-Vtec", "Normal: E-Vtec", "Normal: X-Vtec", + "Test: NoVTEC", "Test: T-Vtec" }; /** * Runs a text formatter script for a given product @@ -76,10 +76,12 @@ public class FormatterUtil { * VTEC mode * @param finish * listener to fire when formatter finishes generating product + * @throws SimulatedTimeProhibitedOperationException */ public static void runFormatterScript(DataManager dataMgr, TextProductManager productMgr, String productName, String dbId, - String vtecMode, TextProductFinishListener finish) { + String vtecMode, TextProductFinishListener finish) + throws SimulatedTimeProhibitedOpException { int testMode = 0; ActiveTableMode atMode = ActiveTableMode.OPERATIONAL; @@ -129,11 +131,15 @@ public class FormatterUtil { public static void runFormatterScript(String name, String vtecMode, String databaseID, String varDict, String vtecActiveTable, - String drtTime, int testMode, TextProductFinishListener finish) { + String drtTime, int testMode, TextProductFinishListener finish) + throws SimulatedTimeProhibitedOpException { + if (!SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("GFE Text formatters"); + } + TextFormatter formatter = new TextFormatter(name, vtecMode, databaseID, varDict, vtecActiveTable, drtTime, testMode, finish); - // Thread thread = new Thread(formatter); - // thread.start(); finish.textProductQueued(ConfigData.ProductStateEnum.Queued); TaskManager.getInstance().queueFormatter(formatter); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java index 7d827a8360..dcb88be6a5 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java @@ -19,9 +19,6 @@ **/ package com.raytheon.viz.warngen.gui; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.ResourcePair; @@ -29,7 +26,6 @@ import com.raytheon.uf.viz.core.exception.VizException; 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.action.AbstractGenericToolAction; -import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.ui.input.EditableManager; /** @@ -44,7 +40,6 @@ import com.raytheon.viz.ui.input.EditableManager; * Oct 10, 2010 6990 Qinglu Lin Used D. Friedman short solution, * with minor changes. * Aug 15, 2013 DR 16418 D. Friedman Always show the dialog. - * Sep 3, 2015 DR 17886 Qinglu Lin Updated for popping up alertViz when switching to DRT. * * * @@ -69,20 +64,11 @@ public class WarngenAction extends AbstractGenericToolAction { protected WarngenLayer getResource(LoadProperties loadProperties, IDescriptor descriptor) throws VizException { - if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) && - !SimulatedTime.getSystemTime().isRealTime() && - !CAVEMode.getFlagInDRT()) { - UFStatus.getHandler().handle(Priority.WARN, - "WarnGen cannot be launched while " + - "CAVE in OPERATIONAL mode and the CAVE clock is not set to real-time."); - return null; - } for (IDisplayPane pane : getSelectedPanes()) { for (ResourcePair rp : pane.getDescriptor().getResourceList()) { if (rp.getResource() instanceof WarngenLayer) { EditableManager.makeEditable(rp.getResource(), true); - ((WarngenLayer) rp.getResource()) - .showDialog(true); + ((WarngenLayer) rp.getResource()).showDialog(true); return (WarngenLayer) rp.getResource(); } } From 777f90fd3f3b2cd322612278f80f013519629746 Mon Sep 17 00:00:00 2001 From: "Qinglu.Lin" Date: Tue, 22 Sep 2015 08:50:13 -0400 Subject: [PATCH 02/14] ASM #18033 - WarnGen: portion of polygon removed when creating a SVS Change-Id: I05cbcc32c03499d90cac60886d2876fee595aee2 Former-commit-id: 0a0941efec11a87332883ccbbc8d72882d5fda28 --- .../com/raytheon/viz/warngen/gis/PolygonUtil.java | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java index 8882ce83b9..375caef950 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gis/PolygonUtil.java @@ -93,6 +93,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. * 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. + * 09/22/2015 DR 18033 Qinglu Lin Updated removeOverlaidLinesegments(), removed one computeSlope(). * * * @author mschenke @@ -1470,7 +1471,7 @@ public class PolygonUtil { slope1 = slope; count += 1; } else { - if (Math.abs(Math.abs(slope) - Math.abs(slope1)) <= min) { + if (Math.abs(slope - slope1) <= min) { count += 1; } else { count = 0; @@ -1767,16 +1768,6 @@ public class PolygonUtil { return 1; } - 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. **/ From 1e48014763d5004fb88afe2e201cd25667beeefe Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Tue, 22 Sep 2015 10:22:46 -0500 Subject: [PATCH 03/14] Omaha #4859: Prevent use of WarnGen when in DRT mode. Change-Id: I2a812cd39ef573b0ca9263e41aeb049e8d0dd7f2 Former-commit-id: 6e12da55bc5ceba6b9fe01e965dae996cec579f6 --- .../viz/warngen/gui/WarngenAction.java | 20 ++++++ .../viz/warngen/gui/WarngenDialog.java | 70 ++++++++++++++----- 2 files changed, 72 insertions(+), 18 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java index dcb88be6a5..f7381d8b59 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenAction.java @@ -19,6 +19,11 @@ **/ 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.drawables.IDescriptor; 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.action.AbstractGenericToolAction; import com.raytheon.viz.ui.input.EditableManager; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** * 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, * with minor changes. * Aug 15, 2013 DR 16418 D. Friedman Always show the dialog. + * Sep 22, 2015 4859 dgilling Prevent dialog from showing in DRT mode. * * * @@ -78,4 +85,17 @@ public class WarngenAction extends AbstractGenericToolAction { layer.showDialog(true); 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); + } } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index e2b845467a..7dac1b427c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -72,6 +72,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.time.ISimulatedTimeChangeListener; import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.TimeRange; 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.ICloseCallback; 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.WarngenConstants; import com.raytheon.viz.warngen.comm.WarningSender; @@ -167,13 +169,14 @@ import com.vividsolutions.jts.geom.Polygon; * chance for that to occur is trivial. * 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. + * Sep 22, 2015 4859 dgilling Prevent product generation in DRT mode. * * * @author chammack * @version 1 */ public class WarngenDialog extends CaveSWTDialog implements - IWarningsArrivedListener { + IWarningsArrivedListener, ISimulatedTimeChangeListener { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WarngenDialog.class); @@ -334,10 +337,13 @@ public class WarngenDialog extends CaveSWTDialog implements warngenLayer = layer; CurrentWarnings.addListener(this); new TemplateRunnerInitJob().schedule(); + SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this); } @Override protected void disposed() { + SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this); + if (bulletListFont != null) { bulletListFont.dispose(); } @@ -876,6 +882,13 @@ public class WarngenDialog extends CaveSWTDialog implements okButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { + if (!SimulatedTimeOperations.isTransmitAllowed()) { + Shell shell = getShell(); + SimulatedTimeOperations.displayFeatureLevelWarning(shell, + "Create WarnGen product"); + return; + } + okPressed(); } @@ -1109,8 +1122,9 @@ public class WarngenDialog extends CaveSWTDialog implements durList.add(data.displayString); } // Add the default duration to the list if what was missing - if (! isDefaultDurationInList && defaultDuration != null) { - durationList.setData(defaultDuration.displayString, defaultDuration); + if (!isDefaultDurationInList && defaultDuration != null) { + durationList + .setData(defaultDuration.displayString, defaultDuration); durList.add(0, defaultDuration.displayString); } @@ -1190,8 +1204,9 @@ public class WarngenDialog extends CaveSWTDialog implements long t0 = System.currentTimeMillis(); try { monitor.beginTask("Generating product", 1); - statusHandler.debug("using startTime " + startTime.getTime() - + " endTime " + endTime.getTime()); + statusHandler.debug("using startTime " + + startTime.getTime() + " endTime " + + endTime.getTime()); String result = TemplateRunner.runTemplate( warngenLayer, startTime.getTime(), endTime.getTime(), selectedBullets, @@ -1224,8 +1239,7 @@ public class WarngenDialog extends CaveSWTDialog implements new Job("Transmitting Warning") { @Override protected IStatus run(IProgressMonitor monitor) { - statusHandler.debug( - ": Transmitting Warning Job Running"); + statusHandler.debug(": Transmitting Warning Job Running"); // Launch the text editor display as the warngen editor // dialog using the result aka the warngen text product. @@ -1694,10 +1708,12 @@ public class WarngenDialog extends CaveSWTDialog implements .equalsIgnoreCase(lastAreaSource); boolean snapHatchedAreaToPolygon = isDifferentAreaSources; boolean preservedSelection = !isDifferentAreaSources; - if (isDifferentAreaSources || !warngenLayer.getConfiguration() - .getHatchedAreaSource().getAreaSource().toLowerCase().equals("marinezones")) { + if (isDifferentAreaSources + || !warngenLayer.getConfiguration().getHatchedAreaSource() + .getAreaSource().toLowerCase().equals("marinezones")) { // If template has a different hatched area source from the previous - // template, then the warned area would be based on the polygon and not + // template, then the warned area would be based on the polygon and + // not // preserved. try { warngenLayer.updateWarnedAreas(snapHatchedAreaToPolygon, @@ -1776,7 +1792,8 @@ public class WarngenDialog extends CaveSWTDialog implements FollowupData data = (FollowupData) updateListCbo .getData(updateListCbo.getItem(updateListCbo .getSelectionIndex())); - statusHandler.debug("updateListSelected: " + (data != null ? data.getDisplayString() : "(null)")); + statusHandler.debug("updateListSelected: " + + (data != null ? data.getDisplayString() : "(null)")); Mode currMode = warngenLayer.getStormTrackState().mode; if (data != null) { // does not refesh if user selected already highlighted option @@ -1928,7 +1945,8 @@ public class WarngenDialog extends CaveSWTDialog implements @Override public void dialogClosed(Object returnValue) { int duration = (Integer) returnValue; - statusHandler.debug("changeSelected.dialogClosed: " + duration); + statusHandler.debug("changeSelected.dialogClosed: " + + duration); if (duration != -1) { durationList.setEnabled(false); endTime.add(Calendar.MINUTE, duration); @@ -2643,13 +2661,13 @@ public class WarngenDialog extends CaveSWTDialog implements } private void restoreDuration(int duration) { - warngenLayer.getStormTrackState().duration = - warngenLayer.getStormTrackState().newDuration = duration; + warngenLayer.getStormTrackState().duration = warngenLayer + .getStormTrackState().newDuration = duration; warngenLayer.getStormTrackState().geomChanged = true; } private int getSelectedDuration() { - Exception excToReport= null; + Exception excToReport = null; DurationData data = null; try { data = (DurationData) durationList.getData(durationList @@ -2669,12 +2687,28 @@ public class WarngenDialog extends CaveSWTDialog implements } duration = 30; } - statusHandler.handle(Priority.WARN, - "Unable to determine duration from selection in WarnGen dialog. Using default of " - + duration + " minutes.", excToReport); + statusHandler + .handle(Priority.WARN, + "Unable to determine duration from selection in WarnGen dialog. Using default of " + + duration + " minutes.", excToReport); } statusHandler.debug("selected duration is " + duration); return duration; } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.time.ISimulatedTimeChangeListener#timechanged() + */ + @Override + public void timechanged() { + if ((getShell().isVisible()) + && (!SimulatedTimeOperations.isTransmitAllowed())) { + SimulatedTimeOperations.displayFeatureLevelWarning(getShell(), + "WarnGen"); + } + } + } From e7afb77380c6204316d0260eef2b1875b5c714cd Mon Sep 17 00:00:00 2001 From: David Friedman Date: Fri, 25 Sep 2015 18:32:43 +0000 Subject: [PATCH 04/14] ASM #17944 - RADAR: Radarserver should handle NDM file tdwrElevations.txt properly Change-Id: Ieff06001a5f13b2b286fb9c1c231f4fc190c4493 Former-commit-id: 17a8ac1fd0695d095d32b2fa6e1978db3ea8cb7d --- .../uf/viz/radarapps/requests/Activator.java | 17 +++++++++-------- .../uf/viz/radarapps/rps/Activator.java | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cave/com.raytheon.uf.viz.radarapps.requests/src/com/raytheon/uf/viz/radarapps/requests/Activator.java b/cave/com.raytheon.uf.viz.radarapps.requests/src/com/raytheon/uf/viz/radarapps/requests/Activator.java index ef487fb674..a23344961f 100644 --- a/cave/com.raytheon.uf.viz.radarapps.requests/src/com/raytheon/uf/viz/radarapps/requests/Activator.java +++ b/cave/com.raytheon.uf.viz.radarapps.requests/src/com/raytheon/uf/viz/radarapps/requests/Activator.java @@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.requests; import org.eclipse.ui.plugin.AbstractUIPlugin; 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 */ @@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin { public Activator() { } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider()); + } /* * (non-Javadoc) diff --git a/cave/com.raytheon.uf.viz.radarapps.rps/src/com/raytheon/uf/viz/radarapps/rps/Activator.java b/cave/com.raytheon.uf.viz.radarapps.rps/src/com/raytheon/uf/viz/radarapps/rps/Activator.java index a4d43d9eeb..23297390dc 100644 --- a/cave/com.raytheon.uf.viz.radarapps.rps/src/com/raytheon/uf/viz/radarapps/rps/Activator.java +++ b/cave/com.raytheon.uf.viz.radarapps.rps/src/com/raytheon/uf/viz/radarapps/rps/Activator.java @@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.rps; import org.eclipse.ui.plugin.AbstractUIPlugin; 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 */ @@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin { public Activator() { } - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider()); + } /* * (non-Javadoc) From 6f9c63e110bd603f20bd4735977571c5e683a43e Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Mon, 28 Sep 2015 11:12:03 -0500 Subject: [PATCH 05/14] Omaha #4858: Fix NullPointerException in ISimulatedTimeChangeListener in GFEPerspectiveManager. Change-Id: I9129be02891d26259dc620fb38d885356ed5a638 Former-commit-id: 25fdc908f2f6e691ce3da3350252d1c3ecc52c8f --- .../perspective/GFEPerspectiveManager.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java index 9b97cb1a09..60ee6b4907 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java @@ -50,6 +50,7 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.RGBColors; +import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; @@ -433,12 +434,22 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager @Override public void timechanged() { - String activePerspective = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getPerspective() - .getId(); - if (GFE_PERSPECTIVE.equals(activePerspective)) { - displaySimulatedTimeWarning(); - } + /* + * Have to jump to the UI thread or else getActiveWorkbenchWindow will + * fail. + */ + VizApp.runAsync(new Runnable() { + + @Override + public void run() { + String activePerspective = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage() + .getPerspective().getId(); + if (GFE_PERSPECTIVE.equals(activePerspective)) { + displaySimulatedTimeWarning(); + } + } + }); } private void displaySimulatedTimeWarning() { From 0677a9dc707436ce4664130dd0cbf8905bb55238 Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Mon, 28 Sep 2015 11:21:38 -0500 Subject: [PATCH 06/14] Omaha #4859: Fix UI threading issue in ISimulatedTimeChangeListener in WarngenDialog. Change-Id: Ia53a635f83796b6defbd82900643031b9bdba6df Former-commit-id: 5b309fba9abc6062708e725d93328f1cf0dd5282 --- .../raytheon/viz/warngen/gui/WarngenDialog.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 7dac1b427c..d1c4876187 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -2704,11 +2704,16 @@ public class WarngenDialog extends CaveSWTDialog implements */ @Override public void timechanged() { - if ((getShell().isVisible()) - && (!SimulatedTimeOperations.isTransmitAllowed())) { - SimulatedTimeOperations.displayFeatureLevelWarning(getShell(), - "WarnGen"); - } - } + VizApp.runAsync(new Runnable() { + @Override + public void run() { + if ((getShell().isVisible()) + && (!SimulatedTimeOperations.isTransmitAllowed())) { + SimulatedTimeOperations.displayFeatureLevelWarning( + getShell(), "WarnGen"); + } + } + }); + } } From 6250424f870101b7d2a77bd11df3c38b825ec969 Mon Sep 17 00:00:00 2001 From: "steve.naples" Date: Tue, 29 Sep 2015 17:23:51 +0000 Subject: [PATCH 07/14] ASM #17975 MPE - Fixed issue with Hydro date not following CAVE date/time. Change-Id: I87c482fd5b3d306310d9e954e15efc66057312da Former-commit-id: 21d86a91f29948292816823c2078f46b0366bf6c --- .../viz/mpe/ui/MPEDisplayManager.java | 27 +++++++--------- .../ui/dialogs/ChooseDataPeriodDialog.java | 31 ++++++------------- .../raytheon/viz/mpe/core/MPEDataManager.java | 6 +++- 3 files changed, 27 insertions(+), 37 deletions(-) diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java index 983c12ca22..286a9c6620 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/MPEDisplayManager.java @@ -35,10 +35,12 @@ import javax.measure.converter.UnitConverter; import javax.measure.unit.Unit; import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.State; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; 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.RadioState; 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.prefs.ColorMapParameters; @@ -81,6 +84,7 @@ import com.raytheon.viz.mpe.MPECommandConstants; import com.raytheon.viz.mpe.MPEDateFormatter; import com.raytheon.viz.mpe.core.MPEDataManager; 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.displays.MPEMapRenderableDisplay; 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. * 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. + * Sep 29, 2015 16790 snaples Fixed issue with date not following the CAVE time when changed, and fixed time matching issue. * * * @@ -663,24 +668,10 @@ public class MPEDisplayManager { * @return */ 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) { // new time, check for save - if (force == false && !isDataSaved()) { + if (!isDataSaved()) { if (!okToProceed("Data Not Saved")) { return false; } @@ -692,6 +683,12 @@ public class MPEDisplayManager { if (display.getContainer() != null) { stopLooping(display.getContainer()); } + try { + display.getDescriptor().redoTimeMatching(); + } catch (VizException e) { + Activator.statusHandler.handle(Priority.PROBLEM, + "Error in redoTimeMatching for MPEDisplayManager", e); + } setCurrentDisplayedDate(newDate); if (displayedFieldResource == null) { diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java index 9e7f09cc8e..69f742805a 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/dialogs/ChooseDataPeriodDialog.java @@ -26,6 +26,8 @@ import java.util.Date; import java.util.Map; 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.swt.SWT; 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.TransmitBestEstimateQPEProvider; 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.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.editor.IMultiPaneEditor; @@ -71,6 +74,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor; * if hour is greater than 18Z. * Jan 05, 2015 14246 lbousaidi enable Transmit Best Estimate QPE. * 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. * * * @@ -161,26 +165,18 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog { displayMgr = MPEDisplayManager.getInstance(pane); dataMgr = MPEDataManager.getInstance(); - dateMap = dataMgr.getDateMap(true); + dateMap = dataMgr.getDateMap(false); qcEnable = MPEDisplayManager.isMpeQcOptionEnabled(); cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); hydroCal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); prevDate = displayMgr.getCurrentEditDate(); cal.setTime(prevDate); - - if( prevHydDate == null ){ - prevHydDate = displayMgr.getCurrentEditDate(); - hydroCal.setTime(prevHydDate); + hydroCal.setTime(displayMgr.getCurrentEditDate()); - if ( cal.get(Calendar.HOUR_OF_DAY) >= 18 ){ - hydroCal.add(Calendar.DATE, 1); - } - }else{ - - hydroCal.setTime(prevHydDate); + if ( hydroCal.get(Calendar.HOUR_OF_DAY) >= 18 ){ + hydroCal.add(Calendar.DATE, 1); } - } /* @@ -551,20 +547,13 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog { } 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); } - if (hydroCal.getTime().before(dataMgr.getEarliestDate()) - || hydroCal.getTime().after(aCal.getTime())) { - hydroCal.setTime(prevHydDate); - } - prevDate = cal.getTime(); - prevHydDate = hydroCal.getTime(); - yearText.setText(Integer.toString(cal.get(Calendar.YEAR))); monthText.setText(Integer.toString(cal.get(Calendar.MONTH) + 1)); daySpinner.setSelection(cal.get(Calendar.DAY_OF_MONTH)); diff --git a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/MPEDataManager.java b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/MPEDataManager.java index 92878d953e..c2c09fbfcb 100644 --- a/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/MPEDataManager.java +++ b/cave/com.raytheon.viz.mpe/src/com/raytheon/viz/mpe/core/MPEDataManager.java @@ -81,6 +81,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Dec 15 2013 DCS 167 cgobs DualPol capabilities * Jul 29, 2015 17471 snaples Added logging for Radar Bias results table query. * Aug 11, 2015 4500 rjpeter Fix type casts. + * Sep 29, 2015 17975 snaples Fixed an issue with getDateMap query sometimes throwing errors. + * * * * @author randerso @@ -728,18 +730,20 @@ public class MPEDataManager { private void getDates(boolean update) { String starttime = ""; + String endtime = ""; if (update && latestAvailableDate != null) { starttime = sdf.format(latestAvailableDate); } else { dateMap = new HashMap(); starttime = sdf.format(getEarliestDate()); } + endtime = sdf.format(getLatestDate()); String sqlQuery = "select obstime,last_save_time,last_exec_time,auto_save from rwresult where rfc='" + RFC + "' and obstime between '" + starttime + "' and '" - + sdf.format(getLatestDate()) + "'"; + + endtime + "'"; try { List results = DirectDbQuery.executeQuery(sqlQuery, From c623963b36f87d13b75b6152a79575b1af89b931 Mon Sep 17 00:00:00 2001 From: "Rici.Yu" Date: Wed, 30 Sep 2015 10:49:17 -0400 Subject: [PATCH 08/14] ASM #18141 - check in changes Ron identified Change-Id: Idbef45bd5fa2f19a247a7abfaee22482db3e7c26 Former-commit-id: c3cba26391a4cd9c039533f756a9c3bea87ecc19 --- .../gfe/userPython/procedures/PlotTPCEvents.py | 10 +++++++++- .../utility/common_static/base/vtec/VTECPartners.py | 3 ++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/PlotTPCEvents.py b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/PlotTPCEvents.py index 3069df8af0..a4a32a44b1 100644 --- a/cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/PlotTPCEvents.py +++ b/cave/com.raytheon.viz.gfe/localization/gfe/userPython/procedures/PlotTPCEvents.py @@ -30,6 +30,13 @@ # # 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 # Procedure is to appear. @@ -40,6 +47,7 @@ from numpy import * import SmartScript import AbsTime import HazardUtils +import VTECPartners import LogStream, logging import UFStatusHandler @@ -89,7 +97,7 @@ class Procedure (SmartScript.SmartScript): continue # only look at the KNHC records - if v['officeid'] != 'KNHC': + if v['officeid'] not in VTECPartners.VTEC_TPC_SITE: continue key = (v['phen'], v['sig'], v['etn']) diff --git a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/VTECPartners.py b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/VTECPartners.py index eafb11dd29..a66626ecb7 100644 --- a/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/VTECPartners.py +++ b/edexOsgi/com.raytheon.uf.edex.activetable/utility/common_static/base/vtec/VTECPartners.py @@ -28,6 +28,7 @@ # 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 # 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 @@ -40,7 +41,7 @@ VTEC_TABLE_REQUEST_SITES = [] # Name of site identifier for SPC and TCV bulletins. 4-characters. 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 # in the ingestAT/MergeVTEC software to filter out records from offices From 853d5507720938b66708ee46380f3e1e1c9bf406 Mon Sep 17 00:00:00 2001 From: Slav Korolev Date: Sun, 27 Sep 2015 18:18:28 -0400 Subject: [PATCH 09/14] Omaha #3873 - Fixed FSSObs monitors to ingest Moving Maritime and MAROBS data. Former-commit-id: 5cdd97df619fb9eba6857fa1e3c62dfde870b9ed --- .../uf/viz/monitor/fog/FogMonitor.java | 71 +- .../fog/threshold/FogThresholdMgr.java | 24 +- .../dialogs/FogMonitoringAreaConfigDlg.java | 29 +- .../fog/ui/dialogs/FogZoneTableDlg.java | 28 +- .../viz/monitor/safeseas/SafeSeasMonitor.java | 71 +- .../safeseas/threshold/SSThresholdMgr.java | 21 +- .../ui/dialogs/SSMonitoringAreaConfigDlg.java | 34 +- .../safeseas/ui/dialogs/SSZoneTableDlg.java | 9 +- .../uf/viz/monitor/snow/SnowMonitor.java | 26 +- .../snow/threshold/SnowThresholdMgr.java | 23 +- .../dialogs/SnowMonitoringAreaConfigDlg.java | 27 +- .../snow/ui/dialogs/SnowZoneTableDlg.java | 6 +- .../uf/viz/monitor/GenerateFSSObReport.java | 100 +- .../com/raytheon/uf/viz/monitor/Monitor.java | 7 +- .../raytheon/uf/viz/monitor/ObsMonitor.java | 92 +- .../uf/viz/monitor/ResourceMonitor.java | 5 +- .../uf/viz/monitor/data/ObHourReports.java | 222 +++- .../viz/monitor/data/ObMultiHrsReports.java | 429 +++---- .../viz/monitor/data/ObZoneHourReports.java | 1013 ++++++++++------ .../uf/viz/monitor/data/TableUtil.java | 525 ++++---- .../IMonitorConfigurationListener.java | 4 +- .../thresholds/AbstractThresholdMgr.java | 169 ++- .../viz/monitor/thresholds/ThresholdMgr.java | 12 +- .../ui/dialogs/MonitoringAreaConfigDlg.java | 126 +- .../viz/monitor/ui/dialogs/ZoneTableDlg.java | 57 +- .../monitor/util/MonitorConfigConstants.java | 750 +++++------- .../localization/plotModels/fssMaritime.svg | 4 +- .../FSSObsMonitorConfigurationManager.java | 134 ++- .../uf/common/monitor/data/ObConst.java | 28 +- .../uf/edex/dat/utils/DatMenuUtil.java | 115 +- .../META-INF/MANIFEST.MF | 7 +- .../plugin/fssobs/FSSObsDataTransform.java | 1053 +++++++++-------- .../edex/plugin/fssobs/FSSObsGenerator.java | 175 ++- .../edex/plugin/fssobs/FSSObsURIFilter.java | 84 +- .../uf/edex/plugin/fssobs/FSSObsUtils.java | 209 ++-- .../plugin/fssobs/common/FSSObsConfig.java | 10 +- .../ingest/LocationTablesIngest.java | 11 +- 37 files changed, 3154 insertions(+), 2556 deletions(-) mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/GenerateFSSObReport.java mode change 100755 => 100644 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObMultiHrsReports.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/ThresholdMgr.java mode change 100644 => 100755 cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java mode change 100644 => 100755 cave/com.raytheon.viz.pointdata/localization/plotModels/fssMaritime.svg mode change 100644 => 100755 edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java index 3182ea5c5c..25af5044ea 100755 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; -import java.util.regex.Pattern; import org.eclipse.core.runtime.IStatus; 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.Shell; -import com.raytheon.uf.common.dataplugin.annotations.DataURI; 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.config.FSSObsMonitorConfigurationManager; 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.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; 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.Monitor; 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 23, 2014 3356 njensen Remove unnecessary import * Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed. + * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage. * * * @@ -139,33 +136,19 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { private final TableData stationTableData = new TableData( CommonConfig.AppName.FOG); - /** All FOG's datauri start with this **/ - private final String OBS = "fssobs"; - /** List of fogAlg listeners **/ private final List fogResources = new ArrayList(); - /** 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 FogMonitor() { - pluginPatterns.add(fogPattern); - fogConfig = new FSSObsMonitorConfigurationManager(MonName.fog.name()); + pluginPatterns.add(fssPattern); + fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog); updateMonitoringArea(); initObserver(OBS, this); - obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); + createDataStructures(); + processProductAtStartup(); obData.setThresholdMgr(FogThresholdMgr.getInstance()); obData.getZoneTableData(); readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG); @@ -180,12 +163,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { if (monitor == null) { monitor = new FogMonitor(); // Pre-populate dialog with an observations from DB - monitor.createDataStructures(); - monitor.getAdjAreas(); - monitor.processProductAtStartup(MonName.fog.name()); monitor.fireMonitorEvent(monitor); } - return monitor; } @@ -209,10 +188,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { // [Jan 21, 2010, zhao] obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); obData.setThresholdMgr(FogThresholdMgr.getInstance()); - obsData = new ObsData(); algorithmData = new TreeMap>(); - for (String zone : MonitoringArea.getPlatformMap().keySet()) { obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone)); } @@ -251,7 +228,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { */ @Override public void processProductMessage(final AlertMessage filtered) { - if (fogPattern.matcher(filtered.dataURI).matches()) { + if (fssPattern.matcher(filtered.dataURI).matches()) { processURI(filtered.dataURI, filtered); } } @@ -264,7 +241,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { * -- the xml configuration filename */ public void readTableConfig(String file) { - // TODO update for Maritime Map> zones = new HashMap>(); // create zones and stations list try { @@ -594,35 +570,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { 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) * @@ -633,9 +580,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { @Override protected void processAtStartup(ObReport report) { obData.addReport(report); - String zone = findZone(report.getPlatformId()); - getTableData().getArea(zone).addReport(report.getObservationTime(), - report); } /** @@ -663,5 +607,4 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { } MonitoringArea.setPlatformMap(zones); } - } diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java index 85b0a5a589..9a69ffa15a 100755 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java @@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.fog.threshold; 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.ObConst.DataUsageKey; 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() * May 20, 2014 3086 skorolev Cleaned code. * Sep 04, 2014 3220 skorolev Removed "site". + * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr. * * * @@ -59,10 +58,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr { */ private FogThresholdMgr() { super("DefaultFogDisplayThresholds.xml", - "DefaultFogMonitorThresholds.xml", AppName.FOG.name() - .toLowerCase()); - areaConfigMgr = new FSSObsMonitorConfigurationManager( - MonName.fog.name()); + "DefaultFogMonitorThresholds.xml", AppName.FOG); init(); } @@ -75,7 +71,6 @@ public class FogThresholdMgr extends AbstractThresholdMgr { if (classInstance == null) { classInstance = new FogThresholdMgr(); } - return classInstance; } @@ -119,19 +114,4 @@ public class FogThresholdMgr extends AbstractThresholdMgr { 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; - } - } diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java index 86e32f7644..86dd5d97e8 100755 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java @@ -19,15 +19,19 @@ **/ package com.raytheon.uf.viz.monitor.fog.ui.dialogs; +import java.io.IOException; + import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; 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.MonName; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; 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.fog.FogMonitor; 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. * Oct 27, 2014 3667 skorolev Cleaned code. * Feb 10, 2015 3886 skorolev Changed confirmation message. + * Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection. * * * @@ -80,19 +85,15 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { * handleOkBtnSelection() */ @Override - protected void handleOkBtnSelection() { + protected void handleOkBtnSelection() throws LocalizationException, + SerializationException, IOException { if (dataIsChanged()) { int choice = showMessage(shell, SWT.YES | SWT.NO, - "Confirm Cofiguration Changes", "Save changes?"); + "Fog Monitor Confirm Changes", "Save changes?"); if (choice == SWT.YES) { // Save the config xml file. - resetAndSave(); - /** - * DR#11279: re-initialize threshold manager and the monitor - * using new monitor area configuration - */ + saveConfigs(); FogThresholdMgr.reInitialize(); - fireConfigUpdateEvent(); // Open Threshold Dialog if zones/stations are added. if ((!configMgr.getAddedZones().isEmpty()) || (!configMgr.getAddedStations().isEmpty())) { @@ -102,19 +103,15 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { fogMonitorDlg.setCloseCallback(new ICloseCallback() { @Override public void dialogClosed(Object returnValue) { - // Clean added zones and stations. Close dialog. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); setReturnValue(true); close(); } }); fogMonitorDlg.open(); } - // Clean added zones and stations. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); } + fireConfigUpdateEvent(); + resetStatus(); } else { // Return back to continue edit. return; } @@ -150,8 +147,8 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { @Override protected FSSObsMonitorConfigurationManager getInstance() { if (configMgr == null) { - configMgr = new FSSObsMonitorConfigurationManager( - MonName.fog.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.fog); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java index 948606d33e..746699731d 100755 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java @@ -60,6 +60,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg; * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. + * Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName. * * * @@ -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) * @@ -304,8 +282,8 @@ public class FogZoneTableDlg extends ZoneTableDlg { @Override protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { if (configMgr == null || configMgr.isPopulated()) { - configMgr = new FSSObsMonitorConfigurationManager( - MonName.fog.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.fog); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/SafeSeasMonitor.java b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/SafeSeasMonitor.java index 746bb8a5b5..166005a721 100755 --- a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/SafeSeasMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/SafeSeasMonitor.java @@ -25,26 +25,22 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Display; 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.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.config.FSSObsMonitorConfigurationManager; 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.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; 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.Monitor; 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 * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. + * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage. * * * @@ -126,12 +123,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { private final TableData stationTableData = new TableData( 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 **/ private final List safeSeasResources = new ArrayList(); @@ -144,31 +135,21 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { /** data holder for FOG data **/ private Map> algorithmData = null; - /** Adjacent areas for current cwa **/ - private Geometry geoAdjAreas; - /** List of fogAlg listeners **/ private final List fogResources = new ArrayList(); - /** 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 SafeSeasMonitor() { - pluginPatterns.add(ssPattern); - ssAreaConfig = new FSSObsMonitorConfigurationManager(MonName.ss.name()); + pluginPatterns.add(fssPattern); + ssAreaConfig = FSSObsMonitorConfigurationManager + .getInstance(MonName.ss); updateMonitoringArea(); initObserver(OBS, this); - obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); - obData.setThresholdMgr(SSThresholdMgr.getInstance()); - obData.getZoneTableData(); + createDataStructures(); + processProductAtStartup(); readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG); - } /** @@ -177,10 +158,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { public static synchronized SafeSeasMonitor getInstance() { if (monitor == null) { monitor = new SafeSeasMonitor(); - // Pre-populate dialog with an observation (METAR) for KOMA - monitor.createDataStructures(); - monitor.getAdjAreas(); - monitor.processProductAtStartup("ss"); monitor.fireMonitorEvent(monitor); } return monitor; @@ -205,6 +182,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { private void createDataStructures() { obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); obData.setThresholdMgr(SSThresholdMgr.getInstance()); + obData.getZoneTableData(); algorithmData = new HashMap>(); } @@ -273,7 +251,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { */ @Override public void processProductMessage(final AlertMessage filtered) { - if (ssPattern.matcher(filtered.dataURI).matches()) { + if (fssPattern.matcher(filtered.dataURI).matches()) { processURI(filtered.dataURI, filtered); } } @@ -594,36 +572,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { 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 * @@ -685,5 +633,4 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener { } MonitoringArea.setPlatformMap(zones); } - } diff --git a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java index b863c5d05a..ef15925e32 100755 --- a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java +++ b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java @@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold; 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.ObConst.DataUsageKey; 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(). * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Sep 04, 2014 3220 skorolev Removed "site". + * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr. * * * @@ -57,9 +56,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr { */ public SSThresholdMgr() { super("DefaultSSDisplayThresholds.xml", - "DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name() - .toLowerCase()); - areaConfigMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); + "DefaultSSMonitorThresholds.xml", AppName.SAFESEAS); init(); } @@ -114,18 +111,4 @@ public class SSThresholdMgr extends AbstractThresholdMgr { 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; - } } diff --git a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java index cbea634ed4..69e52d9916 100755 --- a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java @@ -19,15 +19,19 @@ **/ package com.raytheon.uf.viz.monitor.safeseas.ui.dialogs; +import java.io.IOException; + import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; 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.MonName; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; 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.safeseas.SafeSeasMonitor; 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 19, 2014 2757 skorolev Updated handlers for dialog buttons. * 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. * * * @@ -74,19 +79,25 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { SafeSeasMonitor.getInstance(); } + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg# + * handleOkBtnSelection() + */ @Override - protected void handleOkBtnSelection() { + protected void handleOkBtnSelection() throws LocalizationException, + SerializationException, IOException { if (dataIsChanged()) { int choice = showMessage(shell, SWT.YES | SWT.NO, - "Confirm Cofiguration Changes", "Save changes?"); + "SAFESEAS Monitor Confirm Changes", "Save changes?"); if (choice == SWT.YES) { // Save the config xml file. - resetAndSave(); + saveConfigs(); SSThresholdMgr.reInitialize(); - fireConfigUpdateEvent(); - // Open Threshold Dialog if zones/stations are added. if ((!configMgr.getAddedZones().isEmpty()) || (!configMgr.getAddedStations().isEmpty())) { + // Open Threshold Dialog if zones/stations are added. if (editDialog() == SWT.YES) { ssMonitorDlg = new SSDispMonThreshDlg(shell, CommonConfig.AppName.SAFESEAS, @@ -94,19 +105,15 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { ssMonitorDlg.setCloseCallback(new ICloseCallback() { @Override public void dialogClosed(Object returnValue) { - // Clean added zones and stations. Close dialog. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); setReturnValue(true); close(); } }); ssMonitorDlg.open(); } - // Clean added zones and stations. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); } + fireConfigUpdateEvent(); + resetStatus(); } else { // Return back to continue edit. return; } @@ -142,7 +149,8 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { @Override public FSSObsMonitorConfigurationManager getInstance() { if (configMgr == null) { - configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.ss); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java index a5ddd8f56f..38688ea42f 100755 --- a/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java @@ -57,7 +57,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants; * Nov 10, 2012 1297 skorolev Added initiateProdArray * Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs. * 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. * * * @@ -160,8 +161,7 @@ public class SSZoneTableDlg extends ZoneTableDlg { Map fogAlgThreats = monitor .getAlgorithmData(nominalTime); obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats)); - this.updateTableDlg(monitor.getObData().getObHourReports( - nominalTime)); + this.updateTableDlg(obData.getObHourReports(nominalTime)); } } } @@ -329,7 +329,8 @@ public class SSZoneTableDlg extends ZoneTableDlg { @Override protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { if (configMgr == null || configMgr.isPopulated()) { - configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.ss); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java index 14c200bd77..f78beb4810 100755 --- a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java @@ -25,18 +25,16 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; 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.MonName; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; 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.Monitor; 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 * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. + * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage. * * * @@ -105,33 +104,23 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener { */ 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. **/ private Date dialogTime = null; /** Array of snow listeners **/ private final List snowResources = new ArrayList(); - /** 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 SnowMonitor() { - pluginPatterns.add(snowPattern); - snowConfig = new FSSObsMonitorConfigurationManager(MonName.snow.name()); + pluginPatterns.add(fssPattern); + snowConfig = FSSObsMonitorConfigurationManager + .getInstance(MonName.snow); updateMonitoringArea(); initObserver(OBS, this); obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW); + processProductAtStartup(); obData.setThresholdMgr(SnowThresholdMgr.getInstance()); obData.getZoneTableData(); } @@ -144,7 +133,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener { public static synchronized SnowMonitor getInstance() { if (monitor == null) { monitor = new SnowMonitor(); - monitor.processProductAtStartup("snow"); monitor.fireMonitorEvent(monitor); } return monitor; @@ -236,7 +224,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener { */ @Override public void processProductMessage(final AlertMessage filtered) { - if (snowPattern.matcher(filtered.dataURI).matches()) { + if (fssPattern.matcher(filtered.dataURI).matches()) { processURI(filtered.dataURI, filtered); } } diff --git a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java index 3a17128bec..ed385ac564 100755 --- a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java +++ b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java @@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.snow.threshold; 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.ObConst.DataUsageKey; 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() * May 21, 2014 3086 skorolev Cleaned code. * Sep 04, 2014 3220 skorolev Removed "site". + * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr. * * * @@ -56,11 +55,7 @@ public class SnowThresholdMgr extends AbstractThresholdMgr { */ private SnowThresholdMgr() { super("DefaultSnowDisplayThresholds.xml", - "DefaultSnowMonitorThresholds.xml", AppName.SNOW.name() - .toLowerCase()); - - areaConfigMgr = new FSSObsMonitorConfigurationManager( - MonName.snow.name()); + "DefaultSnowMonitorThresholds.xml", AppName.SNOW); init(); } @@ -115,18 +110,4 @@ public class SnowThresholdMgr extends AbstractThresholdMgr { 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; - } } diff --git a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java index ff7a18b9dd..22f91c669e 100755 --- a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java @@ -19,15 +19,19 @@ **/ package com.raytheon.uf.viz.monitor.snow.ui.dialogs; +import java.io.IOException; + import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Display; 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.MonName; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; 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.snow.SnowMonitor; 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 19, 2014 2757 skorolev Updated handlers for dialog buttons. * 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. * * * @author mpduff @@ -79,15 +84,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { * handleApplyBtnSelection() */ @Override - protected void handleOkBtnSelection() { + protected void handleOkBtnSelection() throws LocalizationException, + SerializationException, IOException { if (dataIsChanged()) { int choice = showMessage(shell, SWT.YES | SWT.NO, - "Confirm Cofiguration Changes", "Save changes?"); + "SNOW Monitor Confirm Changes", "Save changes?"); if (choice == SWT.YES) { // Save the config xml file. - resetAndSave(); + saveConfigs(); SnowThresholdMgr.reInitialize(); - fireConfigUpdateEvent(); // Open Threshold Dialog if zones/stations are added. if ((!configMgr.getAddedZones().isEmpty()) || (!configMgr.getAddedStations().isEmpty())) { @@ -102,19 +107,15 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { @Override public void dialogClosed(Object returnValue) { - // Clean added zones and stations. Close dialog. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); setReturnValue(true); close(); } }); snowMonitorDlg.open(); } - // Clean added zones and stations. - configMgr.getAddedZones().clear(); - configMgr.getAddedStations().clear(); } + fireConfigUpdateEvent(); + resetStatus(); } else { // Return back to continue edit. return; } @@ -135,8 +136,8 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg { @Override protected FSSObsMonitorConfigurationManager getInstance() { if (configMgr == null) { - configMgr = new FSSObsMonitorConfigurationManager( - MonName.snow.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.snow); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java index 875373938b..2801eb8b33 100755 --- a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java +++ b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java @@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg; * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs * Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. + * Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName. * * * @@ -140,7 +141,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg { if (zoneTable.isDisposed()) { return; } - if (me.getSource() instanceof SnowMonitor) { SnowMonitor monitor = (SnowMonitor) me.getSource(); Date date = monitor.getDialogTime(); @@ -265,8 +265,8 @@ public class SnowZoneTableDlg extends ZoneTableDlg { @Override protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() { if (configMgr == null || configMgr.isPopulated()) { - configMgr = new FSSObsMonitorConfigurationManager( - MonName.snow.name()); + configMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.snow); } return configMgr; } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/GenerateFSSObReport.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/GenerateFSSObReport.java old mode 100644 new mode 100755 index efd8ec6e23..df023fa8bd --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/GenerateFSSObReport.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/GenerateFSSObReport.java @@ -23,6 +23,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport; * skorolev Initial creation * May 15, 2012 14510 zhao Modified generateObReport() * Jan 06, 2014 2653 skorolev Included SNOW data into ObReport. + * Sep 20, 2015 3873 skorolev Added IsStationary and getReportType. * * * @@ -46,10 +47,10 @@ public class GenerateFSSObReport { public static ObReport generateObReport(PluginDataObject report) { // Generate the observation report. ObReport obReport = new ObReport(); - FSSObsRecord metar = (FSSObsRecord) report; + FSSObsRecord fssData = (FSSObsRecord) report; try { - obReport.setObservationTime(metar.getTimeObs().getTime()); - obReport.setRefHour(metar.getRefHour().getTime()); + obReport.setObservationTime(fssData.getTimeObs().getTime()); + obReport.setRefHour(fssData.getRefHour().getTime()); } catch (Exception e) { statusHandler .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"); obReport.setTimesFromFssobDataURI(report.getDataURI()); } - obReport.setPlatformId(metar.getPlatformId()); - obReport.setStationary(true); - obReport.setLatitude((float) metar.getLatitude()); - obReport.setLongitude((float) metar.getLongitude()); + obReport.setPlatformId(fssData.getPlatformId()); + obReport.setStationary(fssData.getIsStationary()); + obReport.setLatitude((float) fssData.getLatitude()); + obReport.setLongitude((float) fssData.getLongitude()); // Table data: - obReport.setCeiling(metar.getCeiling()); - obReport.setWindDir(metar.getWindDir()); - obReport.setWindSpeed(metar.getWindSpeed()); - obReport.setMaxWindSpeed(metar.getMaxWindSpeed()); - obReport.setWindGust(metar.getWindGust()); - obReport.setRelativeHumidity(metar.getRelativeHumidity()); + obReport.setCeiling(fssData.getCeiling()); + obReport.setWindDir(fssData.getWindDir()); + obReport.setWindSpeed(fssData.getWindSpeed()); + obReport.setMaxWindSpeed(fssData.getMaxWindSpeed()); + obReport.setWindGust(fssData.getWindGust()); + obReport.setRelativeHumidity(fssData.getRelativeHumidity()); try { - obReport.setVisibility(metar.getVisibility()); + obReport.setVisibility(fssData.getVisibility()); } catch (Exception e) { obReport.setVisibility(0); } - obReport.setDewpoint(metar.getDewpoint()); - obReport.setTemperature(metar.getTemperature()); - obReport.setDewpointDepr(metar.getDewpointDepr()); + obReport.setDewpoint(fssData.getDewpoint()); + obReport.setTemperature(fssData.getTemperature()); + obReport.setDewpointDepr(fssData.getDewpointDepr()); - obReport.setPresentWx(getPrWX(metar.getPresWeather())); + obReport.setPresentWx(getPrWX(fssData.getPresWeather())); obReport.setHighResWaveHeight(ObConst.MISSING); - obReport.setWaveSteepness(metar.getWaveSteepness()); + obReport.setWaveSteepness(fssData.getWaveSteepness()); - obReport.setSeaLevelPress(metar.getSeaLevelPress()); - obReport.setWavePeriod(metar.getWavePeriod()); - obReport.setWindGust(metar.getWindGust()); - obReport.setPSwellHeight(metar.getPrimarySwellWaveHeight().floatValue()); - obReport.setPSwellPeriod(metar.getPrimarySwellWavePeriod()); - obReport.setPSwellDir(metar.getPrimarySwellWaveDir().floatValue()); - obReport.setSSwellHeight(metar.getSecondarySwellWaveHeight() + obReport.setSeaLevelPress(fssData.getSeaLevelPress()); + obReport.setWavePeriod(fssData.getWavePeriod()); + obReport.setWindGust(fssData.getWindGust()); + obReport.setPSwellHeight(fssData.getPrimarySwellWaveHeight() .floatValue()); - obReport.setSSwellPeriod(metar.getSecondarySwellWavePeriod()); - obReport.setSSwellDir(metar.getSecondarySwellWaveDir().floatValue()); - obReport.setPressure(metar.getPressureAltimeter()); - obReport.setPressureChange(metar.getPressChange3Hour()); + obReport.setPSwellPeriod(fssData.getPrimarySwellWavePeriod()); + obReport.setPSwellDir(fssData.getPrimarySwellWaveDir().floatValue()); + obReport.setSSwellHeight(fssData.getSecondarySwellWaveHeight() + .floatValue()); + obReport.setSSwellPeriod(fssData.getSecondarySwellWavePeriod()); + obReport.setSSwellDir(fssData.getSecondarySwellWaveDir().floatValue()); + obReport.setPressure(fssData.getPressureAltimeter()); + obReport.setPressureChange(fssData.getPressChange3Hour()); try { - obReport.setPressChangeChar(Short.parseShort(metar + obReport.setPressChangeChar(Short.parseShort(fssData .getPressChangeChar())); } catch (NumberFormatException e) { obReport.setPressChangeChar((short) 0); } - obReport.setHourlyPrecip(metar.getHourlyPrecip()); + obReport.setHourlyPrecip(fssData.getHourlyPrecip()); - obReport.setRawMessage(metar.getRawMessage()); - obReport.setReportType(ReportType.METAR); - obReport.setSnincrHourly(metar.getSnincrHourly()); - obReport.setSnincrTotal(metar.getSnincrTotal()); - obReport.setFrostbiteTime(metar.getFrostbiteTime()); - obReport.setWindChill(metar.getWindChill()); - obReport.setSnowDepth(metar.getSnowDepth()); - obReport.setSeaSurfaceTemp(metar.getSeaSurfaceTemp()); + obReport.setRawMessage(fssData.getRawMessage()); + ReportType reportType = getReportType(fssData.getReportType()); + obReport.setReportType(reportType); + obReport.setSnincrHourly(fssData.getSnincrHourly()); + obReport.setSnincrTotal(fssData.getSnincrTotal()); + obReport.setFrostbiteTime(fssData.getFrostbiteTime()); + obReport.setWindChill(fssData.getWindChill()); + obReport.setSnowDepth(fssData.getSnowDepth()); + obReport.setSeaSurfaceTemp(fssData.getSeaSurfaceTemp()); 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. * diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/Monitor.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/Monitor.java index 55a40fe607..7ab52f4abb 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/Monitor.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/Monitor.java @@ -24,10 +24,10 @@ import java.util.Collection; import java.util.Iterator; 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.alerts.AlertMessage; 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.listeners.IMonitorConfigurationListener; 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. * 3/2/2009 2047 grichard Added stationId resolution method. * 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. + * * * * @author dhladky @@ -199,7 +201,6 @@ public abstract class Monitor implements IMonitor, IMonitorThresholdListener, final Monitor fmonitor = this; final String ftype = type; - // System.out.println("Listener class: "+type); VizApp.runAsync(new Runnable() { public void run() { diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java index a1045c3bac..08580b7442 100755 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ObsMonitor.java @@ -28,11 +28,15 @@ import java.util.regex.Pattern; import org.eclipse.swt.widgets.Display; 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.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform; 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.jms.notification.NotificationMessage; +import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.status.IUFStatusHandler; 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.exception.VizException; 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.monitor.data.MonitoringArea; import com.raytheon.uf.viz.monitor.data.ObReport; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; 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 * May 08, 2014 3086 skorolev Added current site definition. * Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals. + * Sep 18, 2015 3873 skorolev Included common definitions. * * * @@ -106,6 +110,39 @@ public abstract class ObsMonitor extends Monitor { /** Current CWA **/ 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 * @@ -199,20 +236,13 @@ public abstract class ObsMonitor extends Monitor { Display.getDefault().asyncExec(new Runnable() { public void run() { try { - // Filter removed stations - ArrayList zones = MonitoringArea - .getZoneIds(objectToSend - .getPlatformId()); - if (!zones.isEmpty()) { - ObReport result = GenerateFSSObReport - .generateObReport(objectToSend); - statusHandler - .handle(Priority.INFO, - "New FSSrecord ===> " - + objectToSend - .getDataURI()); - process(result); - } + ObReport result = GenerateFSSObReport + .generateObReport(objectToSend); + statusHandler.handle( + Priority.INFO, + "New FSSrecord ===> " + + objectToSend.getDataURI()); + process(result); } catch (Exception e) { statusHandler .handle(Priority.PROBLEM, @@ -240,7 +270,7 @@ public abstract class ObsMonitor extends Monitor { * @param monitorName * */ - public void processProductAtStartup(String monitorName) { + public void processProductAtStartup() { /** * 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); for (FSSObsRecord objectToSend : obsRecords) { - // Filter removed stations - ArrayList zones = MonitoringArea - .getZoneIds(objectToSend.getPlatformId()); - if (!zones.isEmpty()) { - ObReport result = GenerateFSSObReport - .generateObReport(objectToSend); - processAtStartup(result); - } + ObReport result = GenerateFSSObReport + .generateObReport(objectToSend); + processAtStartup(result); } } } catch (DataCubeException e) { 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); 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; + } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ResourceMonitor.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ResourceMonitor.java index b861d79963..d11c72d3ef 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ResourceMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ResourceMonitor.java @@ -22,8 +22,8 @@ package com.raytheon.uf.viz.monitor; 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.notification.NotificationMessage; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; @@ -36,7 +36,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; * * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Apr 9, 2010 dhladky Initial creation + * Apr 9, 2010 dhladky Initial creation + * Sep 20, 2015 3873 skorolev Replaced deprecated NotificationMessage. * * * diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java old mode 100755 new mode 100644 index a16a2a84fb..7cd4ba3f11 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java @@ -21,16 +21,24 @@ package com.raytheon.uf.viz.monitor.data; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; 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.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.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; 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 @@ -40,13 +48,14 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
+ * Date           Ticket#    Engineer   Description
  * ------------ ---------- ----------- --------------------------
  * Dec. 1, 2009  3424       zhao       Initial creation.
  * Oct.29, 2012  1297       skorolev   Changed HashMap to Map
  * Oct.31  2012  1297       skorolev   Cleaned code.
  * Sep 04  2014  3220       skorolev   Added updateZones method.
  * Mar 17  2015  3888       dhladky    check for nulls
+ * Sep 25  2015  3873       skorolev   Corrected addReport for moving platforms.
  * 
  * 
* @@ -73,8 +82,15 @@ public class ObHourReports { */ private Map hourReports; + /** + * current threshold manager + */ private AbstractThresholdMgr thresholdMgr; + private Set zones = new HashSet(); + + private FSSObsMonitorConfigurationManager configMgr; + /** * constructor * @@ -85,10 +101,12 @@ public class ObHourReports { this.nominalTime = nominalTime; this.appName = appName; this.thresholdMgr = thresholdMgr; + configMgr = this.thresholdMgr.getCfgMgr(); + hourReports = new HashMap(); - Map> zoneStationMap = MonitoringArea - .getPlatformMap(); - for (String zone : zoneStationMap.keySet()) { + zones.clear(); + zones.addAll(configMgr.getAreaList()); + for (String zone : zones) { hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, appName, thresholdMgr)); } @@ -101,28 +119,80 @@ public class ObHourReports { */ public void addReport(ObReport report) { String station = report.getPlatformId(); - List zones = MonitoringArea.getZoneIds(station); - if (zones.size() == 0) { - statusHandler - .error("Error: station: " - + station - + " is not associated with any zone in the monitoring area"); - return; + List stationZones = configMgr.getAreaByStationId(station); + // If station has no associated zone: + if (stationZones.isEmpty()) { + if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) { + // Associate moving platform with monitoring zones + double shipDist = configMgr.getShipDistance(); + 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; - for (String zone : zones) { + // Add station report to all associated zones. + for (String zone : stationZones) { if (hourReports.containsKey(zone)) { - hasZone = true; hourReports.get(zone).addReport(report); } } - if (hasZone == false) { - statusHandler - .error("Error in addreport() of ObHourReports: unable to add obs report to data archive"); - } + return; } /** + * Find zones to include a moving platform. + * + * @param report + * from moving platform + * @param shipDist + * distance from area configuration file + */ + private Set findZoneForShip(ObReport report, double shipDist) { + + double latShip = report.getLatitude(); + double lonShip = report.getLongitude(); + Set shipZones = new HashSet(); + + 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 */ public Map getHourReports() { @@ -186,8 +256,8 @@ public class ObHourReports { } /** - * Returns the ObZoneHourReports object of a caller-specified zone. If such - * object not available, returns null. + * Gets ObZoneHourReports Returns the ObZoneHourReports object of a + * caller-specified zone. If such object not available, returns null. * * @param zone * @return hour reports @@ -200,6 +270,8 @@ public class ObHourReports { } /** + * Gets NominalTime + * * @return nominalTime */ public Date getNominalTime() { @@ -207,6 +279,8 @@ public class ObHourReports { } /** + * Gets AppName + * * @return appName */ public CommonConfig.AppName getAppName() { @@ -215,51 +289,79 @@ public class ObHourReports { /** * Updates zones in the Hour Reports + * + * @param configMgr */ public void updateZones() { - Map> zoneStationMap = MonitoringArea - .getPlatformMap(); - // remove zones or stations - List hourZones = new CopyOnWriteArrayList( - hourReports.keySet()); - for (String zone : hourZones) { - if (hourReports.keySet().contains(zone)) { - List stations = new CopyOnWriteArrayList( - 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); - } - } - } + // Updated list of zones + List updtZones = configMgr.getAreaList(); + // remove zones + hourReports.keySet().retainAll(updtZones); // add zones - for (String zone : zoneStationMap.keySet()) { - List stations = new CopyOnWriteArrayList( - 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)) { + for (String zone : updtZones) { + if (!hourReports.keySet().contains(zone)) { hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, appName, thresholdMgr)); } } + // add and(or) remove stations + for (String zone : updtZones) { + // Updated list of stations in this zone + List 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; } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObMultiHrsReports.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObMultiHrsReports.java old mode 100644 new mode 100755 index 9ab69e8dc1..5a040249e3 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObMultiHrsReports.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObMultiHrsReports.java @@ -24,15 +24,22 @@ import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.SortedMap; 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.AppName; 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.util.TimeUtil; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType; 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 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object * Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method - * Oct.31, 2012 1297 skorolev Clean code. - * Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW - * Sep 04, 2014 3220 skorolev Updated getStationTableData method. - * + * Oct 31, 2012 1297 skorolev Clean code. + * Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW + * Sep 04, 2014 3220 skorolev Updated getStationTableData method. + * Sep 25, 2015 3873 skorolev Added multiHrsTabData. + * * * * @author zhao @@ -61,6 +69,8 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; */ public class ObMultiHrsReports { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(ObMultiHrsReports.class); /** * Thresholds manager @@ -78,17 +88,18 @@ public class ObMultiHrsReports { 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 multiHrsReports; + private SortedMap multiHrsReports = new TreeMap(); /** - * The maximum number of most recent hours within which observation reports - * are to be archived. TODO: move MAX_FRAMES to a configuration file? + * Monitor Table data cache. Key is nominal time, value is TableData */ - private final int MAX_FRAMES = 64; + private ConcurrentHashMap multiHrsTabData = new ConcurrentHashMap(); - private int maxFrames = MAX_FRAMES; + private int maxFrames = ObConst.MAX_FRAMES; + + private FSSObsMonitorConfigurationManager cfgMgr = null; /** * Constructor @@ -97,28 +108,16 @@ public class ObMultiHrsReports { */ public ObMultiHrsReports(CommonConfig.AppName appName) { this.appName = appName; - multiHrsReports = new TreeMap(); - if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) { - initFogAlgCellType(); - } - } - /** - * Add an array of ObReport objects to the ObMultiHrsReports object (Don't - * use! VK) - * - * @param result - */ - public void addReports(ObReport[] results) { - 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); + if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) { + if (appName.equals(AppName.FOG)) { + cfgMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.fog); + } else if (appName.equals(AppName.SAFESEAS)) { + cfgMgr = FSSObsMonitorConfigurationManager + .getInstance(MonName.ss); } - addReport(report); + initFogAlgCellType(); } } @@ -129,8 +128,6 @@ public class ObMultiHrsReports { * @return returns multiHrsReports */ public void addReport(ObReport report) { - // Date nominalTime = TableUtil - // .getNominalTime(report.getObservationTime()); Date nominalTime = report.getRefHour(); /** * 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 */ - if ( appName == AppName.SNOW ) { - if ( report.getTemperature() != ObConst.MISSING && report.getWindSpeed() != ObConst.MISSING ) { - report.setWindChill(calcWindChill( report.getTemperature(), report.getWindSpeed() )); + if (appName == AppName.SNOW) { + if (report.getTemperature() != ObConst.MISSING + && report.getWindSpeed() != ObConst.MISSING) { + report.setWindChill(calcWindChill(report.getTemperature(), + report.getWindSpeed())); } - } - - if (multiHrsReports.containsKey(nominalTime)) { - multiHrsReports.get(nominalTime).addReport(report); + ObHourReports obHourReports; + // new nominal time; create a new ObHourReports object + if (multiHrsReports.isEmpty() + || !multiHrsReports.containsKey(nominalTime)) { + obHourReports = new ObHourReports(nominalTime, appName, + thresholdMgr); } else { - // new nominal time; create a new ObHourReports object + // the map is full; delete the oldest entry if (multiHrsReports.size() >= maxFrames) { - // the map is full; delete the oldest entry multiHrsReports.remove(multiHrsReports.firstKey()); } - ObHourReports obHourReports = new ObHourReports(nominalTime, - appName, thresholdMgr); - obHourReports.addReport(report); - multiHrsReports.put(nominalTime, obHourReports); + // update multiHrsReports with new data + obHourReports = multiHrsReports.get(nominalTime); } + obHourReports.addReport(report); + // update data cache + multiHrsReports.put(nominalTime, obHourReports); + TableData tblData = obHourReports.getZoneTableData(); + multiHrsTabData.put(nominalTime, tblData); } - /** - * DR 15654: - * Wind Chill calculation formula based on - * http://www.nws.noaa.gov/om/windchill/ - * as of Jan. 29, 2013 - * - * @param temperature in degree F - * @param windSpeed in knots - * @return wind chill in degree F - */ - private float calcWindChill(float temp, float windSpd) { - if ( temp > 50.0 || windSpd < 3.0 ) { - return ObConst.MISSING; - } - /** - * 1 knots = 1.15078 mph - */ - float spd = (float) Math.pow(1.15078*windSpd, 0.16); - return 35.74f + 0.6215f*temp - 35.75f*spd + 0.4275f*temp*spd; - } + /** + * DR 15654: Wind Chill calculation formula based on + * http://www.nws.noaa.gov/om/windchill/ as of Jan. 29, 2013 + * + * @param temp + * in degree F + * @param windSpd + * in knots + * @return wind chill in degree F + */ + private float calcWindChill(float temp, float windSpd) { + if (temp > 50.0 || windSpd < 3.0) { + return ObConst.MISSING; + } + /** + * 1 knots = 1.15078 mph + */ + float spd = (float) Math.pow(1.15078 * windSpd, 0.16); + 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 * available (the map is empty), returns an empty zone TableData object * (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 * 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 * @return */ public TableData getZoneTableData(Date nominalTime) { + TableData tabData = null; if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) { return getEmptyZoneTableData(); } if (appName == AppName.FOG) { - return this.getObHourReports(nominalTime).getFogZoneTableData( + tabData = this.getObHourReports(nominalTime).getFogZoneTableData( fogAlgCellType); - } - if (appName == AppName.SAFESEAS) { - return this.getObHourReports(nominalTime).getSSZoneTableData( + } else if (appName == AppName.SAFESEAS) { + tabData = this.getObHourReports(nominalTime).getSSZoneTableData( fogAlgCellType); - } - return this.getObHourReports(nominalTime).getZoneTableData(); - // return multiHrsReports.get(nominalTime).getZoneTableData(); + } else { + 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()); ObHourReports hourReports = new ObHourReports(nominalTime, appName, thresholdMgr); + TableData tabData = null; 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 * data available, an empty/default station TableData object is returned + * + * @param zone + * @return */ public TableData getStationTableData(String zone) { if (multiHrsReports.isEmpty()) { @@ -264,9 +284,13 @@ public class ObMultiHrsReports { * Returns a station TableData object for a caller-specified nominal-time * and zone ID. If no data available, an empty/default station TableData * object is returned. + * + * @param nominalTime + * @param zone + * @return */ public TableData getStationTableData(Date nominalTime, String zone) { - if(zone.equals("")){ + if (zone.equals("")) { return this.getEmptyZoneTableData(); } if (nominalTime == null) { @@ -296,6 +320,7 @@ public class ObMultiHrsReports { * @param zone * @param Station * @param varName + * @param productName * @return ObTrendDataSet object, or null if no data available */ public ObTrendDataSet getTrendDataSet(String zone, String station, @@ -304,81 +329,45 @@ public class ObMultiHrsReports { if (multiHrsReports.isEmpty()) { 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 iterator = multiHrsReports.keySet().iterator(); - - while (iterator.hasNext()) { - Date nominalTime = iterator.next(); - if (nominalTime.compareTo(expectedStartNominalTime) >= 0) { - startNominalTime = nominalTime; - break; - } - } - } - } - // get data ObTrendDataSet trendData = new ObTrendDataSet(zone, varName, productName, appName, thresholdMgr); - // trendData.setThresholdMgr(thresholdMgr); + Iterator nominalTimeIterator = multiHrsReports.keySet() .iterator(); + Date start = findStartNominalTime(); while (nominalTimeIterator.hasNext()) { Date nominalTime = nominalTimeIterator.next(); - if (nominalTime.compareTo(startNominalTime) >= 0) { - Set obsTimes = this.getObHourReports(nominalTime) + if (nominalTime.compareTo(start) >= 0) { + ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime) .getObZoneHourReports(zone) - .getObStnHourReports(station).getObsTimes(); - if (obsTimes != null) { - for (Date obsTime : obsTimes) { - trendData.addDataPoint(obsTime, - new Float(this.getObHourReports(nominalTime) - .getObZoneHourReports(zone) - .getObStnHourReports(station) - .getObReport(obsTime).get(varName))); + .getObStnHourReports(station); + if (stnHrRpts != null) { + Set obsTimes = stnHrRpts.getObsTimes(); + if (obsTimes != null) { + for (Date obsTime : obsTimes) { + trendData.addDataPoint(obsTime, new Float(stnHrRpts + .getObReport(obsTime).get(varName))); + } + } else { + continue; } } } } - return trendData; } /** + * Gets History Table Data * + * @param zone + * : current zone * @param station - * station ID + * : station ID * @param obsType - * ObsHistType - * @return TableData object for obs history table + * : ObsHistType + * @return */ public TableData getHistTableData(String zone, String station, ObsHistType obsType) { @@ -387,37 +376,69 @@ public class ObMultiHrsReports { if (multiHrsReports.isEmpty()) { return tblData; } + ArrayList tblRows = new ArrayList(); + Iterator 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 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 tblRows2 = new ArrayList(); + 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. // 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 + / TimeUtil.MILLIS_PER_HOUR; + // difference in hours 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 + // expected, but may not exist in multiHrsReports + Date expectedStartNominalTime = cal.getTime(); if (multiHrsReports.containsKey(expectedStartNominalTime)) { startNominalTime = expectedStartNominalTime; } else { // this iterator is ordered since multiHrsReports is a sorted // map Iterator iterator = multiHrsReports.keySet().iterator(); - while (iterator.hasNext()) { Date nominalTime = iterator.next(); if (nominalTime.compareTo(expectedStartNominalTime) >= 0) { @@ -427,81 +448,50 @@ public class ObMultiHrsReports { } } } - - // get data - ArrayList tblRows = new ArrayList(); - Iterator nominalTimeIterator = multiHrsReports.keySet() - .iterator(); - while (nominalTimeIterator.hasNext()) { - Date nominalTime = nominalTimeIterator.next(); - if (nominalTime.compareTo(startNominalTime) >= 0) { - Set 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 tblRows2 = new ArrayList(); - for (int i = 0; i < tblRows.size(); i++) { - tblRows2.add(tblRows.get(tblRows.size() - 1 - i)); - } - - tblData.setTableRows(tblRows2); - - return tblData; + return startNominalTime; } /** - * Returns a SortedMap object + * Gets table cache * - * @return multiHrsReports + * @return + */ + public ConcurrentHashMap getMultiHrsTabData() { + return multiHrsTabData; + } + + /** + * Sets table cache + * + * @param multiHrsTabData + */ + public void setMultiHrsTabData( + ConcurrentHashMap multiHrsTabData) { + this.multiHrsTabData = multiHrsTabData; + } + + /** + * Gets data cache + * + * @return SortedMap object */ public SortedMap getMultiHrsReports() { return multiHrsReports; } /** - * Returns a SortedMap object (key is nominal time, value is zone TableData - * object) + * Sets data cache * - * @return + * @param multiHrsReports */ - public SortedMap getMultiHrsTableData() { - SortedMap multiHrsTblData = new TreeMap(); - if (appName == AppName.FOG) { - 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; + public void setMultiHrsReports( + SortedMap multiHrsReports) { + this.multiHrsReports = multiHrsReports; } /** - * Returns the latest nominal time if the map is not empty; otherwise, - * returns the nominal time of the present date-time + * Gets the Latest NominalTime Returns the latest nominal time if the map is + * not empty; otherwise, returns the nominal time of the present date-time * * @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 getNominalTimes() { return multiHrsReports.keySet(); } /** - * Returns the ObHourReports object of the latest nominal time. If no data - * available, returns an empty ObHourReports object. + * Gets ObHourReports Returns the ObHourReports object of the latest nominal + * time. If no data available, returns an empty ObHourReports object. * * @return */ public ObHourReports getObHourReports() { if (multiHrsReports.isEmpty()) { - return new ObHourReports(TableUtil.getNominalTime(SimulatedTime - .getSystemTime().getTime()), appName, thresholdMgr); + ObHourReports obHrsReps = new ObHourReports( + 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()); } /** - * Returns an ObHourReports object of a caller-specified nominal time. If no - * data available, returns an empty ObHourReports object. + * Gets ObHourReports Returns an ObHourReports object of a caller-specified + * nominal time. If no data available, returns an empty ObHourReports + * object. * * @param nominalTime * @return @@ -574,6 +572,7 @@ public class ObMultiHrsReports { } /** + * Gets Threshold Manager * * @return the threshold manager */ @@ -591,6 +590,7 @@ public class ObMultiHrsReports { } /** + * Gets map of types for ALG cell * * @return fogAlgCellType */ @@ -603,11 +603,20 @@ public class ObMultiHrsReports { */ private void initFogAlgCellType() { fogAlgCellType = new HashMap(); - Set zones = MonitoringArea.getPlatformMap().keySet(); + List zones = cfgMgr.getAreaList(); Iterator itr = zones.iterator(); while (itr.hasNext()) { fogAlgCellType.put(itr.next(), CellType.NotAvailable); } setFogAlgCellType(fogAlgCellType); } + + /** + * Updates table cache + */ + public void updateTableCache() { + for (Date time : multiHrsReports.keySet()) { + getZoneTableData(time); + } + } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java old mode 100644 new mode 100755 index 2eab2d8cc6..649955f0d9 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java @@ -21,18 +21,22 @@ package com.raytheon.uf.viz.monitor.data; import java.util.Date; import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.ObConst; 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.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants; /** - * This class is a container of ObStnHourReports objects for - * caller-specified zone and nominal date-time - * (this class corresponds to the RcZoneHourReports c++ class in AWIPS 1) + * This class is a container of ObStnHourReports objects for caller-specified + * zone and nominal date-time (this class corresponds to the RcZoneHourReports + * c++ class in AWIPS 1) * *
  * 
@@ -40,7 +44,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Dec. 1, 2009  3424       zhao       Initial creation.
- * Jan 25, 2010  4281       zhao       Modified updateWorstValuesFog method 
+ * Jan 25, 2010  4281       zhao       Modified updateWorstValuesFog method.
+ * Sep 18, 2015  3873       skorolev   Added moving platform's reports.Replaced MonitoringArea with areaConfig.
  * 
  * 
* @@ -49,374 +54,650 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants; */ public class ObZoneHourReports { - - /** - * the nominal time and zone ID of this ObZoneHourReports object - */ - private Date nominalTime; - private String zone; - - /** - * Thresholds manager - */ - private AbstractThresholdMgr thresholdMgr; - - /** - * application name (snow, fog, safeseas, etc) - */ - private CommonConfig.AppName appName; - - /** - * key is station id, value is ObStnHourReports object - */ - private HashMap zoneHourReports; - - /** - * this object stores worst values of the observation variables - * reported during this nominal hour for this zone - */ - private ObReport worstValues; - - public ObZoneHourReports(Date nominalTime, String zone, CommonConfig.AppName appName, AbstractThresholdMgr thresholdMgr) { - this.nominalTime = nominalTime; - this.zone = zone; - this.appName = appName; - this.thresholdMgr =thresholdMgr; - zoneHourReports = new HashMap(); - for ( String station : MonitoringArea.getPlatformMap().get(zone) ) { - zoneHourReports.put(station, new ObStnHourReports(nominalTime, zone, station, appName, thresholdMgr)); - } - InitWorstValues(); - } - - private void InitWorstValues() { - worstValues = new ObReport(); - worstValues.setZoneId(zone); // the ObReport's init() sets "zone id" to "" !!! - } - /** - * @param xmlKey : XML key of a directional obs variable - * @param dirCurrent : the current worst value - * @param dirNew : the value contained in a new obs report - * @return : the value of worse threat level - */ - private float worseDirection(String xmlKeyFrom, String xmlKeyTo, float dirCurrent, float dirNew) { - /** - * decide which one of the two wind directions is worse - * by comparing their corresponding threat levels - */ - if ( dirNew == ObConst.MISSING ) { - return dirCurrent; - } - - if ( dirCurrent == ObConst.MISSING ) { - return dirNew; - } - - CellType cellTypeCurrent = thresholdMgr.getDirectionalThresholdValueCellType(DataUsageKey.DISPLAY, zone, xmlKeyFrom, xmlKeyTo, dirCurrent); - - if ( cellTypeCurrent == CellType.R ) { - /** - * already worst threat level - */ - return dirCurrent; - } - - CellType cellTypeNew = thresholdMgr.getDirectionalThresholdValueCellType(DataUsageKey.DISPLAY, zone, xmlKeyFrom, xmlKeyTo, dirNew); - - /** - * CellType is enumerated in the order R, Y, G, N/A, ... - */ - if ( cellTypeNew.compareTo(cellTypeCurrent) < 0 ) { - /** - * dirNew corresponds to a higher threat level - */ - return dirNew; - } - - return dirCurrent; - } + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(ObZoneHourReports.class); - public void addReport(ObReport report) { - String station = report.getPlatformId(); - if ( zoneHourReports.containsKey(station) ) { - zoneHourReports.get(station).addReport(report); - } else { - System.out.println("Error: unrecognized station ID: " + station + " (app = " + appName +")"); - } - //updateWorstValues(report); - } - - public TableData getStationTableData() { - TableData tblData = new TableData(appName); - for ( String station : zoneHourReports.keySet() ) { - tblData.addTableRowData(this.getObStnHourReports(station).getStationTableRowData()); - } - return tblData; - } + /** the nominal time and zone ID of this ObZoneHourReports object */ + private Date nominalTime; - /** - * Returns a row of a zone table based on all reports within the nominal hour - * for the specified zone. - * If no data available, an empty/default row of table data is returned. - * @return - */ - public TableRowData getZoneTableRowData() { - TableRowData tblRowData = null; - - if ( appName==CommonConfig.AppName.FOG ) { - updateFogWorstValues(); - tblRowData = TableUtil.getFogTableRowData(zone, zone, worstValues, thresholdMgr, CellType.NotAvailable); - } else if ( appName==CommonConfig.AppName.SAFESEAS ) { - updateSafeseasWorstValues(); - tblRowData = TableUtil.getSafeseasTableRowData(zone, zone, worstValues, thresholdMgr, CellType.NotAvailable); - } else if ( appName==CommonConfig.AppName.SNOW ) { - updateSnowWorstValues(); - tblRowData = TableUtil.getSnowTableRowData(zone, zone, worstValues, thresholdMgr); - } else { - System.out.println("unrecognized appName: " + appName); - } - return tblRowData; - } - - public TableRowData getFogZoneTableRowData(CellType algCellType) { - updateFogWorstValues(); - return TableUtil.getFogTableRowData(zone, zone, worstValues, thresholdMgr, algCellType); - } - - public TableRowData getSSZoneTableRowData(CellType algCellType) { - updateSafeseasWorstValues(); - return TableUtil.getSafeseasTableRowData(zone, zone, worstValues, thresholdMgr, algCellType); - } + /** Monitoring area */ + private String zone; - private void updateFogWorstValues() { - if ( zoneHourReports.isEmpty() ) { - return; - } - InitWorstValues(); - for ( String station : zoneHourReports.keySet() ) { - ObReport report = zoneHourReports.get(station).getLatestObReport(); - if ( report != null ) { - if ( report.getVisibility() != ObConst.MISSING ) { - worstValues.setVisibility(worstValues.getVisibility()==ObConst.MISSING?report.getVisibility():Math.min(worstValues.getVisibility(),report.getVisibility())); - } - - worstValues.setPresentWx(worstValues.getPresentWx()+report.getPresentWx()); - - if ( report.getCeiling() != ObConst.MISSING ) { - worstValues.setCeiling(worstValues.getCeiling()==ObConst.MISSING?report.getCeiling():Math.min(worstValues.getCeiling(),report.getCeiling())); - } - - if ( report.getWindDir() != ObConst.MISSING ) { - worstValues.setWindDir(worseDirection(MonitorConfigConstants.FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey(), MonitorConfigConstants.FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey(), worstValues.getWindDir(),report.getWindDir())); - } - - if ( report.getWindSpeed() != ObConst.MISSING ) { - worstValues.setWindSpeed(worstValues.getWindSpeed()==ObConst.MISSING?report.getWindSpeed():Math.max(worstValues.getWindSpeed(),report.getWindSpeed())); - } - - if ( report.getMaxWindSpeed() != ObConst.MISSING ) { - worstValues.setMaxWindSpeed(worstValues.getMaxWindSpeed()==ObConst.MISSING?report.getMaxWindSpeed():Math.max(worstValues.getMaxWindSpeed(),report.getMaxWindSpeed())); - } - - if ( report.getWindGust() != ObConst.MISSING ) { - worstValues.setWindGust(worstValues.getWindGust()==ObConst.MISSING?report.getWindGust():Math.max(worstValues.getWindGust(),report.getWindGust())); - } - - if ( report.getTemperature() != ObConst.MISSING ) { - worstValues.setTemperature(worstValues.getTemperature()==ObConst.MISSING?report.getTemperature():Math.max(worstValues.getTemperature(),report.getTemperature())); - } - - if ( report.getDewpoint() != ObConst.MISSING ) { - worstValues.setDewpoint(worstValues.getDewpoint()==ObConst.MISSING?report.getDewpoint():Math.max(worstValues.getDewpoint(),report.getDewpoint())); - } - - if ( report.getDewpointDepr() != ObConst.MISSING ) { - worstValues.setDewpointDepr(worstValues.getDewpointDepr()==ObConst.MISSING?report.getDewpointDepr():Math.min(worstValues.getDewpointDepr(),report.getDewpointDepr())); - } - - if ( report.getRelativeHumidity() != ObConst.MISSING ) { - worstValues.setRelativeHumidity(worstValues.getRelativeHumidity()==ObConst.MISSING?report.getRelativeHumidity():Math.max(worstValues.getRelativeHumidity(),report.getRelativeHumidity())); - } - } - } - } + /** Thresholds manager */ + private AbstractThresholdMgr thresholdMgr; - private void updateSnowWorstValues() { - if ( zoneHourReports.isEmpty() ) { - return; - } - InitWorstValues(); - for ( String station : zoneHourReports.keySet() ) { - ObReport report = zoneHourReports.get(station).getLatestObReport(); - if ( report != null ) { - worstValues.setPresentWx(worstValues.getPresentWx()+report.getPresentWx()); - - if ( report.getWindDir() != ObConst.MISSING ) { - worstValues.setWindDir(worseDirection(MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey(), MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey(), worstValues.getWindDir(),report.getWindDir())); - } - - if ( report.getWindSpeed() != ObConst.MISSING ) { - worstValues.setWindSpeed(worstValues.getWindSpeed()==ObConst.MISSING?report.getWindSpeed():Math.max(worstValues.getWindSpeed(),report.getWindSpeed())); - } - - if ( report.getMaxWindSpeed() != ObConst.MISSING ) { - worstValues.setMaxWindSpeed(worstValues.getMaxWindSpeed()==ObConst.MISSING?report.getMaxWindSpeed():Math.max(worstValues.getMaxWindSpeed(),report.getMaxWindSpeed())); - } - - if ( report.getWindGust() != ObConst.MISSING ) { - worstValues.setWindGust(worstValues.getWindGust()==ObConst.MISSING?report.getWindGust():Math.max(worstValues.getWindGust(),report.getWindGust())); - } - - if ( report.getTemperature() != ObConst.MISSING ) { - worstValues.setTemperature(worstValues.getTemperature()==ObConst.MISSING?report.getTemperature():Math.min(worstValues.getTemperature(),report.getTemperature())); - } - - if ( report.getDewpoint() != ObConst.MISSING ) { - worstValues.setDewpoint(worstValues.getDewpoint()==ObConst.MISSING?report.getDewpoint():Math.min(worstValues.getDewpoint(),report.getDewpoint())); - } - - if ( report.getVisibility() != ObConst.MISSING ) { - worstValues.setVisibility(worstValues.getVisibility()==ObConst.MISSING?report.getVisibility():Math.min(worstValues.getVisibility(),report.getVisibility())); - } - - if ( report.getSeaLevelPress() != ObConst.MISSING ) { - worstValues.setSeaLevelPress(worstValues.getSeaLevelPress()==ObConst.MISSING?report.getSeaLevelPress():Math.min(worstValues.getSeaLevelPress(),report.getSeaLevelPress())); - } - - if ( report.getWindChill() != ObConst.MISSING ) { - worstValues.setWindChill(worstValues.getWindChill()==ObConst.MISSING?report.getWindChill():Math.min(worstValues.getWindChill(),report.getWindChill())); - } - - if ( report.getFrostbiteTime() != ObConst.MISSING ) { - worstValues.setFrostbiteTime(worstValues.getFrostbiteTime()==ObConst.MISSING?report.getFrostbiteTime():Math.min(worstValues.getFrostbiteTime(),report.getFrostbiteTime())); - } - - if ( report.getHourlyPrecip() != ObConst.MISSING ) { - worstValues.setHourlyPrecip(worstValues.getHourlyPrecip()==ObConst.MISSING?report.getHourlyPrecip():Math.max(worstValues.getHourlyPrecip(),report.getHourlyPrecip())); - } - - if ( report.getSnowDepth() != ObConst.MISSING ) { - worstValues.setSnowDepth(worstValues.getSnowDepth()==ObConst.MISSING?report.getSnowDepth():Math.max(worstValues.getSnowDepth(),report.getSnowDepth())); - } - - if ( report.getSnincrHourly() != ObConst.MISSING ) { - worstValues.setSnincrHourly(worstValues.getSnincrHourly()==ObConst.MISSING?report.getSnincrHourly():Math.max(worstValues.getSnincrHourly(),report.getSnincrHourly())); - } - - if ( report.getSnincrTotal() != ObConst.MISSING ) { - worstValues.setSnincrTotal(worstValues.getSnincrTotal()==ObConst.MISSING?report.getSnincrTotal():Math.max(worstValues.getSnincrTotal(),report.getSnincrTotal())); - } - } - } - } + /** application name (snow, fog, safeseas, etc) */ + private CommonConfig.AppName appName; - private void updateSafeseasWorstValues() { - if ( zoneHourReports.isEmpty() ) { - return; - } - InitWorstValues(); - for ( String station : zoneHourReports.keySet() ) { - ObReport report = zoneHourReports.get(station).getLatestObReport(); - if ( report != null ) { - if ( report.getWindDir() != ObConst.MISSING ) { - worstValues.setWindDir(worstValues.getWindDir()==ObConst.MISSING?report.getWindDir():worseDirection(MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey(), MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey(), worstValues.getWindDir(),report.getWindDir())); - } - - if ( report.getWindSpeed() != ObConst.MISSING ) { - worstValues.setWindSpeed(worstValues.getWindSpeed()==ObConst.MISSING?report.getWindSpeed():Math.max(worstValues.getWindSpeed(),report.getWindSpeed())); - } - - if ( report.getMaxWindSpeed() != ObConst.MISSING ) { - worstValues.setMaxWindSpeed(worstValues.getMaxWindSpeed()==ObConst.MISSING?report.getMaxWindSpeed():Math.max(worstValues.getMaxWindSpeed(),report.getMaxWindSpeed())); - } - - if ( report.getWindGust() != ObConst.MISSING ) { - worstValues.setWindGust(worstValues.getWindGust()==ObConst.MISSING?report.getWindGust():Math.max(worstValues.getWindGust(),report.getWindGust())); - } - - if ( report.getVisibility() != ObConst.MISSING ) { - worstValues.setVisibility(worstValues.getVisibility()==ObConst.MISSING?report.getVisibility():Math.min(worstValues.getVisibility(),report.getVisibility())); - } - - if ( report.getTemperature() != ObConst.MISSING ) { - worstValues.setTemperature(worstValues.getTemperature()==ObConst.MISSING?report.getTemperature():Math.max(worstValues.getTemperature(),report.getTemperature())); - } - - if ( report.getDewpoint() != ObConst.MISSING ) { - worstValues.setDewpoint(worstValues.getDewpoint()==ObConst.MISSING?report.getDewpoint():Math.max(worstValues.getDewpoint(),report.getDewpoint())); - } - - if ( report.getSeaLevelPress() != ObConst.MISSING ) { - worstValues.setSeaLevelPress(worstValues.getSeaLevelPress()==ObConst.MISSING?report.getSeaLevelPress():Math.min(worstValues.getSeaLevelPress(),report.getSeaLevelPress())); - } - - if ( report.getSeaSurfaceTemp() != ObConst.MISSING ) { - worstValues.setSeaSurfaceTemp(worstValues.getSeaSurfaceTemp()==ObConst.MISSING?report.getSeaSurfaceTemp():Math.max(worstValues.getSeaSurfaceTemp(),report.getSeaSurfaceTemp())); - } - - if ( report.getHighResWaveHeight() != ObConst.MISSING ) { - worstValues.setHighResWaveHeight(worstValues.getHighResWaveHeight()==ObConst.MISSING?report.getHighResWaveHeight():Math.max(worstValues.getHighResWaveHeight(),report.getHighResWaveHeight())); - } - - if ( report.getWaveSteepness() != ObConst.MISSING ) { - worstValues.setWaveSteepness(worstValues.getWaveSteepness()==ObConst.MISSING?report.getWaveSteepness():Math.max(worstValues.getWaveSteepness(),report.getWaveSteepness())); - } - - if ( report.getPSwellHeight() != ObConst.MISSING ) { - worstValues.setPSwellHeight(worstValues.getPSwellHeight()==ObConst.MISSING?report.getPSwellHeight():Math.max(worstValues.getPSwellHeight(),report.getPSwellHeight())); - } - - if ( report.getPSwellPeriod() != ObConst.MISSING ) { - worstValues.setPSwellPeriod(worstValues.getPSwellPeriod()==ObConst.MISSING?report.getPSwellPeriod():Math.max(worstValues.getPSwellPeriod(),report.getPSwellPeriod())); - } - - if ( report.getPSwellDir() != ObConst.MISSING ) { - worstValues.setPSwellDir(worstValues.getPSwellDir()==ObConst.MISSING?report.getPSwellDir():worseDirection(MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey(), MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey(), worstValues.getPSwellDir(),report.getPSwellDir())); - } - - if ( report.getSSwellHeight() != ObConst.MISSING ) { - worstValues.setSSwellHeight(worstValues.getSSwellHeight()==ObConst.MISSING?report.getSSwellHeight():Math.max(worstValues.getSSwellHeight(),report.getSSwellHeight())); - } - - if ( report.getSSwellPeriod() != ObConst.MISSING ) { - worstValues.setSSwellPeriod(worstValues.getSSwellPeriod()==ObConst.MISSING?report.getSSwellPeriod():Math.max(worstValues.getSSwellPeriod(),report.getSSwellPeriod())); - } - - if ( report.getSSwellDir() != ObConst.MISSING ) { - worstValues.setSSwellDir(worstValues.getSSwellDir()==ObConst.MISSING?report.getSSwellDir():worseDirection(MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey(), MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey(), worstValues.getSSwellDir(),report.getSSwellDir())); - } - } - } - } + /** key is station id, value is ObStnHourReports object */ + private HashMap zoneHourReports; - /** - * Returns the ObStnHourReports object of a caller-specified station. - * If such object not available, returns null. - * @param station - * @return - */ - public ObStnHourReports getObStnHourReports(String station) { - if ( !zoneHourReports.containsKey(station) ) { - return null; - } - return zoneHourReports.get(station); - } - - public HashMap getZoneHourReports() { - return zoneHourReports; - } - - public Date getNominalTime() { - return nominalTime; - } - - public String getZone() { - return zone; - } - - public CommonConfig.AppName getAppName() { - return appName; - } + /** + * this object stores worst values of the observation variables reported + * during this nominal hour for this zone + */ + private ObReport worstValues; + + /** + * Constructor + * + * @param nominalTime + * @param zone + * @param appName + * @param thresholdMgr + */ + public ObZoneHourReports(Date nominalTime, String zone, + CommonConfig.AppName appName, AbstractThresholdMgr thresholdMgr) { + this.nominalTime = nominalTime; + this.zone = zone; + this.appName = appName; + this.thresholdMgr = thresholdMgr; + zoneHourReports = new HashMap(); + List stations = thresholdMgr.getCfgMgr().getAreaStations(zone); + if (!stations.isEmpty()) { + for (String station : stations) { + zoneHourReports.put(station, new ObStnHourReports(nominalTime, + zone, station, appName, thresholdMgr)); + } + } + InitWorstValues(); + } + + /** + * Initiates the worst values. + */ + private void InitWorstValues() { + worstValues = new ObReport(); + worstValues.setZoneId(zone); + } + + /** + * The worst direction + * + * @param xmlKeyFrom + * : XML key of a directional obs from variable + * @param xmlKeyTo + * : XML key of a directional obs to variable + * @param dirCurrent + * : the current worst value + * @param dirNew + * : the value contained in a new obs report + * @return : the value of worse threat level + */ + private float worseDirection(String xmlKeyFrom, String xmlKeyTo, + float dirCurrent, float dirNew) { + /** + * decide which one of the two wind directions is worse by comparing + * their corresponding threat levels + */ + if (dirNew == ObConst.MISSING) { + return dirCurrent; + } + + if (dirCurrent == ObConst.MISSING) { + return dirNew; + } + + CellType cellTypeCurrent = thresholdMgr + .getDirectionalThresholdValueCellType(DataUsageKey.DISPLAY, + zone, xmlKeyFrom, xmlKeyTo, dirCurrent); + + if (cellTypeCurrent == CellType.R) { + /** + * already worst threat level + */ + return dirCurrent; + } + + CellType cellTypeNew = thresholdMgr + .getDirectionalThresholdValueCellType(DataUsageKey.DISPLAY, + zone, xmlKeyFrom, xmlKeyTo, dirNew); + + /** + * CellType is enumerated in the order R, Y, G, N/A, ... + */ + if (cellTypeNew.compareTo(cellTypeCurrent) < 0) { + /** + * dirNew corresponds to a higher threat level + */ + return dirNew; + } + + return dirCurrent; + } + + /** + * Adds report + * + * @param report + */ + public void addReport(ObReport report) { + String station = report.getPlatformId(); + nominalTime = report.getObservationTime(); + + if (zoneHourReports.containsKey(station)) { + zoneHourReports.get(station).addReport(report); + } else { + // Add report from moving platform. + ObStnHourReports shipRpts = new ObStnHourReports( + report.getObservationTime(), this.getZone(), station, + this.getAppName(), this.thresholdMgr); + shipRpts.addReport(report); + zoneHourReports.put(station, shipRpts); + } + } + + /** + * Gets StationTableData + * + * @return + */ + public TableData getStationTableData() { + TableData tblData = new TableData(appName); + for (String station : zoneHourReports.keySet()) { + tblData.addTableRowData(this.getObStnHourReports(station) + .getStationTableRowData()); + } + return tblData; + } + + /** + * Returns a row of a zone table based on all reports within the nominal + * hour for the specified zone. If no data available, an empty/default row + * of table data is returned. + * + * @return + */ + public TableRowData getZoneTableRowData() { + TableRowData tblRowData = null; + + if (appName.equals(CommonConfig.AppName.FOG)) { + updateFogWorstValues(); + tblRowData = TableUtil.getFogTableRowData(zone, zone, worstValues, + thresholdMgr, CellType.NotAvailable); + } else if (appName.equals(CommonConfig.AppName.SAFESEAS)) { + updateSafeseasWorstValues(); + tblRowData = TableUtil.getSafeseasTableRowData(zone, zone, + worstValues, thresholdMgr, CellType.NotAvailable); + } else if (appName.equals(CommonConfig.AppName.SNOW)) { + updateSnowWorstValues(); + tblRowData = TableUtil.getSnowTableRowData(zone, zone, worstValues, + thresholdMgr); + } else { + statusHandler.error("unrecognized appName: " + appName); + } + return tblRowData; + } + + /** + * Gets Fog Zone Table Row Data + * + * @param algCellType + * @return + */ + public TableRowData getFogZoneTableRowData(CellType algCellType) { + updateFogWorstValues(); + return TableUtil.getFogTableRowData(zone, zone, worstValues, + thresholdMgr, algCellType); + } + + /** + * Gets SAFESEAS Zone Table Row Data + * + * @param algCellType + * : Type of ALG cell in the table + * @return + */ + public TableRowData getSSZoneTableRowData(CellType algCellType) { + updateSafeseasWorstValues(); + return TableUtil.getSafeseasTableRowData(zone, zone, worstValues, + thresholdMgr, algCellType); + } + + /** + * Updates Fog Worst Values + */ + private void updateFogWorstValues() { + if (zoneHourReports.isEmpty()) { + return; + } + InitWorstValues(); + for (String station : zoneHourReports.keySet()) { + ObReport report = zoneHourReports.get(station).getLatestObReport(); + if (report != null) { + if (report.getVisibility() != ObConst.MISSING) { + worstValues + .setVisibility(worstValues.getVisibility() == ObConst.MISSING ? report + .getVisibility() : Math.min( + worstValues.getVisibility(), + report.getVisibility())); + } + + worstValues.setPresentWx(worstValues.getPresentWx() + + report.getPresentWx()); + + if (report.getCeiling() != ObConst.MISSING) { + worstValues + .setCeiling(worstValues.getCeiling() == ObConst.MISSING ? report + .getCeiling() : Math.min( + worstValues.getCeiling(), + report.getCeiling())); + } + + if (report.getWindDir() != ObConst.MISSING) { + worstValues + .setWindDir(worseDirection( + MonitorConfigConstants.FogDisplay.FOG_DISP_WIND_DIR_FROM + .getXmlKey(), + MonitorConfigConstants.FogDisplay.FOG_DISP_WIND_DIR_TO + .getXmlKey(), worstValues + .getWindDir(), report.getWindDir())); + } + + if (report.getWindSpeed() != ObConst.MISSING) { + worstValues + .setWindSpeed(worstValues.getWindSpeed() == ObConst.MISSING ? report + .getWindSpeed() : Math.max( + worstValues.getWindSpeed(), + report.getWindSpeed())); + } + + if (report.getMaxWindSpeed() != ObConst.MISSING) { + worstValues + .setMaxWindSpeed(worstValues.getMaxWindSpeed() == ObConst.MISSING ? report + .getMaxWindSpeed() : Math.max( + worstValues.getMaxWindSpeed(), + report.getMaxWindSpeed())); + } + + if (report.getWindGust() != ObConst.MISSING) { + worstValues + .setWindGust(worstValues.getWindGust() == ObConst.MISSING ? report + .getWindGust() : Math.max( + worstValues.getWindGust(), + report.getWindGust())); + } + + if (report.getTemperature() != ObConst.MISSING) { + worstValues + .setTemperature(worstValues.getTemperature() == ObConst.MISSING ? report + .getTemperature() : Math.max( + worstValues.getTemperature(), + report.getTemperature())); + } + + if (report.getDewpoint() != ObConst.MISSING) { + worstValues + .setDewpoint(worstValues.getDewpoint() == ObConst.MISSING ? report + .getDewpoint() : Math.max( + worstValues.getDewpoint(), + report.getDewpoint())); + } + + if (report.getDewpointDepr() != ObConst.MISSING) { + worstValues + .setDewpointDepr(worstValues.getDewpointDepr() == ObConst.MISSING ? report + .getDewpointDepr() : Math.min( + worstValues.getDewpointDepr(), + report.getDewpointDepr())); + } + + if (report.getRelativeHumidity() != ObConst.MISSING) { + worstValues.setRelativeHumidity(worstValues + .getRelativeHumidity() == ObConst.MISSING ? report + .getRelativeHumidity() : Math.max( + worstValues.getRelativeHumidity(), + report.getRelativeHumidity())); + } + } + } + } + + /** + * Updates SNOW Worst Values + */ + private void updateSnowWorstValues() { + if (zoneHourReports.isEmpty()) { + return; + } + InitWorstValues(); + for (String station : zoneHourReports.keySet()) { + ObReport report = zoneHourReports.get(station).getLatestObReport(); + if (report != null) { + worstValues.setPresentWx(worstValues.getPresentWx() + + report.getPresentWx()); + + if (report.getWindDir() != ObConst.MISSING) { + worstValues + .setWindDir(worseDirection( + MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_DIR_FROM + .getXmlKey(), + MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_DIR_TO + .getXmlKey(), worstValues + .getWindDir(), report.getWindDir())); + } + + if (report.getWindSpeed() != ObConst.MISSING) { + worstValues + .setWindSpeed(worstValues.getWindSpeed() == ObConst.MISSING ? report + .getWindSpeed() : Math.max( + worstValues.getWindSpeed(), + report.getWindSpeed())); + } + + if (report.getMaxWindSpeed() != ObConst.MISSING) { + worstValues + .setMaxWindSpeed(worstValues.getMaxWindSpeed() == ObConst.MISSING ? report + .getMaxWindSpeed() : Math.max( + worstValues.getMaxWindSpeed(), + report.getMaxWindSpeed())); + } + + if (report.getWindGust() != ObConst.MISSING) { + worstValues + .setWindGust(worstValues.getWindGust() == ObConst.MISSING ? report + .getWindGust() : Math.max( + worstValues.getWindGust(), + report.getWindGust())); + } + + if (report.getTemperature() != ObConst.MISSING) { + worstValues + .setTemperature(worstValues.getTemperature() == ObConst.MISSING ? report + .getTemperature() : Math.min( + worstValues.getTemperature(), + report.getTemperature())); + } + + if (report.getDewpoint() != ObConst.MISSING) { + worstValues + .setDewpoint(worstValues.getDewpoint() == ObConst.MISSING ? report + .getDewpoint() : Math.min( + worstValues.getDewpoint(), + report.getDewpoint())); + } + + if (report.getVisibility() != ObConst.MISSING) { + worstValues + .setVisibility(worstValues.getVisibility() == ObConst.MISSING ? report + .getVisibility() : Math.min( + worstValues.getVisibility(), + report.getVisibility())); + } + + if (report.getSeaLevelPress() != ObConst.MISSING) { + worstValues + .setSeaLevelPress(worstValues.getSeaLevelPress() == ObConst.MISSING ? report + .getSeaLevelPress() : Math.min( + worstValues.getSeaLevelPress(), + report.getSeaLevelPress())); + } + + if (report.getWindChill() != ObConst.MISSING) { + worstValues + .setWindChill(worstValues.getWindChill() == ObConst.MISSING ? report + .getWindChill() : Math.min( + worstValues.getWindChill(), + report.getWindChill())); + } + + if (report.getFrostbiteTime() != ObConst.MISSING) { + worstValues + .setFrostbiteTime(worstValues.getFrostbiteTime() == ObConst.MISSING ? report + .getFrostbiteTime() : Math.min( + worstValues.getFrostbiteTime(), + report.getFrostbiteTime())); + } + + if (report.getHourlyPrecip() != ObConst.MISSING) { + worstValues + .setHourlyPrecip(worstValues.getHourlyPrecip() == ObConst.MISSING ? report + .getHourlyPrecip() : Math.max( + worstValues.getHourlyPrecip(), + report.getHourlyPrecip())); + } + + if (report.getSnowDepth() != ObConst.MISSING) { + worstValues + .setSnowDepth(worstValues.getSnowDepth() == ObConst.MISSING ? report + .getSnowDepth() : Math.max( + worstValues.getSnowDepth(), + report.getSnowDepth())); + } + + if (report.getSnincrHourly() != ObConst.MISSING) { + worstValues + .setSnincrHourly(worstValues.getSnincrHourly() == ObConst.MISSING ? report + .getSnincrHourly() : Math.max( + worstValues.getSnincrHourly(), + report.getSnincrHourly())); + } + + if (report.getSnincrTotal() != ObConst.MISSING) { + worstValues + .setSnincrTotal(worstValues.getSnincrTotal() == ObConst.MISSING ? report + .getSnincrTotal() : Math.max( + worstValues.getSnincrTotal(), + report.getSnincrTotal())); + } + } + } + } + + /** + * Updates SAFESEAS Worst Values + */ + private void updateSafeseasWorstValues() { + if (zoneHourReports.isEmpty()) { + return; + } + InitWorstValues(); + for (String station : zoneHourReports.keySet()) { + ObReport report = zoneHourReports.get(station).getLatestObReport(); + if (report != null) { + if (report.getWindDir() != ObConst.MISSING) { + worstValues + .setWindDir(worstValues.getWindDir() == ObConst.MISSING ? report + .getWindDir() + : worseDirection( + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM + .getXmlKey(), + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_TO + .getXmlKey(), worstValues + .getWindDir(), report + .getWindDir())); + } + + if (report.getWindSpeed() != ObConst.MISSING) { + worstValues + .setWindSpeed(worstValues.getWindSpeed() == ObConst.MISSING ? report + .getWindSpeed() : Math.max( + worstValues.getWindSpeed(), + report.getWindSpeed())); + } + + if (report.getMaxWindSpeed() != ObConst.MISSING) { + worstValues + .setMaxWindSpeed(worstValues.getMaxWindSpeed() == ObConst.MISSING ? report + .getMaxWindSpeed() : Math.max( + worstValues.getMaxWindSpeed(), + report.getMaxWindSpeed())); + } + + if (report.getWindGust() != ObConst.MISSING) { + worstValues + .setWindGust(worstValues.getWindGust() == ObConst.MISSING ? report + .getWindGust() : Math.max( + worstValues.getWindGust(), + report.getWindGust())); + } + + if (report.getVisibility() != ObConst.MISSING) { + worstValues + .setVisibility(worstValues.getVisibility() == ObConst.MISSING ? report + .getVisibility() : Math.min( + worstValues.getVisibility(), + report.getVisibility())); + } + + if (report.getTemperature() != ObConst.MISSING) { + worstValues + .setTemperature(worstValues.getTemperature() == ObConst.MISSING ? report + .getTemperature() : Math.max( + worstValues.getTemperature(), + report.getTemperature())); + } + + if (report.getDewpoint() != ObConst.MISSING) { + worstValues + .setDewpoint(worstValues.getDewpoint() == ObConst.MISSING ? report + .getDewpoint() : Math.max( + worstValues.getDewpoint(), + report.getDewpoint())); + } + + if (report.getSeaLevelPress() != ObConst.MISSING) { + worstValues + .setSeaLevelPress(worstValues.getSeaLevelPress() == ObConst.MISSING ? report + .getSeaLevelPress() : Math.min( + worstValues.getSeaLevelPress(), + report.getSeaLevelPress())); + } + + if (report.getSeaSurfaceTemp() != ObConst.MISSING) { + worstValues.setSeaSurfaceTemp(worstValues + .getSeaSurfaceTemp() == ObConst.MISSING ? report + .getSeaSurfaceTemp() : Math.max( + worstValues.getSeaSurfaceTemp(), + report.getSeaSurfaceTemp())); + } + + if (report.getHighResWaveHeight() != ObConst.MISSING) { + worstValues.setHighResWaveHeight(worstValues + .getHighResWaveHeight() == ObConst.MISSING ? report + .getHighResWaveHeight() : Math.max( + worstValues.getHighResWaveHeight(), + report.getHighResWaveHeight())); + } + + if (report.getWaveSteepness() != ObConst.MISSING) { + worstValues + .setWaveSteepness(worstValues.getWaveSteepness() == ObConst.MISSING ? report + .getWaveSteepness() : Math.max( + worstValues.getWaveSteepness(), + report.getWaveSteepness())); + } + + if (report.getPSwellHeight() != ObConst.MISSING) { + worstValues + .setPSwellHeight(worstValues.getPSwellHeight() == ObConst.MISSING ? report + .getPSwellHeight() : Math.max( + worstValues.getPSwellHeight(), + report.getPSwellHeight())); + } + + if (report.getPSwellPeriod() != ObConst.MISSING) { + worstValues + .setPSwellPeriod(worstValues.getPSwellPeriod() == ObConst.MISSING ? report + .getPSwellPeriod() : Math.max( + worstValues.getPSwellPeriod(), + report.getPSwellPeriod())); + } + + if (report.getPSwellDir() != ObConst.MISSING) { + worstValues + .setPSwellDir(worstValues.getPSwellDir() == ObConst.MISSING ? report + .getPSwellDir() + : worseDirection( + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM + .getXmlKey(), + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO + .getXmlKey(), worstValues + .getPSwellDir(), report + .getPSwellDir())); + } + + if (report.getSSwellHeight() != ObConst.MISSING) { + worstValues + .setSSwellHeight(worstValues.getSSwellHeight() == ObConst.MISSING ? report + .getSSwellHeight() : Math.max( + worstValues.getSSwellHeight(), + report.getSSwellHeight())); + } + + if (report.getSSwellPeriod() != ObConst.MISSING) { + worstValues + .setSSwellPeriod(worstValues.getSSwellPeriod() == ObConst.MISSING ? report + .getSSwellPeriod() : Math.max( + worstValues.getSSwellPeriod(), + report.getSSwellPeriod())); + } + + if (report.getSSwellDir() != ObConst.MISSING) { + worstValues + .setSSwellDir(worstValues.getSSwellDir() == ObConst.MISSING ? report + .getSSwellDir() + : worseDirection( + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM + .getXmlKey(), + MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO + .getXmlKey(), worstValues + .getSSwellDir(), report + .getSSwellDir())); + } + } + } + } + + /** + * Returns the ObStnHourReports object of a caller-specified station. If + * such object not available, returns null. + * + * @param station + * @return + */ + public ObStnHourReports getObStnHourReports(String station) { + if (!zoneHourReports.containsKey(station)) { + return null; + } + return zoneHourReports.get(station); + } + + /** + * Gets Zone Hour Reports + * + * @return + */ + public Map getZoneHourReports() { + return zoneHourReports; + } + + /** + * Gets Nominal Time + * + * @return + */ + public Date getNominalTime() { + return nominalTime; + } + + /** + * Gets Zone + * + * @return + */ + public String getZone() { + return zone; + } + + /** + * Gets AppName + * + * @return + */ + public CommonConfig.AppName getAppName() { + return appName; + } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java old mode 100644 new mode 100755 index 3f5cf9ffce..71941250e7 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java @@ -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.ObConst; 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.CellType; 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 * Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn * 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. * * * @@ -110,13 +112,23 @@ public final class TableUtil { isZone = true; } - String hoverText = null; + DataUsageKey dataUsageKey; + if (tm.getDataUsageKey() != null) { + dataUsageKey = tm.getDataUsageKey(); + } else { + dataUsageKey = DataUsageKey.DISPLAY; + } + + String hoverText = ""; if (isZone) { - hoverText = getZoneHoverText(areaId); + AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone); + if (zoneXML != null) { + hoverText = getZoneHoverText(zoneXML); + } } else { hoverText = getStationHoverText(areaId); } - + // zone or station ID tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText, CellType.AreaId, false)); @@ -131,14 +143,18 @@ public final class TableUtil { visValue = visValue * 16.0f; // vis in units of "miles/16"; this is // used to compare with Red/Yellow // 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( - visString, - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS - .getXmlKey(), visValue), true); + TableCellData visCellData = new TableCellData(visString, + tm.getThresholdValueCellType(dataUsageKey, zone, mccVIS, + visValue), true); visCellData.setValue(visValue); // visValue, instead of visString, // will be used for sorting @@ -320,7 +336,8 @@ public final class TableUtil { * dialog) * @param zone * @param report - * @param tm Abstract Threshold Manager + * @param tm + * Abstract Threshold Manager * @param fogCellType * @return */ @@ -336,9 +353,19 @@ public final class TableUtil { isZone = true; } - String hoverText = null; + DataUsageKey dataUsageKey; + if (tm.getDataUsageKey() != null) { + dataUsageKey = tm.getDataUsageKey(); + } else { + dataUsageKey = DataUsageKey.DISPLAY; + } + + String hoverText = ""; if (isZone) { - hoverText = getZoneHoverText(areaId); + AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone); + if (zoneXML != null) { + hoverText = getZoneHoverText(zoneXML); + } } else { hoverText = getStationHoverText(areaId); } @@ -390,42 +417,52 @@ public final class TableUtil { .getXmlKey(), report .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 - .setTableCellData( - 6, - new TableCellData( - Math.round(new Float(report.getWindSpeed())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED - .getXmlKey(), report - .getWindSpeed()), true)); + // peak wind + String mccPeakWind; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccPeakWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND + .getXmlKey(); + } else { + mccPeakWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_PEAK_WIND + .getXmlKey(); + } + tblRowData.setTableCellData( + 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 - .setTableCellData( - 7, - new TableCellData( - Math.round(new Float(report.getMaxWindSpeed())), - 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)); + tblRowData.setTableCellData( + 8, + new TableCellData(Math.round(new Float(report.getWindGust())), + tm.getThresholdValueCellType(dataUsageKey, zone, + mccWindGust, report.getWindGust()), true)); // visibility float visValue = report.getVisibility(); // vis value in miles (statute @@ -443,20 +480,25 @@ public final class TableUtil { // to compare with Red/Yellow threshold // values - TableCellData visCellData = new TableCellData( - visString, - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS - .getXmlKey(), visValue), true); + String mccVis; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccVis = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS + .getXmlKey(); + } else { + mccVis = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS + .getXmlKey(); + } + + TableCellData visCellData = new TableCellData(visString, + tm.getThresholdValueCellType(dataUsageKey, zone, mccVis, + visValue), true); visCellData.setValue(visValue); // visValue, instead of visString, // will be used for sorting tblRowData.setTableCellData(9, visCellData); } - + // temperature tblRowData .setTableCellData( 10, @@ -468,7 +510,7 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP .getXmlKey(), report .getTemperature()), true)); - + // dewpoint tblRowData .setTableCellData( 11, @@ -480,7 +522,7 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT .getXmlKey(), report .getDewpoint()), true)); - + // SLP tblRowData .setTableCellData( 12, @@ -492,7 +534,7 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP .getXmlKey(), report .getSeaLevelPress()), true)); - + // SST tblRowData .setTableCellData( 13, @@ -504,7 +546,7 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST .getXmlKey(), report .getSeaSurfaceTemp()), true)); - + // wave height tblRowData .setTableCellData( 14, @@ -517,7 +559,7 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT .getXmlKey(), report .getHighResWaveHeight()), true)); - + // wave steep tblRowData .setTableCellData( 15, @@ -529,79 +571,102 @@ public final class TableUtil { MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP .getXmlKey(), report .getWaveSteepness()), true)); - - tblRowData - .setTableCellData( - 16, - new TableCellData( - Math.round(new Float(report.getPSwellHeight())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT - .getXmlKey(), report - .getPSwellHeight()), true)); - - tblRowData - .setTableCellData( - 17, - new TableCellData( - Math.round(new Float(report.getPSwellPeriod())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD - .getXmlKey(), report - .getPSwellPeriod()), true)); - - tblRowData - .setTableCellData( - 18, - new TableCellData( - Math.round(new Float(report.getPSwellDir())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM - .getXmlKey(), report - .getPSwellDir()), true)); - - tblRowData - .setTableCellData( - 19, - new TableCellData( - Math.round(new Float(report.getSSwellHeight())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT - .getXmlKey(), report - .getSSwellHeight()), true)); - - tblRowData - .setTableCellData( - 20, - new TableCellData( - Math.round(new Float(report.getSSwellPeriod())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD - .getXmlKey(), report - .getSSwellPeriod()), true)); - + // swell height + String mccSwell; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccSwell = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT + .getXmlKey(); + } else { + mccSwell = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_HT + .getXmlKey(); + } + tblRowData.setTableCellData( + 16, + new TableCellData( + Math.round(new Float(report.getPSwellHeight())), tm + .getThresholdValueCellType(dataUsageKey, zone, + mccSwell, report.getPSwellHeight()), + true)); + // swell period + String mccSwellPD; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccSwellPD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD + .getXmlKey(); + } else { + mccSwellPD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_PD + .getXmlKey(); + } + tblRowData.setTableCellData( + 17, + new TableCellData( + Math.round(new Float(report.getPSwellPeriod())), tm + .getThresholdValueCellType(dataUsageKey, zone, + mccSwellPD, report.getPSwellPeriod()), + true)); + // swell dir TODO: from only + String mccSwellDirFrom; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccSwellDirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM + .getXmlKey(); + } else { + mccSwellDirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM + .getXmlKey(); + } + tblRowData.setTableCellData( + 18, + new TableCellData(Math.round(new Float(report.getPSwellDir())), + tm.getThresholdValueCellType(dataUsageKey, zone, + mccSwellDirFrom, report.getPSwellDir()), true)); + // swell2 height + String mccSwell2HT; + if (dataUsageKey == DataUsageKey.DISPLAY) { + mccSwell2HT = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT + .getXmlKey(); + } else { + mccSwell2HT = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_HT + .getXmlKey(); + } + tblRowData.setTableCellData( + 19, + new TableCellData( + Math.round(new Float(report.getSSwellPeriod())), tm + .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 .setTableCellData( 21, - new TableCellData( - Math.round(new Float(report.getPSwellDir())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM - .getXmlKey(), report - .getSSwellDir()), true)); - + new TableCellData(Math.round(new Float(report + .getPSwellDir())), + tm.getThresholdValueCellType(dataUsageKey, + zone, mccSwell2DirFrom, + report.getSSwellDir()), true)); + // fog if (isZone) { // zone table: fog monitored at zone level tblRowData.setTableCellData(22, new TableCellData("", fogCellType, @@ -637,9 +702,19 @@ public final class TableUtil { isZone = true; } - String hoverText = null; + DataUsageKey dataUsageKey; + if (tm.getDataUsageKey() != null) { + dataUsageKey = tm.getDataUsageKey(); + } else { + dataUsageKey = DataUsageKey.DISPLAY; + } + + String hoverText = ""; if (isZone) { - hoverText = getZoneHoverText(areaId); + AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone); + if (zoneXML != null) { + hoverText = getZoneHoverText(zoneXML); + } } else { hoverText = getStationHoverText(areaId); } @@ -704,54 +779,64 @@ public final class TableUtil { .getXmlKey(), report .getWindDir()), true)); } - - tblRowData - .setTableCellData( - 6, - new TableCellData( - Math.round(new Float(report.getWindSpeed())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED - .getXmlKey(), report - .getWindSpeed()), true)); - - tblRowData - .setTableCellData( - 7, - new TableCellData( - Math.round(new Float(report.getMaxWindSpeed())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SnowDisplay.SNOW_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.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED - .getXmlKey(), report - .getWindGust()), true)); - - tblRowData - .setTableCellData( - 9, - new TableCellData( - Math.round(new Float(report.getTemperature())), - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP - .getXmlKey(), report - .getTemperature()), true)); + // wind speed + String wsk; + if (dataUsageKey == DataUsageKey.DISPLAY) { + wsk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED + .getXmlKey(); + } else { + wsk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_WIND_SPEED + .getXmlKey(); + } + tblRowData.setTableCellData( + 6, + new TableCellData(Math.round(new Float(report.getWindSpeed())), + tm.getThresholdValueCellType(dataUsageKey, zone, wsk, + report.getWindSpeed()), true)); + // wind peak + String wpk; + if (dataUsageKey == DataUsageKey.DISPLAY) { + wpk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND + .getXmlKey(); + } else { + wpk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_PEAK_WIND + .getXmlKey(); + } + tblRowData.setTableCellData( + 7, + new TableCellData( + Math.round(new Float(report.getMaxWindSpeed())), tm + .getThresholdValueCellType(dataUsageKey, zone, + wpk, report.getMaxWindSpeed()), true)); + // wind gust + String wgk; + if (dataUsageKey == DataUsageKey.DISPLAY) { + wgk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED + .getXmlKey(); + } else { + wgk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_GUST_SPEED + .getXmlKey(); + } + tblRowData.setTableCellData( + 8, + new TableCellData(Math.round(new Float(report.getWindGust())), + tm.getThresholdValueCellType(dataUsageKey, zone, wgk, + report.getWindGust()), true)); + // temperature + String tmprk; + if (dataUsageKey == DataUsageKey.DISPLAY) { + tmprk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP + .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 .setTableCellData( @@ -777,13 +862,17 @@ public final class TableUtil { // used to compare with Red/Yellow // threshold values - TableCellData visCellData = new TableCellData( - visString, - tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, - zone, - MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS - .getXmlKey(), visValue), true); + String visKey; + if (dataUsageKey == DataUsageKey.DISPLAY) { + visKey = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS + .getXmlKey(); + } else { + visKey = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_VIS + .getXmlKey(); + } + TableCellData visCellData = new TableCellData(visString, + tm.getThresholdValueCellType(dataUsageKey, zone, visKey, + visValue), true); visCellData.setValue(visValue); // visValue, instead of visString, // will be used for sorting @@ -802,14 +891,14 @@ public final class TableUtil { MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP .getXmlKey(), report .getSeaLevelPress()), true)); - + // wind chill tblRowData .setTableCellData( 13, new TableCellData( Math.round(new Float(report.getWindChill())), tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, + dataUsageKey, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL .getXmlKey(), report @@ -838,14 +927,14 @@ public final class TableUtil { MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP .getXmlKey(), report .getHourlyPrecip()), true)); - + // snow depth tblRowData .setTableCellData( 16, new TableCellData( Math.round(new Float(report.getSnowDepth())), tm.getThresholdValueCellType( - DataUsageKey.DISPLAY, + dataUsageKey, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH .getXmlKey(), report @@ -884,8 +973,9 @@ public final class TableUtil { * @param zone * @return */ - private static String getZoneHoverText(String zone) { + private static String getZoneHoverText(AreaIdXML zoneXML) { + String zone = zoneXML.getAreaId(); ISpatialQuery sq = null; String sql = null; String hoverText = zone.substring(0, 2) + ", "; @@ -914,6 +1004,11 @@ public final class TableUtil { } else { hoverText += (String) results[0].toString(); } + } else { + if (zoneXML.getCLat() != null) { + hoverText += "(" + zoneXML.getCLat() + ", " + + zoneXML.getCLon() + ")"; + } } } catch (Exception e) { e.printStackTrace(); @@ -956,6 +1051,8 @@ public final class TableUtil { } else if (stnType.intValue() == 1000) { hoverText = stnId + "#MESONET -- " + stnName; } + } else { + hoverText = stnId; } } catch (Exception e) { @@ -976,7 +1073,7 @@ public final class TableUtil { */ public static CellType getCellTypeForSCA(String zone, ObReport report, AbstractThresholdMgr tm) { - // TODO: + float windSpd = report.getWindSpeed(); float windGust = report.getWindGust(); float waveHgt = report.getHighResWaveHeight(); @@ -1027,7 +1124,7 @@ public final class TableUtil { */ public static CellType getCellTypeForGaleWarn(String zone, ObReport report, AbstractThresholdMgr tm) { - // TODO: + CellType type = CellType.NotAvailable; CellType windSpeedType = tm .getThresholdValueCellType( @@ -1064,7 +1161,7 @@ public final class TableUtil { */ public static CellType getCellTypeForStormWarn(String zone, ObReport report, AbstractThresholdMgr tm) { - // TODO: + CellType type = CellType.NotAvailable; CellType windSpeedType = tm .getThresholdValueCellType( @@ -1101,7 +1198,7 @@ public final class TableUtil { */ public static CellType getCellTypeForHFWW(String zone, ObReport report, AbstractThresholdMgr tm) { - // TODO: + CellType type = CellType.NotAvailable; CellType windSpeedType = tm .getThresholdValueCellType( @@ -1138,16 +1235,31 @@ public final class TableUtil { */ public static CellType getCellTypeForFog(String zone, ObReport report, 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 // observation available - CellType snowDepth = tm .getThresholdValueCellType( DataUsageKey.DISPLAY, @@ -1670,5 +1781,5 @@ public final class TableUtil { CommonTableConfig.obsHistCols.PTend)); return tblRowData; } - + // TODO: add MESONET data } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/listeners/IMonitorConfigurationListener.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/listeners/IMonitorConfigurationListener.java index 8e283ccd4b..eeb08154e3 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/listeners/IMonitorConfigurationListener.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/listeners/IMonitorConfigurationListener.java @@ -19,7 +19,7 @@ **/ 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; /** @@ -32,6 +32,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 29, 2009 dhladky Initial creation + * Sep 20, 2015 3873 skorolev Replaced deprecated INotificationObserver + * * * * @author dhladky diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java old mode 100644 new mode 100755 index fc61dc7d91..0d933eb8c5 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java @@ -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.PathManagerFactory; 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.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.monitor.config.CommonTableConfig.CellType; 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 * Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...) * Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method. + * Sep 18, 2015 3873 skorolev Added getCfgMgr(). * * * @@ -61,25 +67,28 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML; */ public abstract class AbstractThresholdMgr { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(AbstractThresholdMgr.class); + /** * 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"; /** - * Default file name for the FOG monitor thresholds. + * Default file name for the monitor thresholds. */ private String defMonitorThreshName = "Unknown"; /** * 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. @@ -117,10 +126,8 @@ public abstract class AbstractThresholdMgr { /** current site **/ protected String site; - /* - * TODO : remove this when debugging is complete - */ - public ThresholdsXML threshXmlCopy; + /** threshold usage **/ + protected DataUsageKey dataUsageKey; /** * Constructor. @@ -129,12 +136,12 @@ public abstract class AbstractThresholdMgr { * @param defMonitorThreshName */ public AbstractThresholdMgr(String defDisplayThreshName, - String defMonitorThreshName, String appName) { + String defMonitorThreshName, AppName appName) { this.defDisplayThreshName = defDisplayThreshName; this.defMonitorThreshName = defMonitorThreshName; this.appName = appName; this.site = LocalizationManager.getInstance().getCurrentSite(); - this.areaConfigMgr = getMonitorAreaConfigInstance(); + this.areaConfigMgr = getCfgMgr(); } /** @@ -148,7 +155,7 @@ public abstract class AbstractThresholdMgr { defaultFileNameMgr.readXmlConfig(); /* - * Setup the Fog display threshold manager + * Setup the display threshold manager */ if (defaultFileNameMgr.getDefaultThresholdFilename() != null && 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() + defMonitorThreshName; @@ -201,7 +208,7 @@ public abstract class AbstractThresholdMgr { LocalizationFile locFile = pm.getLocalizationFile(context, pathAndFileName); - System.out.println("--- validate path = " + statusHandler.handle(Priority.DEBUG, "--- validate path = " + locFile.getFile().getAbsolutePath()); return locFile.getFile().exists(); @@ -235,7 +242,6 @@ public abstract class AbstractThresholdMgr { return monitorThreshMgr.getYellowValue(areaID, key); } } - return 0; } @@ -284,30 +290,24 @@ public abstract class AbstractThresholdMgr { if (hasArea(areaID, dataUsage) == false) { return CellType.NotMonitored; } - if (Double.isNaN(value) == true) { return CellType.NotMonitored; } - if (value == ObConst.MISSING) { return CellType.NotAvailable; } - double red = Double.NaN; double yellow = Double.NaN; if (dataUsage == DataUsageKey.DISPLAY) { red = displayThreshMgr.getRedValue(areaID, key); yellow = displayThreshMgr.getYellowValue(areaID, key); - return calcCellType(key, red, yellow, value); } else if (dataUsage == DataUsageKey.MONITOR) { red = monitorThreshMgr.getRedValue(areaID, key); yellow = monitorThreshMgr.getYellowValue(areaID, key); - return calcCellType(key, red, yellow, value); } - return CellType.NotMonitored; } @@ -328,11 +328,9 @@ public abstract class AbstractThresholdMgr { if (hasArea(areaID, dataUsage) == false) { return CellType.NotMonitored; } - if (Double.isNaN(value) == true) { return CellType.NotMonitored; } - if (value == ObConst.MISSING) { return CellType.NotAvailable; } @@ -357,7 +355,6 @@ public abstract class AbstractThresholdMgr { return calcDirectionalCellType(redFrom, redTo, yellowFrom, yellowTo, value); } - return CellType.NotMonitored; } @@ -379,25 +376,21 @@ public abstract class AbstractThresholdMgr { return CellType.R; } } - if (redFrom > redTo) { if (value > redFrom || value < redTo) { return CellType.R; } } - if (yellowFrom < yellowTo) { if (value > yellowFrom && value < yellowTo) { return CellType.Y; } } - if (yellowFrom > yellowTo) { if (value > yellowFrom || value < yellowTo) { return CellType.Y; } } - return CellType.G; } @@ -427,7 +420,6 @@ public abstract class AbstractThresholdMgr { } else if (value <= yellow) { return CellType.Y; } - return CellType.G; } else { if (value < yellow) { @@ -435,7 +427,6 @@ public abstract class AbstractThresholdMgr { } else if (value <= red) { return CellType.Y; } - return CellType.R; } } else if (redIsHigher == true) { @@ -444,7 +435,6 @@ public abstract class AbstractThresholdMgr { } else if (value < red) { return CellType.Y; } - return CellType.R; } else if (redIsHigher == false) { if (value <= red) { @@ -452,10 +442,8 @@ public abstract class AbstractThresholdMgr { } else if (value <= yellow) { return CellType.Y; } - return CellType.G; } - return CellType.NotMonitored; } @@ -472,11 +460,9 @@ public abstract class AbstractThresholdMgr { + defDisplayThreshName; return; } - if (fileName.endsWith(".xml") == false) { fileName.concat(".xml"); } - if (fileName.compareTo(defDisplayThreshName) == 0) { defaultFileNameMgr.setDefaultThresholdFilename(""); } else { @@ -495,9 +481,7 @@ public abstract class AbstractThresholdMgr { loadDefaultDisplayThreshold(); return; } - currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName; - displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.readThresholdXml(); } @@ -511,23 +495,18 @@ public abstract class AbstractThresholdMgr { if (filename == null || filename.trim().length() == 0) { currFullDisplayXmlFileName = getDisplayThresholdPath() + defDisplayThreshName; - List areaIDs = null; - try { areaIDs = areaConfigMgr.getAreaList(); } catch (Exception e) { e.printStackTrace(); return; } - // Sort the area IDs Collections.sort(areaIDs); - ArrayList threshKeys = getThresholdKeys(DataUsageKey.DISPLAY); - - System.out.println("---- " + currFullDisplayXmlFileName); - + statusHandler.handle(Priority.DEBUG, "---- " + + currFullDisplayXmlFileName); displayThreshMgr.createConfigFromDefaults( currFullDisplayXmlFileName, areaIDs, threshKeys); } else { @@ -543,21 +522,16 @@ public abstract class AbstractThresholdMgr { public void loadDefaultMonitorThreshold() { currFullMonitorXmlFileName = getMonitorThresholdPath() + defMonitorThreshName; - List areaIDs = null; - try { areaIDs = areaConfigMgr.getAreaList(); } catch (Exception e) { e.printStackTrace(); return; } - // Sort the area IDs Collections.sort(areaIDs); - ArrayList threshKeys = getThresholdKeys(DataUsageKey.MONITOR); - monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName, areaIDs, threshKeys); } @@ -572,9 +546,7 @@ public abstract class AbstractThresholdMgr { if (newFileName.trim().compareTo(defDisplayThreshName) == 0) { return; } - currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName; - displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.saveThresholdXml(); } @@ -601,7 +573,6 @@ public abstract class AbstractThresholdMgr { if (usageKey == DataUsageKey.DISPLAY) { return defDisplayThreshName; } - // Return the Monitor threshold file name as the default. return defMonitorThreshName; } @@ -616,61 +587,60 @@ public abstract class AbstractThresholdMgr { return defaultFileNameMgr.getDefaultThresholdFilename(); } + /** + * Gets Thresholds XML Data + * + * @param usageKey + * @return + */ public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) { if (usageKey == DataUsageKey.DISPLAY) { return displayThreshMgr.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. */ public String getDisplayThresholdPath() { String fs = String.valueOf(File.separatorChar); StringBuilder sb = new StringBuilder(); - - sb.append(appName).append(fs); + sb.append(appName.name().toLowerCase()).append(fs); sb.append("threshold").append(fs); sb.append("display").append(fs); - 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. */ public String getMonitorThresholdPath() { String fs = String.valueOf(File.separatorChar); StringBuilder sb = new StringBuilder(); - - sb.append(appName).append(fs); + sb.append(appName.name().toLowerCase()).append(fs); sb.append("threshold").append(fs); sb.append("monitor").append(fs); - return sb.toString(); } /** - * Get the path where the XML file containing the user selected default file - * is located. + * Gets the path where the XML file containing the user selected default + * file is located. * * @return The path of the user selected default file XML. */ public String getDefaultThresholdFilePath() { String fs = String.valueOf(File.separatorChar); StringBuilder sb = new StringBuilder(); - - sb.append(appName).append(fs); + sb.append(appName.name().toLowerCase()).append(fs); sb.append("threshold").append(fs); sb.append("display").append(fs); sb.append("defaultThresh").append(fs); - return sb.toString(); } @@ -686,7 +656,6 @@ public abstract class AbstractThresholdMgr { } else if (dataUsageKey == DataUsageKey.MONITOR) { return monitorThreshMgr.getThresholdsXmlCopy(); } - return null; } @@ -698,7 +667,6 @@ public abstract class AbstractThresholdMgr { */ public boolean deleteFile(LocalizationFile fileName) { boolean deletedUserSelectedDefault = false; - String fileNameStr = fileName.getFile().getName(); /* @@ -712,7 +680,6 @@ public abstract class AbstractThresholdMgr { loadDefaultDisplayThreshold(); deletedUserSelectedDefault = true; } - /* * Delete the file. */ @@ -721,7 +688,6 @@ public abstract class AbstractThresholdMgr { } catch (Exception e) { e.printStackTrace(); } - return deletedUserSelectedDefault; } @@ -736,7 +702,6 @@ public abstract class AbstractThresholdMgr { if (dataUsageKey == DataUsageKey.DISPLAY) { return displayThreshMgr.getThresholdXML().hasAreaId(areaID); } - return monitorThreshMgr.getThresholdXML().hasAreaId(areaID); } @@ -764,34 +729,17 @@ public abstract class AbstractThresholdMgr { ArrayList areasArray = displayXML.getAreas(); for (AreaXML area : areasArray) { - System.out.println("--- " + area.getAreaId()); + statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId()); ArrayList atXmlArray = area.getAreaThresholds(); for (AreaThresholdXML atXml : atXmlArray) { - System.out.println("****** " + atXml.getKey()); - System.out.println(" R " + atXml.getRed()); - System.out.println(" Y " + atXml.getYellow()); - } - } - } - - public void printDisplayThresholdsXMLCopy() { - if (threshXmlCopy == null) { - threshXmlCopy = displayThreshMgr.getThresholdsXmlCopy(); - } - - ArrayList areasArray = threshXmlCopy.getAreas(); - - for (AreaXML area : areasArray) { - System.out.println("--- " + area.getAreaId()); - - ArrayList atXmlArray = area.getAreaThresholds(); - - for (AreaThresholdXML atXml : atXmlArray) { - System.out.println("****** " + atXml.getKey()); - System.out.println(" R " + atXml.getRed()); - System.out.println(" Y " + atXml.getYellow()); + statusHandler.handle(Priority.DEBUG, + "****** " + atXml.getKey()); + statusHandler.handle(Priority.DEBUG, + " R " + atXml.getRed()); + statusHandler.handle(Priority.DEBUG, + " Y " + atXml.getYellow()); } } } @@ -801,6 +749,37 @@ public abstract class AbstractThresholdMgr { * * @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; + } } diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/ThresholdMgr.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/ThresholdMgr.java old mode 100644 new mode 100755 index 09b94134d1..9ba02b0d25 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/ThresholdMgr.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/ThresholdMgr.java @@ -50,6 +50,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML; * ------------ ---------- ----------- -------------------------- * Dec 15, 2009 #3963 lvenable Initial creation * Dec 4, 2012 #1351 skorolev Cleaned code + * Sep 18, 2015 #3873 skorolev Added error message for corrupted or empty default threshold file. * * * @@ -86,10 +87,11 @@ public class ThresholdMgr { */ public void readThresholdXml() { try { - cfgXML = null; + ThresholdsXML newCfgXML = null; IPathManager pm = PathManagerFactory.getPathManager(); File path = pm.getStaticFile(currFullPathAndFileName); - cfgXML = JAXB.unmarshal(path, ThresholdsXML.class); + newCfgXML = JAXB.unmarshal(path, ThresholdsXML.class); + this.setThresholdXML(newCfgXML); } catch (Exception e) { statusHandler.handle(Priority.ERROR, e.getMessage()); } @@ -145,7 +147,11 @@ public class ThresholdMgr { ThresholdsXML.class); createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys); } 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 true; diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java old mode 100644 new mode 100755 index b671edefb6..ed3d42ab75 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/MonitoringAreaConfigDlg.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.monitor.ui.dialogs; +import java.io.IOException; import java.util.ArrayList; 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.Text; +import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; 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.UFStatus; 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. * 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. + * Sep 18, 2015 3873 skorolev Added formIsValid method. * * * @@ -230,6 +234,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements /** Flag set when user wants to close with unsaved modifications. */ 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. * @@ -782,7 +803,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements okBtn.addSelectionListener(new SelectionAdapter() { @Override 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. */ private void handleAddNewAction() { + // Zone configure if (zoneRdo.getSelection() == true) { if (addNewZoneDlg == null) { addNewZoneDlg = new AddNewZoneDlg(shell, appName, this); @@ -893,9 +921,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements }); } addNewZoneDlg.open(); - } else { - if (associatedList.getSelectionIndex() != -1) { - String area = associatedList.getItem(associatedList + } else { // Station configure + if (maRegionalList.getSelectionIndex() != -1) { + String area = maRegionalList.getItem(maRegionalList .getSelectionIndex()); if (addNewStnDlg == null) { addNewStnDlg = new AddNewStationDlg(shell, appName, area, @@ -916,9 +944,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.NONE); messageBox.setText("Selection error."); - messageBox.setMessage("Please select associated zone."); + messageBox.setMessage("Please select a monitoring zone."); messageBox.open(); - associatedList.select(0); + maRegionalList.select(0); } } } @@ -935,8 +963,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements public void dialogClosed(Object returnValue) { if (returnValue instanceof String) { // Update the edit dialog - String selectedZone = returnValue.toString(); - maZones.remove(selectedZone); populateLeftLists(); } editDlg = null; @@ -1096,7 +1122,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements monitorAreaList .setItems(maZones.toArray(new String[maZones.size()])); monitorAreaList.setSelection(maZones.indexOf(zone)); - handleMonitorAreaListSelection(); additionalZones.remove(zone); configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME : ZoneType.REGULAR); @@ -1104,6 +1129,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements configMgr.getAddedZones().add(zone); } configMgr.removeAdjArea(zone); + handleMonitorAreaListSelection(); } else { // Station mode if (associatedList.getSelectionCount() == 0) { showMessage(shell, SWT.ERROR, "Selection Needed", @@ -1148,6 +1174,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements monitorAreaList.remove(monitorAreaList.getSelectionIndex()); associatedList.removeAll(); if (mode == Mode.Zone) { + // entry is a zone to remove. if (!additionalZones.contains(entry)) { additionalZones.add(entry); } @@ -1165,6 +1192,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements entry.charAt(2) == 'Z' ? ZoneType.MARITIME : ZoneType.REGULAR); } else { // Station mode + // entry is a station to remove. additionalStns.add(entry); Collections.sort(additionalStns); additionalList.setItems(additionalStns @@ -1307,7 +1335,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements * Handles the monitor area list selection. */ private void handleMonitorAreaListSelection() { - if (monitorAreaList.getSelectionIndex() == -1) { + if (monitorAreaList.getSelectionIndex() < 0) { return; } 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(); - resetStatus(); configMgr.saveConfigXml(); 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 * 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 @@ -1416,6 +1453,21 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements 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) * @@ -1465,16 +1517,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements public void latLonErrorMsg(String latStr, String lonStr) { MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK); - messageBox.setText("Invalid Lat/Lon"); - 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.setMessage(INVALID_COORD_MSG); messageBox.open(); } @@ -1482,7 +1525,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements * Reset data status. */ protected void resetStatus() { - this.timeWindowChanged = false; this.maZonesRemoved = false; this.maStationsRemoved = false; @@ -1512,11 +1554,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements * @return */ 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, - "Edit Thresholds Now?", message); + "Edit Thresholds Now?", MODIFY_THRESHOLD_MSG); return yesno; } @@ -1538,6 +1577,35 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements return state; } + public java.util.List getMaZones() { + return maZones; + } + + public java.util.List getMaStations() { + return maStations; + } + + public java.util.List getAdditionalZones() { + return additionalZones; + } + + public java.util.List 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. * diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/ZoneTableDlg.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/ZoneTableDlg.java index 650aa52876..c39c9d10db 100755 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/ZoneTableDlg.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/ZoneTableDlg.java @@ -54,7 +54,10 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.IDisplayPane; 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.exception.VizException; import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.map.IMapDescriptor; 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. * Sep 15, 2014 3220 skorolev Added refreshZoneTableData method. * Nov 03, 2014 3741 skorolev Updated zoom procedures. + * Sep 25, 2015 3873 skorolev Added center definition for moving platforms. * * * @@ -191,6 +195,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements private final DateFormat dFormat = new SimpleDateFormat( "E MMM dd HH:mm:ss yyyy"); + public static String datePattern = "yyyy-MM-dd HH:mm:ss"; + /** list of variables to plot. **/ public List prodArray; @@ -653,6 +659,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements initiateProdArray(); dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station + "#" + dataSrc; + if (graphType == GraphType.Trend) { TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle); if (tpd == null) { @@ -812,11 +819,29 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements try { Coordinate stnCenter = MonitorAreaUtils .getStationCenter(selectedStation); - if (stnCenter != null) { - zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL); + if (stnCenter == null) { + // 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 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) { - statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e); + zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL); + } 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("_"); if (prod.size() > 1) { varName = name.substring(0, stInd); - if (varName.equals("SCA")) { + switch (varName) { + case "SCA": varName = "Small Craft Advisory"; - } else if (varName.equals("GALE")) { + break; + case "GALE": varName = "Gale Warning"; - } else if (varName.equals("STORM")) { + break; + case "STORM": varName = "Storm Warning"; - } else if (varName.equals("HURRICANE")) { + break; + case "HURRICANE": varName = "Hurricane Force Wind Warning"; - } else if (varName.equals("BLIZ")) { + break; + case "BLIZ": varName = "Blizzard Warning"; - } else if (varName.equals("FRZ")) { + break; + case "FRZ": varName = "Freezing Precipitation"; - } else if (varName.equals("HSW")) { + break; + case "HSW": varName = "Heavy Snow Warning"; + break; + default: + statusHandler.error("Invalid name for variable " + varName); } } else { varName = name.substring(stInd + 1); diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/util/MonitorConfigConstants.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/util/MonitorConfigConstants.java index 38d9a21f54..8eb136ad77 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/util/MonitorConfigConstants.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/util/MonitorConfigConstants.java @@ -21,8 +21,10 @@ package com.raytheon.uf.viz.monitor.util; import java.util.HashMap; +import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; + /** - * TODO Add Description + * Monitor Configuration Constants. * *
  * 
@@ -30,57 +32,59 @@ import java.util.HashMap;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Mar 16, 2009 2076       avarani     Initial creation
+ * Sep 18, 2015 3873       skorolev    Corrected appName.
  * 
  * 
* * @author avarani * @version 1.0 */ -public class MonitorConfigConstants -{ +public class MonitorConfigConstants { private static HashMap ryHigherMapSS; + private static HashMap ryHigherMapSnow; + private static HashMap ryHigherMapFog; private static boolean rankSwellPeriodHigh = false; + /* - * SAFESEAS - */ - public static enum SafeSeasDisplay - { - SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), - SS_DISP_PROD_SCA_GUST_SPEED("Display.Product.SCA.gust_speed"), - SS_DISP_PROD_SCA_PEAK_WIND("Display.Product.SCA.peak_wind_speed"), - SS_DISP_PROD_SCA_WAVE_HT("Display.Product.SCA.wave_height"), - SS_DISP_PROD_GALE_WIND_SPEED("Display.Product.Gale.wind_speed"), - SS_DISP_PROD_GALE_GUST_SPEED("Display.Product.Gale.gust_speed"), - SS_DISP_PROD_GALE_PEAK_WIND("Display.Product.Gale.peak_wind_speed"), - SS_DISP_PROD_STORM_WIND_SPEED("Display.Product.Storm.wind_speed"), - SS_DISP_PROD_STORM_GUST_SPEED("Display.Product.Storm.gust_speed"), - SS_DISP_PROD_STORM_PEAK_WIND("Display.Product.Storm.peak_wind_speed"), - SS_DISP_PROD_HFWW_WIND_SPEED("Display.Product.Hurricane.wind_speed"), - SS_DISP_PROD_HFWW_GUST_SPEED("Display.Product.Hurricane.gust_speed"), - SS_DISP_PROD_HFWW_PEAK_WIND("Display.Product.Hurricane.peak_wind_speed"), - SS_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), - SS_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), - SS_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), - SS_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), - SS_DISP_WIND_DIR_TO("Display.Wind.dirTo"), - SS_DISP_METEO_VIS("Display.Meteo.visibility"), - SS_DISP_METEO_TEMP("Display.Meteo.temperature"), - SS_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), - SS_DISP_METEO_SLP("Display.Meteo.slp"), - SS_DISP_METEO_SST("Display.Meteo.sea_surface_temp"), - SS_DISP_METEO_WAVE_HT("Display.Meteo.wave_height"), - SS_DISP_METEO_WAVE_STEEP("Display.Meteo.wave_steepness"), - SS_DISP_SWELL_PRIM_HT("Display.Swell.Primary.height"), - SS_DISP_SWELL_PRIM_PD("Display.Swell.Primary.period"), - SS_DISP_SWELL_PRIM_DIR_FROM("Display.Swell.Primary.dirFrom"), - SS_DISP_SWELL_PRIM_DIR_TO("Display.Swell.Primary.dirTo"), - SS_DISP_SWELL_SEC_HT("Display.Swell.Secondary.height"), - SS_DISP_SWELL_SEC_PD("Display.Swell.Secondary.period"), - SS_DISP_SWELL_SEC_DIR_FROM("Display.Swell.Secondary.dirFrom"), - SS_DISP_SWELL_SEC_DIR_TO("Display.Swell.Secondary.dirTo"); + * SAFESEAS + */ + public static enum SafeSeasDisplay { + SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), SS_DISP_PROD_SCA_GUST_SPEED( + "Display.Product.SCA.gust_speed"), SS_DISP_PROD_SCA_PEAK_WIND( + "Display.Product.SCA.peak_wind_speed"), SS_DISP_PROD_SCA_WAVE_HT( + "Display.Product.SCA.wave_height"), SS_DISP_PROD_GALE_WIND_SPEED( + "Display.Product.Gale.wind_speed"), SS_DISP_PROD_GALE_GUST_SPEED( + "Display.Product.Gale.gust_speed"), SS_DISP_PROD_GALE_PEAK_WIND( + "Display.Product.Gale.peak_wind_speed"), SS_DISP_PROD_STORM_WIND_SPEED( + "Display.Product.Storm.wind_speed"), SS_DISP_PROD_STORM_GUST_SPEED( + "Display.Product.Storm.gust_speed"), SS_DISP_PROD_STORM_PEAK_WIND( + "Display.Product.Storm.peak_wind_speed"), SS_DISP_PROD_HFWW_WIND_SPEED( + "Display.Product.Hurricane.wind_speed"), SS_DISP_PROD_HFWW_GUST_SPEED( + "Display.Product.Hurricane.gust_speed"), SS_DISP_PROD_HFWW_PEAK_WIND( + "Display.Product.Hurricane.peak_wind_speed"), SS_DISP_WIND_WIND_SPEED( + "Display.Wind.wind_speed"), SS_DISP_WIND_PEAK_WIND( + "Display.Wind.peak_wind_speed"), SS_DISP_WIND_GUST_SPEED( + "Display.Wind.gust_speed"), SS_DISP_WIND_DIR_FROM( + "Display.Wind.dirFrom"), SS_DISP_WIND_DIR_TO( + "Display.Wind.dirTo"), SS_DISP_METEO_VIS( + "Display.Meteo.visibility"), SS_DISP_METEO_TEMP( + "Display.Meteo.temperature"), SS_DISP_METEO_DEWPT( + "Display.Meteo.dewpoint"), SS_DISP_METEO_SLP( + "Display.Meteo.slp"), SS_DISP_METEO_SST( + "Display.Meteo.sea_surface_temp"), SS_DISP_METEO_WAVE_HT( + "Display.Meteo.wave_height"), SS_DISP_METEO_WAVE_STEEP( + "Display.Meteo.wave_steepness"), SS_DISP_SWELL_PRIM_HT( + "Display.Swell.Primary.height"), SS_DISP_SWELL_PRIM_PD( + "Display.Swell.Primary.period"), SS_DISP_SWELL_PRIM_DIR_FROM( + "Display.Swell.Primary.dirFrom"), SS_DISP_SWELL_PRIM_DIR_TO( + "Display.Swell.Primary.dirTo"), SS_DISP_SWELL_SEC_HT( + "Display.Swell.Secondary.height"), SS_DISP_SWELL_SEC_PD( + "Display.Swell.Secondary.period"), SS_DISP_SWELL_SEC_DIR_FROM( + "Display.Swell.Secondary.dirFrom"), SS_DISP_SWELL_SEC_DIR_TO( + "Display.Swell.Secondary.dirTo"); String XMLKey; @@ -92,22 +96,21 @@ public class MonitorConfigConstants return XMLKey; } } - - public static enum SafeSeasMonitor - { - SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), - SS_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), - SS_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), - SS_MON_METEO_WAVE_HT("Monitor.Meteo.wave_height"), - SS_MON_METEO_VIS("Monitor.Meteo.visibility"), - SS_MON_SWELL_PRIM_HT("Monitor.Swell.Primary.height"), - SS_MON_SWELL_PRIM_PD("Monitor.Swell.Primary.period"), - SS_MON_SWELL_PRIM_DIR_FROM("Monitor.Swell.Primary.dirFrom"), - SS_MON_SWELL_PRIM_DIR_TO("Monitor.Swell.Primary.dirTo"), - SS_MON_SWELL_SEC_HT("Monitor.Swell.Secondary.height"), - SS_MON_SWELL_SEC_PD("Monitor.Swell.Secondary.period"), - SS_MON_SWELL_SEC_DIR_FROM("Monitor.Swell.Secondary.dirFrom"), - SS_MON_SWELL_SEC_DIR_TO("Monitor.Swell.Secondary.dirTo"); + + public static enum SafeSeasMonitor { + SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SS_MON_METEO_PEAK_WIND( + "Monitor.Meteo.peak_wind_speed"), SS_MON_METEO_GUST_SPEED( + "Monitor.Meteo.gust_speed"), SS_MON_METEO_WAVE_HT( + "Monitor.Meteo.wave_height"), SS_MON_METEO_VIS( + "Monitor.Meteo.visibility"), SS_MON_SWELL_PRIM_HT( + "Monitor.Swell.Primary.height"), SS_MON_SWELL_PRIM_PD( + "Monitor.Swell.Primary.period"), SS_MON_SWELL_PRIM_DIR_FROM( + "Monitor.Swell.Primary.dirFrom"), SS_MON_SWELL_PRIM_DIR_TO( + "Monitor.Swell.Primary.dirTo"), SS_MON_SWELL_SEC_HT( + "Monitor.Swell.Secondary.height"), SS_MON_SWELL_SEC_PD( + "Monitor.Swell.Secondary.period"), SS_MON_SWELL_SEC_DIR_FROM( + "Monitor.Swell.Secondary.dirFrom"), SS_MON_SWELL_SEC_DIR_TO( + "Monitor.Swell.Secondary.dirTo"); String XMLKey; @@ -121,34 +124,33 @@ public class MonitorConfigConstants } /* - * SNOW + * SNOW */ - public static enum SnowDisplay - { - SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), - SNOW_DISP_PROD_BLIZZ_WIND_SPEED("Display.Product.Blizzard.wind_speed"), - SNOW_DISP_PROD_BLIZZ_GUST_SPEED("Display.Product.Blizzard.gust_speed"), - SNOW_DISP_PROD_BLIZZ_PEAK_WIND("Display.Product.Blizzard.peak_wind_speed"), - SNOW_DISP_PROD_FRZ_TEMP("Display.Product.Freezing_Precip.temperature"), - SNOW_DISP_PROD_FRZ_HOURLY_PRECIP("Display.Product.Freezing_Precip.hourly_precip"), - SNOW_DISP_PROD_HSW_SNINCR_HOURLY("Display.Product.Heavy_Snow_Warning.snincr_hourly"), - SNOW_DISP_PROD_HSW_SNINCR_TOTAL("Display.Product.Heavy_Snow_Warning.snincr_total"), - SNOW_DISP_PROD_HSW_SNOW_DEPTH("Display.Product.Heavy_Snow_Warning.snow_depth"), - SNOW_DISP_WIND_WIND_SPEED("Display.Product.Wind.wind_speed"), - SNOW_DISP_WIND_PEAK_WIND("Display.Product.Wind.peak_wind_speed"), - SNOW_DISP_WIND_GUST_SPEED("Display.Product.Wind.gust_speed"), - SNOW_DISP_WIND_DIR_FROM("Display.Product.Wind.dirFrom"), - SNOW_DISP_WIND_DIR_TO("Display.Product.Wind.dirTo"), - SNOW_DISP_METEO_TEMP("Display.Meteo.temperature"), - SNOW_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), - SNOW_DISP_METEO_VIS("Display.Meteo.visibility"), - SNOW_DISP_METEO_SLP("Display.Meteo.slp"), - SNOW_DISP_METEO_HOURLY_PRECIP("Display.Meteo.hourly_precip"), - SNOW_DISP_METEO_WIND_CHILL("Display.Meteo.wind_chill"), - SNOW_DISP_METEO_FROSTBITE("Display.Meteo.frostbite_time"), - SNOW_DISP_METEO_SNOW_DEPTH("Display.Meteo.snow_depth"), - SNOW_DISP_METEO_SNINCR_HOURLY("Display.Meteo.snincr_hourly"), - SNOW_DISP_METEO_SNINCR_TOTAL("Display.Meteo.snincr_total"); + public static enum SnowDisplay { + SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), SNOW_DISP_PROD_BLIZZ_WIND_SPEED( + "Display.Product.Blizzard.wind_speed"), SNOW_DISP_PROD_BLIZZ_GUST_SPEED( + "Display.Product.Blizzard.gust_speed"), SNOW_DISP_PROD_BLIZZ_PEAK_WIND( + "Display.Product.Blizzard.peak_wind_speed"), SNOW_DISP_PROD_FRZ_TEMP( + "Display.Product.Freezing_Precip.temperature"), SNOW_DISP_PROD_FRZ_HOURLY_PRECIP( + "Display.Product.Freezing_Precip.hourly_precip"), SNOW_DISP_PROD_HSW_SNINCR_HOURLY( + "Display.Product.Heavy_Snow_Warning.snincr_hourly"), SNOW_DISP_PROD_HSW_SNINCR_TOTAL( + "Display.Product.Heavy_Snow_Warning.snincr_total"), SNOW_DISP_PROD_HSW_SNOW_DEPTH( + "Display.Product.Heavy_Snow_Warning.snow_depth"), SNOW_DISP_WIND_WIND_SPEED( + "Display.Product.Wind.wind_speed"), SNOW_DISP_WIND_PEAK_WIND( + "Display.Product.Wind.peak_wind_speed"), SNOW_DISP_WIND_GUST_SPEED( + "Display.Product.Wind.gust_speed"), SNOW_DISP_WIND_DIR_FROM( + "Display.Product.Wind.dirFrom"), SNOW_DISP_WIND_DIR_TO( + "Display.Product.Wind.dirTo"), SNOW_DISP_METEO_TEMP( + "Display.Meteo.temperature"), SNOW_DISP_METEO_DEWPT( + "Display.Meteo.dewpoint"), SNOW_DISP_METEO_VIS( + "Display.Meteo.visibility"), SNOW_DISP_METEO_SLP( + "Display.Meteo.slp"), SNOW_DISP_METEO_HOURLY_PRECIP( + "Display.Meteo.hourly_precip"), SNOW_DISP_METEO_WIND_CHILL( + "Display.Meteo.wind_chill"), SNOW_DISP_METEO_FROSTBITE( + "Display.Meteo.frostbite_time"), SNOW_DISP_METEO_SNOW_DEPTH( + "Display.Meteo.snow_depth"), SNOW_DISP_METEO_SNINCR_HOURLY( + "Display.Meteo.snincr_hourly"), SNOW_DISP_METEO_SNINCR_TOTAL( + "Display.Meteo.snincr_total"); String XMLKey; @@ -160,16 +162,15 @@ public class MonitorConfigConstants return XMLKey; } } - - public static enum SnowMonitor - { - SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), - SNOW_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), - SNOW_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), - SNOW_MON_METEO_TEMP("Monitor.Meteo.temperature"), - SNOW_MON_METEO_WIND_CHILL("Monitor.Meteo.wind_chill"), - SNOW_MON_METEO_VIS("Monitor.Meteo.visibility"), - SNOW_MON_METEO_SNOW_DEPTH("Monitor.Meteo.snow_depth"); + + public static enum SnowMonitor { + SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SNOW_MON_METEO_PEAK_WIND( + "Monitor.Meteo.peak_wind_speed"), SNOW_MON_METEO_GUST_SPEED( + "Monitor.Meteo.gust_speed"), SNOW_MON_METEO_TEMP( + "Monitor.Meteo.temperature"), SNOW_MON_METEO_WIND_CHILL( + "Monitor.Meteo.wind_chill"), SNOW_MON_METEO_VIS( + "Monitor.Meteo.visibility"), SNOW_MON_METEO_SNOW_DEPTH( + "Monitor.Meteo.snow_depth"); String XMLKey; @@ -183,19 +184,18 @@ public class MonitorConfigConstants } // FOG - public static enum FogDisplay - { - FOG_DISP_METEO_VIS("Display.Meteo.visibility"), - FOG_DISP_METEO_CEILING("Display.Meteo.ceiling"), - FOG_DISP_METEO_TEMP("Display.Meteo.temperature"), - FOG_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), - FOG_DISP_METEO_T_TD("Display.Meteo.t_td"), - FOG_DISP_METEO_REL_HUMIDITY("Display.Meteo.relative_humidity"), - FOG_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), - FOG_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), - FOG_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), - FOG_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), - FOG_DISP_WIND_DIR_TO("Display.Wind.dirTo"); + public static enum FogDisplay { + FOG_DISP_METEO_VIS("Display.Meteo.visibility"), FOG_DISP_METEO_CEILING( + "Display.Meteo.ceiling"), FOG_DISP_METEO_TEMP( + "Display.Meteo.temperature"), FOG_DISP_METEO_DEWPT( + "Display.Meteo.dewpoint"), FOG_DISP_METEO_T_TD( + "Display.Meteo.t_td"), FOG_DISP_METEO_REL_HUMIDITY( + "Display.Meteo.relative_humidity"), FOG_DISP_WIND_WIND_SPEED( + "Display.Wind.wind_speed"), FOG_DISP_WIND_PEAK_WIND( + "Display.Wind.peak_wind_speed"), FOG_DISP_WIND_GUST_SPEED( + "Display.Wind.gust_speed"), FOG_DISP_WIND_DIR_FROM( + "Display.Wind.dirFrom"), FOG_DISP_WIND_DIR_TO( + "Display.Wind.dirTo"); String XMLKey; @@ -207,11 +207,10 @@ public class MonitorConfigConstants return XMLKey; } } - - public static enum FogMonitor - { + + public static enum FogMonitor { FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity"); - + String XMLKey; FogMonitor(String s) { @@ -222,340 +221,248 @@ public class MonitorConfigConstants return XMLKey; } } - - public static Boolean rValueIsHigher(String key, String appName) - { - if ( appName.equals("safeseas") ) { - if ( ryHigherMapSS == null ) { - createRYHigherMapSS(); - } - - if ( ryHigherMapSS.containsKey(key) == true ) { - return ryHigherMapSS.get(key); - } - } else if ( appName.equals("snow") ) { - if ( ryHigherMapSnow == null ) { - createRYHigherMapSnow(); - } - - if ( ryHigherMapSnow.containsKey(key) == true ) { - return ryHigherMapSnow.get(key); - } - } else if ( appName.equals("fog") ) { - if ( ryHigherMapFog == null ) { - createRYHigherMapFog(); - } - - if ( ryHigherMapFog.containsKey(key) == true ) { - return ryHigherMapFog.get(key); - } - } else { - // do nothing here - } - + + public static Boolean rValueIsHigher(String key, AppName appName) { + if (appName.equals(AppName.SAFESEAS)) { + if (ryHigherMapSS == null) { + createRYHigherMapSS(); + } + + if (ryHigherMapSS.containsKey(key) == true) { + return ryHigherMapSS.get(key); + } + } else if (appName.equals(AppName.SNOW)) { + if (ryHigherMapSnow == null) { + createRYHigherMapSnow(); + } + + if (ryHigherMapSnow.containsKey(key) == true) { + return ryHigherMapSnow.get(key); + } + } else if (appName.equals(AppName.FOG)) { + if (ryHigherMapFog == null) { + createRYHigherMapFog(); + } + + if (ryHigherMapFog.containsKey(key) == true) { + return ryHigherMapFog.get(key); + } + } else { + // do nothing here + } + return false; } - - private static void createRYHigherMapSS() - { + + private static void createRYHigherMapSS() { ryHigherMapSS = new HashMap(); - + /* * SafeSeas Display */ - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(), true); - 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_PROD_SCA_WIND_SPEED.getXmlKey(), true); + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true); + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true); + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(), + true); + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true); + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true); + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true); + ryHigherMapSS + .put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(), + true); + 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_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_SST.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); - ryHigherMapSS.put(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); - + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(), + true); + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(), + true); + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(), + true); + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), + rankSwellPeriodHigh); + ryHigherMapSS.put( + 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_PEAK_WIND.getXmlKey(), 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_WIND_SPEED.getXmlKey(), + true); + ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(), + 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_SWELL_PRIM_HT.getXmlKey(), true); - ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(), false); - ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null); - ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(), 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); + ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(), + true); + ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(), + false); + ryHigherMapSS.put( + SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null); + ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(), + 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() - { - ryHigherMapSnow = new HashMap(); - + + private static void createRYHigherMapSnow() { + ryHigherMapSnow = new HashMap(); + /* * Snow Display */ - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), false); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true); - ryHigherMapSnow.put(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_PROD_BLIZZ_VIS.getXmlKey(), + false); + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true); + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true); + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true); + ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(), + true); + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true); + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true); + ryHigherMapSnow.put( + 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_SLP.getXmlKey(), false); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(), false); - ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(), 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); - + ryHigherMapSnow.put( + SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true); + ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(), + false); + ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(), + 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 */ - ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_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_WIND_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_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_SNOW_DEPTH.getXmlKey(), true); + ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(), + true); } - - private static void createRYHigherMapFog() - { - ryHigherMapFog = new HashMap(); + + private static void createRYHigherMapFog() { + ryHigherMapFog = new HashMap(); /* * Fog Display */ 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_DEWPT.getXmlKey(), true); 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_WIND_WIND_SPEED.getXmlKey(), 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_METEO_REL_HUMIDITY.getXmlKey(), + true); + ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(), + 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_TO.getXmlKey(), null); - + /* * Fog Monitor */ 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", - "trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range", "alarm", - "aAlarm", "units" }; - + "trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range", + "alarm", "aAlarm", "units" }; + public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate", - "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(); -// } -// } -// + "qpe", "guidance", "ratio", "diff" }; + public static enum tableFields { - LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), - MIN(8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13); + LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), MIN( + 8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13); int index; @@ -568,8 +475,7 @@ public class MonitorConfigConstants return TABLE_FIELDS[index]; } } - - + public static enum ffmpTable { 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) { - return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "." + field.toString(); + return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "." + + field.toString(); } } - - // Other Constants 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 COLUMN_LIST_KEY = "ColumnList"; - + public static final String SCAN_RADAR_ICAO = "radarIcao"; - + public static final String SCAN_WMO_NUMBER = "wmoNumber"; - + public static final String SCAN_START_INTERVAL = "startInterval"; - + public static final String SCAN_CELL_TILT = "cellTilt"; - + public static final String SCAN_DMD_TILT = "dmdTilt"; private MonitorConfigConstants() { // no instantiation } - public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) { - MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh; - if ( ryHigherMapSS != null ) { - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); - ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh); - } - } + public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) { + MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh; + if (ryHigherMapSS != null) { + ryHigherMapSS.put( + SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), + rankSwellPeriodHigh); + ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), + rankSwellPeriodHigh); + } + } - public static boolean isRankSwellPeriodHigh() { - return rankSwellPeriodHigh; - } + public static boolean isRankSwellPeriodHigh() { + return rankSwellPeriodHigh; + } } diff --git a/cave/com.raytheon.viz.pointdata/localization/plotModels/fssMaritime.svg b/cave/com.raytheon.viz.pointdata/localization/plotModels/fssMaritime.svg old mode 100644 new mode 100755 index 3fd253b6bf..de267b38a7 --- a/cave/com.raytheon.viz.pointdata/localization/plotModels/fssMaritime.svg +++ b/cave/com.raytheon.viz.pointdata/localization/plotModels/fssMaritime.svg @@ -1,6 +1,6 @@ - diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java index 8066256629..8be41a1491 100755 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java @@ -21,8 +21,10 @@ package com.raytheon.uf.common.monitor.config; import java.io.File; import java.util.ArrayList; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; @@ -49,7 +51,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; /** - * Monitor configuration manager. + * Fog, SAFESEAS and SNOW Monitor configuration manager. * *
  * 
@@ -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.
  * Sep 04 2014  3220      skorolev   Added fileUpdated method.
  * 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.
  * 
  * 
* @@ -108,9 +111,6 @@ public class FSSObsMonitorConfigurationManager implements /** Name of plugin */ private static String pluginName = null; - /** Monitor name */ - private static String monitorName = null; - /** Name of area configuration file */ private String configFileName = null; @@ -128,28 +128,29 @@ public class FSSObsMonitorConfigurationManager implements ss, fog, snow }; + /** Default value for Timewindow in hours */ + private static final double DEFAULT_TIME = 2; + /** Localization Area Configuration File. */ private LocalizationFile lacf = null; /** Configuration XML is updated and saved */ protected boolean isPopulated; - /** Singleton instance of this class */ - private static FSSObsMonitorConfigurationManager instance = null; + /** Map for current configuration managers. */ + private final static Map instanceMap = new HashMap<>(); /** * Private Constructor * * @param monitorName */ - public FSSObsMonitorConfigurationManager(String monitorName) { - setMonitorName(monitorName); - setPopulated(false); + private FSSObsMonitorConfigurationManager(MonName monitorName) { // Avoid confusion in file path - if (monitorName == MonName.ss.name()) { + if (monitorName == MonName.ss) { pluginName = "safeseas"; } else { - pluginName = monitorName; + pluginName = monitorName.name(); } /** Path to Monitoring Area Configuration XML. */ setConfigFileName(pluginName + File.separatorChar + "monitoringArea" @@ -162,19 +163,21 @@ public class FSSObsMonitorConfigurationManager implements configXml = new MonAreaConfigXML(); adjAreaConfigXml = new MonAreaConfigXML(); readConfigXml(); + setPopulated(false); } /** - * Get an instance of Configuration manager for FSSObs monitors. + * Returns instance of current monitor. * * @param monitor - * Name of monitor - * @return Instance of manager + * @return */ public static synchronized FSSObsMonitorConfigurationManager getInstance( - String monitor) { + MonName monitor) { + FSSObsMonitorConfigurationManager instance = instanceMap.get(monitor); if (instance == null) { instance = new FSSObsMonitorConfigurationManager(monitor); + instanceMap.put(monitor, instance); } return instance; } @@ -188,6 +191,7 @@ public class FSSObsMonitorConfigurationManager implements public void readConfigXml() { boolean monitorAreaFileExists = true; boolean adjacentAreaFileExists = true; + // Read area configuration XML file. try { IPathManager pm = PathManagerFactory.getPathManager(); LocalizationContext lc = pm.getContext( @@ -198,7 +202,6 @@ public class FSSObsMonitorConfigurationManager implements MonAreaConfigXML configXmltmp = jaxb .unmarshalFromXmlFile(monitorAreaFilePath.toString()); configXml = configXmltmp; - setPopulated(true); } catch (Exception e) { statusHandler .handle(Priority.WARN, @@ -208,7 +211,7 @@ public class FSSObsMonitorConfigurationManager implements + ""); monitorAreaFileExists = false; } - + // Read adjacent area configuration XML file. try { IPathManager pm = PathManagerFactory.getPathManager(); String adjacentAreaFilePath = pm.getFile( @@ -218,7 +221,6 @@ public class FSSObsMonitorConfigurationManager implements MonAreaConfigXML configXmltmp = jaxb .unmarshalFromXmlFile(adjacentAreaFilePath.toString()); adjAreaConfigXml = configXmltmp; - } catch (Exception e) { statusHandler .handle(Priority.WARN, @@ -276,9 +278,7 @@ public class FSSObsMonitorConfigurationManager implements configXml.addAreaId(zoneXml); } } - // Default value for Timewindow. - int defaultVal = 2; - configXml.setTimeWindow(defaultVal); + configXml.setTimeWindow(DEFAULT_TIME); saveConfigXml(); } // Check for an adjacent area config file, if one does not exist, @@ -491,8 +491,10 @@ public class FSSObsMonitorConfigurationManager implements for (AreaIdXML area : areaList) { if (area.getAreaId().equals(areaId)) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - results.add(station.getName() + "#" + station.getType()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + results.add(station.getName() + "#" + station.getType()); + } } } } @@ -512,8 +514,10 @@ public class FSSObsMonitorConfigurationManager implements for (AreaIdXML area : areaList) { if (area.getAreaId().equals(areaId)) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - results.add(station.getName() + "#" + station.getType()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + results.add(station.getName() + "#" + station.getType()); + } } } } @@ -533,8 +537,10 @@ public class FSSObsMonitorConfigurationManager implements for (AreaIdXML area : areaList) { if (area.getAreaId().equals(areaId)) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - results.add(station.getName()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + results.add(station.getName()); + } } } } @@ -553,9 +559,11 @@ public class FSSObsMonitorConfigurationManager implements List areaList = configXml.getAreaIds(); for (AreaIdXML area : areaList) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - if (station.getName().equals(stationId)) { - results.add(area.getAreaId()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + if (station.getName().equals(stationId)) { + results.add(area.getAreaId()); + } } } } @@ -572,9 +580,11 @@ public class FSSObsMonitorConfigurationManager implements List stations = new ArrayList(); for (AreaIdXML area : areaXml) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - stations.add(station.getName() + "#" + station.getType() + "#" - + area.getAreaId()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + stations.add(station.getName() + "#" + station.getType() + + "#" + area.getAreaId()); + } } } return stations; @@ -590,8 +600,10 @@ public class FSSObsMonitorConfigurationManager implements Set stations = new HashSet(); for (AreaIdXML area : areaXml) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - stations.add(station.getName()); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + stations.add(station.getName()); + } } } return stations; @@ -639,10 +651,12 @@ public class FSSObsMonitorConfigurationManager implements for (AreaIdXML areaXml : areaList) { if (areaXml.getAreaId().equals(area)) { List stationList = areaXml.getStationIds(); - for (int i = 0; i < stationList.size(); i++) { - if (stationList.get(i).getName().equals(station)) { - stationList.remove(i); - areaXml.getStationIds(); + if (!stationList.isEmpty()) { + for (int i = 0; i < stationList.size(); i++) { + if (stationList.get(i).getName().equals(station)) { + stationList.remove(i); + areaXml.getStationIds(); + } } } } @@ -659,11 +673,13 @@ public class FSSObsMonitorConfigurationManager implements List areaList = configXml.getAreaIds(); for (AreaIdXML areaXml : areaList) { List stationList = areaXml.getStationIds(); - for (int i = 0; i < stationList.size(); i++) { - StationIdXML stationXml = stationList.get(i); - if (stationXml.getName().equals(station)) { - stationList.remove(i); - i--; + if (!stationList.isEmpty()) { + for (int i = 0; i < stationList.size(); i++) { + StationIdXML stationXml = stationList.get(i); + if (stationXml.getName().equals(station)) { + stationList.remove(i); + i--; + } } } } @@ -841,9 +857,11 @@ public class FSSObsMonitorConfigurationManager implements for (AreaIdXML area : areaList) { if (area.getAreaId().equals(theZone)) { List stationList = area.getStationIds(); - for (StationIdXML station : stationList) { - if (station.getName().equals(theStation)) { - return station.getType(); + if (!stationList.isEmpty()) { + for (StationIdXML station : stationList) { + 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. * @@ -1011,4 +1011,8 @@ public class FSSObsMonitorConfigurationManager implements adjAreaConfigXml.addAreaId(area); } } + + public List getListeners() { + return listeners; + } } diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java old mode 100644 new mode 100755 index 91ce3e4601..5523397540 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/data/ObConst.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.common.monitor.data; - /** * Constants for Observations within the Decision Assistance Tool Suite that * 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 * VarName for SWELL * Nov 06, 2013 2493 bsteffen Remove unused constants. + * Sep 18, 2015 3873 skorolev Added constants for Maritime data * * * @@ -46,6 +46,12 @@ public final class 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 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 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 public enum ChosenAppKey { SNOW, FOG, SAFESEAS @@ -107,7 +131,7 @@ public final class ObConst { SYNOPTIC_MAROB, - MARINE, + MARITIME, METAR, diff --git a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java index 4bd4e31100..cb972ceae9 100755 --- a/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java +++ b/edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java @@ -67,6 +67,7 @@ import com.raytheon.uf.edex.menus.AbstractMenuUtil; * Configuration Manager has not read a * FFMPRunConfig.xml file. * 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. * * * @@ -483,26 +484,26 @@ public class DatMenuUtil extends AbstractMenuUtil { */ private void createSafeseasMenu() { FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager - .getInstance(MonName.ss.name()); - Set ssStns = ssConfig.getStationIDs(); - StringBuilder stations = new StringBuilder(); - for (String s : ssStns) { - if (stations.length() > 0) { - stations.append(","); - } - stations.append(s); + .getInstance(MonName.ss); + Set ssStns = ssConfig.getStationIDs(); + StringBuilder stations = new StringBuilder(); + for (String s : ssStns) { + if (stations.length() > 0) { + stations.append(","); } - String ssStations = stations.toString(); - CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile(); - safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; - safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); - safeMenuContributionFile.contribution[0] = processOtherContribution( - ssStations, "menus/safeseas/baseSafeSeas.xml", - "menu:obs?before=EndOfMaritime", "SAFESEAS", - safeMenuContributionFile.contribution[0]); - toXml(safeMenuContributionFile, "menus" + File.separator - + "safeseas" + File.separator + "index.xml"); - ssConfig = null; + stations.append(s); + } + String ssStations = stations.toString(); + CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile(); + safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; + safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); + safeMenuContributionFile.contribution[0] = processOtherContribution( + ssStations, "menus/safeseas/baseSafeSeas.xml", + "menu:obs?before=EndOfMaritime", "SAFESEAS", + safeMenuContributionFile.contribution[0]); + toXml(safeMenuContributionFile, "menus" + File.separator + "safeseas" + + File.separator + "index.xml"); + ssConfig = null; } /** @@ -510,26 +511,26 @@ public class DatMenuUtil extends AbstractMenuUtil { */ private void createFogMenu() { FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager - .getInstance(MonName.fog.name()); - Set fogStns = fogConfig.getStationIDs(); - StringBuilder stations = new StringBuilder(); - for (String s : fogStns) { - if (stations.length() > 0) { - stations.append(","); - } - stations.append(s); + .getInstance(MonName.fog); + Set fogStns = fogConfig.getStationIDs(); + StringBuilder stations = new StringBuilder(); + for (String s : fogStns) { + if (stations.length() > 0) { + stations.append(","); } - String fogStations = stations.toString(); - CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile(); - fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; - fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); - fogMenuContributionFile.contribution[0] = processOtherContribution( - fogStations, "menus/fog/baseFog.xml", - "menu:obs?after=FOGPLACEHOLDER", "Fog Monitor", - fogMenuContributionFile.contribution[0]); - toXml(fogMenuContributionFile, "menus" + File.separator + "fog" - + File.separator + "index.xml"); - fogConfig = null; + stations.append(s); + } + String fogStations = stations.toString(); + CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile(); + fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; + fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); + fogMenuContributionFile.contribution[0] = processOtherContribution( + fogStations, "menus/fog/baseFog.xml", + "menu:obs?after=FOGPLACEHOLDER", "Fog Monitor", + fogMenuContributionFile.contribution[0]); + toXml(fogMenuContributionFile, "menus" + File.separator + "fog" + + File.separator + "index.xml"); + fogConfig = null; } /** @@ -537,26 +538,26 @@ public class DatMenuUtil extends AbstractMenuUtil { */ private void createSnowMenu() { FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager - .getInstance(MonName.snow.name()); - Set snowStns = snowConfig.getStationIDs(); - StringBuilder stations = new StringBuilder(); - for (String s : snowStns) { - if (stations.length() > 0) { - stations.append(","); - } - stations.append(s); + .getInstance(MonName.snow); + Set snowStns = snowConfig.getStationIDs(); + StringBuilder stations = new StringBuilder(); + for (String s : snowStns) { + if (stations.length() > 0) { + stations.append(","); } - String snowStations = stations.toString(); - CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile(); - snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; - snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); - snowMenuContributionFile.contribution[0] = processOtherContribution( - snowStations, "menus/snow/baseSnow.xml", - "menu:obs?after=SNOWPLACEHOLDER", "SNOW", - snowMenuContributionFile.contribution[0]); - toXml(snowMenuContributionFile, "menus" + File.separator + "snow" - + File.separator + "index.xml"); - snowConfig = null; + stations.append(s); + } + String snowStations = stations.toString(); + CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile(); + snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1]; + snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem(); + snowMenuContributionFile.contribution[0] = processOtherContribution( + snowStations, "menus/snow/baseSnow.xml", + "menu:obs?after=SNOWPLACEHOLDER", "SNOW", + snowMenuContributionFile.contribution[0]); + toXml(snowMenuContributionFile, "menus" + File.separator + "snow" + + File.separator + "index.xml"); + snowConfig = null; } /** diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF index 934c190d0c..20e4fa8b2d 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF @@ -8,7 +8,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Require-Bundle: com.raytheon.uf.edex.cpgsrv;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.edex.decodertools + com.raytheon.uf.edex.decodertools, + com.raytheon.uf.common.monitor Export-Package: com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.plugin.fssobs.common Import-Package: com.raytheon.uf.common.monitor.config, @@ -21,4 +22,8 @@ Import-Package: com.raytheon.uf.common.monitor.config, com.raytheon.uf.edex.menus, com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.pointdata, + gov.noaa.nws.ncep.edex.common.metparameters, + gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion, + javax.measure.converter, + javax.measure.unit, org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java index ba591d6da5..5ba6dce4e4 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java @@ -34,7 +34,7 @@ import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.edex.decodertools.time.TimeTools; /** - * TODO Add Description + * Provides a transform from FSSObsRecord to PointDataContainer and vice versa. * *
  * 
@@ -42,8 +42,9 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
  * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- * Dec 3, 2010            skorolev     Initial creation
+ * Dec  3, 2010            skorolev    Initial creation
  * Jul 23, 2014 3410       bclement    location changed to floats
+ * Sep 18, 2015 3873       skorolev    Fixed assigning timeObs for maritime record.
  * 
  * 
* @@ -53,640 +54,660 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools; public class FSSObsDataTransform { - private FSSObsDAO dao; + private FSSObsDAO dao; - private static PointDataDescription fsspdd; + private static PointDataDescription fsspdd; - public static PointDataContainer pdc; + public static PointDataContainer pdc; - public FSSObsDataTransform() throws JAXBException, PluginException { - this.dao = new FSSObsDAO("fssobs"); - fsspdd = dao.getPointDataDescription(null); - this.setPdc(PointDataContainer.build(fsspdd)); - } + public FSSObsDataTransform() throws JAXBException, PluginException { + this.dao = new FSSObsDAO("fssobs"); + fsspdd = dao.getPointDataDescription(null); + this.setPdc(PointDataContainer.build(fsspdd)); + } - public static final float MISSING = -9999.0f; + public static final float MISSING = -9999.0f; - // ------------------ params in the FSSObsRecord---------------------------- + // ------------------ params in the FSSObsRecord---------------------------- - private static final String CEILING = "ceiling"; - private static final String DEWPOINT = "dewpoint"; - private static final String DEWPOINT_DEPR = "dewpointDepr"; - private static final String FROSTBITE_TIME = "frostbiteTime"; - private static final String HORIZONTAL_VIS = "horzVisibility"; - private static final String HOURLY_PRECIP = "hourlyPrecip"; - private static final String MAX_WIND_SPEED = "maxWindSpeed"; - private static final String PLATFORM_ID = "platformId"; - private static final String PRES_WEATHER = "presWeather"; - private static final String PRESS_CHANGE3_HOUR = "pressChange3Hour"; - private static final String PRESS_CHANGE_CHAR = "pressChangeChar"; - private static final String PRESS_ALTIMETER = "pressureAltimeter"; - private static final String PRI_SWELL_WV_DIR = "primarySwellWaveDir"; - private static final String PRI_SWELL_WV_HGT = "primarySwellWaveHeight"; - private static final String PRI_SWELL_WV_PD = "primarySwellWavePeriod"; - private static final String RAW_MESSAGE = "rawMessage"; - private static final String REL_HUMIDITY = "relativeHumidity"; - private static final String SEA_LEVEL_PRESS = "seaLevelPress"; - private static final String SEA_SFC_TEMP = "seaSurfaceTemp"; - private static final String SEC_SWELL_WV_DIR = "secondarySwellWaveDir"; - private static final String SEC_SWELL_WV_HGT = "secondarySwellWaveHeight"; - private static final String SEC_SWELL_WV_PD = "secondarySwellWavePeriod"; - private static final String SKY_COVER = "skyCover"; - private static final String SNOW_INC_HOURLY = "snincrHourly"; - private static final String SNOW_INC_TOTAL = "snincrTotal"; - private static final String SNOW_DEPTH = "snowDepth"; - private static final String STATION_NAME = "stnName"; - private static final String TEMPERATURE = "temperature"; - private static final String TIME_OBS = "timeObs"; - private static final String REF_HOUR = "refHour"; - private static final String CLOUD_AMOUNT_TOT = "totCloudAmount"; - private static final String VISIBILITY = "visibility"; - private static final String WV_HGT = "waveHeight"; - private static final String WV_PD = "wavePeriod"; - private static final String WV_STEEPNESS = "waveSteepness"; - private static final String WIND_DIR = "windDir"; - private static final String WIND_GUST = "windGust"; - private static final String WIND_SPEED = "windSpeed"; + private static final String CEILING = "ceiling"; - // ------------------Common params (From OBS - // plugin)---------------------------- - private static final String ALTIMETER = "altimeter"; + private static final String DEWPOINT = "dewpoint"; - // private static final String WIND_DIR_STR = "windDirStr"; + private static final String DEWPOINT_DEPR = "dewpointDepr"; - // private static final String DP_FROM_TENTHS = "dpFromTenths"; + private static final String FROSTBITE_TIME = "frostbiteTime"; - // private static final String TEMP_FROM_TENTHS = "tempFromTenths"; + private static final String HORIZONTAL_VIS = "horzVisibility"; - private static final String VERT_VISIBILITY = "vertVisibility"; + private static final String HOURLY_PRECIP = "hourlyPrecip"; - private static final String LONGITUDE = "longitude"; + private static final String MAX_WIND_SPEED = "maxWindSpeed"; - private static final String LATITUDE = "latitude"; + private static final String PLATFORM_ID = "platformId"; - private static final String ELEVATION = "elevation"; + private static final String PRES_WEATHER = "presWeather"; - private static final String STATION_ID = "stationId"; + private static final String PRESS_CHANGE3_HOUR = "pressChange3Hour"; - private static final String REPORT_TYPE = "reportType"; + private static final String PRESS_CHANGE_CHAR = "pressChangeChar"; - private static final String RAW_METAR = "rawMETAR"; + private static final String PRESS_ALTIMETER = "pressureAltimeter"; - private static final String SKY_COVER_TYPE = "skyCoverType"; + private static final String PRI_SWELL_WV_DIR = "primarySwellWaveDir"; - private static final String SKY_LAYER_BASE = "skyLayerBase"; + private static final String PRI_SWELL_WV_HGT = "primarySwellWaveHeight"; - // ---------------From SFCOBS ------------------------------------- + private static final String PRI_SWELL_WV_PD = "primarySwellWavePeriod"; - private static final String RAW_REPORT = "rawReport"; + private static final String RAW_MESSAGE = "rawMessage"; - private static final String HI_RES_WV_HGT = "highResWaveHeight"; + private static final String REL_HUMIDITY = "relativeHumidity"; - private static final String PEAK_WIND_SPEED = "peakWindSpeed"; + private static final String SEA_LEVEL_PRESS = "seaLevelPress"; - private static final String PRECIP1_HOUR = "precip1Hour"; + private static final String SEA_SFC_TEMP = "seaSurfaceTemp"; - public static final String OBS_PARAMS_LIST; + private static final String SEC_SWELL_WV_DIR = "secondarySwellWaveDir"; - // ----------------From LDADMESOWEST------------------------------- + private static final String SEC_SWELL_WV_HGT = "secondarySwellWaveHeight"; - private static final String STORAGE_TYPE = "storageType"; + private static final String SEC_SWELL_WV_PD = "secondarySwellWavePeriod"; - private static final String DATA_PROVIDER = "dataProvider"; + private static final String SKY_COVER = "skyCover"; - private static final String HOME_WFO = "homeWFO"; + private static final String SNOW_INC_HOURLY = "snincrHourly"; - private static final String OBSERVATION_TIME = "observationTime"; + private static final String SNOW_INC_TOTAL = "snincrTotal"; - private static final String PROVIDER_ID = "providerId"; + private static final String SNOW_DEPTH = "snowDepth"; - private static final String HANDBOOK5_ID = "handbook5Id"; + private static final String STATION_NAME = "stnName"; - private static final String STATION_TYPE = "stationType"; + private static final String TEMPERATURE = "temperature"; - private static final String REPORT_TIME = "reportTime"; + private static final String TIME_OBS = "timeObs"; - private static final String RECEIVED_TIME = "receivedTime"; + private static final String REF_HOUR = "refHour"; - private static final String NUMERICAL_WMO_ID = "numericWMOid"; + private static final String CLOUD_AMOUNT_TOT = "totCloudAmount"; - private static final String DATA_PLATFORM_TYPE = "dataPlatformType"; + private static final String VISIBILITY = "visibility"; - private static final String PLATFORM_TRUE_DIRECTION = "platformTrueDirection"; + private static final String WV_HGT = "waveHeight"; - private static final String PLARFORM_TRUE_SPEED = "platformTrueSpeed"; + private static final String WV_PD = "wavePeriod"; - private static final String TEMP_CHANGE_TIME = "tempChangeTime"; + private static final String WV_STEEPNESS = "waveSteepness"; - private static final String WET_BULB_TEMPERATURE = "wetBulbTemperature"; + private static final String WIND_DIR = "windDir"; - private static final String RH_CHANGE_TIME = "rhChangeTime"; + private static final String WIND_GUST = "windGust"; - private static final String STATION_PRESSURE = "stationPressure"; + private static final String WIND_SPEED = "windSpeed"; - private static final String STATION_PRESS_CHANGE_TIME = "stationPressChangeTime"; + // ------------------Common params (From OBS + // plugin)---------------------------- + private static final String ALTIMETER = "altimeter"; - private static final String WIND_DIR_CHANGE_TIME = "windDirChangeTime"; + private static final String VERT_VISIBILITY = "vertVisibility"; - private static final String WIND_SPEED_CHANGE_TIME = "windSpeedChangeTime"; + private static final String LONGITUDE = "longitude"; - private static final String WIND_GUST_CHANGE_TIME = "windGustChangeTime"; + private static final String LATITUDE = "latitude"; - private static final String WIND_DIR_MIN = "windDirMin"; + private static final String ELEVATION = "elevation"; - private static final String WIND_DIR_MAX = "windDirMax"; + private static final String STATION_ID = "stationId"; - private static final String VISIBILITY_STATUS = "visibilityStatus"; + private static final String REPORT_TYPE = "reportType"; - private static final String TOTAL_CLOUD_COVER = "totalCloudCover"; + private static final String RAW_METAR = "rawMETAR"; - private static final String CLOUD_BASE_HEIGHT = "cloudBaseHeight"; + private static final String SKY_COVER_TYPE = "skyCoverType"; - private static final String LOW_LEVEL_CLOUD_TYPE = "lowLevelCloudType"; + private static final String SKY_LAYER_BASE = "skyLayerBase"; - private static final String MID_LEVEL_CLOUD_TYPE = "midLevelCloudType"; + // ---------------From SFCOBS ------------------------------------- - private static final String HIGH_LEVEL_CLOUD_TYPE = "highLevelCloudType"; + private static final String RAW_REPORT = "rawReport"; - private static final String MAX_TEMP_RECORD_PERIOD = "maxTempRecordPeriod"; + private static final String HI_RES_WV_HGT = "highResWaveHeight"; - private static final String MAXIMUM_TEMPERATURE = "maximumTemperature"; + private static final String PEAK_WIND_SPEED = "peakWindSpeed"; - private static final String MIN_TEMP_RECORD_PERIOD = "minTempRecordPeriod"; + private static final String PRECIP1_HOUR = "precip1Hour"; - private static final String MINIMUM_TEMPERATURE = "minimumTemperature"; + private static final String TIME_NOMINAL = "timeNominal"; - private static final String PRECIP_ACCUM = "precipAccum"; + public static final String OBS_PARAMS_LIST; - private static final String PRECIP_TYPE = "precipType"; + // ----------------From LDADMESOWEST------------------------------- - private static final String PRECIP_INTENSITY = "precipIntensity"; + private static final String STORAGE_TYPE = "storageType"; - private static final String TIME_SINCE_LAST_PCP = "timeSinceLastPcp"; + private static final String DATA_PROVIDER = "dataProvider"; - private static final String SOLAR_RADIATION = "solarRadiation"; + private static final String HOME_WFO = "homeWFO"; - private static final String SOLAR_RAD_CHANGE_TIME = "solarRadChangeTime"; + private static final String OBSERVATION_TIME = "observationTime"; - private static final String SEA_SURFACE_TEMP = "seaSurfaceTemp"; + private static final String PROVIDER_ID = "providerId"; - private static final String WAVE_PERIOD = "wavePeriod"; + private static final String HANDBOOK5_ID = "handbook5Id"; - private static final String WAVE_HEIGHT = "waveHeight"; + private static final String STATION_TYPE = "stationType"; - private static final String RAW_MESONET = "rawMessage"; + private static final String REPORT_TIME = "reportTime"; - private static final String PRESSURE = "pressure"; + private static final String RECEIVED_TIME = "receivedTime"; - private static final String SEA_LEVEL_PRESSURE = "seaLevelPressure"; + private static final String NUMERICAL_WMO_ID = "numericWMOid"; - private static final String PRECIP_RATE = "precipRate"; + private static final String DATA_PLATFORM_TYPE = "dataPlatformType"; - private static final String FUEL_TEMPERATURE = "fuelTemperature"; + private static final String PLATFORM_TRUE_DIRECTION = "platformTrueDirection"; - private static final String FUEL_MOISTURE = "fuelMoisture"; + private static final String PLARFORM_TRUE_SPEED = "platformTrueSpeed"; - private static final String SOIL_TEMPERATURE = "soilTemperature"; + private static final String TEMP_CHANGE_TIME = "tempChangeTime"; - private static final String SOIL_MOISTURE = "soilMoisture"; + private static final String WET_BULB_TEMPERATURE = "wetBulbTemperature"; - static { - StringBuffer sb = new StringBuffer(); - sb.append("altimeter,"); - sb.append("windGust,"); - sb.append("windSpeed,"); - sb.append("windDir,"); - sb.append("dewpoint,"); - sb.append("temperature,"); - sb.append("precip1Hour,"); - sb.append("seaLevelPress,"); - sb.append("pressChange3Hour,"); - sb.append("pressChangeChar,"); - sb.append("visibility,"); - sb.append("vertVisibility,"); - sb.append("longitude,"); - sb.append("latitude,"); - sb.append("elevation,"); - sb.append("stationId,"); - sb.append("reportType,"); - sb.append("skyCover,"); - sb.append("skyCoverType,"); - sb.append("skyLayerBase,"); - sb.append("presWeather,"); - sb.append("rawMETAR,"); - sb.append("timeObs "); + private static final String RH_CHANGE_TIME = "rhChangeTime"; - OBS_PARAMS_LIST = sb.toString(); - } + private static final String STATION_PRESSURE = "stationPressure"; - public static FSSObsRecord fromMetarRecord(PointDataContainer container) - throws JAXBException { - container.setCurrentSz(container.getAllocatedSz()); - PointDataView pdv = container.readRandom(0); - FSSObsRecord fssr = new FSSObsRecord(); - fssr.setReportType(pdv.getString(REPORT_TYPE)); - SurfaceObsLocation loc = new SurfaceObsLocation(); - loc.setStationId(pdv.getString(STATION_ID)); + private static final String STATION_PRESS_CHANGE_TIME = "stationPressChangeTime"; + + private static final String WIND_DIR_CHANGE_TIME = "windDirChangeTime"; + + private static final String WIND_SPEED_CHANGE_TIME = "windSpeedChangeTime"; + + private static final String WIND_GUST_CHANGE_TIME = "windGustChangeTime"; + + private static final String WIND_DIR_MIN = "windDirMin"; + + private static final String WIND_DIR_MAX = "windDirMax"; + + private static final String VISIBILITY_STATUS = "visibilityStatus"; + + private static final String TOTAL_CLOUD_COVER = "totalCloudCover"; + + private static final String CLOUD_BASE_HEIGHT = "cloudBaseHeight"; + + private static final String LOW_LEVEL_CLOUD_TYPE = "lowLevelCloudType"; + + private static final String MID_LEVEL_CLOUD_TYPE = "midLevelCloudType"; + + private static final String HIGH_LEVEL_CLOUD_TYPE = "highLevelCloudType"; + + private static final String MAX_TEMP_RECORD_PERIOD = "maxTempRecordPeriod"; + + private static final String MAXIMUM_TEMPERATURE = "maximumTemperature"; + + private static final String MIN_TEMP_RECORD_PERIOD = "minTempRecordPeriod"; + + private static final String MINIMUM_TEMPERATURE = "minimumTemperature"; + + private static final String PRECIP_ACCUM = "precipAccum"; + + private static final String PRECIP_TYPE = "precipType"; + + private static final String PRECIP_INTENSITY = "precipIntensity"; + + private static final String TIME_SINCE_LAST_PCP = "timeSinceLastPcp"; + + private static final String SOLAR_RADIATION = "solarRadiation"; + + private static final String SOLAR_RAD_CHANGE_TIME = "solarRadChangeTime"; + + private static final String SEA_SURFACE_TEMP = "seaSurfaceTemp"; + + private static final String WAVE_PERIOD = "wavePeriod"; + + private static final String WAVE_HEIGHT = "waveHeight"; + + private static final String RAW_MESONET = "rawMessage"; + + private static final String PRESSURE = "pressure"; + + private static final String SEA_LEVEL_PRESSURE = "seaLevelPressure"; + + private static final String PRECIP_RATE = "precipRate"; + + private static final String FUEL_TEMPERATURE = "fuelTemperature"; + + private static final String FUEL_MOISTURE = "fuelMoisture"; + + private static final String SOIL_TEMPERATURE = "soilTemperature"; + + private static final String SOIL_MOISTURE = "soilMoisture"; + + static { + StringBuffer sb = new StringBuffer(); + sb.append("altimeter,"); + sb.append("windGust,"); + sb.append("windSpeed,"); + sb.append("windDir,"); + sb.append("dewpoint,"); + sb.append("temperature,"); + sb.append("precip1Hour,"); + sb.append("seaLevelPress,"); + sb.append("pressChange3Hour,"); + sb.append("pressChangeChar,"); + sb.append("visibility,"); + sb.append("vertVisibility,"); + sb.append("longitude,"); + sb.append("latitude,"); + sb.append("elevation,"); + sb.append("stationId,"); + sb.append("reportType,"); + sb.append("skyCover,"); + sb.append("skyCoverType,"); + sb.append("skyLayerBase,"); + sb.append("presWeather,"); + sb.append("rawMETAR,"); + sb.append("timeObs "); + + OBS_PARAMS_LIST = sb.toString(); + } + + public static FSSObsRecord fromMetarRecord(PointDataContainer container) + throws JAXBException { + container.setCurrentSz(container.getAllocatedSz()); + PointDataView pdv = container.readRandom(0); + FSSObsRecord fssr = new FSSObsRecord(); + fssr.setReportType(pdv.getString(REPORT_TYPE)); + SurfaceObsLocation loc = new SurfaceObsLocation(); + loc.setStationId(pdv.getString(STATION_ID)); float lat = pdv.getNumber(LATITUDE).floatValue(); float lon = pdv.getNumber(LONGITUDE).floatValue(); - loc.assignLocation(lat, lon); - loc.setElevation(pdv.getNumber(ELEVATION).intValue()); - fssr.setLocation(loc); - String stId = FSSObsUtils.getStationName(loc.getStationId()); - fssr.setPlatformId(loc.getStationId()); - fssr.setStnName(stId); - fssr.setRawMessage(pdv.getString(RAW_METAR)); - fssr.setDataTime(new DataTime(new Date(pdv.getNumber(TIME_OBS) - .longValue()))); - long to = pdv.getLong(TIME_OBS); - fssr.setTimeObs(TimeUtil.newGmtCalendar(new Date(to))); - // nominalTime - fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs())); - // in mbar - fssr.setSeaLevelPress(pdv.getNumber(SEA_LEVEL_PRESS).floatValue()); - // in mmHg - fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue()); - // Double pa = - // DecoderTools.inToPa(pdv.getNumber(ALTIMETER).doubleValue()); - // fssr.setPressureAltimeter(pa.floatValue()); - fssr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue()); - fssr.setPressChangeChar(pdv.getString(PRESS_CHANGE_CHAR)); - // in Fahrenheit - if (pdv.getFloat(DEWPOINT) != MISSING) { - fssr.setDewpoint(1.8f * pdv.getFloat(DEWPOINT) + 32.0f); - } - if (pdv.getFloat(TEMPERATURE) != MISSING) { - fssr.setTemperature(1.8f * pdv.getFloat(TEMPERATURE) + 32.0f); - } - // in meters - fssr.setVisibility(pdv.getNumber(VISIBILITY).floatValue()); - Number[] levels = pdv.getNumberAllLevels(SKY_LAYER_BASE); - String[] skyCov = pdv.getStringAllLevels(SKY_COVER_TYPE); - if (pdv.getNumber(VERT_VISIBILITY).floatValue() >= 0 - && pdv.getNumber(VERT_VISIBILITY).floatValue() < 1e20f - && pdv.getNumber(VERT_VISIBILITY).floatValue() != MISSING) { - fssr.setCeiling(pdv.getNumber(VERT_VISIBILITY).floatValue() / 100f); - } else { - // in feet - float ceiling = FSSObsUtils.findMetarCeilingFromLayers(skyCov, - levels); - fssr.setCeiling(ceiling); - } - fssr.setSkyCover(pdv.getStringAllLevels(SKY_COVER)); - // in inch - fssr.setHourlyPrecip(pdv.getFloat(PRECIP1_HOUR)); + loc.assignLocation(lat, lon); + loc.setElevation(pdv.getNumber(ELEVATION).intValue()); + fssr.setLocation(loc); + String stId = FSSObsUtils.getStationName(loc.getStationId()); + fssr.setPlatformId(loc.getStationId()); + fssr.setStnName(stId); + fssr.setRawMessage(pdv.getString(RAW_METAR)); + fssr.setDataTime(new DataTime(pdv.getDate(TIME_OBS))); + fssr.setTimeObs(pdv.getCalendar(TIME_OBS)); + fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs())); + // in mbar + fssr.setSeaLevelPress(pdv.getNumber(SEA_LEVEL_PRESS).floatValue()); + // in mmHg + fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue()); + fssr.setPressChange3Hour(pdv.getNumber(PRESS_CHANGE3_HOUR).floatValue()); + fssr.setPressChangeChar(pdv.getString(PRESS_CHANGE_CHAR)); + // in Fahrenheit + if (pdv.getFloat(DEWPOINT) != MISSING) { + fssr.setDewpoint(1.8f * pdv.getFloat(DEWPOINT) + 32.0f); + } + if (pdv.getFloat(TEMPERATURE) != MISSING) { + fssr.setTemperature(1.8f * pdv.getFloat(TEMPERATURE) + 32.0f); + } + // in meters + fssr.setVisibility(pdv.getNumber(VISIBILITY).floatValue()); + Number[] levels = pdv.getNumberAllLevels(SKY_LAYER_BASE); + String[] skyCov = pdv.getStringAllLevels(SKY_COVER_TYPE); + if (pdv.getNumber(VERT_VISIBILITY).floatValue() >= 0 + && pdv.getNumber(VERT_VISIBILITY).floatValue() < 1e20f + && pdv.getNumber(VERT_VISIBILITY).floatValue() != MISSING) { + fssr.setCeiling(pdv.getNumber(VERT_VISIBILITY).floatValue() / 100f); + } else { + // in feet + float ceiling = FSSObsUtils.findMetarCeilingFromLayers(skyCov, + levels); + fssr.setCeiling(ceiling); + } + fssr.setSkyCover(pdv.getStringAllLevels(SKY_COVER)); + // in inch + fssr.setHourlyPrecip(pdv.getFloat(PRECIP1_HOUR)); - // fssr.setWindDir(Float.valueOf(pdv.getString(WIND_DIR_STR))); - fssr.setWindDir(pdv.getFloat(WIND_DIR)); - // in knotes - if (pdv.getNumber(WIND_GUST).floatValue() != MISSING) { - fssr.setWindGust(pdv.getNumber(WIND_GUST).floatValue()); - } - if (pdv.getNumber(WIND_SPEED).floatValue() != MISSING) { - fssr.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue()); - } + fssr.setWindDir(pdv.getFloat(WIND_DIR)); + // in knotes + if (pdv.getNumber(WIND_GUST).floatValue() != MISSING) { + fssr.setWindGust(pdv.getNumber(WIND_GUST).floatValue()); + } + if (pdv.getNumber(WIND_SPEED).floatValue() != MISSING) { + fssr.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue()); + } - fssr.setPresWeather(pdv.getStringAllLevels(PRES_WEATHER)); + fssr.setPresWeather(pdv.getStringAllLevels(PRES_WEATHER)); - return fssr; - } + return fssr; + } - public static final String HDR_PARAMS_LIST; - static { - StringBuffer sb = new StringBuffer(); + public static final String HDR_PARAMS_LIST; + static { + StringBuffer sb = new StringBuffer(); - sb.append("stationId,"); - sb.append("latitude,"); - sb.append("longitude,"); - sb.append("elevation,"); - sb.append("timeObs,"); - sb.append("timeNominal,"); - sb.append("reportType,"); - sb.append("rawReport,"); - sb.append("wmoHeader,"); + sb.append("stationId,"); + sb.append("latitude,"); + sb.append("longitude,"); + sb.append("elevation,"); + sb.append("timeObs,"); + sb.append("timeNominal,"); + sb.append("reportType,"); + sb.append("rawReport,"); + sb.append("wmoHeader,"); - HDR_PARAMS_LIST = sb.toString(); - } + HDR_PARAMS_LIST = sb.toString(); + } - public static String SFCOBS_PARAMS_LIST = null; - static { - StringBuffer sb = new StringBuffer(); - sb.append(HDR_PARAMS_LIST); + public static String SFCOBS_PARAMS_LIST = null; + static { + StringBuffer sb = new StringBuffer(); + sb.append(HDR_PARAMS_LIST); - sb.append("temperature,"); - sb.append("dewpoint,"); + sb.append("temperature,"); + sb.append("dewpoint,"); - sb.append("windSpeed,"); - sb.append("windDir,"); - sb.append("windGust,"); + sb.append("windSpeed,"); + sb.append("windDir,"); + sb.append("windGust,"); - sb.append("peakWindSpeedTime,"); - sb.append("peakWindDir,"); - sb.append("peakWindSpeed,"); + sb.append("peakWindSpeedTime,"); + sb.append("peakWindDir,"); + sb.append("peakWindSpeed,"); - sb.append("seaLevelPress,"); - sb.append("altimeter,"); - sb.append("pressChangeChar,"); - sb.append("pressChange3Hour,"); + sb.append("seaLevelPress,"); + sb.append("altimeter,"); + sb.append("pressChangeChar,"); + sb.append("pressChange3Hour,"); - sb.append("visibility,"); - sb.append("presWeather,"); + sb.append("visibility,"); + sb.append("presWeather,"); - sb.append("totCloudAmount,"); - sb.append("precip1Hour,"); - sb.append("seaSurfaceTemp,"); - sb.append("waveHeight,"); - sb.append("wavePeriod,"); - sb.append("waveSteepness,"); + sb.append("totCloudAmount,"); + sb.append("precip1Hour,"); + sb.append("seaSurfaceTemp,"); + sb.append("waveHeight,"); + sb.append("wavePeriod,"); + sb.append("waveSteepness,"); - sb.append("highResWaveHeight,"); + sb.append("highResWaveHeight,"); - sb.append("primarySwellWaveDir,"); - sb.append("primarySwellWavePeriod,"); - sb.append("primarySwellWaveHeight,"); + sb.append("primarySwellWaveDir,"); + sb.append("primarySwellWavePeriod,"); + sb.append("primarySwellWaveHeight,"); - sb.append("secondarySwellWaveDir,"); - sb.append("secondarySwellWavePeriod,"); - sb.append("secondarySwellWaveHeight "); + sb.append("secondarySwellWaveDir,"); + sb.append("secondarySwellWavePeriod,"); + sb.append("secondarySwellWaveHeight "); - SFCOBS_PARAMS_LIST = sb.toString(); - } + SFCOBS_PARAMS_LIST = sb.toString(); + } - private static final String[] MESOWEST_PARAMS = { PRESS_CHANGE3_HOUR, - PRESS_CHANGE_CHAR, ALTIMETER, WIND_GUST, WIND_SPEED, DEWPOINT, - TEMPERATURE, PRES_WEATHER, VISIBILITY, LONGITUDE, LATITUDE, - STATION_NAME, STORAGE_TYPE, ELEVATION, STATION_ID, DATA_PROVIDER, - HOME_WFO, OBSERVATION_TIME, PROVIDER_ID, HANDBOOK5_ID, - STATION_TYPE, REPORT_TIME, RECEIVED_TIME, NUMERICAL_WMO_ID, - DATA_PLATFORM_TYPE, PLATFORM_TRUE_DIRECTION, PLARFORM_TRUE_SPEED, - TEMP_CHANGE_TIME, WET_BULB_TEMPERATURE, RH_CHANGE_TIME, - STATION_PRESSURE, STATION_PRESS_CHANGE_TIME, WIND_DIR_CHANGE_TIME, - WIND_SPEED_CHANGE_TIME, WIND_GUST_CHANGE_TIME, WIND_DIR_MIN, - WIND_DIR_MAX, VISIBILITY_STATUS, TOTAL_CLOUD_COVER, - CLOUD_BASE_HEIGHT, LOW_LEVEL_CLOUD_TYPE, MID_LEVEL_CLOUD_TYPE, - HIGH_LEVEL_CLOUD_TYPE, MAX_TEMP_RECORD_PERIOD, MAXIMUM_TEMPERATURE, - MIN_TEMP_RECORD_PERIOD, MINIMUM_TEMPERATURE, PRECIP_ACCUM, - PRECIP_TYPE, PRECIP_INTENSITY, TIME_SINCE_LAST_PCP, - SOLAR_RADIATION, SOLAR_RAD_CHANGE_TIME, SEA_SURFACE_TEMP, - WAVE_PERIOD, WAVE_HEIGHT, RAW_MESONET, "relHumidity", WIND_DIR, - PRESSURE, SEA_LEVEL_PRESSURE, PRECIP_RATE, FUEL_TEMPERATURE, - FUEL_MOISTURE, SOIL_TEMPERATURE, SOIL_MOISTURE, REPORT_TYPE }; + private static final String[] MESOWEST_PARAMS = { PRESS_CHANGE3_HOUR, + PRESS_CHANGE_CHAR, ALTIMETER, WIND_GUST, WIND_SPEED, DEWPOINT, + TEMPERATURE, PRES_WEATHER, VISIBILITY, LONGITUDE, LATITUDE, + STATION_NAME, STORAGE_TYPE, ELEVATION, STATION_ID, DATA_PROVIDER, + HOME_WFO, OBSERVATION_TIME, PROVIDER_ID, HANDBOOK5_ID, + STATION_TYPE, REPORT_TIME, RECEIVED_TIME, NUMERICAL_WMO_ID, + DATA_PLATFORM_TYPE, PLATFORM_TRUE_DIRECTION, PLARFORM_TRUE_SPEED, + TEMP_CHANGE_TIME, WET_BULB_TEMPERATURE, RH_CHANGE_TIME, + STATION_PRESSURE, STATION_PRESS_CHANGE_TIME, WIND_DIR_CHANGE_TIME, + WIND_SPEED_CHANGE_TIME, WIND_GUST_CHANGE_TIME, WIND_DIR_MIN, + WIND_DIR_MAX, VISIBILITY_STATUS, TOTAL_CLOUD_COVER, + CLOUD_BASE_HEIGHT, LOW_LEVEL_CLOUD_TYPE, MID_LEVEL_CLOUD_TYPE, + HIGH_LEVEL_CLOUD_TYPE, MAX_TEMP_RECORD_PERIOD, MAXIMUM_TEMPERATURE, + MIN_TEMP_RECORD_PERIOD, MINIMUM_TEMPERATURE, PRECIP_ACCUM, + PRECIP_TYPE, PRECIP_INTENSITY, TIME_SINCE_LAST_PCP, + SOLAR_RADIATION, SOLAR_RAD_CHANGE_TIME, SEA_SURFACE_TEMP, + WAVE_PERIOD, WAVE_HEIGHT, RAW_MESONET, "relHumidity", WIND_DIR, + PRESSURE, SEA_LEVEL_PRESSURE, PRECIP_RATE, FUEL_TEMPERATURE, + FUEL_MOISTURE, SOIL_TEMPERATURE, SOIL_MOISTURE, REPORT_TYPE }; - public static final String MESOWEST_PARAMS_LIST; - static { - StringBuffer sb = new StringBuffer(); - boolean first = true; - for (String s : MESOWEST_PARAMS) { - if (!first) { - sb.append(", "); - } else { - first = false; - } - sb.append(s); - } - MESOWEST_PARAMS_LIST = sb.toString(); - } + public static final String MESOWEST_PARAMS_LIST; + static { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (String s : MESOWEST_PARAMS) { + if (!first) { + sb.append(", "); + } else { + first = false; + } + sb.append(s); + } + MESOWEST_PARAMS_LIST = sb.toString(); + } - public static FSSObsRecord fromMaritimeRecord(PointDataContainer container) - throws JAXBException { - container.setCurrentSz(container.getAllocatedSz()); - PointDataView pdv = container.readRandom(0); + public static FSSObsRecord fromMaritimeRecord(PointDataContainer container) + throws JAXBException { + container.setCurrentSz(container.getAllocatedSz()); + PointDataView pdv = container.readRandom(0); - FSSObsRecord fssr = new FSSObsRecord(); - SurfaceObsLocation loc = new SurfaceObsLocation(); - loc.setStationId(pdv.getString(STATION_ID)); + FSSObsRecord fssr = new FSSObsRecord(); + SurfaceObsLocation loc = new SurfaceObsLocation(); + loc.setStationId(pdv.getString(STATION_ID)); float lat = pdv.getNumber(LATITUDE).floatValue(); float lon = pdv.getNumber(LONGITUDE).floatValue(); - loc.assignLocation(lat, lon); - loc.setElevation(pdv.getNumber(ELEVATION).intValue()); - fssr.setLocation(loc); - String stId = FSSObsUtils.getStationName(loc.getStationId()); - fssr.setPlatformId(loc.getStationId()); - fssr.setStnName(stId); + loc.assignLocation(lat, lon); + loc.setElevation(pdv.getNumber(ELEVATION).intValue()); + fssr.setLocation(loc); + fssr.setPlatformId(loc.getStationId()); + String stFullName = FSSObsUtils.getStationName(loc.getStationId()); + if (stFullName != null) { + fssr.setStnName(stFullName); + } else { + stFullName = fssr.getPlatformId(); + } + fssr.setRawMessage(pdv.getString(RAW_REPORT)); + fssr.setDataTime(new DataTime(pdv.getDate(TIME_OBS))); + fssr.setTimeObs(pdv.getCalendar(TIME_OBS)); + fssr.setRefHour(pdv.getCalendar(TIME_NOMINAL)); + // in mbar + if (pdv.getFloat(SEA_LEVEL_PRESS) != MISSING) { + fssr.setSeaLevelPress(pdv.getFloat(SEA_LEVEL_PRESS) / 100); + } + fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue()); + fssr.setPressChange3Hour(pdv.getFloat(PRESS_CHANGE3_HOUR)); + fssr.setPressChangeChar(String.valueOf(pdv.getInt(PRESS_CHANGE_CHAR))); - fssr.setRawMessage(pdv.getString(RAW_REPORT)); - fssr.setDataTime(new DataTime(new Date(pdv.getNumber(TIME_OBS) - .longValue()))); - long to = pdv.getLong(TIME_OBS); - fssr.setTimeObs(TimeUtil.newGmtCalendar(new Date(to))); - // TODO: check nominalTime - fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs())); + // http://www.hpc.ncep.noaa.gov/html/tempconversion.shtml + // in Fahrenheit + if (pdv.getFloat(DEWPOINT) != MISSING) { + fssr.setDewpoint(1.8f * (pdv.getFloat(DEWPOINT) - 273.15f) + 32.0f); + } + if (pdv.getFloat(TEMPERATURE) != MISSING) { + fssr.setTemperature(1.8f * (pdv.getFloat(TEMPERATURE) - 273.15f) + 32.0f); + } + if (pdv.getNumber(SEA_SFC_TEMP).floatValue() != MISSING) { + fssr.setSeaSurfaceTemp(1.8f * (pdv.getNumber(SEA_SFC_TEMP) + .floatValue() - 273.15f) + 32.0f); + } + // in nautical miles + fssr.setHorzVisibility(pdv.getNumber(VISIBILITY).floatValue()); - // in mbar - if (pdv.getFloat(SEA_LEVEL_PRESS) != MISSING) { - fssr.setSeaLevelPress(pdv.getFloat(SEA_LEVEL_PRESS) / 100); - } - fssr.setPressureAltimeter(pdv.getNumber(ALTIMETER).floatValue()); - // Double pa = - // DecoderTools.inToPa(pdv.getNumber(ALTIMETER).doubleValue()); - // if (pdv.getNumber(ALTIMETER).doubleValue() != MISSING) { - // fssr.setPressure(pa.floatValue()); - // } - fssr.setPressChange3Hour(pdv.getFloat(PRESS_CHANGE3_HOUR)); - fssr.setPressChangeChar(String.valueOf(pdv.getInt(PRESS_CHANGE_CHAR))); + fssr.setWindDir(pdv.getNumber(WIND_DIR).floatValue()); + // in knotes + if (pdv.getNumber(WIND_GUST).floatValue() != MISSING) { + fssr.setWindGust(pdv.getNumber(WIND_GUST).floatValue()); + } + if (pdv.getNumber(WIND_SPEED).floatValue() != MISSING) { + fssr.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue()); + } + if (pdv.getFloat(PEAK_WIND_SPEED) != MISSING) { + fssr.setMaxWindSpeed(pdv.getFloat(PEAK_WIND_SPEED)); + } + fssr.setReportType(String.valueOf(pdv.getInt(REPORT_TYPE))); + String[] pw = new String[25]; + pw[0] = pdv.getString(PRES_WEATHER); + fssr.setPresWeather(pw); - // http://www.hpc.ncep.noaa.gov/html/tempconversion.shtml - // in Fahrenheit - if (pdv.getFloat(DEWPOINT) != MISSING) { - fssr.setDewpoint(1.8f * (pdv.getFloat(DEWPOINT) - 273.15f) + 32.0f); - } - if (pdv.getFloat(TEMPERATURE) != MISSING) { - fssr.setTemperature(1.8f * (pdv.getFloat(TEMPERATURE) - 273.15f) + 32.0f); - } - if (pdv.getNumber(SEA_SFC_TEMP).floatValue() != MISSING) { - fssr.setSeaSurfaceTemp(1.8f * (pdv.getNumber(SEA_SFC_TEMP) - .floatValue() - 273.15f) + 32.0f); - } - // in nautical miles - fssr.setHorzVisibility(pdv.getNumber(VISIBILITY).floatValue()); + fssr.setHighResWaveHeight(pdv.getFloat(HI_RES_WV_HGT)); + fssr.setHourlyPrecip(pdv.getFloat(PRECIP1_HOUR)); - fssr.setWindDir(pdv.getNumber(WIND_DIR).floatValue()); - // in knotes - if (pdv.getNumber(WIND_GUST).floatValue() != MISSING) { - fssr.setWindGust(pdv.getNumber(WIND_GUST).floatValue()); - } - if (pdv.getNumber(WIND_SPEED).floatValue() != MISSING) { - fssr.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue()); - } - if (pdv.getFloat(PEAK_WIND_SPEED) != MISSING) { - fssr.setMaxWindSpeed(pdv.getFloat(PEAK_WIND_SPEED)); - } - fssr.setReportType(String.valueOf(pdv.getInt(REPORT_TYPE))); - String[] pw = new String[25]; - pw[0] = pdv.getString(PRES_WEATHER); - fssr.setPresWeather(pw); + fssr.setPrimarySwellWaveDir(pdv.getNumber(PRI_SWELL_WV_DIR) + .doubleValue()); + fssr.setPrimarySwellWaveHeight(pdv.getNumber(PRI_SWELL_WV_HGT) + .doubleValue()); + fssr.setPrimarySwellWavePeriod(pdv.getNumber(PRI_SWELL_WV_PD) + .intValue()); + fssr.setSecondarySwellWaveDir(pdv.getNumber(SEC_SWELL_WV_DIR) + .doubleValue()); + fssr.setSecondarySwellWaveHeight(pdv.getNumber(SEC_SWELL_WV_HGT) + .doubleValue()); + fssr.setSecondarySwellWavePeriod(pdv.getNumber(SEC_SWELL_WV_PD) + .intValue()); + fssr.setWaveHeight(pdv.getNumber(WV_HGT).doubleValue()); + fssr.setWavePeriod(pdv.getNumber(WV_PD).intValue()); + fssr.setWaveSteepness(pdv.getNumber(WV_STEEPNESS).floatValue()); + fssr.setTotCloudAmount(pdv.getInt(CLOUD_AMOUNT_TOT)); - fssr.setHighResWaveHeight(pdv.getFloat(HI_RES_WV_HGT)); - fssr.setHourlyPrecip(pdv.getFloat(PRECIP1_HOUR)); + return fssr; + } - fssr.setPrimarySwellWaveDir(pdv.getNumber(PRI_SWELL_WV_DIR) - .doubleValue()); - fssr.setPrimarySwellWaveHeight(pdv.getNumber(PRI_SWELL_WV_HGT) - .doubleValue()); - fssr.setPrimarySwellWavePeriod(pdv.getNumber(PRI_SWELL_WV_PD) - .intValue()); - fssr.setSecondarySwellWaveDir(pdv.getNumber(SEC_SWELL_WV_DIR) - .doubleValue()); - fssr.setSecondarySwellWaveHeight(pdv.getNumber(SEC_SWELL_WV_HGT) - .doubleValue()); - fssr.setSecondarySwellWavePeriod(pdv.getNumber(SEC_SWELL_WV_PD) - .intValue()); - fssr.setWaveHeight(pdv.getNumber(WV_HGT).doubleValue()); - fssr.setWavePeriod(pdv.getNumber(WV_PD).intValue()); - fssr.setWaveSteepness(pdv.getNumber(WV_STEEPNESS).floatValue()); - fssr.setTotCloudAmount(pdv.getInt(CLOUD_AMOUNT_TOT)); - - return fssr; - // TODO : Intermediate winds - } - - /** - * @param result - * @return - */ - public static FSSObsRecord fromLdadmesowestRecord( - PointDataContainer container) throws JAXBException { - container.setCurrentSz(container.getAllocatedSz()); - PointDataView pdv = container.readRandom(0); - FSSObsRecord fssr = new FSSObsRecord(); - fssr.setReportType(pdv.getString(REPORT_TYPE)); - SurfaceObsLocation loc = new SurfaceObsLocation(); - loc.setStationId(pdv.getString(STATION_ID)); + /** + * @param result + * @return + */ + public static FSSObsRecord fromLdadmesowestRecord( + PointDataContainer container) throws JAXBException { + container.setCurrentSz(container.getAllocatedSz()); + PointDataView pdv = container.readRandom(0); + FSSObsRecord fssr = new FSSObsRecord(); + fssr.setReportType(pdv.getString(REPORT_TYPE)); + SurfaceObsLocation loc = new SurfaceObsLocation(); + loc.setStationId(pdv.getString(STATION_ID)); float lat = pdv.getNumber(LATITUDE).floatValue(); float lon = pdv.getNumber(LONGITUDE).floatValue(); - loc.assignLocation(lat, lon); - loc.setElevation(pdv.getNumber(ELEVATION).intValue()); - fssr.setLocation(loc); - String stId = FSSObsUtils.getStationName(loc.getStationId()); - fssr.setPlatformId(loc.getStationId()); - fssr.setStnName(stId + pdv.getString(DATA_PROVIDER)); - fssr.setRawMessage(pdv.getString(RAW_MESSAGE)); - fssr.setDataTime(new DataTime(new Date(pdv.getNumber(OBSERVATION_TIME) - .longValue()))); - long to = pdv.getLong(OBSERVATION_TIME); + loc.assignLocation(lat, lon); + loc.setElevation(pdv.getNumber(ELEVATION).intValue()); + fssr.setLocation(loc); + String stId = FSSObsUtils.getStationName(loc.getStationId()); + fssr.setPlatformId(loc.getStationId()); + fssr.setStnName(stId + pdv.getString(DATA_PROVIDER)); + fssr.setRawMessage(pdv.getString(RAW_MESSAGE)); + fssr.setDataTime(new DataTime(new Date(pdv.getNumber(OBSERVATION_TIME) + .longValue()))); + long to = pdv.getLong(OBSERVATION_TIME); fssr.setTimeObs(TimeUtil.newGmtCalendar(new Date(to))); - fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs())); - // fssr.setCeiling(pdv.getNumber(CLOUD_BASE_HEIGHT).floatValue()); - if (pdv.getFloat(DEWPOINT) != MISSING) { - fssr.setDewpoint(1.8f * (pdv.getFloat(DEWPOINT) - 273.15f) + 32.0f); - } - fssr.setRelativeHumidity(pdv.getFloat("relHumidity")); - if (pdv.getFloat(TEMPERATURE) != MISSING) { - fssr.setTemperature(1.8f * (pdv.getFloat(TEMPERATURE) - 273.15f) + 32.0f); - } - // fssr.setHighResWaveHeight(highResWaveHeight); - // fssr.setHorzVisibility(horzVisibility); - // fssr.setHourlyPrecip(pdv.getFloat(HOURLY_PRECIP)); - // fssr.setMaxWindSpeed(maxWindSpeed); - fssr.setMessageData(pdv.getString(RAW_MESSAGE)); - fssr.setPressChange3Hour(pdv.getFloat(PRESS_CHANGE3_HOUR)); - fssr.setPressChangeChar(String.valueOf(pdv.getInt(PRESS_CHANGE_CHAR))); - fssr.setPressureAltimeter(pdv.getFloat(ALTIMETER)); // in Pascal - // fssr.setPresWeather(pdv.getStringAllLevels(PRES_WEATHER)); - // fssr.setPrimarySwellWaveDir(primarySwellWaveDir); - // fssr.setPrimarySwellWaveHeight(primarySwellWaveHeight); - // fssr.setPrimarySwellWavePeriod(primarySwellWavePeriod); - if (pdv.getFloat(SEA_LEVEL_PRESSURE) != MISSING) { - fssr.setSeaLevelPress(pdv.getFloat(SEA_LEVEL_PRESSURE) / 100); - } - if (pdv.getFloat(SEA_SURFACE_TEMP) != MISSING) { - fssr.setSeaSurfaceTemp(1.8f * (pdv.getFloat(SEA_SURFACE_TEMP) - 273.15f) + 32.0f); - } - // fssr.setSecondarySwellWaveDir(secondarySwellWaveDir); - // fssr.setSecondarySwellWaveHeight(secondarySwellWaveHeight); - // fssr.setSecondarySwellWavePeriod(secondarySwellWavePeriod); - // fssr.setSkyCover(pdv.getStringAllLevels(SKY_COVER)); - // fssr.setTotCloudAmount(pdv.getInt(TOTAL_CLOUD_COVER)); - fssr.setVisibility(pdv.getFloat(VISIBILITY)); - fssr.setWaveHeight(pdv.getNumber(WAVE_HEIGHT).doubleValue()); - fssr.setWindDir(pdv.getFloat(WIND_DIR)); - fssr.setWindGust(pdv.getFloat(WIND_GUST)); - fssr.setWindSpeed(pdv.getFloat(WIND_SPEED)); + fssr.setRefHour(TimeTools.roundToNearestHour(fssr.getTimeObs())); + // TODO: All comments should be cleaned up when Mesonet is implemented. + // fssr.setCeiling(pdv.getNumber(CLOUD_BASE_HEIGHT).floatValue()); + if (pdv.getFloat(DEWPOINT) != MISSING) { + fssr.setDewpoint(1.8f * (pdv.getFloat(DEWPOINT) - 273.15f) + 32.0f); + } + fssr.setRelativeHumidity(pdv.getFloat("relHumidity")); + if (pdv.getFloat(TEMPERATURE) != MISSING) { + fssr.setTemperature(1.8f * (pdv.getFloat(TEMPERATURE) - 273.15f) + 32.0f); + } + // fssr.setHighResWaveHeight(highResWaveHeight); + // fssr.setHorzVisibility(horzVisibility); + // fssr.setHourlyPrecip(pdv.getFloat(HOURLY_PRECIP)); + // fssr.setMaxWindSpeed(maxWindSpeed); + fssr.setMessageData(pdv.getString(RAW_MESSAGE)); + fssr.setPressChange3Hour(pdv.getFloat(PRESS_CHANGE3_HOUR)); + fssr.setPressChangeChar(String.valueOf(pdv.getInt(PRESS_CHANGE_CHAR))); + fssr.setPressureAltimeter(pdv.getFloat(ALTIMETER)); // in Pascal + // fssr.setPresWeather(pdv.getStringAllLevels(PRES_WEATHER)); + // fssr.setPrimarySwellWaveDir(primarySwellWaveDir); + // fssr.setPrimarySwellWaveHeight(primarySwellWaveHeight); + // fssr.setPrimarySwellWavePeriod(primarySwellWavePeriod); + if (pdv.getFloat(SEA_LEVEL_PRESSURE) != MISSING) { + fssr.setSeaLevelPress(pdv.getFloat(SEA_LEVEL_PRESSURE) / 100); + } + if (pdv.getFloat(SEA_SURFACE_TEMP) != MISSING) { + fssr.setSeaSurfaceTemp(1.8f * (pdv.getFloat(SEA_SURFACE_TEMP) - 273.15f) + 32.0f); + } + // fssr.setSecondarySwellWaveDir(secondarySwellWaveDir); + // fssr.setSecondarySwellWaveHeight(secondarySwellWaveHeight); + // fssr.setSecondarySwellWavePeriod(secondarySwellWavePeriod); + // fssr.setSkyCover(pdv.getStringAllLevels(SKY_COVER)); + // fssr.setTotCloudAmount(pdv.getInt(TOTAL_CLOUD_COVER)); + fssr.setVisibility(pdv.getFloat(VISIBILITY)); + fssr.setWaveHeight(pdv.getNumber(WAVE_HEIGHT).doubleValue()); + fssr.setWindDir(pdv.getFloat(WIND_DIR)); + fssr.setWindGust(pdv.getFloat(WIND_GUST)); + fssr.setWindSpeed(pdv.getFloat(WIND_SPEED)); - return fssr; - } + return fssr; + } - public static PointDataView buildView(FSSObsRecord record) { - pdc = PointDataContainer.build(fsspdd); - PointDataView pdv = pdc.append(); + public static PointDataView buildView(FSSObsRecord record) { + pdc = PointDataContainer.build(fsspdd); + PointDataView pdv = pdc.append(); - pdv.setFloat(CEILING, record.getCeiling()); - pdv.setFloat(DEWPOINT, record.getDewpoint()); - pdv.setFloat(DEWPOINT_DEPR, record.getDewpointDepr()); - pdv.setFloat(FROSTBITE_TIME, record.getFrostbiteTime()); - pdv.setFloat(HORIZONTAL_VIS, record.getHorzVisibility()); - pdv.setFloat(HOURLY_PRECIP, record.getHourlyPrecip()); - pdv.setFloat(MAX_WIND_SPEED, record.getMaxWindSpeed()); - pdv.setString(PLATFORM_ID, record.getPlatformId()); - String[] weatherCondition = record.getPresWeather(); - if (weatherCondition != null) { - for (int i = 0; i < weatherCondition.length; i++) { - if (weatherCondition[i] != null) { - pdv.setString(PRES_WEATHER, weatherCondition[i], i); - } - } - } - pdv.setFloat(PRESS_CHANGE3_HOUR, record.getPressChange3Hour()); - pdv.setString(PRESS_CHANGE_CHAR, record.getPressChangeChar()); - pdv.setFloat(PRESS_ALTIMETER, record.getPressureAltimeter()); - pdv.setFloat(PRI_SWELL_WV_DIR, record.getPrimarySwellWaveDir() - .floatValue()); - pdv.setFloat(PRI_SWELL_WV_HGT, record.getPrimarySwellWaveHeight() - .floatValue()); - pdv.setInt(PRI_SWELL_WV_PD, record.getPrimarySwellWavePeriod()); - pdv.setString(RAW_MESSAGE, record.getRawMessage()); - pdv.setFloat(REL_HUMIDITY, record.getRelativeHumidity()); - pdv.setFloat(SEA_LEVEL_PRESS, record.getSeaLevelPress()); - pdv.setFloat(SEA_SFC_TEMP, record.getSeaSurfaceTemp()); - pdv.setFloat(SEC_SWELL_WV_DIR, record.getSecondarySwellWaveDir() - .floatValue()); - pdv.setFloat(SEC_SWELL_WV_HGT, record.getSecondarySwellWaveHeight() - .floatValue()); - pdv.setInt(SEC_SWELL_WV_PD, record.getSecondarySwellWavePeriod()); - if (record.getSkyCover() != null) { - String[] skyList = record.getSkyCover(); - for (int i = 0; i < skyList.length; i++) { - if (skyList[i] != null) { - pdv.setString(SKY_COVER, skyList[i], i); - } - } - } - pdv.setFloat(SNOW_INC_HOURLY, record.getSnincrHourly()); - pdv.setFloat(SNOW_INC_TOTAL, record.getSnincrTotal()); - pdv.setFloat(SNOW_DEPTH, record.getSnowDepth()); - pdv.setString(STATION_NAME, record.getStnName()); - pdv.setFloat(TEMPERATURE, record.getTemperature()); - pdv.setLong(TIME_OBS, record.getTimeObs().getTimeInMillis()); - pdv.setLong(REF_HOUR, record.getRefHour().getTimeInMillis()); - pdv.setInt(CLOUD_AMOUNT_TOT, record.getTotCloudAmount()); - pdv.setFloat(VISIBILITY, record.getVisibility()); - pdv.setFloat(WV_HGT, record.getWaveHeight().floatValue()); - pdv.setInt(WV_PD, record.getWavePeriod()); - pdv.setFloat(WV_STEEPNESS, record.getWaveSteepness()); - pdv.setFloat(WIND_DIR, record.getWindDir()); - pdv.setFloat(WIND_SPEED, record.getWindSpeed()); - pdv.setFloat(WIND_GUST, record.getWindGust()); - pdv.setFloat(HI_RES_WV_HGT, record.getHighResWaveHeight()); + pdv.setFloat(CEILING, record.getCeiling()); + pdv.setFloat(DEWPOINT, record.getDewpoint()); + pdv.setFloat(DEWPOINT_DEPR, record.getDewpointDepr()); + pdv.setFloat(FROSTBITE_TIME, record.getFrostbiteTime()); + pdv.setFloat(HORIZONTAL_VIS, record.getHorzVisibility()); + pdv.setFloat(HOURLY_PRECIP, record.getHourlyPrecip()); + pdv.setFloat(MAX_WIND_SPEED, record.getMaxWindSpeed()); + pdv.setString(PLATFORM_ID, record.getPlatformId()); + String[] weatherCondition = record.getPresWeather(); + if (weatherCondition != null) { + for (int i = 0; i < weatherCondition.length; i++) { + if (weatherCondition[i] != null) { + pdv.setString(PRES_WEATHER, weatherCondition[i], i); + } + } + } + pdv.setFloat(PRESS_CHANGE3_HOUR, record.getPressChange3Hour()); + pdv.setString(PRESS_CHANGE_CHAR, record.getPressChangeChar()); + pdv.setFloat(PRESS_ALTIMETER, record.getPressureAltimeter()); + pdv.setFloat(PRI_SWELL_WV_DIR, record.getPrimarySwellWaveDir() + .floatValue()); + pdv.setFloat(PRI_SWELL_WV_HGT, record.getPrimarySwellWaveHeight() + .floatValue()); + pdv.setInt(PRI_SWELL_WV_PD, record.getPrimarySwellWavePeriod()); + pdv.setString(RAW_MESSAGE, record.getRawMessage()); + pdv.setFloat(REL_HUMIDITY, record.getRelativeHumidity()); + pdv.setFloat(SEA_LEVEL_PRESS, record.getSeaLevelPress()); + pdv.setFloat(SEA_SFC_TEMP, record.getSeaSurfaceTemp()); + pdv.setFloat(SEC_SWELL_WV_DIR, record.getSecondarySwellWaveDir() + .floatValue()); + pdv.setFloat(SEC_SWELL_WV_HGT, record.getSecondarySwellWaveHeight() + .floatValue()); + pdv.setInt(SEC_SWELL_WV_PD, record.getSecondarySwellWavePeriod()); + if (record.getSkyCover() != null) { + String[] skyList = record.getSkyCover(); + for (int i = 0; i < skyList.length; i++) { + if (skyList[i] != null) { + pdv.setString(SKY_COVER, skyList[i], i); + } + } + } + pdv.setFloat(SNOW_INC_HOURLY, record.getSnincrHourly()); + pdv.setFloat(SNOW_INC_TOTAL, record.getSnincrTotal()); + pdv.setFloat(SNOW_DEPTH, record.getSnowDepth()); + pdv.setString(STATION_NAME, record.getStnName()); + pdv.setFloat(TEMPERATURE, record.getTemperature()); + pdv.setLong(TIME_OBS, record.getTimeObs().getTimeInMillis()); + pdv.setLong(REF_HOUR, record.getRefHour().getTimeInMillis()); + pdv.setInt(CLOUD_AMOUNT_TOT, record.getTotCloudAmount()); + pdv.setFloat(VISIBILITY, record.getVisibility()); + pdv.setFloat(WV_HGT, record.getWaveHeight().floatValue()); + pdv.setInt(WV_PD, record.getWavePeriod()); + pdv.setFloat(WV_STEEPNESS, record.getWaveSteepness()); + pdv.setFloat(WIND_DIR, record.getWindDir()); + pdv.setFloat(WIND_SPEED, record.getWindSpeed()); + pdv.setFloat(WIND_GUST, record.getWindGust()); + pdv.setFloat(HI_RES_WV_HGT, record.getHighResWaveHeight()); - // pdv.setLong(TIME_NOMINAL, record.getRefHour().getTimeInMillis()); + // pdv.setLong(TIME_NOMINAL, record.getRefHour().getTimeInMillis()); - record.setPointDataView(pdv); - return pdv; - } + record.setPointDataView(pdv); + return pdv; + } - /** - * @param pdc - * the pdc to set - */ - public void setPdc(PointDataContainer pdc) { + /** + * @param pdc + * the pdc to set + */ + public void setPdc(PointDataContainer pdc) { FSSObsDataTransform.pdc = pdc; - } + } - /** - * @return the pdc - */ - public PointDataContainer getPdc() { - return pdc; - } + /** + * @return the pdc + */ + public PointDataContainer getPdc() { + return pdc; + } } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java index 1097c03a3d..90c3ec5ac3 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java @@ -20,14 +20,21 @@ package com.raytheon.uf.edex.plugin.fssobs; +import java.util.ArrayList; import java.util.HashSet; +import java.util.List; +import java.util.Set; import com.raytheon.edex.site.SiteUtil; import com.raytheon.edex.urifilter.URIFilter; 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.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.MonName; +import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.events.MonitorConfigEvent; import com.raytheon.uf.common.monitor.events.MonitorConfigListener; 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.dat.utils.DatMenuUtil; import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig; +import com.vividsolutions.jts.geom.Coordinate; /** * Generates a FSSObs Record. @@ -51,6 +59,7 @@ import com.raytheon.uf.edex.plugin.fssobs.common.FSSObsConfig; * May 23, 2014 3086 skorolev Cleaned code. * Aug 18, 2014 3530 bclement removed constructDataURI() call * Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one. + * Sep 18, 2015 3873 skorolev Added moving platforms testing. * * * @@ -69,10 +78,14 @@ public class FSSObsGenerator extends CompositeProductGenerator implements /** Product */ private static final String productType = "fssobs"; - /** Sets of all stations to filter for */ - private HashSet allStations = null; + /** Stations to filter */ + private Set allStations = new HashSet(); - private FSSObsMonitorConfigurationManager currManager = null; + public FSSObsMonitorConfigurationManager fogmcm = null; + + public FSSObsMonitorConfigurationManager ssmcm = null; + + public FSSObsMonitorConfigurationManager snowmcm = null; /** * Public construction @@ -92,29 +105,84 @@ public class FSSObsGenerator extends CompositeProductGenerator implements public void generateProduct(URIGenerateMessage genMessage) { FSSObsConfig fss_config = null; + boolean isStationary = true; try { fss_config = new FSSObsConfig(genMessage, this); this.setPluginDao(new FSSObsDAO(productType)); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } - FSSObsRecord[] fssRecs = new FSSObsRecord[genMessage.getUris().length]; - int i = 0; + List fssRecs = new ArrayList(); 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(); + fssObsRec.setIsStationary(isStationary); fssObsRec = fss_config.getTableRow(uri); FSSObsDataTransform.buildView(fssObsRec); - fssRecs[i] = fssObsRec; - i++; + fssRecs.add(fssObsRec); } - if (fssRecs.length > 0) { - this.setPluginDataObjects(fssRecs); + if (!fssRecs.isEmpty()) { + this.setPluginDataObjects((PluginDataObject[]) fssRecs + .toArray(new PluginDataObject[fssRecs.size()])); 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 marineZone = new HashSet(); + 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) * @@ -125,7 +193,6 @@ public class FSSObsGenerator extends CompositeProductGenerator implements protected void createFilters() { filters = new URIFilter[1]; filters[0] = new FSSObsURIFilter(genName, allStations); - allStations = null; } /* @@ -138,14 +205,9 @@ public class FSSObsGenerator extends CompositeProductGenerator implements protected void configureFilters() { statusHandler.handle(Priority.INFO, getGeneratorName() + " process Filter Config..."); - allStations = new HashSet(); - - for (MonName mname : MonName.values()) { - currManager = new FSSObsMonitorConfigurationManager(mname.name()); - currManager.addListener(this); - allStations.addAll(currManager.getStations()); - currManager = null; - } + allStations.addAll(getFogConfig().getStations()); + allStations.addAll(getSSConfig().getStations()); + allStations.addAll(getSnowConfig().getStations()); } /** @@ -187,4 +249,79 @@ public class FSSObsGenerator extends CompositeProductGenerator implements 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; + } + } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java index d8625acb0b..41cd554ee6 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java @@ -3,12 +3,15 @@ package com.raytheon.uf.edex.plugin.fssobs; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; +import java.util.Set; import java.util.TimeZone; import java.util.regex.Pattern; import com.raytheon.edex.urifilter.URIFilter; 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; /** @@ -23,6 +26,7 @@ import com.vividsolutions.jts.geom.Coordinate; * Dec 5, 2012 #1351 skorolev Cleaned code * Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin * Sep 04, 2014 3220 skorolev Removed CWA from filter. + * Sep 17, 2015 3873 skorolev Added pattern for moving platforms. * * * @@ -30,6 +34,8 @@ import com.vividsolutions.jts.geom.Coordinate; * @version 1.0 */ public class FSSObsURIFilter extends URIFilter { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(URIFilter.class); /** Station ID **/ private String stn; @@ -41,28 +47,26 @@ public class FSSObsURIFilter extends URIFilter { private HashMap patternKeys = null; /** METAR Pattern **/ - private Pattern MetarPattern = null; + private Pattern metarPattern = null; /** Maritime Pattern **/ - private Pattern MaritimePattern = null; + private Pattern maritimePattern = null; /** 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 **/ private String dataType; /** All filtered stations */ - private HashSet stations = null; + private Set stations = null; /** Date format **/ private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S"; - /** Station type **/ - private enum StnType { - METAR, MARITIME, MESONET - }; - /** * Constructor * @@ -72,7 +76,7 @@ public class FSSObsURIFilter extends URIFilter { * @param stations * for FSSObs filter */ - public FSSObsURIFilter(String name, HashSet stations) { + public FSSObsURIFilter(String name, Set stations) { super(name); logger.info("FSSObsFilter " + name + " Filter construction..."); setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" }); @@ -96,19 +100,30 @@ public class FSSObsURIFilter extends URIFilter { String[] tokens = pat.split(st); setStn(tokens[0]); setDataType(tokens[1]); - if (getDataType().equals(StnType.METAR.name())) { + switch (getDataType()) { + case ObConst.METAR: setMetarPattern(); getMatchURIs().put(getMetarPattern(), 0l); - } - if (getDataType().equals(StnType.MARITIME.name())) { + break; + case ObConst.MARITIME: setMaritimePattern(); getMatchURIs().put(getMaritimePattern(), 0l); - } - if (getDataType().equals(StnType.MESONET.name())) { + break; + case ObConst.MESONET: setMesowestPattern(); 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 null; } @@ -265,7 +279,7 @@ public class FSSObsURIFilter extends URIFilter { * @return MetarPattern */ public Pattern getMetarPattern() { - return MetarPattern; + return metarPattern; } /** @@ -273,7 +287,7 @@ public class FSSObsURIFilter extends URIFilter { */ public void setMetarPattern() { // "/obs/2010-11-01_14:15:00.0/METAR/null/K0A9/36.371/-82.173" - MetarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator + metarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator + wildCard + uriSeperator + "null" + uriSeperator + getStn() + uriSeperator); } @@ -284,15 +298,15 @@ public class FSSObsURIFilter extends URIFilter { * @return MaritimePattern */ public Pattern getMaritimePattern() { - return MaritimePattern; + return maritimePattern; } /** * Sets Maritime Pattern */ public void setMaritimePattern() { - // /sfcobs/2010-10-28_10:36:00.0/1004/null/BEPB6/32.373/-64.703 - MaritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator + // /sfcobs/2010-10-28_10:36:00.0/1004[5]/null/BEPB6/32.373/-64.703 + maritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator + wildCard + uriSeperator + "null" + uriSeperator + getStn() + uriSeperator); } @@ -303,7 +317,7 @@ public class FSSObsURIFilter extends URIFilter { * @return the mesowestPattern */ public Pattern getMesowestPattern() { - return MesowestPattern; + return mesowestPattern; } /** @@ -313,12 +327,34 @@ public class FSSObsURIFilter extends URIFilter { * the mesowestPattern to set */ 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 - MesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard + mesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard + uriSeperator + wildCard + uriSeperator + wildCard + 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 * diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java index e8dc607dfc..fed9f5ccd6 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java @@ -19,16 +19,25 @@ **/ package com.raytheon.uf.edex.plugin.fssobs; +import gov.noaa.nws.ncep.edex.common.metparameters.Amount; +import gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion.PRLibrary; +import gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion.PRLibrary.InvalidValueException; + import java.util.Map; import java.util.Map.Entry; 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.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.geospatial.ISpatialQuery; import com.raytheon.uf.common.geospatial.SpatialQueryFactory; +import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -36,7 +45,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.edex.pointdata.PointDataQuery; /** - * Get METAR and Maritime data records + * Utilities for FSSObs data records. * *
  * 
@@ -52,6 +61,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
  * Jan 06, 2014 2653       skorolev    Corrected decoding of snincrHourly and snincrTotal.
  * Apr 28, 2014 3086       skorolev    Updated getStations method.
  * Sep 04, 2014 3220       skorolev    Removed getStations method.
+ * Sep 18, 2015 3873       skorolev    Removed identical constant definitions.
  * 
  * 
* @@ -63,23 +73,32 @@ public class FSSObsUtils { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(FSSObsUtils.class); - /** Centigrade -> Kelvin */ - public static final float TMCK = 273.15f; + /** FAHRENHEIT -> CELSIUS */ + private static final UnitConverter fToC = NonSI.FAHRENHEIT + .getConverterTo(SI.CELSIUS); - /** - * Value of missed data. - */ - public static final float MISSING = -9999.0f; + /** CELSIUS --> KELVIN */ + private static final UnitConverter cToK = SI.CELSIUS + .getConverterTo(SI.KELVIN); - /** - * The constant representing the sky condition for sky clear - */ - private static final int SKC_SKY_CONDITION = 9999999; + /** Knots --> kilometers per hour */ + private static final UnitConverter knotToKph = NonSI.KNOT + .getConverterTo(NonSI.KILOMETERS_PER_HOUR); - /** - * The constant representing the sky condition for clear sky - */ - private static final int CLR_SKY_CONDITION = 8888888; + private static final float defaultCeiling = 1e20f; + + // ----------- Constants required for Frostbite time calculation.--------- + + // 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; /** Plug-in name **/ private enum Plgn { @@ -95,8 +114,14 @@ public class FSSObsUtils { /** Database **/ private static String db = "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 = '"; + /** + * 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; + */ + private static String sqlexp = "select name from common_obs_spatial where ( catalogtype=1 or catalogtype=30 or catalogtype=31 or catalogtype=32 or catalogtype = 33 or catalogtype = 1000 or catalogtype = 1001) and stationid = '"; /** * Constructor @@ -133,7 +158,7 @@ public class FSSObsUtils { } /** - * Gets station name from database. + * Gets descriptive station name from database. * * @param stnId * @return station name @@ -147,7 +172,8 @@ public class FSSObsUtils { Object[] results = sq.dbRequest(sql, db); retVal = (String) results[0]; } catch (Exception e) { - statusHandler.handle(Priority.ERROR, e.getMessage()); + statusHandler.handle(Priority.ERROR, + "Could not to get a station name: " + e.getMessage()); } return retVal; } @@ -228,18 +254,18 @@ public class FSSObsUtils { * @return -- time in minutes */ 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 // error (a negative number to -1.668 power is NAN) - if (temperatureC < -4.8) - fbMinutes = ((-24.5f * ((0.667f * windspeedKPH) + 4.8f)) + 2111f) - * (float) Math.pow((-4.8 - temperatureC), -1.668); + if (temperatureC < frostbiteTempMax) + fbMinutes = ((f1 * ((f2 * windspeedKPH) + frostbiteTempMax)) + f3) + * (float) Math.pow((frostbiteTempMax - temperatureC), f4); else - return MISSING; + return ObConst.MISSING; // Check for frost bite boundaries if (!(fbMinutes <= 30 && windspeedKPH > 25.0 && windspeedKPH <= 80.5)) - fbMinutes = MISSING; + fbMinutes = ObConst.MISSING; return fbMinutes; } @@ -253,29 +279,27 @@ public class FSSObsUtils { * @return -- wind chill in degrees Celsius */ public static float calcWindChill(float temp, float windSpd) { - float spd; - /* arbitrarily do the calculation only for temps at or below 60F */ - if (temp > 16.) - return 1e37f; - /* no chilling if speed < 4 mph = 6.44km/h */ - if (windSpd < 6.4) - return temp; - /* peg speed at 80 mph (= 128.75 km/h) */ - if (windSpd > 128.75) - spd = 128.75f; - else - spd = windSpd; - spd = (float) Math.pow(spd, 0.16); - float windChillTemp = 13.12f + 0.6215f * temp - 11.37f * spd + 0.3965f - * temp * spd; - return windChillTemp; + float retVal = ObConst.MISSING; + Amount t = new Amount(temp, SI.CELSIUS); + Amount s = new Amount(windSpd, NonSI.KNOT); + try { + Amount wcht = PRLibrary.prWcht(t, s); + retVal = (float) wcht.doubleValue(); + } catch (NullPointerException | InvalidValueException e) { + statusHandler.handle( + Priority.PROBLEM, + "Could not get a WindChill temperature: " + + e.getLocalizedMessage(), e); + } + return retVal; } /** * This method calculates a floating point number representing the ceiling. * 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 - * condition, and returns that layer. + * condition, and returns that + * layer(http://www.srh.noaa.gov/srh/dad/sfc/chapter5.pdf). * * @param skyCov * -- the set of sky coverage data @@ -283,29 +307,29 @@ public class FSSObsUtils { */ public static float findMetarCeilingFromLayers(String[] skyCov, Number[] levels) { - float ceiling = 1e20f; - // Find a ceiling in a METAR report. - try { - for (int i = 0; i < skyCov.length; i++) { - String sc = skyCov[i]; - // SCT ??? - if (sc.equals("CLR")) { - ceiling = CLR_SKY_CONDITION; - break; - } else if (sc.equals("SKC")) { - ceiling = SKC_SKY_CONDITION; - break; - } else if ((sc.equals("BKN")) || (sc.equals("OVC"))) { - if (levels[i] != null) { - ceiling = levels[i].floatValue() / 100f; - break; - } + float ceiling = defaultCeiling; + for (int i = 0; i < skyCov.length; i++) { + String sc = skyCov[i]; + // SCT = scattered ??? + switch (sc) { + case "CLR": + ceiling = ObConst.CLR_SKY_CONDITION; + break; + case "SKC": + ceiling = ObConst.SKC_SKY_CONDITION; + break; + case "BKN": + case "OVC": + if (levels[i] != null) { + ceiling = levels[i].floatValue() / 100f; } + break; + default: + statusHandler.error("Get unkown sky cover " + sc); + break; } - } catch (RuntimeException e) { - // ignore cloud cover that is null } - return ceiling >= 1e20f ? MISSING : ceiling; + return ceiling >= defaultCeiling ? ObConst.MISSING : ceiling; } /** @@ -319,20 +343,18 @@ public class FSSObsUtils { * @return -- calculated Relative Humidity in % */ public static Float getRH(float dewpoint, float temperature) { - float retVal = MISSING; - // From http://www.hpc.ncep.noaa.gov/html/dewrh.shtml - // to Celsius - if (dewpoint != MISSING && temperature != MISSING) { - float temp = (100f / (212f - 32f)) * (temperature - 32f); - float dwpt = (100f / (212f - 32f)) * (dewpoint - 32f); - // 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; + float retVal = ObConst.MISSING; + Amount t = new Amount(fToC.convert(temperature), SI.CELSIUS); + Amount d = new Amount(fToC.convert(dewpoint), SI.CELSIUS); + Amount rh; + try { + rh = PRLibrary.prRelh(t, d); + retVal = (float) rh.doubleValue(); + } catch (NullPointerException | InvalidValueException e) { + statusHandler.handle( + Priority.PROBLEM, + "Error to get Relative Humidity: " + + e.getLocalizedMessage(), e); } return retVal; } @@ -351,7 +373,7 @@ public class FSSObsUtils { // is set at 40F and wind speed between 14 and 43 knts) : float[] retVal = new float[5]; for (int i = 0; i < 5; i++) { - retVal[i] = MISSING; + retVal[i] = ObConst.MISSING; } float temp = tableRow.getTemperature(); float windspd = tableRow.getWindSpeed(); @@ -381,36 +403,13 @@ public class FSSObsUtils { } } sc.close(); - if ((temp != MISSING) && (temp < 4.4f) - // 277.6 K = 40 F = 4.44444 C - && (windspd != MISSING) - && (windspd <= 43.0f && windspd >= 14.0f)) { - float speedKPH = windspd * 1.6f; + if (temp != ObConst.MISSING && windspd != ObConst.MISSING) { + float speedKPH = (float) knotToKph.convert(windspd); // in Kelvin - retVal[3] = calcWindChill(temp, speedKPH) + TMCK; + retVal[3] = (float) cToK.convert(calcWindChill( + (float) fToC.convert(temp), speedKPH)); // in minutes - retVal[4] = calcFrostbiteTime(speedKPH, 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)); + retVal[4] = calcFrostbiteTime(speedKPH, (float) fToC.convert(temp)); } return retVal; } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java index 9d03a99073..c042040998 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/common/FSSObsConfig.java @@ -25,6 +25,7 @@ import org.apache.commons.logging.LogFactory; import com.raytheon.edex.urifilter.URIGenerateMessage; import com.raytheon.uf.common.dataplugin.PluginException; 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.UFStatus; 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 * Aug 30, 2013 2298 rjpeter Make getPluginName abstract * Sep 04, 2014 3220 skorolev Removed cwa and monitorUse from data set. + * Sep 18, 2015 3873 skorolev Removed identical constant definitions. * * * @@ -106,19 +108,19 @@ public class FSSObsConfig { e); } } - if (tableRow.getRelativeHumidity() == FSSObsUtils.MISSING) { + if (tableRow.getRelativeHumidity() == ObConst.MISSING) { Float RH = FSSObsUtils.getRH(tableRow.getDewpoint(), tableRow.getTemperature()); tableRow.setRelativeHumidity(RH); } float[] snowData = FSSObsUtils.getSnowData(tableRow); - if ((tableRow.getTemperature() != FSSObsUtils.MISSING) - && (tableRow.getDewpoint() != FSSObsUtils.MISSING)) { + if ((tableRow.getTemperature() != ObConst.MISSING) + && (tableRow.getDewpoint() != ObConst.MISSING)) { // TODO to check if this is correct. calcdpd() in Meteolib tableRow.setDewpointDepr(tableRow.getTemperature() - tableRow.getDewpoint()); } else { - tableRow.setDewpointDepr(FSSObsUtils.MISSING); + tableRow.setDewpointDepr(ObConst.MISSING); } tableRow.setSnincrHourly(snowData[0]); tableRow.setSnincrTotal(snowData[1]); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java index a4c4376018..deeff2bcc5 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java @@ -56,6 +56,7 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy; * Mar 06, 2014 2876 mpduff New NDM plugin. * Apr 28, 2014 3086 skorolev Updated setupLocalFiles method * Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers. + * Sep 18, 2015 3873 skorolev Corrected monitor's names. * * * @@ -128,12 +129,10 @@ public class LocationTablesIngest implements INationalDatasetSubscriber { private void setupLocalFiles() { List monitors = new ArrayList(); - monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog - .name())); - monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss - .name())); - monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.snow - .name())); + monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog)); + monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss)); + monitors.add(FSSObsMonitorConfigurationManager + .getInstance(MonName.snow)); } /** From 3529f049acd154f9cd2a2f0e4f896a2fa1420c08 Mon Sep 17 00:00:00 2001 From: Slav Korolev Date: Fri, 2 Oct 2015 10:31:36 -0400 Subject: [PATCH 10/14] Omaha #3873 - Fixed FSSObs monitors to ingest Moving Maritime and MAROBS data. Former-commit-id: 54db6e02ded719a69ee47d91bb17023d1c571f20 --- .../META-INF/MANIFEST.MF | 3 +- .../uf/edex/plugin/fssobs/FSSObsUtils.java | 139 ++++++++++-------- 2 files changed, 80 insertions(+), 62 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF index 20e4fa8b2d..748b1413da 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/META-INF/MANIFEST.MF @@ -18,12 +18,11 @@ Import-Package: com.raytheon.uf.common.monitor.config, com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata.spatial, com.raytheon.uf.common.status, + com.raytheon.uf.common.wxmath, com.raytheon.uf.edex.dat.utils, com.raytheon.uf.edex.menus, com.raytheon.uf.edex.plugin.fssobs, com.raytheon.uf.edex.pointdata, - gov.noaa.nws.ncep.edex.common.metparameters, - gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion, javax.measure.converter, javax.measure.unit, org.apache.commons.logging diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java index fed9f5ccd6..30307da149 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java @@ -19,10 +19,7 @@ **/ package com.raytheon.uf.edex.plugin.fssobs; -import gov.noaa.nws.ncep.edex.common.metparameters.Amount; -import gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion.PRLibrary; -import gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion.PRLibrary.InvalidValueException; - +import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; @@ -35,13 +32,14 @@ import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.geospatial.ISpatialQuery; -import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.pointdata.PointDataContainer; 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.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; /** @@ -87,7 +85,7 @@ public class FSSObsUtils { private static final float defaultCeiling = 1e20f; - // ----------- Constants required for Frostbite time calculation.--------- + // ----------- Constants required for Frostbite time calculation.---------: // Temperature must be lower than -4.8C (23F) to avoid a calculation error private static final float frostbiteTempMax = -4.8f; @@ -100,28 +98,43 @@ public class FSSObsUtils { private static final float f4 = -1.668f; - /** Plug-in name **/ - private enum Plgn { - obs, sfcobs, ldadmesonet - }; + // ----------- 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 **/ - private static String slct = "dataURI"; + private static final String SLCT = "dataURI"; /** Equal sign **/ - private static String equ = "="; + private static final String EQU = "="; /** Database **/ - private static String db = "metadata"; - - /** - * 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; - */ - private static String sqlexp = "select name from common_obs_spatial where ( catalogtype=1 or catalogtype=30 or catalogtype=31 or catalogtype=32 or catalogtype = 33 or catalogtype = 1000 or catalogtype = 1001) and stationid = '"; + private static final String METADATA = "metadata"; /** * Constructor @@ -143,9 +156,9 @@ public class FSSObsUtils { PointDataQuery request = null; PointDataContainer result = null; try { - request = new PointDataQuery(Plgn.obs.toString()); + request = new PointDataQuery(OBS); request.requestAllLevels(); - request.addParameter(slct, uri, equ); + request.addParameter(SLCT, uri, EQU); request.setParameters(FSSObsDataTransform.OBS_PARAMS_LIST); result = request.execute(); if (result != null) { @@ -164,12 +177,22 @@ public class FSSObsUtils { * @return station name */ public static String getStationName(String stnId) { + CoreDao dao = null; + dao = new CoreDao(DaoConfig.forDatabase(METADATA)); 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 { - sq = SpatialQueryFactory.create(); - Object[] results = sq.dbRequest(sql, db); + Map paramMap = new HashMap<>(1, 1); + paramMap.put("stationid", stnId); + Object[] results = dao.executeSQLQuery(sql, paramMap); retVal = (String) results[0]; } catch (Exception e) { statusHandler.handle(Priority.ERROR, @@ -191,8 +214,8 @@ public class FSSObsUtils { PointDataQuery request = null; PointDataContainer result = null; try { - request = new PointDataQuery(Plgn.sfcobs.toString()); - request.addParameter(slct, uri, equ); + request = new PointDataQuery(SFCOBS); + request.addParameter(SLCT, uri, EQU); request.setParameters(FSSObsDataTransform.SFCOBS_PARAMS_LIST); result = request.execute(); if (result != null) { @@ -221,9 +244,10 @@ public class FSSObsUtils { try { Map rcMap = RequestConstraint .toConstraintMapping(DataURIUtil.createDataURIMap(uri)); - // Not actually in db + // TODO: There is no uri field in ldadmesonet table. Should be + // corrected. URIs are required to generate CompositeProduct. rcMap.remove("pluginName"); - request = new PointDataQuery(Plgn.ldadmesonet.toString()); + request = new PointDataQuery(LDADMESONET); for (Entry entry : rcMap.entrySet()) { RequestConstraint rc = entry.getValue(); String value = rc.getConstraintValue(); @@ -235,7 +259,6 @@ public class FSSObsUtils { if (result != null) { recFromMesowest = FSSObsDataTransform .fromLdadmesowestRecord(result); - } } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); @@ -279,19 +302,21 @@ public class FSSObsUtils { * @return -- wind chill in degrees Celsius */ public static float calcWindChill(float temp, float windSpd) { - float retVal = ObConst.MISSING; - Amount t = new Amount(temp, SI.CELSIUS); - Amount s = new Amount(windSpd, NonSI.KNOT); - try { - Amount wcht = PRLibrary.prWcht(t, s); - retVal = (float) wcht.doubleValue(); - } catch (NullPointerException | InvalidValueException e) { - statusHandler.handle( - Priority.PROBLEM, - "Could not get a WindChill temperature: " - + e.getLocalizedMessage(), e); - } - return retVal; + float spd; + /* arbitrarily do the calculation only for temps at or below 60F */ + if (temp > wctMax) + return defaultWct; + /* no chilling if speed < 4 mph = 6.44km/h */ + if (windSpd < windSpdMin) + return temp; + /* peg speed at 80 mph (= 128.75 km/h) */ + if (windSpd > windSpdMax) + spd = 128.75f; + else + spd = windSpd; + spd = (float) Math.pow(spd, wc1); + float windChillTemp = wc2 + wc3 * temp - wc4 * spd + wc5 * temp * spd; + return windChillTemp; } /** @@ -337,24 +362,18 @@ public class FSSObsUtils { * Fahrenheit. * * @param dewpoint - * in F + * in Farenheit * @param temperature - * in F + * in Farenheit * @return -- calculated Relative Humidity in % */ public static Float getRH(float dewpoint, float temperature) { float retVal = ObConst.MISSING; - Amount t = new Amount(fToC.convert(temperature), SI.CELSIUS); - Amount d = new Amount(fToC.convert(dewpoint), SI.CELSIUS); - Amount rh; - try { - rh = PRLibrary.prRelh(t, d); - retVal = (float) rh.doubleValue(); - } catch (NullPointerException | InvalidValueException e) { - statusHandler.handle( - Priority.PROBLEM, - "Error to get Relative Humidity: " - + e.getLocalizedMessage(), e); + if (dewpoint != ObConst.MISSING && temperature != ObConst.MISSING) { + // convert to Celsius: + float temp = (float) fToC.convert(temperature); + float dwpt = (float) fToC.convert(dewpoint); + retVal = CalcRH.calcrh(temp, dwpt); } return retVal; } From 2562ae5473ed68072931a51eddbc45f022c306cc Mon Sep 17 00:00:00 2001 From: Slav Korolev Date: Wed, 7 Oct 2015 11:26:19 -0400 Subject: [PATCH 11/14] Omaha #3873 - Fixed FSSObs monitors to ingest Moving Maritime and MAROBS data. Former-commit-id: 99dc9a9a08623804e7511d57f0ad140bee7acb5c --- .../src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java index 30307da149..30a9f0d7ae 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java @@ -244,8 +244,6 @@ public class FSSObsUtils { try { Map rcMap = RequestConstraint .toConstraintMapping(DataURIUtil.createDataURIMap(uri)); - // TODO: There is no uri field in ldadmesonet table. Should be - // corrected. URIs are required to generate CompositeProduct. rcMap.remove("pluginName"); request = new PointDataQuery(LDADMESONET); for (Entry entry : rcMap.entrySet()) { From 75ef14640b9a3e41ce4ce03551fb4f8f575f479f Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Thu, 8 Oct 2015 14:35:20 -0500 Subject: [PATCH 12/14] Omaha #4958: Add support for viewing raw NationalBlend model data to GFE. Change-Id: I1e8f43459cf0582fdd40aecb64ea98c9986611fb Former-commit-id: 1856ec86534f5ab6a3be8a0ac8bdd11da5efff20 --- .../base/grid/dataset/alias/gfeParamInfo.xml | 1 + .../base/parameter/alias/gfeParamName.xml | 2 + .../base/config/gfe/serverConfig.py | 5 +- .../base/grid/parameterInfo/NationalBlend.xml | 220 ++++++++++++++++++ .../patch/etc/pqact.conf.template | 5 + 5 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/NationalBlend.xml diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml index f342a011d8..f48b3dd092 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/grid/dataset/alias/gfeParamInfo.xml @@ -230,4 +230,5 @@ RFCFFG_ParameterInfo RFCFFG_ParameterInfo RFCFFG_ParameterInfo + NationalBlend diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml index b4b8b57c26..da469c45d3 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/parameter/alias/gfeParamName.xml @@ -11,8 +11,10 @@ Feb 24, 2015 DR 16671 byin Added HPBL for RUC13 May 21, 2015 DR 17515 bhunder Added parameters for URMA25 Jun 29, 2015 #4537 rferrel Added parameters for HRRR. + Oct 08, 2015 #4958 dgilling Added parameters for NationalBlend. --> + aptmp av cape cfrzr diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py index d44aa41c00..44fd5f1705 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py @@ -67,7 +67,8 @@ # 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 #17144 bhunder Added weather Params for URMA25 and OCONUS RTMA +# 05/29/2015 #17144 bhunder Added weather Params for URMA25 and OCONUS RTMA +# 10/07/2015 #4958 dgilling Added support for NationalBlend D2D data. #################################################################################################### #---------------------------------------------------------------------------- @@ -1351,6 +1352,7 @@ elif SID in CONUS_EAST_SITES: ('FFG-TAR', 'FFGTAR'), ('FFG-TIR', 'FFGTIR'), ('FFG-TUA', 'FFGTUA'), + 'NationalBlend', ] else: #######DCS3501 WEST_CONUS @@ -1430,6 +1432,7 @@ else: #######DCS3501 WEST_CONUS ('FFG-TAR', 'FFGTAR'), ('FFG-TIR', 'FFGTIR'), ('FFG-TUA', 'FFGTUA'), + 'NationalBlend', ] if SID in GreatLake_SITES: diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/NationalBlend.xml b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/NationalBlend.xml new file mode 100644 index 0000000000..e10ebcdfc1 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/grid/parameterInfo/NationalBlend.xml @@ -0,0 +1,220 @@ + + + + 0 + 10800 + 21600 + 32400 + 43200 + 54000 + 64800 + 75600 + 86400 + 97200 + 108000 + 118800 + 129600 + 140400 + 151200 + 162000 + 172800 + 183600 + 194400 + 205200 + 216000 + 226800 + 237600 + 248400 + 259200 + 270000 + 280800 + 291600 + 302400 + 313200 + 324000 + 334800 + 345600 + 356400 + 367200 + 378000 + 388800 + 399600 + 410400 + 421200 + 432000 + 442800 + 453600 + 464400 + 475200 + 486000 + 496800 + 507600 + 518400 + 529200 + 540000 + 550800 + 561600 + 572400 + 583200 + 594000 + 604800 + 615600 + 626400 + 637200 + 648000 + 658800 + 669600 + 680400 + 691200 + + + t + temperature + K + degree_Kelvin + T + 180.0 + 330.0 + -999999.0 + 1 + 2 FHAG + + FHAG2 + + + + dpt + Dewpoint Temperature + K + degree_Kelvin + Td + 180.0 + 330.0 + -999999.0 + 1 + FHAG 2 + + FHAG2 + + + + mnt12hr + Minimum Temperature + K + degree_Kelvin + minT + 180.0 + 330.0 + -999999.0 + 1 + FHAG 2 + + FHAG2 + + + + mxt12hr + Maximum Temperature + K + degree_Kelvin + maxT + 180.0 + 330.0 + -999999.0 + 1 + FHAG 2 + + FHAG2 + + + + pop + Probability of 12hr precip + % + percent + 12hrPcpProb + 0.0 + 100.0 + -999999.0 + 0 + SFC + + SFC + + + + tcc + Total Cloud Cover + % + percent + totalCldCvr + 0.0 + 100.0 + -999999.0 + 0 + SFC + + SFC + + + + ws + Wind Speed + m/s + meter/sec + windSpeed + -150.0 + 150.0 + -999999.0 + 1 + FHAG 10 + + FHAG10 + + + + wd + Wind Direction + degreeTrue + degree_True + windDir + 0.0 + 360.0 + -999999.0 + 1 + FHAG 10 + + FHAG10 + + + + rh + Relative Humidity + % + percent + rh + 0.0 + 100.0 + -999999.0 + 1 + FHAG 2 + + FHAG2 + + + + aptmp + Apparent Temperature + K + degree_Kelvin + aptmp + 180.0 + 330.0 + -999999.0 + 1 + 2 FHAG + + FHAG2 + + + diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template index 1bd2fbbd8b..8a5011fd8d 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template +++ b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template @@ -41,6 +41,7 @@ #20150202 4066 rferrel Add pattern form Earth Networks Total Lightning: SFPA42 #20150507 4434 skorolev Add pattern for GFS20 #20150820 DR 17915 mporricelli Add pattern for GFS229 (1 deg GFS) +#20151008 4958 dgilling Add pattern for NationalBlend #*************************************************************** # AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw # PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001 @@ -846,3 +847,7 @@ ANY ^(NWUS64) KWNS (..)(..)(..) EXP (.*wcl_decrypted.*) 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 From 2c33406500ecf3508ff8cba7e6c316ababda09b5 Mon Sep 17 00:00:00 2001 From: Ron Anderson Date: Mon, 12 Oct 2015 17:57:59 -0500 Subject: [PATCH 13/14] Omaha #4967 Fix a missed __numpy__ instance Change-Id: I1cffb3479c963e62d7e5e3fedac69341f1d0e718 Former-commit-id: 12e92bcf4d828cbd449f8255a29cc2da79c0c836 --- .../utility/common_static/base/python/gfe/JSmartUtils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/python/gfe/JSmartUtils.py b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/python/gfe/JSmartUtils.py index 0272c6b0fe..a34fcea878 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/python/gfe/JSmartUtils.py +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/utility/common_static/base/python/gfe/JSmartUtils.py @@ -27,8 +27,8 @@ # # 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 +# 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): editPointsX, editPointsY = __getMaskIndiciesForJava(fillMask) borderPointsX, borderPointsY = __getMaskIndiciesForJava(borderMask) @@ -74,7 +76,7 @@ def fillEditArea(grid, fillMask, borderMask): gridObj = JavaSmartUtils.fillEditArea(grid, grid.shape[1], grid.shape[0], \ editPointsY, editPointsX, borderPointsY, borderPointsX) - retObj = gridObj.__numpy__[0] + retObj = gridObj.getNDArray() return retObj From d47ee99ee2dc342227e878c91ab38986f8c37e94 Mon Sep 17 00:00:00 2001 From: Slav Korolev Date: Fri, 9 Oct 2015 15:04:11 -0400 Subject: [PATCH 14/14] Omaha #3873 - Fixed FSSObs monitors to ingest Moving Maritime and MAROBS data. Former-commit-id: e2a71ae3bfe31c1abbd286b50132d15ac04e996f --- .../com/raytheon/uf/viz/monitor/fog/FogMonitor.java | 1 - .../raytheon/uf/viz/monitor/snow/SnowMonitor.java | 4 +++- .../uf/edex/plugin/fssobs/FSSObsDataTransform.java | 3 ++- .../raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java | 12 ++++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java index 25af5044ea..0567b57487 100755 --- a/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/FogMonitor.java @@ -149,7 +149,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener { initObserver(OBS, this); createDataStructures(); processProductAtStartup(); - obData.setThresholdMgr(FogThresholdMgr.getInstance()); obData.getZoneTableData(); readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG); } diff --git a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java index f78beb4810..d52cdfcb77 100755 --- a/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java +++ b/cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/SnowMonitor.java @@ -120,8 +120,10 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener { updateMonitoringArea(); initObserver(OBS, this); obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW); - processProductAtStartup(); + // Set up thresholds. obData.setThresholdMgr(SnowThresholdMgr.getInstance()); + // Retrieve existing data. + processProductAtStartup(); obData.getZoneTableData(); } diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java index 5ba6dce4e4..94a2a2da3d 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsDataTransform.java @@ -492,7 +492,8 @@ public class FSSObsDataTransform { if (stFullName != null) { fssr.setStnName(stFullName); } else { - stFullName = fssr.getPlatformId(); + //Descriptive name for moving platform. + fssr.setStnName(fssr.getPlatformId()); } fssr.setRawMessage(pdv.getString(RAW_REPORT)); fssr.setDataTime(new DataTime(pdv.getDate(TIME_OBS))); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java index 30a9f0d7ae..58b262e489 100755 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsUtils.java @@ -171,7 +171,7 @@ public class FSSObsUtils { } /** - * Gets descriptive station name from database. + * Gets descriptive station name from database. Returns Null if not found. * * @param stnId * @return station name @@ -193,10 +193,12 @@ public class FSSObsUtils { Map paramMap = new HashMap<>(1, 1); paramMap.put("stationid", stnId); Object[] results = dao.executeSQLQuery(sql, paramMap); - retVal = (String) results[0]; + if (results.length > 0) { + retVal = (String) results[0]; + } } catch (Exception e) { statusHandler.handle(Priority.ERROR, - "Could not to get a station name: " + e.getMessage()); + "Could not get station name for station id: " + stnId, e); } return retVal; } @@ -347,8 +349,10 @@ public class FSSObsUtils { ceiling = levels[i].floatValue() / 100f; } break; + case "": + break; default: - statusHandler.error("Get unkown sky cover " + sc); + statusHandler.error("Get unknown sky cover " + sc); break; } }