Issue #2361 remove dependencies on mesowest and delete dead grichardson code
Former-commit-id:bd9578dd6d
[formerly65d7d4dac9
] [formerly477c64c8bd
] [formerlybd9578dd6d
[formerly65d7d4dac9
] [formerly477c64c8bd
] [formerly2f79b34a77
[formerly477c64c8bd
[formerly a91a4fe2261050daee83b1edaa7d01404b7b89a0]]]] Former-commit-id:2f79b34a77
Former-commit-id:d2af0d52a6
[formerly2419a99ac7
] [formerly a01d69eb125667dc0511591658732e612649a73e [formerly1adac8829f
]] Former-commit-id: a2aea41bda81ba451fdb55f8030f7d56d6699493 [formerlyc9cdcc056a
] Former-commit-id:41dab56b49
This commit is contained in:
parent
6e06e2852f
commit
360066e5b8
28 changed files with 6 additions and 4738 deletions
|
@ -169,11 +169,4 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.mesowest"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
|
|
@ -1,217 +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.uf.viz.monitor.fog;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstThreat;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstTime;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstValue;
|
||||
import com.raytheon.uf.viz.monitor.data.ObTime;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IGuardianListener;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
|
||||
/**
|
||||
* FogReportModel class is a singleton class that contains the report model for
|
||||
* this decision assistance tool.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class FogReportModel {
|
||||
|
||||
/**
|
||||
* The static singleton instance.
|
||||
*/
|
||||
private static FogReportModel instance;
|
||||
|
||||
/**
|
||||
* Indicates whether to clear all existing observations (if true) or honor
|
||||
* the age-out scheme (if false) protected boolean redoFullThreatInterval;
|
||||
*/
|
||||
private boolean redoFullThreatInterval;
|
||||
|
||||
/**
|
||||
* Indicates whether the forecast office wants the Fog Monitor's SAFESEAS
|
||||
* fog threat levels considered when determining the overall marine threat
|
||||
* level
|
||||
*/
|
||||
private boolean usingFogThreatLevel;
|
||||
|
||||
/** The "green" list */
|
||||
private ObTime greenList = new ObTime(ObConst.ThreatLevel.GREEN);
|
||||
|
||||
/** The "yellow" list */
|
||||
private ObTime yellowList = new ObTime(ObConst.ThreatLevel.YELLOW);
|
||||
|
||||
/** The "red" list */
|
||||
private ObTime redList = new ObTime(ObConst.ThreatLevel.RED);
|
||||
|
||||
/** The worst value report */
|
||||
private ObReportWorstValue worstValueReport = new ObReportWorstValue()
|
||||
.init();
|
||||
|
||||
/** The worst value time report */
|
||||
private ObReportWorstTime worstValueTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/** The worst threat report */
|
||||
private ObReportWorstThreat worstThreatReport = new ObReportWorstThreat()
|
||||
.init();
|
||||
|
||||
/** The worst threat time report */
|
||||
private ObReportWorstTime worstThreatTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/**
|
||||
* Observing Station Location
|
||||
*/
|
||||
private final Map<String, com.vividsolutions.jts.geom.Point> obStationLocation = new HashMap<String, com.vividsolutions.jts.geom.Point>();
|
||||
|
||||
/**
|
||||
* Observing Station Geometry
|
||||
*/
|
||||
private final Map<String, PreparedGeometry> obStationGeometry = new HashMap<String, PreparedGeometry>();
|
||||
|
||||
/**
|
||||
* Display (stand-in) for Guardian type alert visualization.
|
||||
*/
|
||||
private IGuardianListener fogDisplay;
|
||||
|
||||
/**
|
||||
* Singleton constructor.
|
||||
*
|
||||
* @return the observation station model.
|
||||
*/
|
||||
public static synchronized FogReportModel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new FogReportModel();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor: Use getInstance().
|
||||
*/
|
||||
private FogReportModel() {
|
||||
}
|
||||
|
||||
public boolean isRedoFullThreatInterval() {
|
||||
return redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public void setRedoFullThreatInterval(boolean redoFullThreatInterval) {
|
||||
this.redoFullThreatInterval = redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public ObTime getGreenList() {
|
||||
return greenList;
|
||||
}
|
||||
|
||||
public void setGreenList(ObTime greenList) {
|
||||
this.greenList = greenList;
|
||||
}
|
||||
|
||||
public ObTime getYellowList() {
|
||||
return yellowList;
|
||||
}
|
||||
|
||||
public void setYellowList(ObTime yellowList) {
|
||||
this.yellowList = yellowList;
|
||||
}
|
||||
|
||||
public ObTime getRedList() {
|
||||
return redList;
|
||||
}
|
||||
|
||||
public void setRedList(ObTime redList) {
|
||||
this.redList = redList;
|
||||
}
|
||||
|
||||
public Map<String, com.vividsolutions.jts.geom.Point> getObStationLocation() {
|
||||
return obStationLocation;
|
||||
}
|
||||
|
||||
public Map<String, PreparedGeometry> getObStationGeometry() {
|
||||
return obStationGeometry;
|
||||
}
|
||||
|
||||
public ObReportWorstValue getWorstValueReport() {
|
||||
return worstValueReport;
|
||||
}
|
||||
|
||||
public void setWorstValueReport(ObReportWorstValue worstValueReport) {
|
||||
this.worstValueReport = worstValueReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstValueTimeReport() {
|
||||
return worstValueTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstValueTimeReport(ObReportWorstTime worstValueTimeReport) {
|
||||
this.worstValueTimeReport = worstValueTimeReport;
|
||||
}
|
||||
|
||||
public ObReportWorstThreat getWorstThreatReport() {
|
||||
return worstThreatReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatReport(ObReportWorstThreat worstThreatReport) {
|
||||
this.worstThreatReport = worstThreatReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstThreatTimeReport() {
|
||||
return worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatTimeReport(ObReportWorstTime worstThreatTimeReport) {
|
||||
this.worstThreatTimeReport = worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public boolean isUsingFogThreatLevel() {
|
||||
return usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public void setUsingFogThreatLevel(boolean usingFogThreatLevel) {
|
||||
this.usingFogThreatLevel = usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public IGuardianListener getFogDisplay() {
|
||||
return fogDisplay;
|
||||
}
|
||||
|
||||
public void setFogDisplay(IGuardianListener fogDisplay) {
|
||||
this.fogDisplay = fogDisplay;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,327 +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.uf.viz.monitor.fog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
||||
import com.raytheon.uf.viz.monitor.ProcessNewReport;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitorAreaThresholds;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* The ProcessFogReport class contains the business logic to process a FOG
|
||||
* report.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 12, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ProcessFogReport extends ProcessNewReport {
|
||||
|
||||
// Instance of Fog Report Model
|
||||
private FogReportModel model = FogReportModel.getInstance();
|
||||
|
||||
// The list of ObReports to processes
|
||||
private ObReport[] report;
|
||||
|
||||
// Indicator that report was dropped (not processed)
|
||||
private List<Boolean> droppedReport = new ArrayList<Boolean>();
|
||||
|
||||
// Public Constructor
|
||||
public ProcessFogReport(ObReport[] report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the Fog Report
|
||||
*/
|
||||
public void processFogReport() {
|
||||
if (model.isRedoFullThreatInterval()) {
|
||||
model.setRedoFullThreatInterval(false);
|
||||
// completely empty out the green, yellow, and red lists; we must
|
||||
// re-process all reports within the SAFESEAS button's time
|
||||
// interval.
|
||||
model.getGreenList().clearObTimeList();
|
||||
model.getYellowList().clearObTimeList();
|
||||
model.getRedList().clearObTimeList();
|
||||
} else {
|
||||
// remove from the green, yellow, and red lists all observation
|
||||
// times two or more hours old.
|
||||
model.getGreenList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getYellowList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getRedList().pruneObTimeList(ObUtil.getDropTime());
|
||||
}
|
||||
String latestObscurationString = "";
|
||||
String obscurationString = "";
|
||||
float minVisThisRun = 1e34f;
|
||||
float minVis = 1e34f;
|
||||
Date minVisTimeThisRun = ObUtil.getDropTime();
|
||||
Date minVisTime = ObUtil.getDropTime();
|
||||
for (int i = 0; i < report.length; i++) {
|
||||
|
||||
// DO NOT PROCESS SYNOPTIC FIXED LAND OR SYNOPTIC MOBILE LAND
|
||||
if (report[i].getReportType() == ReportType.SYNOPTIC_FIXED_LAND
|
||||
|| report[i].getReportType() == ReportType.SYNOPTIC_MOBILE_LAND) {
|
||||
droppedReport.add(true);
|
||||
continue;
|
||||
}
|
||||
newDataReceived = true;
|
||||
obTime = report[i].getObservationTime();
|
||||
if (obTime.after(dropTime)) {
|
||||
// Initialize threat level for observation.
|
||||
threatLevel = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ChosenAppKey.FOG);
|
||||
|
||||
// insert the report's observation time into the correct
|
||||
// threat list based on the report's threat level.
|
||||
switch (threatLevel) {
|
||||
case GREEN:
|
||||
model.getGreenList().storeDateTime(obTime);
|
||||
break;
|
||||
case YELLOW:
|
||||
model.getYellowList().storeDateTime(obTime);
|
||||
break;
|
||||
case RED:
|
||||
model.getRedList().storeDateTime(obTime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
// Search the report's present weather string for
|
||||
// obscurations.
|
||||
|
||||
String presentWx = report[i].getPresentWx();
|
||||
|
||||
if (MonitorAreaThresholds.isObstructionReported(presentWx)) {
|
||||
// The present weather contains an obscuration.
|
||||
// Now check the obscuration string for the same
|
||||
// obscuration.
|
||||
if (!latestObscurationString.contains(presentWx)) {
|
||||
// The presentWx obscuration is not in the obscuration
|
||||
// string, so append the two-character obscuration
|
||||
// portion of presentWx onto the larger string.
|
||||
latestObscurationString += presentWx + " ";
|
||||
}
|
||||
}
|
||||
|
||||
// Now find the minimum visibility.
|
||||
// The vis >=0 check prevents running afoul of the MISSING -9999
|
||||
// value.
|
||||
|
||||
float vis = report[i].getVisibility();
|
||||
if (vis >= 0) {
|
||||
// Vis comes in in 16ths of a statute mile. Convert to
|
||||
// statute miles.
|
||||
// vis /= 16.0f;
|
||||
// Update: in AWIPS II, visibility is in statute miles
|
||||
// due to processing upstream.
|
||||
|
||||
// Find the minimum vis from the current update (and the ob
|
||||
// time). The "<=" instead of "<" allows for
|
||||
// minVisTime_this_run updates if the lowest vis stays
|
||||
// static for awhile.
|
||||
if (vis <= minVisThisRun) {
|
||||
minVisThisRun = vis;
|
||||
minVisTimeThisRun = obTime;
|
||||
}
|
||||
}
|
||||
} // end if (report is not too old)
|
||||
} // end report loop
|
||||
|
||||
if (droppedReport.size() == report.length) {
|
||||
return; // there are no reports that were not dropped
|
||||
}
|
||||
|
||||
// If there have been station updates, then update the class member
|
||||
// Otherwise, if there are no updates (as is often the case, don't
|
||||
// let the "latest" empty string blot out valid obscuration text
|
||||
// from a previous run.
|
||||
if (latestObscurationString.length() != 0) {
|
||||
obscurationString = latestObscurationString;
|
||||
}
|
||||
|
||||
// Check for empty string
|
||||
if (obscurationString.length() == 0) {
|
||||
obscurationString = "N/A";
|
||||
}
|
||||
|
||||
// If the latest min vis (from the latest run) is valid and is lower
|
||||
// than or equal to the stored min vis for the whole time duration,
|
||||
// then update the min vis for the whole time duration ( >= instead of
|
||||
// > allows for more frequent obtime updates.) Min vis time comparison
|
||||
// to drop time checks of _minVis is too old.
|
||||
|
||||
if (minVisThisRun < 1e20 && minVisThisRun >= 0) {
|
||||
if (minVisThisRun <= minVis || minVisTime.before(dropTime)) {
|
||||
minVis = minVisThisRun;
|
||||
if (minVisTimeThisRun.after(dropTime)) {
|
||||
minVisTime = minVisTimeThisRun;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String minVisStr = "";
|
||||
if (minVis >= 0 && minVis < 1e20f) {
|
||||
minVisStr = ObUtil.getDisplayString("%.2f mi.", minVis);
|
||||
} else {
|
||||
minVisStr = "N/A";
|
||||
}
|
||||
|
||||
// Now determine the new overall threat level.
|
||||
threatLevel = ThreatLevel.GRAY;
|
||||
|
||||
String threatMessage = "";
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
threatMessage += "Lowest Vis : " + minVisStr + " observed at "
|
||||
+ ObUtil.getDisplayString(minVisTime, ObConst.DATE_FORMAT)
|
||||
+ "Z\n";
|
||||
}
|
||||
threatMessage += "Obscurations: " + obscurationString + "\n";
|
||||
|
||||
if (!model.getRedList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.RED;
|
||||
threatMessage = "Monitored observations at RED threshold level.";
|
||||
} else if (!model.getYellowList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.YELLOW;
|
||||
threatMessage = "Monitored observations at YELLOW threshold level.";
|
||||
} else if (!model.getGreenList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.GREEN;
|
||||
threatMessage = "Monitored observations at GREEN threshold level.";
|
||||
} else {
|
||||
threatMessage = "No monitoring information from any observation platform.";
|
||||
}
|
||||
|
||||
// If Fog Monitor algorithm output is to be considered in the
|
||||
// obs app threat level, then evaluate the max fog threat level.
|
||||
|
||||
if (model.isUsingFogThreatLevel()) {
|
||||
// Get the fog threat level.
|
||||
ThreatLevel fogThreatLevel = ObUtil.readFogThreatLevel();
|
||||
|
||||
// Convert threat level number into string for text output.
|
||||
String fogThreatString = ObConst.THREAT_LEVEL_STRINGS[fogThreatLevel
|
||||
.ordinal()];
|
||||
|
||||
// Convert to upper case.
|
||||
String upcaseFogThreatString = fogThreatString.toUpperCase();
|
||||
|
||||
// Define extra Fog Monitor messages to be delivered to Guardian.
|
||||
if (fogThreatLevel == ThreatLevel.GRAY) {
|
||||
threatMessage += "\nNo Fog Monitor threat levels available";
|
||||
} else if (fogThreatLevel == ThreatLevel.BLACK) {
|
||||
threatMessage += "\nFog Monitor error. Check FMprocessor on server. ";
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor at " + upcaseFogThreatString
|
||||
+ " threshold level.";
|
||||
}
|
||||
|
||||
// Choose the higher of the two threats as the level to go forward.
|
||||
if ((fogThreatLevel.compareTo(threatLevel)) > 0) {
|
||||
threatLevel = fogThreatLevel;
|
||||
}
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor satellite algorithms "
|
||||
+ "configured not to provide Guardian info.";
|
||||
}
|
||||
|
||||
// Setup string for latest obstime; N/A if none available.
|
||||
String obTimeString = "";
|
||||
if (latestObTime.before(dropTime)) {
|
||||
obTimeString = "N/A";
|
||||
} else {
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
obTimeString = ObUtil.getDisplayString(latestObTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
}
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
String dropTimeString = ObUtil.getDisplayString(dropTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
|
||||
// Set up time window character string.
|
||||
String timeCharStr = ObUtil.getDisplayString("%5.2f",
|
||||
(float) MonitoringArea.getTimeWindow());
|
||||
|
||||
// Add time window info to Guardian message.
|
||||
threatMessage += "\nTime Window (hours): " + timeCharStr + "\n";
|
||||
|
||||
// Send the message to AlertViz f/k/a Guardian.
|
||||
String mssg = "";
|
||||
int priority = 0;
|
||||
switch (threatLevel) {
|
||||
case RED:
|
||||
priority = 1;
|
||||
break;
|
||||
case YELLOW:
|
||||
priority = 2;
|
||||
break;
|
||||
case GREEN:
|
||||
priority = 3;
|
||||
break;
|
||||
case BLACK:
|
||||
priority = 4;
|
||||
break;
|
||||
default:
|
||||
priority = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
String type = "";
|
||||
type = "Fog/Vis Status";
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
mssg = type
|
||||
+ " "
|
||||
+ ObUtil.getDisplayString(ObUtil.getThreatTime(),
|
||||
ObConst.DATE_FORMAT) + "\n" + threatMessage;
|
||||
}
|
||||
String key = "";
|
||||
key = "FOG_MONITOR";
|
||||
|
||||
// TODO Send the message (mssg) to AlertViz f/k/a Guardian.
|
||||
// System.out.println(mssg + " " + "MONITOR" + " " + key + " " +
|
||||
// priority);
|
||||
//model.getFogDisplay().putMessage(
|
||||
// mssg + " " + "MONITOR:" + " " + key + " " + "RT1: "
|
||||
// + report[0].getReportType().toString() + " " + "STN1: "
|
||||
// + report[0].getPlatformId() + " " + "PRIORITY: "
|
||||
// + priority);
|
||||
//model.getFogDisplay().putPriority(threatLevel);
|
||||
|
||||
}
|
||||
}
|
|
@ -1,786 +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.uf.viz.monitor.safeseas;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
||||
import com.raytheon.uf.viz.monitor.ProcessNewReport;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitorAreaThresholds;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* The ProcessSafeSeasReport class contains the business logic to process a
|
||||
* SAFESEAS report.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 12, 2009 1999 grichard Initial creation.
|
||||
* Nov 30, 2009 3424 zhao/wkwock/slav display station data.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProcessSafeSeasReport extends ProcessNewReport {
|
||||
|
||||
// Instance of Safe Seas Report Model
|
||||
private SafeSeasReportModel model = SafeSeasReportModel.getInstance();
|
||||
|
||||
// The list of ObReports to processes
|
||||
private ObReport[] report;
|
||||
|
||||
// Indicator that report was dropped (not processed)
|
||||
private List<Boolean> droppedReport = new ArrayList<Boolean>();
|
||||
|
||||
// Public Constructor
|
||||
public ProcessSafeSeasReport(ObReport[] report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the Safe Seas Report
|
||||
*/
|
||||
public void processSafeSeasReport() {
|
||||
if (model.isRedoFullThreatInterval()) {
|
||||
model.setRedoFullThreatInterval(false);
|
||||
// completely empty out the green, yellow, and red lists; we must
|
||||
// re-process all reports within the SAFESEAS button's time
|
||||
// interval.
|
||||
model.getGreenList().clearObTimeList();
|
||||
model.getYellowList().clearObTimeList();
|
||||
model.getRedList().clearObTimeList();
|
||||
} else {
|
||||
// remove from the green, yellow, and red lists all observation
|
||||
// times two or more hours old.
|
||||
model.getGreenList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getYellowList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getRedList().pruneObTimeList(ObUtil.getDropTime());
|
||||
}
|
||||
for (int i = 0; i < report.length; i++) {
|
||||
|
||||
// DO NOT PROCESS SYNOPTIC FIXED LAND OR SYNOPTIC MOBILE LAND
|
||||
if (report[i].getReportType() == ReportType.SYNOPTIC_FIXED_LAND
|
||||
|| report[i].getReportType() == ReportType.SYNOPTIC_MOBILE_LAND) {
|
||||
droppedReport.add(true);
|
||||
continue;
|
||||
}
|
||||
newDataReceived = true;
|
||||
obTime = report[i].getObservationTime();
|
||||
if (latestObTime.before(obTime)) {
|
||||
latestObTime = obTime;
|
||||
}
|
||||
if (obTime.after(dropTime)) {
|
||||
// Initialize threat level for observation.
|
||||
ObConst.ThreatLevel threatTemp = ObConst.ThreatLevel.GRAY;
|
||||
// Begin worst case value and threat level evaluations for each
|
||||
// parameter. Note that worst case values and threat levels are
|
||||
// handled independently, because the county-by-county, zone-by-
|
||||
// zone threshold settings mean that the worst-case value may
|
||||
// not be generating the highest threat level (so you can't just
|
||||
// plug the worst-case value into get_threat_level()). Checks
|
||||
// against drop time allow expired values (older than the time
|
||||
// window specifies) to be discarded.
|
||||
|
||||
// Wind speed evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getWindSpeed() < report[i]
|
||||
.getWindSpeed()
|
||||
|| model.getWorstValueTimeReport().getWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setWindSpeed(
|
||||
report[i].getWindSpeed());
|
||||
model.getWorstValueTimeReport().setWindSpeed(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.WIND_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getWindSpeed().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setWindSpeed(threatTemp);
|
||||
model.getWorstThreatTimeReport().setWindSpeed(obTime);
|
||||
}
|
||||
|
||||
// Wind gust evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getWindGust() < report[i]
|
||||
.getWindGust()
|
||||
|| model.getWorstValueTimeReport().getWindGust()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setWindGust(
|
||||
report[i].getWindGust());
|
||||
model.getWorstValueTimeReport().setWindGust(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.GUST_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getWindGust().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getWindGust()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setWindGust(threatTemp);
|
||||
model.getWorstThreatTimeReport().setWindGust(obTime);
|
||||
}
|
||||
|
||||
// Peak wind evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getMaxWindSpeed() < report[i]
|
||||
.getMaxWindSpeed()
|
||||
|| model.getWorstValueTimeReport().getMaxWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setMaxWindSpeed(
|
||||
report[i].getMaxWindSpeed());
|
||||
model.getWorstValueTimeReport().setMaxWindSpeed(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.MAX_WIND_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getMaxWindSpeed().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getMaxWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setMaxWindSpeed(threatTemp);
|
||||
model.getWorstThreatTimeReport().setMaxWindSpeed(obTime);
|
||||
}
|
||||
|
||||
// Visibility evaluations.
|
||||
|
||||
float vis = report[i].getVisibility();
|
||||
// The vis >=0 check prevents running afoul of the MISSING -999
|
||||
// value.
|
||||
if ((model.getWorstValueReport().getVisibility() > vis && vis >= 0)
|
||||
|| (vis >= 0 && model.getWorstValueTimeReport()
|
||||
.getVisibility().before(dropTime))) {
|
||||
// Divide by 16.0 to get statute miles.
|
||||
// model.getWorstValueReport().setVisibility(vis / 16.0f);
|
||||
// Update: in AWIPS II, visibility is in statute miles
|
||||
// due to processing upstream.
|
||||
model.getWorstValueTimeReport().setVisibility(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.VISIBILITY);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getVisibility().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getVisibility()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setVisibility(threatTemp);
|
||||
model.getWorstThreatTimeReport().setVisibility(obTime);
|
||||
}
|
||||
|
||||
// Wave height evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getHighResWaveHeight() < report[i]
|
||||
.getHighResWaveHeight()
|
||||
|| model.getWorstValueTimeReport()
|
||||
.getHighResWaveHeight().before(dropTime)) {
|
||||
model.getWorstValueReport().setHighResWaveHeight(
|
||||
report[i].getHighResWaveHeight());
|
||||
model.getWorstValueTimeReport()
|
||||
.setHighResWaveHeight(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.WAVE_HEIGHT);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getHighResWaveHeight()
|
||||
.ordinal() < threatTemp.ordinal())
|
||||
|| model.getWorstThreatTimeReport()
|
||||
.getHighResWaveHeight().before(dropTime)) {
|
||||
model.getWorstThreatReport().setHighResWaveHeight(
|
||||
threatTemp);
|
||||
model.getWorstThreatTimeReport().setHighResWaveHeight(
|
||||
obTime);
|
||||
}
|
||||
|
||||
// Primary swell height evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getPSwellHeight() < report[i]
|
||||
.getPSwellHeight()
|
||||
|| model.getWorstValueTimeReport().getPSwellHeight()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setPSwellHeight(
|
||||
report[i].getPSwellHeight());
|
||||
model.getWorstValueTimeReport().setPSwellHeight(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.PRIM_SWELL_HT);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getPSwellHeight().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getPSwellHeight()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setPSwellHeight(threatTemp);
|
||||
model.getWorstThreatTimeReport().setPSwellHeight(obTime);
|
||||
}
|
||||
|
||||
// Primary swell period evaluations. There's an extra check
|
||||
// to see whether higher or lower values should be emphasized
|
||||
// (the check is MonitorAreaThresholds.isRankHighSwellPeriods())
|
||||
|
||||
if ((MonitorAreaThresholds.isRankHighSwellPeriods() && model
|
||||
.getWorstValueReport().getPSwellPeriod() < report[i]
|
||||
.getPSwellPeriod())
|
||||
|| (!MonitorAreaThresholds.isRankHighSwellPeriods() && model
|
||||
.getWorstValueReport().getPSwellPeriod() > report[i]
|
||||
.getPSwellPeriod())
|
||||
|| (model.getWorstValueTimeReport().getPSwellPeriod()
|
||||
.before(dropTime))) {
|
||||
model.getWorstValueReport().setPSwellPeriod(
|
||||
report[i].getPSwellPeriod());
|
||||
model.getWorstValueTimeReport().setPSwellPeriod(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.PRIM_SWELL_PD);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getPSwellPeriod().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getPSwellPeriod()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setPSwellPeriod(threatTemp);
|
||||
model.getWorstThreatTimeReport().setPSwellPeriod(obTime);
|
||||
}
|
||||
|
||||
// Primary swell direction evaluations.
|
||||
// Omit primary worst swell value calculation.
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.PRIM_SWELL_DIR);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getPSwellDir().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getPSwellDir()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setPSwellDir(threatTemp);
|
||||
model.getWorstThreatTimeReport().setPSwellDir(obTime);
|
||||
}
|
||||
|
||||
// Secondary swell height evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getSSwellHeight() < report[i]
|
||||
.getSSwellHeight()
|
||||
|| model.getWorstValueTimeReport().getSSwellHeight()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setSSwellHeight(
|
||||
report[i].getSSwellHeight());
|
||||
model.getWorstValueTimeReport().setSSwellHeight(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.SEC_SWELL_HT);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getSSwellHeight().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getSSwellHeight()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setSSwellHeight(threatTemp);
|
||||
model.getWorstThreatTimeReport().setSSwellHeight(obTime);
|
||||
}
|
||||
|
||||
// Secondary swell period evaluations. There's an extra check
|
||||
// to see whether higher or lower values should be emphasized
|
||||
// (the check is MonitorAreaThresholds.isRankHighSwellPeriods())
|
||||
|
||||
if ((MonitorAreaThresholds.isRankHighSwellPeriods() && model
|
||||
.getWorstValueReport().getSSwellPeriod() < report[i]
|
||||
.getSSwellPeriod())
|
||||
|| (!MonitorAreaThresholds.isRankHighSwellPeriods() && model
|
||||
.getWorstValueReport().getSSwellPeriod() > report[i]
|
||||
.getSSwellPeriod())
|
||||
|| (model.getWorstValueTimeReport().getSSwellPeriod()
|
||||
.before(dropTime))) {
|
||||
model.getWorstValueReport().setSSwellPeriod(
|
||||
report[i].getSSwellPeriod());
|
||||
model.getWorstValueTimeReport().setSSwellPeriod(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.SEC_SWELL_PD);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getSSwellPeriod().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getSSwellPeriod()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setSSwellPeriod(threatTemp);
|
||||
model.getWorstThreatTimeReport().setSSwellPeriod(obTime);
|
||||
}
|
||||
|
||||
// Secondary swell direction evaluations.
|
||||
// Omit primary worst swell value calculation.
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.SEC_SWELL_DIR);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getSSwellDir().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getSSwellDir()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setSSwellDir(threatTemp);
|
||||
model.getWorstThreatTimeReport().setSSwellDir(obTime);
|
||||
}
|
||||
|
||||
// insert the report's observation time into the correct threat
|
||||
// list based on the report's threat level.
|
||||
switch (threatLevel) {
|
||||
case GREEN:
|
||||
model.getGreenList().storeDateTime(obTime);
|
||||
break;
|
||||
case YELLOW:
|
||||
model.getYellowList().storeDateTime(obTime);
|
||||
break;
|
||||
case RED:
|
||||
model.getRedList().storeDateTime(obTime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
} // end if (report is not too old)
|
||||
} // end report loop
|
||||
|
||||
if (droppedReport.size() == report.length) {
|
||||
return; // there are no reports that were not dropped
|
||||
}
|
||||
|
||||
// Initialize the boolean matching vector (which is true if there's a
|
||||
// match (if we've seen the basic string, without intensity, earlier
|
||||
// in the upcoming loop. It is assigned the size of the presentWxVec
|
||||
// vector (one T/F for each present weather element in the vector).
|
||||
List<Boolean> presentWxMatchVec = new ArrayList<Boolean>();
|
||||
// Initialize the present weather match vector.
|
||||
for (int i = 0; i < presentWxVec.size(); i++) {
|
||||
presentWxMatchVec.add(false);
|
||||
}
|
||||
String maxIntensityFrozenPrecip = "";
|
||||
|
||||
// This loop sorts through the frozen precip vector collected above.
|
||||
// The filter above identified the unique frozen precip strings. Now
|
||||
// that we have unique strings in a vector, we can sort through them
|
||||
// again, looking for the highest intensity. Only the highest intensity
|
||||
// of each unique present weather string will be listed in the Guardian
|
||||
// output (e.g., if -SNFZFG, SNFZFG, and +SNFZFG have been reported,
|
||||
// the +SNFZFG string will be displayed in the Guardian cursor outputi).
|
||||
for (int i = 0; i < presentWxVec.size(); i++) {
|
||||
// Check to see if this string (sans intensity) has been matched
|
||||
// in a prior iteration. If so, continue.
|
||||
if (presentWxMatchVec.get(i)) {
|
||||
continue;
|
||||
}
|
||||
String stringI = "";
|
||||
ObConst.IntensityLevel maxIntensityLevel;
|
||||
|
||||
// Get the present weather strings without the intensity
|
||||
// prefix. This is straightforward for moderate events
|
||||
// (because there is no prefix), but for light or heavy
|
||||
// events, the TextString::right() method is used to lop
|
||||
// off initial +/- character.
|
||||
if (intensityLevelVec.get(i) == ObConst.IntensityLevel.MODERATE) {
|
||||
stringI = presentWxVec.get(i);
|
||||
} else {
|
||||
stringI = presentWxVec.get(i).replaceFirst("(\\+|-)", "");
|
||||
}
|
||||
|
||||
// Initialize the max intensity level for this event.
|
||||
maxIntensityLevel = intensityLevelVec.get(i);
|
||||
|
||||
// Initialize the string which will hold the event of the current
|
||||
// type that has the highest intensity.
|
||||
String maxIntensityPresentWx = "";
|
||||
|
||||
// Start a second loop to compare the rest of the vector to
|
||||
// the current weather event.
|
||||
for (int j = i + 1; j < presentWxVec.size(); j++) {
|
||||
// As was done above, skip over vector elements which have
|
||||
// already been matched to the same weather event, and thus
|
||||
// have been accounted for.
|
||||
if (presentWxMatchVec.get(j)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the present weather strings without the intensity
|
||||
// prefix (as was done in the i-loop.)
|
||||
String stringJ = "";
|
||||
if (intensityLevelVec.get(j) == ObConst.IntensityLevel.MODERATE) {
|
||||
stringJ = presentWxVec.get(j);
|
||||
} else {
|
||||
stringJ = presentWxVec.get(j).replaceFirst("(\\+|-)", "");
|
||||
}
|
||||
|
||||
// Compare the strings from the nested loops...
|
||||
if (stringI.equals(stringJ)) {
|
||||
// If there is a match, flag the corresponding boolean
|
||||
// vector element as true.
|
||||
presentWxMatchVec.set(j, true);
|
||||
|
||||
// Compare the current max intensity found for this event
|
||||
// type with the intensity of the current inner-loop
|
||||
// vector[i] element. Change if necessary.
|
||||
if (maxIntensityLevel.compareTo(intensityLevelVec.get(j)) < 0) {
|
||||
maxIntensityLevel = intensityLevelVec.get(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Append the appropriate maximum intensity prefix (for
|
||||
// light or heavy) the max event type string.
|
||||
if (maxIntensityLevel == ObConst.IntensityLevel.HEAVY) {
|
||||
maxIntensityPresentWx = "+" + stringI;
|
||||
} else if (maxIntensityLevel == ObConst.IntensityLevel.LIGHT) {
|
||||
maxIntensityPresentWx = "-" + stringI;
|
||||
} else {
|
||||
maxIntensityPresentWx = stringI;
|
||||
}
|
||||
|
||||
maxIntensityFrozenPrecip += maxIntensityPresentWx = " ";
|
||||
// Now that the parent loop will iterate, assign the matching
|
||||
// vector element as true -- this weather event type does not
|
||||
// need to be evaluated again.
|
||||
presentWxMatchVec.set(i, true);
|
||||
}
|
||||
|
||||
// Update max intensity frozen precip values to Guardian output
|
||||
// string provided the time they were reported is within the drop
|
||||
// time. Also check for length to ensure that quick, back-to
|
||||
// back updates don't blot out the values (the only way the
|
||||
// maxIntensityFrozenPrecipString would be 0 sized if the
|
||||
// _latestFrozenPrecipTime > drop_time is if notifications came
|
||||
// in rapidly back to back, and no new obs were reported in that
|
||||
// time.
|
||||
|
||||
if (!latestFrozenPrecipTime.before(dropTime)) {
|
||||
guardianFrozenPrecip = maxIntensityFrozenPrecip;
|
||||
} else {
|
||||
guardianFrozenPrecip = "";
|
||||
}
|
||||
|
||||
// now determine the new overall threat level.
|
||||
threatLevel = ThreatLevel.GRAY;
|
||||
String threatMessage = "";
|
||||
if (!model.getRedList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.RED;
|
||||
threatMessage = "Monitored observations at RED threshold level.";
|
||||
} else if (!model.getYellowList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.YELLOW;
|
||||
threatMessage = "Monitored observations at YELLOW threshold level.";
|
||||
} else if (!model.getGreenList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.GREEN;
|
||||
threatMessage = "Monitored observations at GREEN threshold level.";
|
||||
} else {
|
||||
threatMessage = "No monitoring information from any observation platform.";
|
||||
}
|
||||
|
||||
String worstVal = "";
|
||||
|
||||
if (threatLevel != ThreatLevel.GRAY) {
|
||||
threatMessage += "\n\nMONITORED VALUES \t HIGHEST THREAT LEVELS\n ";
|
||||
|
||||
// Visibility threat message
|
||||
if (model.getWorstValueReport().getVisibility() < 0
|
||||
|| model.getWorstValueReport().getVisibility() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.2f mi", model
|
||||
.getWorstValueReport().getVisibility());
|
||||
}
|
||||
threatMessage += "Min Vis: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getVisibility().ordinal()] + "\n ";
|
||||
|
||||
// Wind speed threat message
|
||||
if (model.getWorstValueReport().getWindSpeed() < 0
|
||||
|| model.getWorstValueReport().getWindSpeed() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getWindSpeed());
|
||||
}
|
||||
threatMessage += "Max Wind Speed: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getWindSpeed().ordinal()] + "\n ";
|
||||
|
||||
// Wind gust threat message
|
||||
if (model.getWorstValueReport().getWindGust() < 0
|
||||
|| model.getWorstValueReport().getWindGust() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getWindGust());
|
||||
}
|
||||
threatMessage += "Max Wind Gust: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getWindGust().ordinal()] + "\n ";
|
||||
|
||||
// Peak Wind speed threat message
|
||||
if (model.getWorstValueReport().getMaxWindSpeed() < 0
|
||||
|| model.getWorstValueReport().getMaxWindSpeed() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getMaxWindSpeed());
|
||||
}
|
||||
threatMessage += "Max Peak Wind: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getMaxWindSpeed().ordinal()] + "\n ";
|
||||
|
||||
// High resolution wave height threat message
|
||||
if (model.getWorstValueReport().getHighResWaveHeight() < 0
|
||||
|| model.getWorstValueReport().getHighResWaveHeight() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f ft", model
|
||||
.getWorstValueReport().getHighResWaveHeight());
|
||||
}
|
||||
threatMessage += "Max Wave Ht: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getHighResWaveHeight().ordinal()] + "\n ";
|
||||
|
||||
// Primary swell height threat message
|
||||
if (model.getWorstValueReport().getPSwellHeight() < 0
|
||||
|| model.getWorstValueReport().getPSwellHeight() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f ft", model
|
||||
.getWorstValueReport().getPSwellHeight());
|
||||
}
|
||||
threatMessage += "Max Prim Swell Ht: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getPSwellHeight().ordinal()] + "\n ";
|
||||
|
||||
// Primary swell period threat message
|
||||
if (model.getWorstValueReport().getPSwellPeriod() < 0
|
||||
|| model.getWorstValueReport().getPSwellPeriod() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f sec", model
|
||||
.getWorstValueReport().getPSwellPeriod());
|
||||
}
|
||||
threatMessage += "Max Prim Swell Pd: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getPSwellPeriod().ordinal()] + "\n ";
|
||||
|
||||
// Primary swell direction threat message
|
||||
worstVal = "NM";
|
||||
threatMessage += "Prim Swell Dir: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getPSwellDir().ordinal()] + "\n ";
|
||||
|
||||
// Secondary swell height threat message
|
||||
if (model.getWorstValueReport().getSSwellHeight() < 0
|
||||
|| model.getWorstValueReport().getSSwellHeight() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f ft", model
|
||||
.getWorstValueReport().getSSwellHeight());
|
||||
}
|
||||
threatMessage += "Max Sec Swell Ht: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getSSwellHeight().ordinal()] + "\n ";
|
||||
|
||||
// Secondary swell period threat message
|
||||
if (model.getWorstValueReport().getSSwellPeriod() < 0
|
||||
|| model.getWorstValueReport().getSSwellPeriod() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f sec", model
|
||||
.getWorstValueReport().getSSwellPeriod());
|
||||
}
|
||||
threatMessage += "Max Sec Swell Pd: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getSSwellPeriod().ordinal()] + "\n ";
|
||||
|
||||
// Secondary swell direction threat message
|
||||
worstVal = "NM";
|
||||
threatMessage += "Sec Swell Dir: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getSSwellDir().ordinal()] + "\n ";
|
||||
|
||||
}
|
||||
|
||||
// If Fog Monitor algorithm output is to be considered in the
|
||||
// obs app threat level, then evaluate the max fog threat level.
|
||||
|
||||
if (model.isUsingFogThreatLevel()) {
|
||||
// Get the fog threat level.
|
||||
ThreatLevel fogThreatLevel = ObUtil.readFogThreatLevel();
|
||||
|
||||
// Convert threat level number into string for text output.
|
||||
String fogThreatString = ObConst.THREAT_LEVEL_STRINGS[fogThreatLevel
|
||||
.ordinal()];
|
||||
|
||||
// Convert to upper case.
|
||||
String upcaseFogThreatString = fogThreatString.toUpperCase();
|
||||
|
||||
// Define extra Fog Monitor messages to be delivered to Guardian.
|
||||
if (fogThreatLevel == ThreatLevel.GRAY) {
|
||||
threatMessage += "\nNo Fog Monitor threat levels available";
|
||||
} else if (fogThreatLevel == ThreatLevel.BLACK) {
|
||||
threatMessage += "\nFog Monitor error. Check FMprocessor on server. ";
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor at " + upcaseFogThreatString
|
||||
+ " threshold level.";
|
||||
}
|
||||
|
||||
// Choose the higher of the two threats as the level to go forward.
|
||||
if ((fogThreatLevel.compareTo(threatLevel)) > 0) {
|
||||
threatLevel = fogThreatLevel;
|
||||
}
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor input not contributing to SAFESEAS icon.\n";
|
||||
}
|
||||
|
||||
// Setup string for latest obstime; N/A if none available.
|
||||
String obTimeString = "";
|
||||
if (latestObTime.before(dropTime)) {
|
||||
obTimeString = "N/A";
|
||||
} else {
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
obTimeString = ObUtil.getDisplayString(latestObTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
}
|
||||
String dropTimeString = null;
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
dropTimeString = ObUtil.getDisplayString(dropTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
|
||||
// Set up time window character string.
|
||||
String timeCharStr = ObUtil.getDisplayString("%5.2f",
|
||||
(float) MonitoringArea.getTimeWindow());
|
||||
|
||||
threatMessage += "Latest Observation (GMT): " + obTimeString
|
||||
+ "\nEarliest Report Time Considered (GMT): " + dropTimeString
|
||||
+ "\nTime Window (hours): " + timeCharStr + "\n";
|
||||
|
||||
// Send the message to AlertViz f/k/a Guardian.
|
||||
String mssg = "";
|
||||
int priority = 0;
|
||||
switch (threatLevel) {
|
||||
case RED:
|
||||
priority = 1;
|
||||
break;
|
||||
case YELLOW:
|
||||
priority = 2;
|
||||
break;
|
||||
case GREEN:
|
||||
priority = 3;
|
||||
break;
|
||||
case BLACK:
|
||||
priority = 4;
|
||||
break;
|
||||
default:
|
||||
priority = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
String type = "";
|
||||
type = "MaritimeThreat";
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
mssg = type
|
||||
+ " "
|
||||
+ ObUtil.getDisplayString(ObUtil.getThreatTime(),
|
||||
ObConst.DATE_FORMAT) + "\n" + threatMessage;
|
||||
}
|
||||
String key = "";
|
||||
key = "SAFESEAS";
|
||||
|
||||
// TODO Send the message (mssg) to AlertViz f/k/a Guardian.
|
||||
// System.out.println(mssg + " " + "MONITOR" + " " + key + " " +
|
||||
// priority);
|
||||
/* model.getSafeSeasDisplay().putMessage(
|
||||
mssg + " " + "MONITOR:" + " " + key + " " + "RT1: "
|
||||
+ report[0].getReportType().toString() + " " + "STN1: "
|
||||
+ report[0].getPlatformId() + " " + "PRIORITY: "
|
||||
+ priority);
|
||||
model.getSafeSeasDisplay().putPriority(threatLevel);
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,217 +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.uf.viz.monitor.safeseas;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstThreat;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstTime;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstValue;
|
||||
import com.raytheon.uf.viz.monitor.data.ObTime;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IGuardianListener;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
|
||||
/**
|
||||
* SafeSeasReportModel class is a singleton class that contains the report model
|
||||
* for this decision assistance tool.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SafeSeasReportModel {
|
||||
|
||||
/**
|
||||
* The static singleton instance.
|
||||
*/
|
||||
private static SafeSeasReportModel instance;
|
||||
|
||||
/**
|
||||
* Indicates whether to clear all existing observations (if true) or honor
|
||||
* the age-out scheme (if false) protected boolean redoFullThreatInterval;
|
||||
*/
|
||||
private boolean redoFullThreatInterval;
|
||||
|
||||
/**
|
||||
* Indicates whether the forecast office wants the Fog Monitor's SAFESEAS
|
||||
* fog threat levels considered when determining the overall marine threat
|
||||
* level
|
||||
*/
|
||||
private boolean usingFogThreatLevel;
|
||||
|
||||
/** The "green" list */
|
||||
private ObTime greenList = new ObTime(ObConst.ThreatLevel.GREEN);
|
||||
|
||||
/** The "yellow" list */
|
||||
private ObTime yellowList = new ObTime(ObConst.ThreatLevel.YELLOW);
|
||||
|
||||
/** The "red" list */
|
||||
private ObTime redList = new ObTime(ObConst.ThreatLevel.RED);
|
||||
|
||||
/** The worst value report */
|
||||
private ObReportWorstValue worstValueReport = new ObReportWorstValue()
|
||||
.init();
|
||||
|
||||
/** The worst value time report */
|
||||
private ObReportWorstTime worstValueTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/** The worst threat report */
|
||||
private ObReportWorstThreat worstThreatReport = new ObReportWorstThreat()
|
||||
.init();
|
||||
|
||||
/** The worst threat time report */
|
||||
private ObReportWorstTime worstThreatTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/**
|
||||
* Observing Station Location
|
||||
*/
|
||||
private final Map<String, com.vividsolutions.jts.geom.Point> obStationLocation = new HashMap<String, com.vividsolutions.jts.geom.Point>();
|
||||
|
||||
/**
|
||||
* Observing Station Geometry
|
||||
*/
|
||||
private final Map<String, PreparedGeometry> obStationGeometry = new HashMap<String, PreparedGeometry>();
|
||||
|
||||
/**
|
||||
* Display (stand-in) for Guardian type alert visualization.
|
||||
*/
|
||||
private IGuardianListener safeSeasDisplay;
|
||||
|
||||
/**
|
||||
* Singleton constructor.
|
||||
*
|
||||
* @return the observation station model.
|
||||
*/
|
||||
public static synchronized SafeSeasReportModel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SafeSeasReportModel();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor: Use getInstance().
|
||||
*/
|
||||
private SafeSeasReportModel() {
|
||||
}
|
||||
|
||||
public boolean isRedoFullThreatInterval() {
|
||||
return redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public void setRedoFullThreatInterval(boolean redoFullThreatInterval) {
|
||||
this.redoFullThreatInterval = redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public ObTime getGreenList() {
|
||||
return greenList;
|
||||
}
|
||||
|
||||
public void setGreenList(ObTime greenList) {
|
||||
this.greenList = greenList;
|
||||
}
|
||||
|
||||
public ObTime getYellowList() {
|
||||
return yellowList;
|
||||
}
|
||||
|
||||
public void setYellowList(ObTime yellowList) {
|
||||
this.yellowList = yellowList;
|
||||
}
|
||||
|
||||
public ObTime getRedList() {
|
||||
return redList;
|
||||
}
|
||||
|
||||
public void setRedList(ObTime redList) {
|
||||
this.redList = redList;
|
||||
}
|
||||
|
||||
public Map<String, com.vividsolutions.jts.geom.Point> getObStationLocation() {
|
||||
return obStationLocation;
|
||||
}
|
||||
|
||||
public Map<String, PreparedGeometry> getObStationGeometry() {
|
||||
return obStationGeometry;
|
||||
}
|
||||
|
||||
public ObReportWorstValue getWorstValueReport() {
|
||||
return worstValueReport;
|
||||
}
|
||||
|
||||
public void setWorstValueReport(ObReportWorstValue worstValueReport) {
|
||||
this.worstValueReport = worstValueReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstValueTimeReport() {
|
||||
return worstValueTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstValueTimeReport(ObReportWorstTime worstValueTimeReport) {
|
||||
this.worstValueTimeReport = worstValueTimeReport;
|
||||
}
|
||||
|
||||
public ObReportWorstThreat getWorstThreatReport() {
|
||||
return worstThreatReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatReport(ObReportWorstThreat worstThreatReport) {
|
||||
this.worstThreatReport = worstThreatReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstThreatTimeReport() {
|
||||
return worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatTimeReport(ObReportWorstTime worstThreatTimeReport) {
|
||||
this.worstThreatTimeReport = worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public boolean isUsingFogThreatLevel() {
|
||||
return usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public void setUsingFogThreatLevel(boolean usingFogThreatLevel) {
|
||||
this.usingFogThreatLevel = usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public IGuardianListener getSafeSeasDisplay() {
|
||||
return safeSeasDisplay;
|
||||
}
|
||||
|
||||
public void setSafeSeasDisplay(IGuardianListener safeSeasDisplay) {
|
||||
this.safeSeasDisplay = safeSeasDisplay;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,273 +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.uf.viz.monitor.safeseas.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IGuardianListener;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasReportModel;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* The SAFESEAS Dialog Stand-in
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 20, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SafeSeasDialog extends CaveSWTDialog implements IGuardianListener {
|
||||
|
||||
/**
|
||||
* Guardian threat message viewer text control.
|
||||
*/
|
||||
private StyledText threatMessageViewerStTxt;
|
||||
|
||||
/**
|
||||
* Guardian threat priority label.
|
||||
*/
|
||||
private Label guardianLbl;
|
||||
|
||||
/**
|
||||
* Large font.
|
||||
*/
|
||||
private Font largeFont;
|
||||
|
||||
/**
|
||||
* Text editor background color.
|
||||
*/
|
||||
private Color editorColor;
|
||||
|
||||
/**
|
||||
* Instance variable for Safe Seas Monitor
|
||||
*/
|
||||
private SafeSeasMonitor safeSeas;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent Shell.
|
||||
*/
|
||||
public SafeSeasDialog(Shell parent) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
setText("SAFESEAS");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 5;
|
||||
mainLayout.marginWidth = 5;
|
||||
mainLayout.verticalSpacing = 5;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
largeFont.dispose();
|
||||
editorColor.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
largeFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
editorColor = new Color(getDisplay(), 82, 107, 129);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
createGuardianControl();
|
||||
createBottomButtons();
|
||||
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
public void shellClosed(ShellEvent event) {
|
||||
closeDisplay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Guardian control.
|
||||
*/
|
||||
private void createGuardianControl() {
|
||||
Composite guardianComp = new Composite(shell, SWT.NONE);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
guardianComp.setLayout(new GridLayout(1, false));
|
||||
guardianComp.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.heightHint = 25;
|
||||
gd.widthHint = 450;
|
||||
|
||||
guardianLbl = new Label(guardianComp, SWT.CENTER);
|
||||
guardianLbl
|
||||
.setText("The color coded result of this decision assistance tool");
|
||||
guardianLbl.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.heightHint = 150;
|
||||
gd.widthHint = 450;
|
||||
|
||||
threatMessageViewerStTxt = new StyledText(guardianComp, SWT.BORDER
|
||||
| SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
threatMessageViewerStTxt.setWordWrap(true);
|
||||
threatMessageViewerStTxt.setFont(largeFont);
|
||||
threatMessageViewerStTxt.setEditable(false);
|
||||
threatMessageViewerStTxt.setLayoutData(gd);
|
||||
threatMessageViewerStTxt.setBackground(editorColor);
|
||||
threatMessageViewerStTxt.setForeground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_WHITE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the OK and Cancel buttons.
|
||||
*/
|
||||
private void createBottomButtons() {
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
buttonComp.setLayout(new GridLayout(2, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(80, SWT.DEFAULT);
|
||||
Button okBtn = new Button(buttonComp, SWT.PUSH);
|
||||
okBtn.setText("Start");
|
||||
okBtn.setLayoutData(gd);
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
SafeSeasReportModel.getInstance().setSafeSeasDisplay(
|
||||
SafeSeasDialog.this);
|
||||
safeSeas = SafeSeasMonitor.getInstance();
|
||||
safeSeas
|
||||
.readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(80, SWT.DEFAULT);
|
||||
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
|
||||
cancelBtn.setText("Stop");
|
||||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
closeDisplay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the display.
|
||||
*/
|
||||
public void closeDisplay() {
|
||||
try {
|
||||
// Unregister for all alert notifications on this monitor
|
||||
for (String p : SafeSeasMonitor.pluginName) {
|
||||
safeSeas.stopObserver(p, safeSeas);
|
||||
}
|
||||
// Kill the monitor
|
||||
safeSeas.nullifyMonitor();
|
||||
} catch (NullPointerException e) {
|
||||
// Dispose the dialog
|
||||
shell.dispose();
|
||||
}
|
||||
// Dispose the dialog
|
||||
shell.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method puts the guardian threat priority in the label
|
||||
*/
|
||||
@Override
|
||||
public void putPriority(ObConst.ThreatLevel threatPriority) {
|
||||
try {
|
||||
switch (threatPriority) {
|
||||
case BLACK:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_BLACK));
|
||||
break;
|
||||
case GRAY:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GRAY));
|
||||
break;
|
||||
case GREEN:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GREEN));
|
||||
break;
|
||||
case YELLOW:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_YELLOW));
|
||||
break;
|
||||
case RED:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_RED));
|
||||
break;
|
||||
default:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GRAY));
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method puts the guardian threat message in the text control
|
||||
*/
|
||||
@Override
|
||||
public void putMessage(String threatMessage) {
|
||||
try {
|
||||
threatMessageViewerStTxt.setText(threatMessage);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -1,711 +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.uf.viz.monitor.snow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
||||
import com.raytheon.uf.viz.monitor.ProcessNewReport;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitorAreaThresholds;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* The ProcessSnowReport class contains the business logic to process a SNOW
|
||||
* report.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 12, 2009 1999 grichard Initial creation.
|
||||
* Nov 6, 2009 3424 zhao/wkwock comment out senting info to guardian.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ProcessSnowReport extends ProcessNewReport {
|
||||
|
||||
// Instance of Snow Report Model
|
||||
private SnowReportModel model = SnowReportModel.getInstance();
|
||||
|
||||
// The list of ObReports to processes
|
||||
private ObReport[] report;
|
||||
|
||||
// Public Constructor
|
||||
public ProcessSnowReport(ObReport[] report) {
|
||||
this.report = report;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the Snow Report
|
||||
*/
|
||||
public void processSnowReport() {
|
||||
if (model.isRedoFullThreatInterval()) {
|
||||
model.setRedoFullThreatInterval(false);
|
||||
// completely empty out the green, yellow, and red lists; we must
|
||||
// re-process all reports within the SAFESEAS button's time
|
||||
// interval.
|
||||
model.getGreenList().clearObTimeList();
|
||||
model.getYellowList().clearObTimeList();
|
||||
model.getRedList().clearObTimeList();
|
||||
} else {
|
||||
// remove from the green, yellow, and red lists all observation
|
||||
// times two or more hours old.
|
||||
model.getGreenList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getYellowList().pruneObTimeList(ObUtil.getDropTime());
|
||||
model.getRedList().pruneObTimeList(ObUtil.getDropTime());
|
||||
}
|
||||
for (int i = 0; i < report.length; i++) {
|
||||
newDataReceived = true;
|
||||
obTime = report[i].getObservationTime();
|
||||
if (latestObTime.before(obTime)) {
|
||||
latestObTime = obTime;
|
||||
}
|
||||
if (obTime.after(dropTime)) {
|
||||
// Initialize threat level for observation.
|
||||
ObConst.ThreatLevel threatTemp = ObConst.ThreatLevel.GRAY;
|
||||
// Begin worst case value and threat level evaluations for each
|
||||
// parameter. Note that worst case values and threat levels are
|
||||
// handled independently, because the county-by-county, zone-by-
|
||||
// zone threshold settings mean that the worst-case value may
|
||||
// not be generating the highest threat level (so you can't just
|
||||
// plug the worst-case value into get_threat_level()). Checks
|
||||
// against drop time allow expired values (older than the time
|
||||
// window specifies) to be discarded.
|
||||
|
||||
// Wind speed evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getWindSpeed() < report[i]
|
||||
.getWindSpeed()
|
||||
|| model.getWorstValueTimeReport().getWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setWindSpeed(
|
||||
report[i].getWindSpeed());
|
||||
model.getWorstValueTimeReport().setWindSpeed(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.WIND_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getWindSpeed().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setWindSpeed(threatTemp);
|
||||
model.getWorstThreatTimeReport().setWindSpeed(obTime);
|
||||
}
|
||||
|
||||
// Wind gust evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getWindGust() < report[i]
|
||||
.getWindGust()
|
||||
|| model.getWorstValueTimeReport().getWindGust()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setWindGust(
|
||||
report[i].getWindGust());
|
||||
model.getWorstValueTimeReport().setWindGust(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.GUST_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getWindGust().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getWindGust()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setWindGust(threatTemp);
|
||||
model.getWorstThreatTimeReport().setWindGust(obTime);
|
||||
}
|
||||
|
||||
// Peak wind evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getMaxWindSpeed() < report[i]
|
||||
.getMaxWindSpeed()
|
||||
|| model.getWorstValueTimeReport().getMaxWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setMaxWindSpeed(
|
||||
report[i].getMaxWindSpeed());
|
||||
model.getWorstValueTimeReport().setMaxWindSpeed(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.MAX_WIND_SPEED);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getMaxWindSpeed().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getMaxWindSpeed()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setMaxWindSpeed(threatTemp);
|
||||
model.getWorstThreatTimeReport().setMaxWindSpeed(obTime);
|
||||
}
|
||||
|
||||
// Visibility evaluations.
|
||||
|
||||
float vis = report[i].getVisibility();
|
||||
// The vis >=0 check prevents running afoul of the MISSING -999
|
||||
// value.
|
||||
if ((model.getWorstValueReport().getVisibility() > vis && vis >= 0)
|
||||
|| (vis >= 0 && model.getWorstValueTimeReport()
|
||||
.getVisibility().before(dropTime))) {
|
||||
// Divide by 16.0 to get statute miles.
|
||||
// model.getWorstValueReport().setVisibility(vis / 16.0f);
|
||||
// Update: in AWIPS II, visibility is in statute miles
|
||||
// due to processing upstream.
|
||||
model.getWorstValueTimeReport().setVisibility(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.VISIBILITY);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getVisibility().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getVisibility()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setVisibility(threatTemp);
|
||||
model.getWorstThreatTimeReport().setVisibility(obTime);
|
||||
}
|
||||
|
||||
// Temperature evaluations.
|
||||
// Check for missing report values to avoid getting locked into
|
||||
// a -999 as the "worst case".
|
||||
|
||||
if (((model.getWorstValueReport().getTemperature() > report[i]
|
||||
.getTemperature()) && report[i].getTemperature() != ObConst.MISSING)
|
||||
|| (model.getWorstValueTimeReport().getTemperature()
|
||||
.before(dropTime))) {
|
||||
model.getWorstValueReport().setTemperature(
|
||||
report[i].getTemperature());
|
||||
model.getWorstValueTimeReport().setTemperature(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.TEMPERATURE);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getTemperature().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getTemperature()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setTemperature(threatTemp);
|
||||
model.getWorstThreatTimeReport().setTemperature(obTime);
|
||||
}
|
||||
|
||||
// Wind chill evaluations.
|
||||
// Check for missing report values to avoid getting locked into
|
||||
// a -999 as the "worst case".
|
||||
|
||||
if (((model.getWorstValueReport().getWindChill() > report[i]
|
||||
.getWindChill()) && report[i].getWindChill() != ObConst.MISSING)
|
||||
|| (model.getWorstValueTimeReport().getWindChill()
|
||||
.before(dropTime))) {
|
||||
model.getWorstValueReport().setWindChill(
|
||||
report[i].getWindChill());
|
||||
model.getWorstValueTimeReport().setWindChill(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.WIND_CHILL);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getWindChill().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getWindChill()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setWindChill(threatTemp);
|
||||
model.getWorstThreatTimeReport().setWindChill(obTime);
|
||||
}
|
||||
|
||||
// Snow depth evaluations.
|
||||
|
||||
if (model.getWorstValueReport().getSnowDepth() < report[i]
|
||||
.getSnowDepth()
|
||||
|| model.getWorstValueTimeReport().getSnowDepth()
|
||||
.before(dropTime)) {
|
||||
model.getWorstValueReport().setSnowDepth(
|
||||
report[i].getSnowDepth());
|
||||
model.getWorstValueTimeReport().setSnowDepth(obTime);
|
||||
}
|
||||
|
||||
threatTemp = MonitorAreaThresholds.getThreatLevel(report[i],
|
||||
ObConst.VarName.SNOW_DEPTH);
|
||||
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
if ((model.getWorstThreatReport().getSnowDepth().ordinal() < threatTemp
|
||||
.ordinal())
|
||||
|| model.getWorstThreatTimeReport().getSnowDepth()
|
||||
.before(dropTime)) {
|
||||
model.getWorstThreatReport().setSnowDepth(threatTemp);
|
||||
model.getWorstThreatTimeReport().setSnowDepth(obTime);
|
||||
}
|
||||
|
||||
// Search the report's present weather string for
|
||||
// freezing precip.
|
||||
|
||||
String presentWx = report[i].getPresentWx();
|
||||
|
||||
threatTemp = ObConst.ThreatLevel.GRAY;
|
||||
|
||||
if ((presentWx.contains("FZ")) || (presentWx.contains("SN"))
|
||||
|| (presentWx.contains("SG"))
|
||||
|| (presentWx.contains("IC"))
|
||||
|| (presentWx.contains("PL"))
|
||||
|| (presentWx.contains("GR"))
|
||||
|| (presentWx.contains("GS"))) {
|
||||
// The present weather contains freezing precip.
|
||||
// Now check the freezing precip vector for the same Wx.
|
||||
|
||||
boolean uniquePresentWx = true;
|
||||
for (int j = 0; j < presentWxVec.size(); j++) {
|
||||
if (presentWx.equals(presentWxVec.get(j))) {
|
||||
uniquePresentWx = false;
|
||||
}
|
||||
}
|
||||
// If we have found a present weather string not yet
|
||||
// encountered in this run, append to the vector...
|
||||
if (uniquePresentWx) {
|
||||
// The present Wx has not been reported yet in this
|
||||
// run, so append it to the array.
|
||||
|
||||
presentWxVec.add(presentWx);
|
||||
|
||||
// Check for intensity prefix (light, moderate, heavy),
|
||||
// append to intensity vector.
|
||||
|
||||
if (String.valueOf(presentWx.charAt(0)).equals("+")) {
|
||||
intensityLevelVec.add(ObConst.IntensityLevel.HEAVY);
|
||||
} else if (String.valueOf(presentWx.charAt(0)).equals(
|
||||
"-")) {
|
||||
intensityLevelVec.add(ObConst.IntensityLevel.LIGHT);
|
||||
} else {
|
||||
intensityLevelVec
|
||||
.add(ObConst.IntensityLevel.MODERATE);
|
||||
}
|
||||
|
||||
// Append the frozen precip string.
|
||||
frozenPrecip += presentWx + " ";
|
||||
}
|
||||
|
||||
// Update present Wx time and set threat level to
|
||||
// yellow for frozen precip (note that
|
||||
// _latestFrozenPrecipTime
|
||||
// is an AbsTime, unlike the Report elements used to hold
|
||||
// times for other parameters, which are integers. This is
|
||||
// why obtime.unixTime() is not used.
|
||||
|
||||
latestFrozenPrecipTime = obTime;
|
||||
threatTemp = ThreatLevel.YELLOW;
|
||||
|
||||
}
|
||||
|
||||
// Update the station's overall threat level based on
|
||||
// presentWX results.
|
||||
if (threatLevel.ordinal() < threatTemp.ordinal()) {
|
||||
threatLevel = threatTemp;
|
||||
}
|
||||
|
||||
// insert the report's observation time into the correct
|
||||
// threat
|
||||
// list based on the report's threat level.
|
||||
switch (threatLevel) {
|
||||
case GREEN:
|
||||
model.getGreenList().storeDateTime(obTime);
|
||||
break;
|
||||
case YELLOW:
|
||||
model.getYellowList().storeDateTime(obTime);
|
||||
break;
|
||||
case RED:
|
||||
model.getRedList().storeDateTime(obTime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} // end switch
|
||||
} // end if (report is not too old)
|
||||
} // end report loop
|
||||
|
||||
// Initialize the boolean matching vector (which is true if there's a
|
||||
// match (if we've seen the basic string, without intensity, earlier
|
||||
// in the upcoming loop. It is assigned the size of the presentWxVec
|
||||
// vector (one T/F for each present weather element in the vector).
|
||||
List<Boolean> presentWxMatchVec = new ArrayList<Boolean>();
|
||||
// Initialize the present weather match vector.
|
||||
for (int i = 0; i < presentWxVec.size(); i++) {
|
||||
presentWxMatchVec.add(false);
|
||||
}
|
||||
String maxIntensityFrozenPrecip = "";
|
||||
|
||||
// This loop sorts through the frozen precip vector collected above.
|
||||
// The filter above identified the unique frozen precip strings. Now
|
||||
// that we have unique strings in a vector, we can sort through them
|
||||
// again, looking for the highest intensity. Only the highest intensity
|
||||
// of each unique present weather string will be listed in the Guardian
|
||||
// output (e.g., if -SNFZFG, SNFZFG, and +SNFZFG have been reported,
|
||||
// the +SNFZFG string will be displayed in the Guardian cursor outputi).
|
||||
for (int i = 0; i < presentWxVec.size(); i++) {
|
||||
// Check to see if this string (sans intensity) has been matched
|
||||
// in a prior iteration. If so, continue.
|
||||
if (presentWxMatchVec.get(i)) {
|
||||
continue;
|
||||
}
|
||||
String stringI = "";
|
||||
ObConst.IntensityLevel maxIntensityLevel;
|
||||
|
||||
// Get the present weather strings without the intensity
|
||||
// prefix. This is straightforward for moderate events
|
||||
// (because there is no prefix), but for light or heavy
|
||||
// events, the TextString::right() method is used to lop
|
||||
// off initial +/- character.
|
||||
if (intensityLevelVec.get(i) == ObConst.IntensityLevel.MODERATE) {
|
||||
stringI = presentWxVec.get(i);
|
||||
} else {
|
||||
stringI = presentWxVec.get(i).replaceFirst("(\\+|-)", "");
|
||||
}
|
||||
|
||||
// Initialize the max intensity level for this event.
|
||||
maxIntensityLevel = intensityLevelVec.get(i);
|
||||
|
||||
// Initialize the string which will hold the event of the current
|
||||
// type that has the highest intensity.
|
||||
String maxIntensityPresentWx = "";
|
||||
|
||||
// Start a second loop to compare the rest of the vector to
|
||||
// the current weather event.
|
||||
for (int j = i + 1; j < presentWxVec.size(); j++) {
|
||||
// As was done above, skip over vector elements which have
|
||||
// already been matched to the same weather event, and thus
|
||||
// have been accounted for.
|
||||
if (presentWxMatchVec.get(j)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the present weather strings without the intensity
|
||||
// prefix (as was done in the i-loop.)
|
||||
String stringJ = "";
|
||||
if (intensityLevelVec.get(j) == ObConst.IntensityLevel.MODERATE) {
|
||||
stringJ = presentWxVec.get(j);
|
||||
} else {
|
||||
stringJ = presentWxVec.get(j).replaceFirst("(\\+|-)", "");
|
||||
}
|
||||
|
||||
// Compare the strings from the nested loops...
|
||||
if (stringI.equals(stringJ)) {
|
||||
// If there is a match, flag the corresponding boolean
|
||||
// vector element as true.
|
||||
presentWxMatchVec.set(j, true);
|
||||
|
||||
// Compare the current max intensity found for this event
|
||||
// type with the intensity of the current inner-loop
|
||||
// vector[i] element. Change if necessary.
|
||||
if (maxIntensityLevel.compareTo(intensityLevelVec.get(j)) < 0) {
|
||||
maxIntensityLevel = intensityLevelVec.get(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Append the appropriate maximum intensity prefix (for
|
||||
// light or heavy) the max event type string.
|
||||
if (maxIntensityLevel == ObConst.IntensityLevel.HEAVY) {
|
||||
maxIntensityPresentWx = "+" + stringI;
|
||||
} else if (maxIntensityLevel == ObConst.IntensityLevel.LIGHT) {
|
||||
maxIntensityPresentWx = "-" + stringI;
|
||||
} else {
|
||||
maxIntensityPresentWx = stringI;
|
||||
}
|
||||
|
||||
maxIntensityFrozenPrecip += maxIntensityPresentWx = " ";
|
||||
// Now that the parent loop will iterate, assign the matching
|
||||
// vector element as true -- this weather event type does not
|
||||
// need to be evaluated again.
|
||||
presentWxMatchVec.set(i, true);
|
||||
}
|
||||
|
||||
// Update max intensity frozen precip values to Guardian output
|
||||
// string provided the time they were reported is within the drop
|
||||
// time. Also check for length to ensure that quick, back-to
|
||||
// back updates don't blot out the values (the only way the
|
||||
// maxIntensityFrozenPrecipString would be 0 sized if the
|
||||
// _latestFrozenPrecipTime > drop_time is if notifications came
|
||||
// in rapidly back to back, and no new obs were reported in that
|
||||
// time.
|
||||
|
||||
if (!latestFrozenPrecipTime.before(dropTime)) {
|
||||
guardianFrozenPrecip = maxIntensityFrozenPrecip;
|
||||
} else {
|
||||
guardianFrozenPrecip = "";
|
||||
}
|
||||
|
||||
// now determine the new overall threat level.
|
||||
threatLevel = ThreatLevel.GRAY;
|
||||
String threatMessage = "";
|
||||
if (!model.getRedList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.RED;
|
||||
threatMessage = "Monitored observations at RED threshold level.";
|
||||
} else if (!model.getYellowList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.YELLOW;
|
||||
threatMessage = "Monitored observations at YELLOW threshold level.";
|
||||
} else if (!model.getGreenList().isObTimeListEmpty()) {
|
||||
threatLevel = ThreatLevel.GREEN;
|
||||
threatMessage = "Monitored observations at GREEN threshold level.";
|
||||
} else {
|
||||
threatMessage = "No monitoring information from any observation platform.";
|
||||
}
|
||||
|
||||
String worstVal = "";
|
||||
|
||||
if (threatLevel != ThreatLevel.GRAY) {
|
||||
threatMessage += "\n\nMONITORED VALUES \t HIGHEST THREAT LEVELS\n ";
|
||||
|
||||
// Visibility threat message
|
||||
if (model.getWorstValueReport().getVisibility() < 0
|
||||
|| model.getWorstValueReport().getVisibility() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.2f mi", model
|
||||
.getWorstValueReport().getVisibility());
|
||||
}
|
||||
threatMessage += "Min Vis: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getVisibility().ordinal()] + "\n ";
|
||||
|
||||
// Wind speed threat message
|
||||
if (model.getWorstValueReport().getWindSpeed() < 0
|
||||
|| model.getWorstValueReport().getWindSpeed() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getWindSpeed());
|
||||
}
|
||||
threatMessage += "Max Wind Speed: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getWindSpeed().ordinal()] + "\n ";
|
||||
|
||||
// Wind gust threat message
|
||||
if (model.getWorstValueReport().getWindGust() < 0
|
||||
|| model.getWorstValueReport().getWindGust() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getWindGust());
|
||||
}
|
||||
threatMessage += "Max Wind Gust: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getWindGust().ordinal()] + "\n ";
|
||||
|
||||
// Peak Wind speed threat message
|
||||
if (model.getWorstValueReport().getMaxWindSpeed() < 0
|
||||
|| model.getWorstValueReport().getMaxWindSpeed() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f kts", model
|
||||
.getWorstValueReport().getMaxWindSpeed());
|
||||
}
|
||||
threatMessage += "Max Peak Wind: "
|
||||
+ worstVal
|
||||
+ "\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getMaxWindSpeed().ordinal()] + "\n ";
|
||||
|
||||
// Temperature threat message
|
||||
if ((model.getWorstValueReport().getTemperature() == ObConst.MISSING)
|
||||
|| model.getWorstValueReport().getTemperature() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
// Convert from degrees K to F.
|
||||
float lowestTempDegF = 1.8f * (model.getWorstValueReport()
|
||||
.getTemperature() - 273.15f) + 32.0f;
|
||||
worstVal = ObUtil.getDisplayString("%.1f F", lowestTempDegF);
|
||||
}
|
||||
threatMessage += "Min Temp: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getTemperature().ordinal()] + "\n ";
|
||||
|
||||
// Wind chill threat message
|
||||
if ((model.getWorstValueReport().getWindChill() == ObConst.MISSING)
|
||||
|| model.getWorstValueReport().getWindChill() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f F", model
|
||||
.getWorstValueReport().getWindChill());
|
||||
}
|
||||
threatMessage += "Min Wind Chill Temp: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getWindChill().ordinal()] + "\n ";
|
||||
|
||||
// Snow depth threat message
|
||||
if ((model.getWorstValueReport().getSnowDepth() < 0)
|
||||
|| model.getWorstValueReport().getSnowDepth() > 1e20f) {
|
||||
worstVal = "N/A";
|
||||
} else {
|
||||
worstVal = ObUtil.getDisplayString("%.1f in.", model
|
||||
.getWorstValueReport().getSnowDepth());
|
||||
}
|
||||
threatMessage += "Max Snow Depth: "
|
||||
+ worstVal
|
||||
+ "\t\t "
|
||||
+ ObConst.THREAT_LEVEL_STRINGS[model.getWorstThreatReport()
|
||||
.getSnowDepth().ordinal()] + "\n ";
|
||||
|
||||
// Frozen precipitation threat message
|
||||
if (guardianFrozenPrecip.length() == 0) {
|
||||
threatMessage += "No frozen precip reported.\n";
|
||||
} else {
|
||||
threatMessage += "Frozen precip reported (highest intensity): "
|
||||
+ guardianFrozenPrecip + "\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If Fog Monitor algorithm output is to be considered in the
|
||||
// obs app threat level, then evaluate the max fog threat level.
|
||||
|
||||
if (model.isUsingFogThreatLevel()) {
|
||||
// Get the fog threat level.
|
||||
ThreatLevel fogThreatLevel = ObUtil.readFogThreatLevel();
|
||||
|
||||
// Convert threat level number into string for text output.
|
||||
String fogThreatString = ObConst.THREAT_LEVEL_STRINGS[fogThreatLevel
|
||||
.ordinal()];
|
||||
|
||||
// Convert to upper case.
|
||||
String upcaseFogThreatString = fogThreatString.toUpperCase();
|
||||
|
||||
// Define extra Fog Monitor messages to be delivered to Guardian.
|
||||
if (fogThreatLevel == ThreatLevel.GRAY) {
|
||||
threatMessage += "\nNo Fog Monitor threat levels available";
|
||||
} else if (fogThreatLevel == ThreatLevel.BLACK) {
|
||||
threatMessage += "\nFog Monitor error. Check FMprocessor on server. ";
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor at " + upcaseFogThreatString
|
||||
+ " threshold level.";
|
||||
}
|
||||
|
||||
// Choose the higher of the two threats as the level to go forward.
|
||||
if ((fogThreatLevel.compareTo(threatLevel)) > 0) {
|
||||
threatLevel = fogThreatLevel;
|
||||
}
|
||||
} else {
|
||||
threatMessage += "\nFog Monitor input not contributing to SNOW icon.\n";
|
||||
}
|
||||
|
||||
// Setup string for latest obstime; N/A if none available.
|
||||
String obTimeString = "";
|
||||
if (latestObTime.before(dropTime)) {
|
||||
obTimeString = "N/A";
|
||||
} else {
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
obTimeString = ObUtil.getDisplayString(latestObTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
}
|
||||
String dropTimeString = null;
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
dropTimeString = ObUtil.getDisplayString(dropTime,
|
||||
ObConst.DATE_FORMAT);
|
||||
}
|
||||
|
||||
// Set up time window character string.
|
||||
String timeCharStr = ObUtil.getDisplayString("%5.2f",
|
||||
(float) MonitoringArea.getTimeWindow());
|
||||
|
||||
threatMessage += "Latest Observation (GMT): " + obTimeString
|
||||
+ "\nEarliest Report Time Considered (GMT): " + dropTimeString
|
||||
+ "\nTime Window (hours): " + timeCharStr + "\n";
|
||||
|
||||
// Send the message to AlertViz f/k/a Guardian.
|
||||
String mssg = "";
|
||||
int priority = 0;
|
||||
switch (threatLevel) {
|
||||
case RED:
|
||||
priority = 1;
|
||||
break;
|
||||
case YELLOW:
|
||||
priority = 2;
|
||||
break;
|
||||
case GREEN:
|
||||
priority = 3;
|
||||
break;
|
||||
case BLACK:
|
||||
priority = 4;
|
||||
break;
|
||||
default:
|
||||
priority = 5;
|
||||
break;
|
||||
}
|
||||
|
||||
String type = "";
|
||||
type = "WinterWeather";
|
||||
synchronized(ObConst.DATE_FORMAT){
|
||||
mssg = type
|
||||
+ " "
|
||||
+ ObUtil.getDisplayString(ObUtil.getThreatTime(),
|
||||
ObConst.DATE_FORMAT) + "\n" + threatMessage;
|
||||
}
|
||||
String key = "";
|
||||
key = "SNOW";
|
||||
|
||||
// TODO Send the message (mssg) to AlertViz f/k/a Guardian.
|
||||
// System.out.println(mssg + " " + "MONITOR" + " " + key + " " +
|
||||
// priority);
|
||||
/* kwz model.getSnowDisplay returns null. and processFogReport.java also working on this part.
|
||||
* so just comment out for now
|
||||
model.getSnowDisplay().putMessage(
|
||||
mssg + " " + "MONITOR:" + " " + key + " " + "RT1: "
|
||||
+ report[0].getReportType().toString() + " " + "STN1: "
|
||||
+ report[0].getPlatformId() + " " + "PRIORITY: "
|
||||
+ priority);
|
||||
model.getSnowDisplay().putPriority(threatLevel);
|
||||
*/
|
||||
}
|
||||
}
|
|
@ -1,217 +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.uf.viz.monitor.snow;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstThreat;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstTime;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReportWorstValue;
|
||||
import com.raytheon.uf.viz.monitor.data.ObTime;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IGuardianListener;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
|
||||
/**
|
||||
* SnowReportModel class is a singleton class that contains the report model for
|
||||
* this decision assistance tool.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 13, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SnowReportModel {
|
||||
|
||||
/**
|
||||
* The static singleton instance.
|
||||
*/
|
||||
private static SnowReportModel instance;
|
||||
|
||||
/**
|
||||
* Indicates whether to clear all existing observations (if true) or honor
|
||||
* the age-out scheme (if false) protected boolean redoFullThreatInterval;
|
||||
*/
|
||||
private boolean redoFullThreatInterval;
|
||||
|
||||
/**
|
||||
* Indicates whether the forecast office wants the Fog Monitor's SAFESEAS
|
||||
* fog threat levels considered when determining the overall marine threat
|
||||
* level
|
||||
*/
|
||||
private boolean usingFogThreatLevel;
|
||||
|
||||
/** The "green" list */
|
||||
private ObTime greenList = new ObTime(ObConst.ThreatLevel.GREEN);
|
||||
|
||||
/** The "yellow" list */
|
||||
private ObTime yellowList = new ObTime(ObConst.ThreatLevel.YELLOW);
|
||||
|
||||
/** The "red" list */
|
||||
private ObTime redList = new ObTime(ObConst.ThreatLevel.RED);
|
||||
|
||||
/** The worst value report */
|
||||
private ObReportWorstValue worstValueReport = new ObReportWorstValue()
|
||||
.init();
|
||||
|
||||
/** The worst value time report */
|
||||
private ObReportWorstTime worstValueTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/** The worst threat report */
|
||||
private ObReportWorstThreat worstThreatReport = new ObReportWorstThreat()
|
||||
.init();
|
||||
|
||||
/** The worst threat time report */
|
||||
private ObReportWorstTime worstThreatTimeReport = new ObReportWorstTime()
|
||||
.init();
|
||||
|
||||
/**
|
||||
* Observing Station Location
|
||||
*/
|
||||
private final Map<String, com.vividsolutions.jts.geom.Point> obStationLocation = new HashMap<String, com.vividsolutions.jts.geom.Point>();
|
||||
|
||||
/**
|
||||
* Observing Station Geometry
|
||||
*/
|
||||
private final Map<String, PreparedGeometry> obStationGeometry = new HashMap<String, PreparedGeometry>();
|
||||
|
||||
/**
|
||||
* Display (stand-in) for Guardian type alert visualization.
|
||||
*/
|
||||
private IGuardianListener snowDisplay;
|
||||
|
||||
/**
|
||||
* Singleton constructor.
|
||||
*
|
||||
* @return the observation station model.
|
||||
*/
|
||||
public static synchronized SnowReportModel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new SnowReportModel();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor: Use getInstance().
|
||||
*/
|
||||
private SnowReportModel() {
|
||||
}
|
||||
|
||||
public boolean isRedoFullThreatInterval() {
|
||||
return redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public void setRedoFullThreatInterval(boolean redoFullThreatInterval) {
|
||||
this.redoFullThreatInterval = redoFullThreatInterval;
|
||||
}
|
||||
|
||||
public ObTime getGreenList() {
|
||||
return greenList;
|
||||
}
|
||||
|
||||
public void setGreenList(ObTime greenList) {
|
||||
this.greenList = greenList;
|
||||
}
|
||||
|
||||
public ObTime getYellowList() {
|
||||
return yellowList;
|
||||
}
|
||||
|
||||
public void setYellowList(ObTime yellowList) {
|
||||
this.yellowList = yellowList;
|
||||
}
|
||||
|
||||
public ObTime getRedList() {
|
||||
return redList;
|
||||
}
|
||||
|
||||
public void setRedList(ObTime redList) {
|
||||
this.redList = redList;
|
||||
}
|
||||
|
||||
public Map<String, com.vividsolutions.jts.geom.Point> getObStationLocation() {
|
||||
return obStationLocation;
|
||||
}
|
||||
|
||||
public Map<String, PreparedGeometry> getObStationGeometry() {
|
||||
return obStationGeometry;
|
||||
}
|
||||
|
||||
public ObReportWorstValue getWorstValueReport() {
|
||||
return worstValueReport;
|
||||
}
|
||||
|
||||
public void setWorstValueReport(ObReportWorstValue worstValueReport) {
|
||||
this.worstValueReport = worstValueReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstValueTimeReport() {
|
||||
return worstValueTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstValueTimeReport(ObReportWorstTime worstValueTimeReport) {
|
||||
this.worstValueTimeReport = worstValueTimeReport;
|
||||
}
|
||||
|
||||
public ObReportWorstThreat getWorstThreatReport() {
|
||||
return worstThreatReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatReport(ObReportWorstThreat worstThreatReport) {
|
||||
this.worstThreatReport = worstThreatReport;
|
||||
}
|
||||
|
||||
public ObReportWorstTime getWorstThreatTimeReport() {
|
||||
return worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public void setWorstThreatTimeReport(ObReportWorstTime worstThreatTimeReport) {
|
||||
this.worstThreatTimeReport = worstThreatTimeReport;
|
||||
}
|
||||
|
||||
public boolean isUsingFogThreatLevel() {
|
||||
return usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public void setUsingFogThreatLevel(boolean usingFogThreatLevel) {
|
||||
this.usingFogThreatLevel = usingFogThreatLevel;
|
||||
}
|
||||
|
||||
public IGuardianListener getSnowDisplay() {
|
||||
return snowDisplay;
|
||||
}
|
||||
|
||||
public void setSnowDisplay(IGuardianListener snowDisplay) {
|
||||
this.snowDisplay = snowDisplay;
|
||||
}
|
||||
|
||||
}
|
|
@ -13,8 +13,6 @@ Require-Bundle: org.eclipse.ui,
|
|||
com.raytheon.viz.ui;bundle-version="1.10.13",
|
||||
org.geotools;bundle-version="2.4.0",
|
||||
com.raytheon.viz.alerts;bundle-version="1.10.13",
|
||||
com.raytheon.viz.aviation;bundle-version="1.11.1",
|
||||
com.raytheon.uf.edex.plugin.mesowest;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.monitor;bundle-version="1.11.17",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
|
|
|
@ -1,194 +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.uf.viz.monitor;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.sfcobs.ObsCommon;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ConfigUtil;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* This class generates an observation report from the actual observation
|
||||
* (sfcobs)
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GenerateMarineObReport implements IObReportable {
|
||||
|
||||
/**
|
||||
* This method generates an observation report from the actual observation
|
||||
* (sfcobs)
|
||||
*
|
||||
* @param marine
|
||||
* -- the marine record
|
||||
* @param obReport
|
||||
* -- the observation report
|
||||
* @param chosenAppKey
|
||||
* -- the chosen application key
|
||||
* @return -- the generated observation report
|
||||
*/
|
||||
@Override
|
||||
public ObReport generateObReport(PluginDataObject marine,
|
||||
ObReport obReport, ChosenAppKey chosenAppKey) {
|
||||
// Generate the observation report.
|
||||
obReport
|
||||
.setObservationTime(((ObsCommon) marine).getTimeObs().getTime());
|
||||
obReport.setPlatformId(((ObsCommon) marine).getStationId());
|
||||
obReport.setStationary(true);
|
||||
obReport.setLatitude((float) ((ObsCommon) marine).getLatitude());
|
||||
obReport.setLongitude((float) ((ObsCommon) marine).getLongitude());
|
||||
try {
|
||||
obReport.setWindSpeed(((ObsCommon) marine).getWindSpeed()
|
||||
.floatValue());
|
||||
} catch (Exception e1) {
|
||||
obReport.setWindSpeed(0);
|
||||
}
|
||||
try {
|
||||
obReport.setWindDir(((ObsCommon) marine).getWindDirection());
|
||||
} catch (Exception e) {
|
||||
obReport.setWindDir(0);
|
||||
}
|
||||
obReport.setHighResWaveHeight(ObConst.MISSING);
|
||||
obReport.setWaveSteepness(ObConst.MISSING);
|
||||
try {
|
||||
obReport.setVisibility(ConfigUtil
|
||||
.lookupVisibility(((ObsCommon) marine).getHorzVisibility()
|
||||
.floatValue()));
|
||||
} catch (Exception e) {
|
||||
obReport.setVisibility(0);
|
||||
}
|
||||
try {
|
||||
obReport
|
||||
.setTemperature(((ObsCommon) marine).getTemp().floatValue());
|
||||
} catch (Exception e) {
|
||||
obReport.setTemperature(ObConst.MISSING);
|
||||
}
|
||||
obReport.setSeaLevelPress(ObConst.MISSING);
|
||||
obReport.setWavePeriod(ObConst.MISSING);
|
||||
obReport.setWindGust(ObConst.MISSING);
|
||||
obReport.setPSwellHeight(ObConst.MISSING);
|
||||
obReport.setPSwellPeriod(ObConst.MISSING);
|
||||
obReport.setPSwellDir(ObConst.MISSING);
|
||||
obReport.setSSwellHeight(ObConst.MISSING);
|
||||
obReport.setSSwellPeriod(ObConst.MISSING);
|
||||
obReport.setSSwellDir(ObConst.MISSING);
|
||||
try {
|
||||
obReport.setPressure(((ObsCommon) marine).getPressureAltimeter());
|
||||
} catch (Exception e) {
|
||||
obReport.setPressure(ObConst.MISSING);
|
||||
}
|
||||
try {
|
||||
obReport.setPressureChange(((ObsCommon) marine)
|
||||
.getPressureAltimeter());
|
||||
} catch (Exception e) {
|
||||
obReport.setPressureChange(ObConst.MISSING);
|
||||
}
|
||||
obReport.setPressChangeChar((short) 0);
|
||||
try {
|
||||
obReport.setDewpoint(((ObsCommon) marine).getDwpt().floatValue());
|
||||
} catch (Exception e) {
|
||||
obReport.setDewpoint(ObConst.MISSING);
|
||||
}
|
||||
obReport.setMaxWindSpeed(ObConst.MISSING);
|
||||
try {
|
||||
obReport.setHourlyPrecip(((ObsCommon) marine).getWx_past_1());
|
||||
} catch (Exception e) {
|
||||
obReport.setHourlyPrecip(ObConst.MISSING);
|
||||
}
|
||||
try {
|
||||
obReport.setPresentWx(((ObsCommon) marine).getWx_past_1()
|
||||
.toString());
|
||||
} catch (Exception e) {
|
||||
obReport.setPresentWx("");
|
||||
}
|
||||
try {
|
||||
obReport.setRawMessage(((ObsCommon) marine).getMessageData()
|
||||
.toString());
|
||||
} catch (Exception e) {
|
||||
obReport.setRawMessage("");
|
||||
}
|
||||
obReport.setReportType(findReportType(((ObsCommon) marine)
|
||||
.getReportType()));
|
||||
if (chosenAppKey == ChosenAppKey.SNOW) {
|
||||
obReport = ObUtil.generateObReportSnow(obReport,
|
||||
((ObsCommon) marine).getMessageData().toString());
|
||||
} else if (chosenAppKey == ChosenAppKey.FOG) {
|
||||
try {
|
||||
obReport.setRelativeHumidity(((ObsCommon) marine)
|
||||
.getTotalCloudCover());
|
||||
} catch (Exception e) {
|
||||
obReport.setRelativeHumidity(ObConst.MISSING);
|
||||
}
|
||||
try {
|
||||
obReport.setCeiling(((ObsCommon) marine).getVertVisibility());
|
||||
} catch (Exception e) {
|
||||
obReport.setCeiling(ObConst.MISSING);
|
||||
}
|
||||
}
|
||||
|
||||
return obReport;
|
||||
}
|
||||
|
||||
// Method that finds the report type enumeration of a marine report
|
||||
private ReportType findReportType(int rt) {
|
||||
ReportType reportType = ReportType.MARINE;
|
||||
switch (rt) {
|
||||
case IDecoderConstants.SYNOPTIC_FIXED_LAND:
|
||||
reportType = ReportType.SYNOPTIC_FIXED_LAND;
|
||||
break;
|
||||
case IDecoderConstants.SYNOPTIC_MOBILE_LAND:
|
||||
reportType = ReportType.SYNOPTIC_MOBILE_LAND;
|
||||
break;
|
||||
case IDecoderConstants.SYNOPTIC_SHIP:
|
||||
reportType = ReportType.SYNOPTIC_SHIP;
|
||||
break;
|
||||
case IDecoderConstants.SYNOPTIC_CMAN:
|
||||
reportType = ReportType.SYNOPTIC_CMAN;
|
||||
break;
|
||||
case IDecoderConstants.SYNOPTIC_MOORED_BUOY:
|
||||
reportType = ReportType.SYNOPTIC_MOORED_BUOY;
|
||||
break;
|
||||
case IDecoderConstants.DRIFTING_BUOY:
|
||||
reportType = ReportType.DRIFTING_BUOY;
|
||||
break;
|
||||
case IDecoderConstants.SYNOPTIC_MAROB:
|
||||
reportType = ReportType.SYNOPTIC_MAROB;
|
||||
break;
|
||||
}
|
||||
|
||||
return reportType;
|
||||
}
|
||||
}
|
|
@ -1,120 +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.uf.viz.monitor;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* This class generates an observation report from the actual observation
|
||||
* (mesowest)
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GenerateMesoObReport implements IObReportable {
|
||||
|
||||
/**
|
||||
* This method generates an observation report from the actual observation
|
||||
* (mesowest)
|
||||
*
|
||||
* @param meso
|
||||
* -- the mesonet record
|
||||
* @param obReport
|
||||
* -- the observation report
|
||||
* @param chosenAppKey
|
||||
* -- the chosen application key
|
||||
* @return -- the generated observation report
|
||||
*/
|
||||
@Override
|
||||
public ObReport generateObReport(PluginDataObject meso, ObReport obReport,
|
||||
ChosenAppKey chosenAppKey) {
|
||||
// Generate the observation report.
|
||||
obReport.setObservationTime(((MESOWestRecord) meso).getTimeObs()
|
||||
.getTime());
|
||||
obReport.setPlatformId(((MESOWestRecord) meso).getStationId());
|
||||
obReport.setStationary(true);
|
||||
obReport.setLatitude((float) ((MESOWestRecord) meso).getLatitude());
|
||||
obReport.setLongitude((float) ((MESOWestRecord) meso).getLongitude());
|
||||
obReport.setWindSpeed(((MESOWestRecord) meso).getWindSpeed()
|
||||
.floatValue());
|
||||
try {
|
||||
obReport.setWindDir(((MESOWestRecord) meso).getWindDirection()
|
||||
.floatValue());
|
||||
} catch (Exception e) {
|
||||
obReport.setWindDir(0);
|
||||
}
|
||||
obReport.setHighResWaveHeight(ObConst.MISSING);
|
||||
obReport.setWaveSteepness(ObConst.MISSING);
|
||||
obReport.setVisibility(0);
|
||||
|
||||
obReport.setSeaLevelPress(((MESOWestRecord) meso).getSeaLevelPressure().floatValue());
|
||||
obReport.setTemperature(((MESOWestRecord) meso).getTemp().floatValue());
|
||||
obReport.setWavePeriod(ObConst.MISSING);
|
||||
obReport
|
||||
.setWindGust(((MESOWestRecord) meso).getWindGust().floatValue());
|
||||
obReport.setPSwellHeight(ObConst.MISSING);
|
||||
obReport.setPSwellPeriod(ObConst.MISSING);
|
||||
obReport.setPSwellDir(ObConst.MISSING);
|
||||
obReport.setSSwellHeight(ObConst.MISSING);
|
||||
obReport.setSSwellPeriod(ObConst.MISSING);
|
||||
obReport.setSSwellDir(ObConst.MISSING);
|
||||
obReport.setPressure(((MESOWestRecord) meso).getAltimeter()
|
||||
.floatValue());
|
||||
obReport.setPressureChange(((MESOWestRecord) meso).getPressure()
|
||||
.floatValue());
|
||||
|
||||
obReport.setPressChangeChar((short) 0);
|
||||
|
||||
obReport.setDewpoint(((MESOWestRecord) meso).getDwpt().floatValue());
|
||||
obReport.setMaxWindSpeed(ObConst.MISSING);
|
||||
obReport.setHourlyPrecip(((MESOWestRecord) meso).getPrecip_01H()
|
||||
.floatValue());
|
||||
|
||||
obReport.setRawMessage(((MESOWestRecord) meso).getMessageData()
|
||||
.toString());
|
||||
obReport.setReportType(ReportType.MESONET);
|
||||
if (chosenAppKey == ChosenAppKey.SNOW) {
|
||||
obReport = ObUtil.generateObReportSnow(obReport,
|
||||
((MESOWestRecord) meso).getMessageData().toString());
|
||||
} else if (chosenAppKey == ChosenAppKey.FOG) {
|
||||
obReport = ObUtil.generateObReportFog(obReport, null, 0);
|
||||
|
||||
}
|
||||
|
||||
return obReport;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,150 +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.uf.viz.monitor;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord;
|
||||
import com.raytheon.uf.common.dataplugin.obs.metar.util.WeatherCondition;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* This class generates an observation report from the actual observation
|
||||
* (metar)
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 2, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GenerateMetarObReport implements IObReportable {
|
||||
|
||||
/**
|
||||
* This method generates an observation report from the actual observation
|
||||
* (metar)
|
||||
*
|
||||
* @param metar
|
||||
* -- the metar record
|
||||
* @param obReport
|
||||
* -- the observation report
|
||||
* @param chosenAppKey
|
||||
* -- the chosen application key
|
||||
* @return -- the generated observation report
|
||||
*/
|
||||
@Override
|
||||
public ObReport generateObReport(PluginDataObject report, ObReport obReport,
|
||||
ChosenAppKey chosenAppKey) {
|
||||
// Generate the observation report.
|
||||
if(report instanceof MetarRecord) {
|
||||
MetarRecord metar = (MetarRecord) report;
|
||||
obReport.setObservationTime(metar.getTimeObs()
|
||||
.getTime());
|
||||
obReport.setPlatformId(metar.getStationId());
|
||||
obReport.setStationary(true);
|
||||
obReport.setLatitude((float) metar.getLatitude());
|
||||
obReport.setLongitude((float) metar.getLongitude());
|
||||
obReport.setWindSpeed(metar.getWindSpeed());
|
||||
|
||||
try {
|
||||
obReport.setWindDir(Float.parseFloat(metar
|
||||
.getWindDir()));
|
||||
} catch (Exception e) {
|
||||
obReport.setWindDir(0);
|
||||
}
|
||||
|
||||
obReport.setHighResWaveHeight(ObConst.MISSING);
|
||||
obReport.setWaveSteepness(ObConst.MISSING);
|
||||
|
||||
try {
|
||||
obReport.setVisibility(metar.getVisibility());
|
||||
} catch (Exception e) {
|
||||
obReport.setVisibility(0);
|
||||
}
|
||||
|
||||
obReport.setSeaLevelPress(metar.getSeaLevelPress());
|
||||
obReport.setWavePeriod(ObConst.MISSING);
|
||||
obReport.setWindGust(metar.getWindGust());
|
||||
obReport.setPSwellHeight(ObConst.MISSING);
|
||||
obReport.setPSwellPeriod(ObConst.MISSING);
|
||||
obReport.setPSwellDir(ObConst.MISSING);
|
||||
obReport.setSSwellHeight(ObConst.MISSING);
|
||||
obReport.setSSwellPeriod(ObConst.MISSING);
|
||||
obReport.setSSwellDir(ObConst.MISSING);
|
||||
obReport.setPressure(metar.getAltimeter());
|
||||
obReport.setPressureChange(metar.getPressChange3Hour());
|
||||
|
||||
try {
|
||||
obReport.setPressChangeChar(Short.parseShort(metar
|
||||
.getPressChangeChar()));
|
||||
} catch (NumberFormatException e) {
|
||||
obReport.setPressChangeChar((short) 0);
|
||||
}
|
||||
|
||||
obReport.setDewpoint(metar.getDewPoint());
|
||||
obReport.setTemperature(metar.getTemperature());
|
||||
obReport.setMaxWindSpeed(ObConst.MISSING);
|
||||
|
||||
obReport.setHourlyPrecip(metar.getPrecip1Hour());
|
||||
obReport.setPresentWx(WeatherCondition.toCanonicalForm(metar.getWeatherCondition()));
|
||||
obReport.setRawMessage(metar.getMessageData());
|
||||
obReport.setReportType(ReportType.METAR);
|
||||
|
||||
if (chosenAppKey == ChosenAppKey.SNOW) {
|
||||
obReport = ObUtil.generateObReportSnow(obReport,
|
||||
metar.getMessageData());
|
||||
} else if (chosenAppKey == ChosenAppKey.FOG) {
|
||||
obReport = ObUtil.generateObReportFog(obReport,
|
||||
metar.getSkyCoverage(),
|
||||
metar.getVertVisibility());
|
||||
}
|
||||
|
||||
// conversions
|
||||
if (obReport.getCeiling() != ObConst.MISSING) {
|
||||
obReport.setCeiling(obReport.getCeiling()/100);
|
||||
}
|
||||
if (metar.getDewPoint() != ObConst.MISSING) {
|
||||
//convert to fahrenheit
|
||||
obReport.setDewpoint((metar.getDewPoint()*(9f/5f))+32.0f);
|
||||
}
|
||||
if (metar.getTemperature() != ObConst.MISSING) {
|
||||
//convert to fahrenheit
|
||||
obReport.setTemperature((metar.getTemperature()*(9f/5f))+32.0f);
|
||||
}
|
||||
// set the depression
|
||||
if (obReport.getTemperature() != ObConst.MISSING &&
|
||||
obReport.getDewpoint() != ObConst.MISSING) {
|
||||
obReport.setDewpointDepr(obReport.getTemperature()-obReport.getDewpoint());
|
||||
}
|
||||
}
|
||||
|
||||
return obReport;
|
||||
}
|
||||
}
|
|
@ -1,48 +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.uf.viz.monitor;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
|
||||
/**
|
||||
* The IObReportable interface specifies method(s) that effect display of
|
||||
* decision assistance tool output.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 2, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IObReportable {
|
||||
|
||||
ObReport generateObReport(PluginDataObject obj, ObReport obReport,
|
||||
ChosenAppKey chosenAppKey);
|
||||
|
||||
}
|
|
@ -1,424 +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.uf.viz.monitor;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
||||
import com.raytheon.uf.viz.monitor.data.SafeSeasThresholdStruct;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogDisplay;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasDisplay;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowDisplay;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
|
||||
|
||||
/**
|
||||
* The MonitorThresholdDataFactory class is a "Simple Factory Pattern" that
|
||||
* creates a monitor threshold data entity that uses the same data class layout
|
||||
* as the legacy SSthresholdStruct.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 20, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public final class MonitorThresholdDataFactory {
|
||||
|
||||
// Private constructor.
|
||||
private MonitorThresholdDataFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* createMonitorThresholdData is a static method in a simple factory pattern
|
||||
* that news-up a HashMap of MonitorThresholdStruct objects requested.
|
||||
*
|
||||
* @param app
|
||||
* -- the kind of application in decision assistance tool suite
|
||||
* @param usage
|
||||
* -- the usage of the threshold data, either monitor or display
|
||||
* @param level
|
||||
* -- the threat level of the threshold data, e.g., red or yellow
|
||||
* @param areaId
|
||||
* -- array of area IDs
|
||||
* @param config
|
||||
* -- MonitorThresholdConfiguration object that holds the
|
||||
* configuration data for the app and usage.
|
||||
* @return -- HashMap of MonitorThresholdStruct objects keyed by the areaId.
|
||||
*/
|
||||
public static HashMap<String, SafeSeasThresholdStruct> createMonitorThresholdData(
|
||||
ChosenAppKey app, DataUsageKey usage, ThreatLevel level,
|
||||
String[] areaId, MonitorThresholdConfiguration config) {
|
||||
HashMap<String, SafeSeasThresholdStruct> data = new HashMap<String, SafeSeasThresholdStruct>();
|
||||
|
||||
for (int i = 0; i < areaId.length; i++) {
|
||||
data.put(areaId[i], createMonitorThresholdData(app, usage, level,
|
||||
areaId[i], config));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* createMonitorThresholdData is a static method in a simple factory pattern
|
||||
* that news-up the MonitorThresholdStruct object requested.
|
||||
*
|
||||
* @param app
|
||||
* -- the kind of application in decision assistance tool suite
|
||||
* @param usage
|
||||
* -- the usage of the threshold data, either monitor or display
|
||||
* @param level
|
||||
* -- the threat level of the threshold data, e.g., red or yellow
|
||||
* @param areaID
|
||||
* -- the area ID
|
||||
* @param config
|
||||
* -- MonitorThresholdConfiguration object that holds the
|
||||
* configuration data for the app and usage.
|
||||
* @return the MonitorThresholdStruct object
|
||||
*/
|
||||
public static SafeSeasThresholdStruct createMonitorThresholdData(
|
||||
ChosenAppKey app, DataUsageKey usage, ThreatLevel level,
|
||||
String areaId, MonitorThresholdConfiguration config) {
|
||||
SafeSeasThresholdStruct data = new SafeSeasThresholdStruct();
|
||||
|
||||
if (app == ChosenAppKey.SAFESEAS) {
|
||||
if (usage == DataUsageKey.DISPLAY) {
|
||||
// SAFESEAS Display Product Small Craft Advisory
|
||||
data.setScaWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setScaGustSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setScaMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setScaWaveHeight(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Product Gale Warning
|
||||
data.setGaleWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGaleGustSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGaleMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Product Storm Warning
|
||||
data.setStormWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setStormGustSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_STORM_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setStormMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_STORM_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Product Hurricane Warning
|
||||
data.setHurricaneWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_HFWW_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHurricaneGustSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_HFWW_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHurricaneMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_PROD_HFWW_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Wind
|
||||
data.setWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGustSpeed(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindDir1(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setWindDir2(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey()).getValueInt(
|
||||
level));
|
||||
|
||||
// SAFESEAS Display Meteo
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setTemperature(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setDewpoint(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPressure(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setSeaSurfaceTemp(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setWaveHeight(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWaveSteepness(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Swell primary
|
||||
data.setPrimSwellHt(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellPd(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellDir1(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellDir2(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Display Swell Secondary
|
||||
data.setSecSwellHt(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_SEC_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellPd(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellDir1(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellDir2(config.getValue(areaId,
|
||||
SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
} else if (usage == DataUsageKey.MONITOR) {
|
||||
// SAFESEAS Monitor Meteo
|
||||
data.setWindSpeed(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setMaxWindSpeed(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGustSpeed(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWaveHeight(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey()).getValueInt(
|
||||
level));
|
||||
|
||||
// SAFESEAS Monitor Swell Primary
|
||||
data.setPrimSwellHt(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellPd(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellDir1(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPrimSwellDir2(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SAFESEAS Monitor Swell Secondary
|
||||
data.setSecSwellHt(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellPd(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellDir1(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSecSwellDir2(config.getValue(areaId,
|
||||
SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
}
|
||||
} else if (app == ChosenAppKey.SNOW) {
|
||||
if (usage == DataUsageKey.DISPLAY) {
|
||||
// SNOW Display Product Blizzard
|
||||
data.setBlizzardVisibility(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setBlizzardWindSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setBlizzardGustSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setBlizzardMaxWindSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SNOW Display Product Freezing Precipitation
|
||||
data.setFrzTemperature(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setFrzHourlyPrecip(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHswSnincrHourly(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHswSnincrTotal(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHswSnowDepth(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SNOW Display Product Wind
|
||||
data.setWindSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setMaxWindSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGustSpeed(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindDir1(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindDir2(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// SNOW Display Meteo
|
||||
data.setTemperature(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setDewpoint(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setPressure(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setHourlyPrecip(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindchill(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setFrostbiteTime(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSnowDepth(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSnincrHourly(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setSnincrTotal(config.getValue(areaId,
|
||||
SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey())
|
||||
.getValueInt(level));
|
||||
} else if (usage == DataUsageKey.MONITOR) {
|
||||
// SNOW Monitor Meteo
|
||||
data.setWindSpeed(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setMaxWindSpeed(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGustSpeed(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setTemperature(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_TEMP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindchill(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_WIND_CHILL.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_VIS.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setSnowDepth(config.getValue(areaId,
|
||||
SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey())
|
||||
.getValueInt(level));
|
||||
}
|
||||
} else if (app == ChosenAppKey.FOG) {
|
||||
if (usage == DataUsageKey.DISPLAY) {
|
||||
// Fog Display Meteo
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_METEO_VIS.getXmlKey()).getValueInt(
|
||||
level));
|
||||
data.setCeiling(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setTemperature(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setDewpointDepr(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setRelativeHumidity(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey())
|
||||
.getValueInt(level));
|
||||
|
||||
// Fog Display Wind
|
||||
data.setWindSpeed(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setMaxWindSpeed(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_WIND_PEAK_WIND.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setGustSpeed(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_WIND_GUST_SPEED.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindDir1(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey())
|
||||
.getValueInt(level));
|
||||
data.setWindDir2(config.getValue(areaId,
|
||||
FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey())
|
||||
.getValueInt(level));
|
||||
} else if (usage == DataUsageKey.MONITOR) {
|
||||
// Fog Monitor Meteo
|
||||
data.setVisibility(config.getValue(areaId,
|
||||
FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey())
|
||||
.getValueInt(level));
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
|
@ -1,63 +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.uf.viz.monitor;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
|
||||
/**
|
||||
* The ObReportGenFactory class is a Simple Factory Pattern that creates an
|
||||
* observation report generator entity that satisfies the IObReportable
|
||||
* interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ObReportGenFactory {
|
||||
|
||||
/**
|
||||
* createObReportableEntity is a static method in a simple factory pattern
|
||||
* that news-up the observation-reportable object requested.
|
||||
*
|
||||
* @param pluginName
|
||||
* @return the observation-reportable object
|
||||
*/
|
||||
public static IObReportable createObReportableEntity(String pluginName) {
|
||||
IObReportable entity = null;
|
||||
if (pluginName.equalsIgnoreCase(ObConst.METAR_PLUGIN_NAME)) {
|
||||
entity = new GenerateMetarObReport();
|
||||
} else if (pluginName.equalsIgnoreCase(ObConst.MARINE_PLUGIN_NAME)) {
|
||||
entity = new GenerateMarineObReport();
|
||||
} else if (pluginName.equalsIgnoreCase(ObConst.MESO_PLUGIN_NAME)) {
|
||||
entity = new GenerateMesoObReport();
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,84 +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.uf.viz.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.util.ObUtil;
|
||||
|
||||
/**
|
||||
* The ProcessNewReport abstract class contains the business logic to process a
|
||||
* report that may be a SAFESEAS, SNOW, or Fog Monitor report.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 12, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class ProcessNewReport {
|
||||
|
||||
// The time of the threat
|
||||
protected Date threatTime = ObUtil.getThreatTime();
|
||||
|
||||
// The drop time
|
||||
protected Date dropTime = ObUtil.getDropTime();
|
||||
|
||||
// The latest observation time
|
||||
protected Date latestObTime = ObUtil.getDropTime();
|
||||
|
||||
// The frozen precipitation time
|
||||
protected Date latestFrozenPrecipTime = ObUtil.getDropTime();
|
||||
|
||||
// The time of the observation
|
||||
protected Date obTime;
|
||||
|
||||
// New data received indicator
|
||||
protected boolean newDataReceived = false;
|
||||
|
||||
// The threat level
|
||||
protected ObConst.ThreatLevel threatLevel = ObConst.ThreatLevel.GRAY;
|
||||
|
||||
// Frozen precipitation string
|
||||
protected String frozenPrecip = "";
|
||||
|
||||
// AlertViz (f/k/a Guardian) frozen precipitation string
|
||||
protected String guardianFrozenPrecip = "";
|
||||
|
||||
// Present weather vector
|
||||
protected List<String> presentWxVec = new ArrayList<String>();
|
||||
|
||||
// Intensity character vector
|
||||
protected List<String> intensityCharVec = new ArrayList<String>();
|
||||
|
||||
// Intensity level vector
|
||||
protected List<ObConst.IntensityLevel> intensityLevelVec = new ArrayList<ObConst.IntensityLevel>();
|
||||
|
||||
}
|
|
@ -1,262 +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.uf.viz.monitor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ReportModel class is a singleton class that contains the report model for
|
||||
* this decision assistance tool.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 26, 2009 2047 grichard Initial creation.
|
||||
* 3/3/2009 2047 grichard Added unlimited visibility.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ReportModel {
|
||||
/**
|
||||
* The static singleton instance.
|
||||
*/
|
||||
private static ReportModel instance;
|
||||
|
||||
/**
|
||||
* Visibility Look Up
|
||||
*/
|
||||
private final Map<String, Float> reportableFloatVisibilityLookUp = new HashMap<String, Float>();
|
||||
|
||||
/**
|
||||
* Visibility Look Up
|
||||
*/
|
||||
private final Map<Integer, String> reportableStringVisibilityLookUp = new HashMap<Integer, String>();
|
||||
|
||||
/**
|
||||
* Singleton constructor.
|
||||
*
|
||||
* @return the observation station model.
|
||||
*/
|
||||
public static synchronized ReportModel getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new ReportModel();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor: Use getInstance().
|
||||
*/
|
||||
private ReportModel() {
|
||||
// Initialize the look up table for string to float lookup.
|
||||
reportableFloatVisibilityLookUp.put("0", 0 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0SM", 0 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/16", 1 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/16SM", 1 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0100", 1 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/8", 2 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/8SM", 2 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0200", 2 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/16", 3 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/16SM", 3 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0300", 3 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/4", 4 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/4SM", 4 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0400", 4 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5/16", 5 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5/16SM", 5 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0500", 5 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/8", 6 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/8SM", 6 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0600", 6 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0700", 7 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/2", 8 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1/2SM", 8 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0800", 8 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("0900", 9 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5/8", 10 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5/8SM", 10 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1000", 10 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1100", 11 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/4", 12 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3/4SM", 12 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1200", 12 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1300", 13 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("7/8", 14 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("7/8SM", 14 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1400", 14 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1500", 15 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1", 16 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1SM", 16 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1600", 16 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1700", 17 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/8", 18 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/8SM", 18 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1800", 18 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1900", 19 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/4", 20 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/4SM", 20 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2000", 20 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2100", 21 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 3/8", 22 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 3/8SM", 22 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2200", 22 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2300", 23 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/2", 24 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 1/2SM", 24 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2400", 24 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2500", 25 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 5/8", 26 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 5/8SM", 26 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2600", 26 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2700", 27 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 3/4", 28 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 3/4SM", 28 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2800", 28 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2900", 29 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 7/8", 30 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("1 7/8SM", 30 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3000", 30 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3100", 31 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2", 32 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2SM", 32 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3200", 32 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3300", 33 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3400", 34 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3500", 35 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 1/4", 36 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 1/4SM", 36 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3600", 36 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3700", 37 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 3/8", 38 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 3/8SM", 38 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3800", 38 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3900", 39 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 1/2", 40 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 1/2SM", 40 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4000", 40 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4100", 41 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4200", 42 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4300", 43 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 3/4", 44 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("2 3/4SM", 44 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4400", 44 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4500", 45 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4600", 46 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4700", 47 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3", 48 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("3SM", 48 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4800", 48 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4900", 49 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5000", 50 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4", 64 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("4SM", 64 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("6000", 64 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("7000", 70 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5", 80 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("5SM", 80 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("8000", 80 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("6", 96 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("6SM", 96 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("9000", 96 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("7", 112 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("7SM", 112 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("9999", 112 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("8", 128 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("8SM", 128 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("9", 144 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("9SM", 144 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("10", 160 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("10SM", 160 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("11", 176 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("11SM", 176 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("15", 240 / 16f);
|
||||
reportableFloatVisibilityLookUp.put("15SM", 240 / 16f);
|
||||
|
||||
// Initialize the look up table for integer to string lookup,
|
||||
// where the integer is scaled to sixteenths of a statute mile.
|
||||
reportableStringVisibilityLookUp.put(0, "0");
|
||||
reportableStringVisibilityLookUp.put(1, "1/16");
|
||||
reportableStringVisibilityLookUp.put(2, "1/8");
|
||||
reportableStringVisibilityLookUp.put(3, "3/16");
|
||||
reportableStringVisibilityLookUp.put(4, "1/4");
|
||||
reportableStringVisibilityLookUp.put(5, "5/16");
|
||||
reportableStringVisibilityLookUp.put(6, "3/8");
|
||||
reportableStringVisibilityLookUp.put(8, "1/2");
|
||||
reportableStringVisibilityLookUp.put(10, "5/8");
|
||||
reportableStringVisibilityLookUp.put(12, "3/4");
|
||||
reportableStringVisibilityLookUp.put(14, "7/8");
|
||||
reportableStringVisibilityLookUp.put(16, "1");
|
||||
reportableStringVisibilityLookUp.put(18, "1 1/8");
|
||||
reportableStringVisibilityLookUp.put(20, "1 1/4");
|
||||
reportableStringVisibilityLookUp.put(22, "1 3/8");
|
||||
reportableStringVisibilityLookUp.put(24, "1 1/2");
|
||||
reportableStringVisibilityLookUp.put(26, "1 5/8");
|
||||
reportableStringVisibilityLookUp.put(28, "1 3/4");
|
||||
reportableStringVisibilityLookUp.put(30, "1 7/8");
|
||||
reportableStringVisibilityLookUp.put(32, "2");
|
||||
reportableStringVisibilityLookUp.put(36, "2 1/4");
|
||||
reportableStringVisibilityLookUp.put(40, "2 1/2");
|
||||
reportableStringVisibilityLookUp.put(44, "2 3/4");
|
||||
reportableStringVisibilityLookUp.put(48, "3");
|
||||
reportableStringVisibilityLookUp.put(64, "4");
|
||||
reportableStringVisibilityLookUp.put(80, "5");
|
||||
reportableStringVisibilityLookUp.put(96, "6");
|
||||
reportableStringVisibilityLookUp.put(112, "7");
|
||||
reportableStringVisibilityLookUp.put(128, "8");
|
||||
reportableStringVisibilityLookUp.put(144, "9");
|
||||
reportableStringVisibilityLookUp.put(160, "10");
|
||||
reportableStringVisibilityLookUp.put(176, "11");
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that fetches the visibility map containing floats
|
||||
*
|
||||
* @return the map containing floats
|
||||
*/
|
||||
public Map<String, Float> getReportableFloatVisibilityLookUp() {
|
||||
return reportableFloatVisibilityLookUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that fetches the visibility map containing strings
|
||||
*
|
||||
* @return the map containing strings
|
||||
*/
|
||||
public Map<Integer, String> getReportableStringVisibilityLookUp() {
|
||||
return reportableStringVisibilityLookUp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that converts units of meters into units of statute miles
|
||||
*/
|
||||
public float metersToStatuteMiles(float vis) {
|
||||
return vis / 1609.347f;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +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.uf.viz.monitor.config;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 22, 2009 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractAreaConfigMgr {
|
||||
|
||||
}
|
|
@ -1,46 +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.uf.viz.monitor.listeners;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
|
||||
/**
|
||||
* Interface for updating Guardian with threat priority and threat message.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 4, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IGuardianListener {
|
||||
|
||||
void putPriority(ObConst.ThreatLevel threatPriority);
|
||||
|
||||
void putMessage(String threatMessage);
|
||||
|
||||
}
|
|
@ -1,88 +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.uf.viz.monitor.util;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.ReportModel;
|
||||
|
||||
/**
|
||||
* This class contains utility methods.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 26, 2009 2047 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public final class ConfigUtil {
|
||||
|
||||
// Private constructor -- all contents must be public static
|
||||
private ConfigUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that fetches the visibility as a string.
|
||||
*
|
||||
* @param vis
|
||||
* -- whole number that represents visibility in sixteenths of a
|
||||
* statute mile
|
||||
* @return String that represents visibility in reportable fractional units
|
||||
* of statute miles
|
||||
*/
|
||||
public static String lookupVisibility(int vis) {
|
||||
ReportModel reportModel = ReportModel.getInstance();
|
||||
return reportModel.getReportableStringVisibilityLookUp().get(vis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that fetches the visibility as a float.
|
||||
*
|
||||
* @param vis
|
||||
* -- string that represents visibility in reportable fractional
|
||||
* units of statute miles
|
||||
* @return float that represents visibility in statute miles
|
||||
*/
|
||||
public static float lookupVisibility(String vis) {
|
||||
ReportModel reportModel = ReportModel.getInstance();
|
||||
// System.out.println("Vis = " + vis);
|
||||
return reportModel.getReportableFloatVisibilityLookUp().get(vis.trim());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that fetches the visibility as a float.
|
||||
*
|
||||
* @param vis
|
||||
* -- float that represents visibility in reportable fractional
|
||||
* units of meters
|
||||
* @return float that represents visibility in statute miles
|
||||
*/
|
||||
public static float lookupVisibility(float vis) {
|
||||
ReportModel reportModel = ReportModel.getInstance();
|
||||
// System.out.println("Vis = " + vis);
|
||||
return reportModel.metersToStatuteMiles(vis);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,167 +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.uf.viz.monitor.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore;
|
||||
|
||||
/**
|
||||
* MonitorConfiguration object stores configuration data common to all Monitors.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 16, 2009 2076 avarani Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author avarani
|
||||
* @version 1.0
|
||||
*/
|
||||
public class MonitorConfiguration {
|
||||
|
||||
private String[] zoneList;
|
||||
|
||||
private String[] stationList;
|
||||
|
||||
private HashMap<String, String[]> zoneMap;
|
||||
|
||||
private String[] columnList;
|
||||
|
||||
/**
|
||||
* @param store
|
||||
* HierarchicalPreferenceStore
|
||||
* @return zoneList String[]
|
||||
*/
|
||||
public String[] getZoneList(HierarchicalPreferenceStore store) {
|
||||
if (zoneList == null) {
|
||||
String key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.ALL_ZONES_KEY;
|
||||
zoneList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
}
|
||||
|
||||
return zoneList.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param store
|
||||
* HierarchicalPreferenceStore
|
||||
* @return stationList String[]
|
||||
*/
|
||||
public String[] getStationList(HierarchicalPreferenceStore store) {
|
||||
if (stationList == null) {
|
||||
String key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.STATION_LIST_KEY;
|
||||
stationList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
}
|
||||
|
||||
return stationList.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param store
|
||||
* HierarchicalPreferenceStore
|
||||
* @return columnList String[]
|
||||
*/
|
||||
public String[] getColumnList(HierarchicalPreferenceStore store) {
|
||||
if (columnList == null) {
|
||||
String key = MonitorConfigConstants.COLUMN_LIST_KEY;
|
||||
columnList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
}
|
||||
|
||||
return columnList.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param store
|
||||
* HierarchicalPreferenceStore
|
||||
* @return zoneMap HashMap<String, String[]>
|
||||
*/
|
||||
public HashMap<String, String[]> getZoneMap(
|
||||
HierarchicalPreferenceStore store) {
|
||||
if (zoneMap == null) {
|
||||
String key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.ACTIVE_ZONES_KEY;
|
||||
String[] zones = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
zoneMap = new HashMap<String, String[]>();
|
||||
|
||||
for (int i = 0; i < zones.length; i++) {
|
||||
key = MonitorConfigConstants.AREA_IDS_KEY + zones[i]
|
||||
+ MonitorConfigConstants.STATIONS_KEY;
|
||||
String[] stations = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
|
||||
zoneMap.put(zones[i], stations);
|
||||
}
|
||||
}
|
||||
|
||||
return new HashMap<String, String[]>(zoneMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the internal data structures from the HierarchicalPreferenceStore.
|
||||
* This is common data used by all monitors.
|
||||
*
|
||||
* @param store
|
||||
* HierarchicalPreferenceStore
|
||||
*/
|
||||
public void reload(HierarchicalPreferenceStore store) {
|
||||
// Fill zoneList with all known zones.
|
||||
String key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.ALL_ZONES_KEY;
|
||||
zoneList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
|
||||
// Fill stationList with all known stations.
|
||||
key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.STATION_LIST_KEY;
|
||||
stationList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
|
||||
// Fill zoneMap with a mapping of all watched zones and their associated
|
||||
// stations.
|
||||
key = MonitorConfigConstants.AREA_IDS_KEY
|
||||
+ MonitorConfigConstants.ACTIVE_ZONES_KEY;
|
||||
String[] zones = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
zoneMap = new HashMap<String, String[]>();
|
||||
|
||||
for (int i = 0; i < zones.length; i++) {
|
||||
key = MonitorConfigConstants.AREA_IDS_KEY + zones[i]
|
||||
+ MonitorConfigConstants.STATIONS_KEY;
|
||||
String[] stations = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
|
||||
zoneMap.put(zones[i], stations);
|
||||
}
|
||||
|
||||
// Fill columnList with all visible columns.
|
||||
key = MonitorConfigConstants.COLUMN_LIST_KEY;
|
||||
columnList = store.getStringArray(
|
||||
HierarchicalPreferenceStore.Level.COMBINED, key);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@
|
|||
package com.raytheon.uf.viz.monitor.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Scanner;
|
||||
|
@ -33,7 +32,6 @@ import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
|||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.wxmath.CalcRH;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.viz.aviation.model.CloudGroup;
|
||||
|
||||
/**
|
||||
* This class contains utility methods.
|
||||
|
@ -47,6 +45,7 @@ import com.raytheon.viz.aviation.model.CloudGroup;
|
|||
* 2/25/2009 2047 grichard Added SNOW report generation method.
|
||||
* Jan 19, 2010 4240 zhao Modified generateObReportSnow method
|
||||
* Aug 14, 2013 2262 dgilling Use new wxmath method for calcrh.
|
||||
* Oct 23, 2013 2361 njensen Removed two unused methods
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -163,18 +162,6 @@ public final class ObUtil {
|
|||
return String.format(formatString, (dbVal != null) ? dbVal : "");
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that gets the time that the fog threat level file for SAFESEAS was
|
||||
* last modified.
|
||||
*
|
||||
* @return the time when last modified
|
||||
*/
|
||||
private static Date readFogThreatTime() {
|
||||
// TODO Obtain the actual time that the fog threat level file for
|
||||
// SafeSeas was last modified.
|
||||
return getDropTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method first gets the time that the fog threat level file for
|
||||
* SAFESEAS was last modified to determine whether or not the most recent
|
||||
|
@ -283,63 +270,6 @@ public final class ObUtil {
|
|||
return obReport;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method builds a string representing the present sky coverage given a
|
||||
* set of sky coverage data from an actual observation (metar). The
|
||||
* mathematical set appears to contain elements that originally were space
|
||||
* delimited strings. The set is of course unordered. Guidance/clues for
|
||||
* detecting the implied order comes from NWSI(s).
|
||||
*
|
||||
* @param skyCov
|
||||
* -- the set of sky coverage data
|
||||
* @return -- a string representing the sky cover
|
||||
*/
|
||||
public static String buildPresentSkyCov(Set<SkyCover> skyCov) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
/** Sky Conditions */
|
||||
ArrayList<CloudGroup> cloudGroup = new ArrayList<CloudGroup>();
|
||||
// Capture the distinct parts of the sky coverage. Then
|
||||
// reorder these parts using guidance from an NWSI.
|
||||
// Put the cloud group settings into the observation.
|
||||
try {
|
||||
for (SkyCover sc : skyCov) {
|
||||
CloudGroup cldGp = new CloudGroup();
|
||||
cldGp.setCldCat(CloudGroup.CloudCategory.valueOf(sc.getType()));
|
||||
if (sc.getHeight() != null) {
|
||||
cldGp.setCldHgt(sc.getHeight());
|
||||
} else {
|
||||
cldGp.setCldHgt(-1);
|
||||
}
|
||||
if (sc.getGenus() != null) {
|
||||
cldGp.setGenus(sc.getGenus());
|
||||
}
|
||||
cloudGroup.add(cldGp);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// ignore cloud cover that is null
|
||||
}
|
||||
// Initialize the present sky cover string to the empty string.
|
||||
sb.append("");
|
||||
// Sky Coverage
|
||||
for (CloudGroup cg : cloudGroup) {
|
||||
sb.append(cg.getCldCat().value());
|
||||
if (cg.getCldHgt() > 0) {
|
||||
int cldHgtHds = cg.getCldHgt() / 100;
|
||||
if (cldHgtHds < 10) {
|
||||
sb.append("00");
|
||||
} else if (cldHgtHds < 100) {
|
||||
sb.append("0");
|
||||
}
|
||||
sb.append(cldHgtHds);
|
||||
}
|
||||
if (cg.getGenus() != null) {
|
||||
sb.append(cg.getGenus());
|
||||
}
|
||||
sb.append(" ");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method calculates a floating point number representing the ceiling.
|
||||
* By definition, the ceiling is the lowest overcast or broken cloud layer,
|
||||
|
|
|
@ -6,7 +6,6 @@ Bundle-Version: 1.12.1174.qualifier
|
|||
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Export-Package: com.raytheon.edex.plugin.obs,
|
||||
com.raytheon.edex.plugin.obs.mesowest,
|
||||
com.raytheon.edex.plugin.obs.metar,
|
||||
com.raytheon.edex.plugin.obs.metar.util,
|
||||
com.raytheon.edex.uengine.tasks.obs
|
||||
|
|
|
@ -54,6 +54,7 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
|||
* Mar 19, 2013 1785 bgonzale Added performance status handler and added
|
||||
* status to decode.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Oct 23, 2013 2361 njensen Removed dead mesowest code
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -145,13 +146,9 @@ public class ObsDecoder extends AbstractDecoder {
|
|||
logger.error(traceId + "- Attempt to create non-METAR Decoder");
|
||||
}
|
||||
} else {
|
||||
if (message.startsWith("PARM")) {
|
||||
logger.error(traceId + "- Attempt to create MESOWest Decoder");
|
||||
} else {
|
||||
logger.error(traceId
|
||||
+ " - Unable to find appropriate obs decoder:Data Length="
|
||||
+ messageData.length);
|
||||
}
|
||||
logger.error(traceId
|
||||
+ " - Unable to find appropriate obs decoder:Data Length="
|
||||
+ messageData.length);
|
||||
}
|
||||
|
||||
return decoder;
|
||||
|
|
|
@ -24,7 +24,6 @@ import java.io.File;
|
|||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.plugin.AbstractRecordSeparator;
|
||||
import com.raytheon.edex.plugin.obs.mesowest.MesowestSeparator;
|
||||
import com.raytheon.edex.plugin.obs.metar.MetarSeparator;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
|
||||
|
@ -39,6 +38,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* ate Ticket# Engineer Description
|
||||
* ----------- ---------- ----------- --------------------------
|
||||
* 4/27/07 199 bphillip Initial creation
|
||||
* Oct 23, 2013 2361 njensen Removed dead mesowest code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -81,10 +81,6 @@ public class ObsSeparator extends AbstractRecordSeparator {
|
|||
separator = new MetarSeparator();
|
||||
}
|
||||
|
||||
// Load mesowest separator
|
||||
else if (message.contains("PARM")) {
|
||||
separator = new MesowestSeparator();
|
||||
}
|
||||
separator.setData(data, headers);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,186 +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.edex.plugin.obs.mesowest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.plugin.AbstractRecordSeparator;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* Separator implementation for mesowest plugin.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 15Nov2006 58 Rockwood Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
* @version 1
|
||||
*/
|
||||
public class MesowestSeparator extends AbstractRecordSeparator {
|
||||
|
||||
private final Log theLogger = LogFactory.getLog(getClass());
|
||||
|
||||
/** Regex used to search for METAR messages */
|
||||
private static final String WMOICAO = "^[KCP]...,";
|
||||
|
||||
/** PARM header to identifiy individual Mesowest records */
|
||||
private static final String PARM = "PARM,";
|
||||
|
||||
/** Pattern object for regex search */
|
||||
Pattern pattern;
|
||||
|
||||
/** Regex matcher */
|
||||
private Matcher matcher;
|
||||
|
||||
/** List of records contained in file */
|
||||
private List<String> records;
|
||||
|
||||
private Iterator<String> iterator = null;
|
||||
|
||||
private List<String> stations;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*/
|
||||
public MesowestSeparator() {
|
||||
records = new ArrayList<String>();
|
||||
stations = new ArrayList<String>();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.plugin.AbstractRecordSeparator#setData(byte[])
|
||||
*/
|
||||
public void setData(byte[] data, Headers headers) {
|
||||
this.separate(new String(data));
|
||||
iterator = records.iterator();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.edex.plugin.AbstractRecordSeparator#hasNext()
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
if (iterator == null) {
|
||||
return false;
|
||||
} else {
|
||||
return iterator.hasNext();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] next() {
|
||||
try {
|
||||
String temp = iterator.next();
|
||||
if (StringUtil.isEmptyString(temp)) {
|
||||
return (byte[]) null;
|
||||
} else {
|
||||
return temp.getBytes();
|
||||
}
|
||||
} catch (NoSuchElementException e) {
|
||||
return (byte[]) null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
private void separate(String message) {
|
||||
|
||||
String[] mesoParts = message.split("\\x0A");
|
||||
pattern = Pattern.compile(WMOICAO);
|
||||
|
||||
try {
|
||||
// Assigns records
|
||||
for (int i = 3; i < mesoParts.length; i++) {
|
||||
// Search for a WMO ICAO and, if found, discard
|
||||
matcher = pattern.matcher(mesoParts[i]);
|
||||
if (!matcher.find()) {
|
||||
// Make sure there are not duplicate entries
|
||||
String[] mesoStation = mesoParts[i].split(",");
|
||||
if (!stations.contains(mesoStation[0])) {
|
||||
records.add(PARM + mesoParts[i]);
|
||||
stations.add(mesoStation[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
theLogger.warn("No valid METAR records found.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test function
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
String fileName = "/awips/opt/data/sbn/tst/ascii/mesowest.dat";
|
||||
String fileContents = "";
|
||||
MesowestSeparator ben = new MesowestSeparator();
|
||||
System.out.println(fileName);
|
||||
|
||||
File mesowestData = new File(fileName);
|
||||
int fileSize = (int) mesowestData.length();
|
||||
|
||||
try {
|
||||
char[] mesoWestContents = new char[fileSize];
|
||||
BufferedReader in = new BufferedReader(new FileReader(mesowestData));
|
||||
|
||||
in.read(mesoWestContents);
|
||||
in.close();
|
||||
fileContents = new String(mesoWestContents);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ben.setData(fileContents.getBytes(), null);
|
||||
int i = 0;
|
||||
while (ben.hasNext()) {
|
||||
System.out.println("Record #" + (++i) + ": \n" + ben.next());
|
||||
}
|
||||
System.out.println("Stations processed: " + i);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,23 +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.
|
||||
**/
|
||||
/**
|
||||
* Core classes for mesowest plugin. Core files include the decoder, record, and separator. This data type does not require a writer implementation.
|
||||
*/
|
||||
package com.raytheon.edex.plugin.obs.mesowest;
|
|
@ -13,7 +13,6 @@ Require-Bundle: com.raytheon.uf.edex.cpgsrv;bundle-version="1.12.1153",
|
|||
com.raytheon.uf.common.dataplugin.fssobs;bundle-version="1.0.0",
|
||||
com.raytheon.edex.plugin.obs;bundle-version="1.12.1172",
|
||||
com.raytheon.uf.common.dataplugin.sfcobs;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.plugin.mesowest;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.decodertools
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.edex.plugin.fssobs,
|
||||
|
|
Loading…
Add table
Reference in a new issue