Issue #2493 remove mesowest.
Former-commit-id:f761c701cf
[formerlyd0b7966458
] [formerlyf761c701cf
[formerlyd0b7966458
] [formerly36916fedcd
[formerly 9a2fe6fa13d424c254b4ed071b743837dfb2e702]]] Former-commit-id:36916fedcd
Former-commit-id:5d31aad5c2
[formerlybaebe37ba6
] Former-commit-id:afe014af99
This commit is contained in:
parent
4094bce5c4
commit
925d8bca38
29 changed files with 41 additions and 2830 deletions
|
@ -20,25 +20,14 @@
|
||||||
-->
|
-->
|
||||||
<?eclipse version="3.2"?>
|
<?eclipse version="3.2"?>
|
||||||
<plugin>
|
<plugin>
|
||||||
<extension
|
<!-- Re-enabled when base/site/user permissions are set up -->
|
||||||
|
<!-- <extension
|
||||||
point="com.raytheon.viz.ui.contextualMenu">
|
point="com.raytheon.viz.ui.contextualMenu">
|
||||||
|
|
||||||
<contextualMenu
|
<contextualMenu
|
||||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.EnableDisableMetarAction"
|
|
||||||
capabilityInterface="com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource"
|
|
||||||
name="MetarAction"
|
|
||||||
sortID="113"/>
|
|
||||||
<contextualMenu
|
|
||||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.EnableDisableMesowestAction"
|
|
||||||
capabilityInterface="com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource"
|
|
||||||
name="MesowestAction"
|
|
||||||
sortID="114"/>
|
|
||||||
<!-- Re-enabled when base/site/user permissions are set up -->
|
|
||||||
<!-- <contextualMenu
|
|
||||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.ViewPlotModelAction"
|
actionClass="com.raytheon.viz.pointdata.ui.cmenu.ViewPlotModelAction"
|
||||||
name="Edit Plot Model"
|
name="Edit Plot Model"
|
||||||
sortID="115"/> -->
|
sortID="115"/>
|
||||||
</extension>
|
</extension> -->
|
||||||
<extension
|
<extension
|
||||||
point="com.raytheon.uf.viz.core.resource">
|
point="com.raytheon.uf.viz.core.resource">
|
||||||
<resource
|
<resource
|
||||||
|
|
|
@ -57,7 +57,6 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||||
import com.raytheon.viz.pointdata.PlotModelGenerator;
|
import com.raytheon.viz.pointdata.PlotModelGenerator;
|
||||||
|
@ -75,19 +74,23 @@ import com.vividsolutions.jts.geom.Envelope;
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* 11/20/2006 brockwoo Initial creation.
|
* Nov 20, 2006 brockwoo Initial creation.
|
||||||
* 02/17/2009 njensen Refactored to new rsc architecture.
|
* Feb 17, 2009 njensen Refactored to new rsc architecture.
|
||||||
* 03/17/2009 2105 jsanchez Plot goessounding/poessounding availability.
|
* Mar 17, 2009 2105 jsanchez Plot goessounding/poessounding
|
||||||
* 03/30/2009 2169 jsanchez Updated initNewFrame.
|
* availability.
|
||||||
* 04/09/2009 952 jsanchez Plot acars.
|
* Mar 30, 2009 2169 jsanchez Updated initNewFrame.
|
||||||
* 04/13/2009 2251 jsanchez Plot profilers.
|
* Apr 09, 2009 952 jsanchez Plot acars.
|
||||||
* 05/12/2009 2338 jsanchez Updated resourceChanged. Registered units.
|
* Apr 13, 2009 2251 jsanchez Plot profilers.
|
||||||
* 06/08/2009 2450 jsanchez Updated inpsect method to find closest plot.
|
* May 12, 2009 2338 jsanchez Updated resourceChanged. Registered
|
||||||
* ======================================
|
* units.
|
||||||
* AWIPS2 DR Work
|
* Jun 08, 2009 2450 jsanchez Updated inpsect method to find closest
|
||||||
* 08/09/2012 1011 jkorman Added screenToWorldRatio calc to paintInternal.
|
* plot.
|
||||||
|
* Aug 09, 2012 1011 jkorman Added screenToWorldRatio calc to
|
||||||
|
* paintInternal.
|
||||||
|
* Nov 06, 2013 2493 bsteffen Removed IPlotDataResource
|
||||||
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -97,7 +100,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
||||||
*/
|
*/
|
||||||
public class PlotResource extends
|
public class PlotResource extends
|
||||||
AbstractVizResource<PlotResourceData, MapDescriptor> implements
|
AbstractVizResource<PlotResourceData, MapDescriptor> implements
|
||||||
IPlotDataResource, IResourceDataChanged {
|
IResourceDataChanged {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
.getHandler(PlotResource.class);
|
.getHandler(PlotResource.class);
|
||||||
|
|
||||||
|
@ -109,10 +112,6 @@ public class PlotResource extends
|
||||||
|
|
||||||
private DataTime displayedObsTime;
|
private DataTime displayedObsTime;
|
||||||
|
|
||||||
private boolean metarEnabled;
|
|
||||||
|
|
||||||
private boolean mesowestEnabled;
|
|
||||||
|
|
||||||
private VA_Advanced progDisc;
|
private VA_Advanced progDisc;
|
||||||
|
|
||||||
private double actualPlotWidth;
|
private double actualPlotWidth;
|
||||||
|
@ -197,8 +196,6 @@ public class PlotResource extends
|
||||||
public PlotResource(PlotResourceData data, LoadProperties props) {
|
public PlotResource(PlotResourceData data, LoadProperties props) {
|
||||||
super(data, props);
|
super(data, props);
|
||||||
this.dataTimes = new ArrayList<DataTime>();
|
this.dataTimes = new ArrayList<DataTime>();
|
||||||
metarEnabled = true;
|
|
||||||
mesowestEnabled = true;
|
|
||||||
this.progDisc = new VA_Advanced();
|
this.progDisc = new VA_Advanced();
|
||||||
this.stationsToParse = new ArrayList<PluginDataObject>();
|
this.stationsToParse = new ArrayList<PluginDataObject>();
|
||||||
this.frameInfo = new HashMap<String, FrameInformation>();
|
this.frameInfo = new HashMap<String, FrameInformation>();
|
||||||
|
@ -446,46 +443,6 @@ public class PlotResource extends
|
||||||
generator.shutdown();
|
generator.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if mesowest data is being displayed by the layer .
|
|
||||||
*
|
|
||||||
* @return Whether mesowest is enabled or not
|
|
||||||
*/
|
|
||||||
public boolean isMesowestEnabled() {
|
|
||||||
return mesowestEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if metar data is being displayed by the layer.
|
|
||||||
*
|
|
||||||
* @return Whether metar is enabled or not
|
|
||||||
*/
|
|
||||||
public boolean isMetarEnabled() {
|
|
||||||
return metarEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables/disables mesowest data.
|
|
||||||
*
|
|
||||||
* @param flag
|
|
||||||
* Enable or disable mesowest on the display
|
|
||||||
*/
|
|
||||||
public void setMesowestMode(boolean flag) {
|
|
||||||
mesowestEnabled = flag;
|
|
||||||
// aTarget.setNeedsRefresh(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enables/disables metar data.
|
|
||||||
*
|
|
||||||
* @param flag
|
|
||||||
* Enable or disable metar on the display
|
|
||||||
*/
|
|
||||||
public void setMetarMode(boolean flag) {
|
|
||||||
metarEnabled = flag;
|
|
||||||
// aTarget.setNeedsRefresh(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataTime[] getDataTimes() {
|
public DataTime[] getDataTimes() {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
|
|
||||||
package com.raytheon.viz.pointdata.ui.cmenu;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
|
||||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enable/Disable metar data within a layer
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Nov 28, 2006 brockwoo Initial Creation.
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author brockwoo
|
|
||||||
* @version 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EnableDisableMesowestAction extends AbstractRightClickAction {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
|
||||||
boolean isEnabled = rsc.isMesowestEnabled();
|
|
||||||
rsc.setMesowestMode(!isEnabled);
|
|
||||||
this.setChecked(!isEnabled);
|
|
||||||
if (isEnabled && !rsc.isMetarEnabled()) {
|
|
||||||
rsc.setMetarMode(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSelectedRsc(ResourcePair selectedRsc) {
|
|
||||||
super.setSelectedRsc(selectedRsc);
|
|
||||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
|
||||||
|
|
||||||
boolean curState = rsc.isMesowestEnabled();
|
|
||||||
this.setChecked(curState);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.action.Action#getText()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return "Enable Mesowest";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,82 +0,0 @@
|
||||||
/**
|
|
||||||
* This software was developed and / or modified by Raytheon Company,
|
|
||||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
||||||
*
|
|
||||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
||||||
* This software product contains export-restricted data whose
|
|
||||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
||||||
* to non-U.S. persons whether in the United States or abroad requires
|
|
||||||
* an export license or other authorization.
|
|
||||||
*
|
|
||||||
* Contractor Name: Raytheon Company
|
|
||||||
* Contractor Address: 6825 Pine Street, Suite 340
|
|
||||||
* Mail Stop B8
|
|
||||||
* Omaha, NE 68106
|
|
||||||
* 402.291.0100
|
|
||||||
*
|
|
||||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
||||||
* further licensing information.
|
|
||||||
**/
|
|
||||||
|
|
||||||
package com.raytheon.viz.pointdata.ui.cmenu;
|
|
||||||
|
|
||||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
|
||||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Enable/Disable metar data within a layer
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Nov 28, 2006 brockwoo Initial Creation.
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author brockwoo
|
|
||||||
* @version 1
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class EnableDisableMetarAction extends AbstractRightClickAction {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
|
||||||
boolean isEnabled = rsc.isMetarEnabled();
|
|
||||||
rsc.setMetarMode(!isEnabled);
|
|
||||||
this.setChecked(!isEnabled);
|
|
||||||
if (isEnabled && !rsc.isMesowestEnabled()) {
|
|
||||||
rsc.setMesowestMode(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSelectedRsc(ResourcePair selectedRsc) {
|
|
||||||
super.setSelectedRsc(selectedRsc);
|
|
||||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
|
||||||
|
|
||||||
boolean curState = rsc.isMetarEnabled();
|
|
||||||
this.setChecked(curState);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.jface.action.Action#getText()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getText() {
|
|
||||||
return "Enable METAR";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
11
deltaScripts/14.2.1/dropMesowest.sh
Normal file
11
deltaScripts/14.2.1/dropMesowest.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# DR #2493 remove mesowest from the database
|
||||||
|
|
||||||
|
PSQL="/awips2/psql/bin/psql"
|
||||||
|
|
||||||
|
SQL_COMMAND="
|
||||||
|
delete from plugin_info where name = 'mesowest';
|
||||||
|
drop table if exists mesowest;
|
||||||
|
drop sequence if exists mesowestseq;
|
||||||
|
"
|
||||||
|
${PSQL} -U awips -d metadata -c "${SQL_COMMAND}"
|
|
@ -19,8 +19,6 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.common.monitor.data;
|
package com.raytheon.uf.common.monitor.data;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.TimeZone;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants for Observations within the Decision Assistance Tool Suite that
|
* Constants for Observations within the Decision Assistance Tool Suite that
|
||||||
|
@ -29,10 +27,13 @@ import java.util.TimeZone;
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------- -------- ----------- --------------------------
|
||||||
* Feb 10, 2009 1999 grichard Initial creation.
|
* Feb 10, 2009 1999 grichard Initial creation.
|
||||||
* Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to VarName for SWELL
|
* Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to
|
||||||
|
* VarName for SWELL
|
||||||
|
* Nov 06, 2013 2493 bsteffen Remove unused constants.
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author grichard
|
* @author grichard
|
||||||
|
@ -45,16 +46,6 @@ public final class ObConst {
|
||||||
private ObConst() {
|
private ObConst() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Date Format
|
|
||||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
|
|
||||||
"yyyy-MM-dd HH:mm");
|
|
||||||
|
|
||||||
public static SimpleDateFormat obTimeFormat = DATE_FORMAT;
|
|
||||||
|
|
||||||
static {
|
|
||||||
obTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Time Window in units of hours
|
// Time Window in units of hours
|
||||||
public static final int THREAT_INTERVAL_HOURS = 2;
|
public static final int THREAT_INTERVAL_HOURS = 2;
|
||||||
|
|
||||||
|
@ -85,21 +76,6 @@ public final class ObConst {
|
||||||
|
|
||||||
public static final String SKC_SKY_STRING = "SKC";
|
public static final String SKC_SKY_STRING = "SKC";
|
||||||
|
|
||||||
// Image type used for Fog Monitor
|
|
||||||
public enum ImageType {
|
|
||||||
VIS, IR3_9, IR10_7, Undefined_ImageType
|
|
||||||
}
|
|
||||||
|
|
||||||
// Intensity Level
|
|
||||||
public enum IntensityLevel {
|
|
||||||
LIGHT, MODERATE, HEAVY
|
|
||||||
};
|
|
||||||
|
|
||||||
// Monitor Area
|
|
||||||
// public enum MonitorArea {
|
|
||||||
// SS, FM, SS_FM
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Chosen Application Key
|
// Chosen Application Key
|
||||||
public enum ChosenAppKey {
|
public enum ChosenAppKey {
|
||||||
SNOW, FOG, SAFESEAS
|
SNOW, FOG, SAFESEAS
|
||||||
|
@ -115,11 +91,6 @@ public final class ObConst {
|
||||||
BLACK, GRAY, GREEN, YELLOW, RED, YELLOW_LO, YELLOW_HI, RED_LO, RED_HI, UNDEFINED_THREATLEVEL
|
BLACK, GRAY, GREEN, YELLOW, RED, YELLOW_LO, YELLOW_HI, RED_LO, RED_HI, UNDEFINED_THREATLEVEL
|
||||||
}
|
}
|
||||||
|
|
||||||
// Threat Level Strings
|
|
||||||
public static final String[] THREAT_LEVEL_STRINGS = { "black", "gray",
|
|
||||||
"green", "yellow", "red", "yellow_lo", "yellow_hi", "red_lo",
|
|
||||||
"red_hi" };
|
|
||||||
|
|
||||||
// Report Type
|
// Report Type
|
||||||
public enum ReportType {
|
public enum ReportType {
|
||||||
SYNOPTIC_FIXED_LAND,
|
SYNOPTIC_FIXED_LAND,
|
||||||
|
@ -158,19 +129,6 @@ public final class ObConst {
|
||||||
VISIBILITY, WIND_SPEED, MAX_WIND_SPEED, GUST_SPEED, TEMPERATURE, WIND_CHILL, SNOW_DEPTH, PRIM_SWELL_HT, PRIM_SWELL_PD, PRIM_SWELL_DIR, SEC_SWELL_HT, SEC_SWELL_PD, SEC_SWELL_DIR, STATIONARY, WAVE_HEIGHT, WAVE_PERIOD, WAVE_STEEPNESS, LATITUDE, LONGITUDE, NOMINAL_DATETIME, OBSERVATION_DATETIME, PLATFORM_ID, PRESSURE, PRES_CHANGE, WIND_DIR, FOG, ZONE_ID, DEWPOINT, PRES_WX, SEA_SURFACE_TEMPERATURE, HOURLY_PRECIP, SNINCR_HOURLY, SNINCR_TOTAL, FROSTBITE_TIME, RELATIVE_HUMIDITY, CEILING, DEWPOINT_DEPR, SEA_LEVEL_PRESS, UNDEFINED_VARIABLE
|
VISIBILITY, WIND_SPEED, MAX_WIND_SPEED, GUST_SPEED, TEMPERATURE, WIND_CHILL, SNOW_DEPTH, PRIM_SWELL_HT, PRIM_SWELL_PD, PRIM_SWELL_DIR, SEC_SWELL_HT, SEC_SWELL_PD, SEC_SWELL_DIR, STATIONARY, WAVE_HEIGHT, WAVE_PERIOD, WAVE_STEEPNESS, LATITUDE, LONGITUDE, NOMINAL_DATETIME, OBSERVATION_DATETIME, PLATFORM_ID, PRESSURE, PRES_CHANGE, WIND_DIR, FOG, ZONE_ID, DEWPOINT, PRES_WX, SEA_SURFACE_TEMPERATURE, HOURLY_PRECIP, SNINCR_HOURLY, SNINCR_TOTAL, FROSTBITE_TIME, RELATIVE_HUMIDITY, CEILING, DEWPOINT_DEPR, SEA_LEVEL_PRESS, UNDEFINED_VARIABLE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variable Name Strings
|
|
||||||
public static final String[] VAR_NAME_TEXT = { "GUST_SPEED", "LATITUDE",
|
|
||||||
"LONGITUDE", "NOMINAL_DATETIME", "OBSERVATION_DATETIME",
|
|
||||||
"PLATFORM_ID", "PRESSURE", "PRES_CHANGE", "PRIM_SWELL_DIR",
|
|
||||||
"PRIM_SWELL_HT", "PRIM_SWELL_PD", "SEC_SWELL_DIR", "SEC_SWELL_HT",
|
|
||||||
"SEC_SWELL_PD", "STATIONARY", "TEMPERATURE", "VISIBILITY",
|
|
||||||
"WAVE_HEIGHT", "WAVE_PERIOD", "WAVE_STEEPNESS", "WIND_DIR",
|
|
||||||
"WIND_SPEED", "MAX_WIND_SPEED", "FOG", "ZONE_ID", "DEWPOINT",
|
|
||||||
"PRES_WX", "SEA_SURFACE_TEMPERATURE", "HOURLY_PRECIP",
|
|
||||||
"SNOW_DEPTH", "SNINCR_HOURLY", "SNINCR_TOTAL", "WIND_CHILL",
|
|
||||||
"FROSTBITE_TIME", "RELATIVE_HUMIDITY", "CEILING", "DEWPOINT_DEPR",
|
|
||||||
"SEA_LEVEL_PRESS", "UNDEFINED_VARIABLE" };
|
|
||||||
|
|
||||||
// Display Variable Names
|
// Display Variable Names
|
||||||
public enum DisplayVarName {
|
public enum DisplayVarName {
|
||||||
SCA_WIND_SPEED, SCA_GUST_SPEED, SCA_MAX_WIND_SPEED, SCA_WAVE_HEIGHT, GALE_WIND_SPEED, GALE_GUST_SPEED, GALE_MAX_WIND_SPEED, STORM_WIND_SPEED, STORM_GUST_SPEED, STORM_MAX_WIND_SPEED, HURRICANE_WIND_SPEED, HURRICANE_GUST_SPEED, HURRICANE_MAX_WIND_SPEED, VAR_WIND_DIR, VAR_WIND_SPEED, VAR_MAX_WIND_SPEED, VAR_GUST_SPEED, VAR_VISIBILITY, VAR_TEMPERATURE, VAR_DEWPOINT, VAR_SEA_SURFACE_TEMPERATURE, VAR_WAVE_HEIGHT, VAR_WAVE_STEEPNESS, VAR_TIME, VAR_LATITUDE, VAR_LONGITUDE, VAR_PRESSURE, VAR_PRES_CHANGE, VAR_SNOW_DEPTH, VAR_SNINCR_HOURLY, VAR_SNINCR_TOTAL, VAR_WIND_CHILL, VAR_FROSTBITE_TIME, VAR_HOURLY_PRECIP, VAR_PRIM_SWELL_HT, VAR_PRIM_SWELL_PD, VAR_PRIM_SWELL_DIR, VAR_SEC_SWELL_HT, VAR_SEC_SWELL_PD, VAR_SEC_SWELL_DIR, VAR_FOG, BLIZ_WIND_SPEED, BLIZ_GUST_SPEED, BLIZ_MAX_WIND_SPEED, BLIZ_VISIBILITY, FRZ_HOURLY_PRECIP, FRZ_TEMPERATURE, HSW_SNOW_DEPTH, HSW_SNINCR_HOURLY, HSW_SNINCR_TOTAL, VAR_RELATIVE_HUMIDITY, VAR_CEILING, VAR_DEWPOINT_DEPR, VAR_SEA_LEVEL_PRESS
|
SCA_WIND_SPEED, SCA_GUST_SPEED, SCA_MAX_WIND_SPEED, SCA_WAVE_HEIGHT, GALE_WIND_SPEED, GALE_GUST_SPEED, GALE_MAX_WIND_SPEED, STORM_WIND_SPEED, STORM_GUST_SPEED, STORM_MAX_WIND_SPEED, HURRICANE_WIND_SPEED, HURRICANE_GUST_SPEED, HURRICANE_MAX_WIND_SPEED, VAR_WIND_DIR, VAR_WIND_SPEED, VAR_MAX_WIND_SPEED, VAR_GUST_SPEED, VAR_VISIBILITY, VAR_TEMPERATURE, VAR_DEWPOINT, VAR_SEA_SURFACE_TEMPERATURE, VAR_WAVE_HEIGHT, VAR_WAVE_STEEPNESS, VAR_TIME, VAR_LATITUDE, VAR_LONGITUDE, VAR_PRESSURE, VAR_PRES_CHANGE, VAR_SNOW_DEPTH, VAR_SNINCR_HOURLY, VAR_SNINCR_TOTAL, VAR_WIND_CHILL, VAR_FROSTBITE_TIME, VAR_HOURLY_PRECIP, VAR_PRIM_SWELL_HT, VAR_PRIM_SWELL_PD, VAR_PRIM_SWELL_DIR, VAR_SEC_SWELL_HT, VAR_SEC_SWELL_PD, VAR_SEC_SWELL_DIR, VAR_FOG, BLIZ_WIND_SPEED, BLIZ_GUST_SPEED, BLIZ_MAX_WIND_SPEED, BLIZ_VISIBILITY, FRZ_HOURLY_PRECIP, FRZ_TEMPERATURE, HSW_SNOW_DEPTH, HSW_SNINCR_HOURLY, HSW_SNINCR_TOTAL, VAR_RELATIVE_HUMIDITY, VAR_CEILING, VAR_DEWPOINT_DEPR, VAR_SEA_LEVEL_PRESS
|
||||||
|
@ -200,24 +158,6 @@ public final class ObConst {
|
||||||
"kts", "kts", "nm", "in", "F", "in", "in", "in", "%", "ftx100",
|
"kts", "kts", "nm", "in", "F", "in", "in", "in", "%", "ftx100",
|
||||||
"F", "mb" };
|
"F", "mb" };
|
||||||
|
|
||||||
// Remarks section delimiter in METAR
|
|
||||||
public static final String REMARK_EXPR = "RMK";
|
|
||||||
|
|
||||||
// Snow increasing rapidly remark expression in a METAR's remarks section
|
|
||||||
public static final String SNINCR_EXPR = "(SNINCR )(\\d+)/(\\d+)";
|
|
||||||
|
|
||||||
// Snow depth remark expression in a METAR's remarks section
|
|
||||||
public static final String SNOW_DEPTH_EXPR = "4/\\(d{3})";
|
|
||||||
|
|
||||||
// Metar plugin name
|
|
||||||
public static final String METAR_PLUGIN_NAME = "obs";
|
|
||||||
|
|
||||||
// Marine plugin name
|
|
||||||
public static final String MARINE_PLUGIN_NAME = "scfobs";
|
|
||||||
|
|
||||||
// Meso plugin name
|
|
||||||
public static final String MESO_PLUGIN_NAME = "mesowest";
|
|
||||||
|
|
||||||
// Default station identifier
|
// Default station identifier
|
||||||
public static final String DEFAULT_STATION_NAME = "KOMA";
|
public static final String DEFAULT_STATION_NAME = "KOMA";
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
<name>Local</name>
|
<name>Local</name>
|
||||||
<extRetentionHours>168</extRetentionHours>
|
<extRetentionHours>168</extRetentionHours>
|
||||||
<dataSet>
|
<dataSet>
|
||||||
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc)</dirPattern>
|
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|qc)</dirPattern>
|
||||||
<filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern>
|
<filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern>
|
||||||
<displayLabel>{1}</displayLabel>
|
<displayLabel>{1}</displayLabel>
|
||||||
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
||||||
|
|
|
@ -269,13 +269,6 @@
|
||||||
version="0.0.0"
|
version="0.0.0"
|
||||||
unpack="false"/>
|
unpack="false"/>
|
||||||
|
|
||||||
<plugin
|
|
||||||
id="com.raytheon.uf.edex.plugin.mesowest"
|
|
||||||
download-size="0"
|
|
||||||
install-size="0"
|
|
||||||
version="0.0.0"
|
|
||||||
unpack="false"/>
|
|
||||||
|
|
||||||
<plugin
|
<plugin
|
||||||
id="com.raytheon.uf.edex.plugin.qc"
|
id="com.raytheon.uf.edex.plugin.qc"
|
||||||
download-size="0"
|
download-size="0"
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>com.raytheon.uf.edex.plugin.mesowest</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.python.pydev.PyDevBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.pde.PluginNature</nature>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.python.pydev.pythonNature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
|
@ -1,7 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<?eclipse-pydev version="1.0"?>
|
|
||||||
|
|
||||||
<pydev_project>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
|
|
||||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
|
||||||
</pydev_project>
|
|
|
@ -1,7 +0,0 @@
|
||||||
#Tue Mar 03 17:15:37 GMT+00:00 2009
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
|
@ -1,17 +0,0 @@
|
||||||
Manifest-Version: 1.0
|
|
||||||
Bundle-ManifestVersion: 2
|
|
||||||
Bundle-Name: Mesowest Plug-in
|
|
||||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.mesowest
|
|
||||||
Bundle-Version: 1.12.1174.qualifier
|
|
||||||
Bundle-Vendor: RAYTHEON
|
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
|
||||||
Require-Bundle: com.raytheon.edex.common,
|
|
||||||
com.raytheon.uf.common.pointdata,
|
|
||||||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
|
||||||
com.raytheon.uf.common.localization,
|
|
||||||
org.geotools,
|
|
||||||
javax.persistence,
|
|
||||||
javax.measure
|
|
||||||
Export-Package: com.raytheon.uf.edex.plugin.mesowest,
|
|
||||||
com.raytheon.uf.edex.plugin.mesowest.common
|
|
||||||
Import-Package: org.apache.commons.logging
|
|
|
@ -1,129 +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.
|
|
||||||
##
|
|
||||||
import sys, os, time, re, string, getopt
|
|
||||||
import copy
|
|
||||||
import LogStream
|
|
||||||
import pupynere
|
|
||||||
from com.raytheon.uf.common.pointdata.spatial import SurfaceObsLocation
|
|
||||||
from java.lang import Double
|
|
||||||
from java.lang import Integer
|
|
||||||
|
|
||||||
class MesowestDecoder():
|
|
||||||
|
|
||||||
def __init__(self, text=None, filePath=None):
|
|
||||||
|
|
||||||
self._parameters = ['altimeter', 'dewpoint', 'relHumidity', 'stationId', 'rawMessage', 'temperature', 'windDir', 'windGust', 'windSpeed', 'precipAccum']
|
|
||||||
self._mappings = ['altimeter', 'dwpt', 'humidity', 'stationId', 'obsText', 'temp', 'windDirection', 'windGust', 'windSpeed', 'precip']
|
|
||||||
|
|
||||||
|
|
||||||
#to ensure time calls are based on Zulu
|
|
||||||
os.environ['TZ'] = "GMT0"
|
|
||||||
|
|
||||||
self._deleteAfterProcessing = 0
|
|
||||||
if filePath is None:
|
|
||||||
self._incomingFilename = None
|
|
||||||
else:
|
|
||||||
self._incomingFilename = filePath
|
|
||||||
|
|
||||||
def decode(self):
|
|
||||||
fillValue = None
|
|
||||||
missing = None
|
|
||||||
mesowestReports = list()
|
|
||||||
obsList = dict()
|
|
||||||
net = pupynere.netcdf_file(self._incomingFilename,"r")
|
|
||||||
records = net._recs
|
|
||||||
for x in range(records):
|
|
||||||
stationId = ''.join(net.variables['stationId'][x])
|
|
||||||
reportTime = net.variables['reportTime'][x] * 1000
|
|
||||||
if obsList.has_key(reportTime):
|
|
||||||
if stationId in obsList[reportTime]:
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
obsList[reportTime].append(stationId)
|
|
||||||
else:
|
|
||||||
obsList[reportTime] = list()
|
|
||||||
obsList[reportTime].append(stationId)
|
|
||||||
mesowestReport = dict()
|
|
||||||
for paramNum in range(len(self._parameters)):
|
|
||||||
param = self._parameters[paramNum]
|
|
||||||
mapping = self._mappings[paramNum]
|
|
||||||
variable = net.variables[param]
|
|
||||||
# Set the missing value if available
|
|
||||||
try:
|
|
||||||
missing = variable.missing_value
|
|
||||||
except AttributeError:
|
|
||||||
missing = None
|
|
||||||
# Set the fill value if available
|
|
||||||
try:
|
|
||||||
fillValue = variable._FillValue
|
|
||||||
except AttributeError:
|
|
||||||
fillValue = None
|
|
||||||
if len(variable.shape) == 1:
|
|
||||||
if fillValue != None and variable[x] == fillValue:
|
|
||||||
mesowestReport[mapping] = Double(-9999.0)
|
|
||||||
continue
|
|
||||||
if missing != None:
|
|
||||||
# Odd case where certain values are -764 in the netcdf
|
|
||||||
if variable[x] == missing or variable[x] < -600:
|
|
||||||
mesowestReport[mapping] = Double(-9999.0)
|
|
||||||
continue
|
|
||||||
mesowestReport[mapping] = Double.valueOf(str(variable[x]))
|
|
||||||
elif len(variable.shape) > 1 and variable.shape[1] > 3:
|
|
||||||
mesowestReport[mapping] = ''.join(variable[x])
|
|
||||||
|
|
||||||
location = SurfaceObsLocation()
|
|
||||||
lat = Double.valueOf(str(net.variables['latitude'][x]))
|
|
||||||
lon = Double.valueOf(str(net.variables['longitude'][x]))
|
|
||||||
elv = Double.valueOf(str(net.variables['elevation'][x]))
|
|
||||||
location.assignLocation(lat.doubleValue(),lon.doubleValue());
|
|
||||||
location.setElevation(Integer(elv.intValue()));
|
|
||||||
location.setStationId(stationId)
|
|
||||||
mesowestReport['location'] = location
|
|
||||||
mesowestReport['timeObs'] = long(reportTime)
|
|
||||||
mesowestReport['dataTime'] = mesowestReport['timeObs']
|
|
||||||
mesowestReport['networkType'] = ''.join(net.variables['stationType'][x])
|
|
||||||
mesowestReports.append(mesowestReport)
|
|
||||||
net.close()
|
|
||||||
return mesowestReports
|
|
||||||
|
|
||||||
|
|
||||||
def _usage(self):
|
|
||||||
#Prints out usage information if started without sufficient command
|
|
||||||
#line arguments.
|
|
||||||
s = "This tool is not meant to be run from the command line."
|
|
||||||
print s
|
|
||||||
LogStream.logProblem(s)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
try:
|
|
||||||
LogStream.logEvent("MesowestDecoder Starting")
|
|
||||||
decoder = MesowestDecoder()
|
|
||||||
decoder.decode()
|
|
||||||
decoder = None
|
|
||||||
LogStream.logEvent("MesowestDecoder Finished")
|
|
||||||
except:
|
|
||||||
LogStream.logProblem("Caught Exception: ", LogStream.exc())
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
sys.exit(0)
|
|
|
@ -1,6 +0,0 @@
|
||||||
source.. = src/
|
|
||||||
output.. = bin/
|
|
||||||
bin.includes = META-INF/,\
|
|
||||||
.,\
|
|
||||||
res/,\
|
|
||||||
MesowestDecoder.py
|
|
|
@ -1,21 +0,0 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
|
||||||
|
|
||||||
<bean id="mesowestPluginName" class="java.lang.String">
|
|
||||||
<constructor-arg type="java.lang.String" value="mesowest" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mesowestProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
|
||||||
<property name="pluginName" ref="mesowestPluginName" />
|
|
||||||
<property name="pluginFQN" value="com.raytheon.uf.edex.plugin.mesowest" />
|
|
||||||
<property name="dao" value="com.raytheon.uf.edex.plugin.mesowest.dao.MESOWestDao" />
|
|
||||||
<property name="record" value="com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
|
||||||
<constructor-arg value="mesowest"/>
|
|
||||||
<constructor-arg ref="mesowestProperties"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,75 +0,0 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
|
||||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
|
||||||
|
|
||||||
<bean id="mesowestDatabase" class="java.lang.String">
|
|
||||||
<constructor-arg type="java.lang.String" value="metadata" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mesowestFilter" class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
|
|
||||||
<constructor-arg type="java.lang.String" value="mesowest_filters.xml" />
|
|
||||||
<constructor-arg type="java.lang.String" value="SITE" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mesowestInitializer" class="com.raytheon.edex.plugin.DefaultPluginInitializer">
|
|
||||||
<constructor-arg ref="mesowestPluginName" />
|
|
||||||
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mesowestSeparator" class="com.raytheon.uf.edex.plugin.mesowest.MESOWestSeparator" />
|
|
||||||
|
|
||||||
<!--bean id="mesowestDecoder" class="com.raytheon.uf.edex.plugin.mesowest.MESOWestDecoder">
|
|
||||||
<constructor-arg ref="mesowestPluginName" />
|
|
||||||
</bean-->
|
|
||||||
|
|
||||||
<bean id="mesowestDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
|
||||||
<property name="pluginName" value="mesowest" />
|
|
||||||
<property name="pluginFQN" value="com.raytheon.uf.edex.plugin.mesowest" />
|
|
||||||
<property name="moduleName" value="MesowestDecoder" />
|
|
||||||
<property name="recordClassname"
|
|
||||||
value="com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord" />
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mesowestCamelRegistered" factory-bean="contextManager"
|
|
||||||
factory-method="register" depends-on="persistCamelRegistered">
|
|
||||||
<constructor-arg ref="mesowest-camel"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<camelContext id="mesowest-camel"
|
|
||||||
xmlns="http://camel.apache.org/schema/spring"
|
|
||||||
errorHandlerRef="errorHandler"
|
|
||||||
autoStartup="false">
|
|
||||||
<!--
|
|
||||||
<endpoint id="mesowestFileEndpoint" uri="file:${edex.home}/data/sbn/mesowest?noop=true&idempotent=false" />
|
|
||||||
|
|
||||||
<route id="mesowestFileConsumerRoute">
|
|
||||||
<from ref="mesowestFileEndpoint" />
|
|
||||||
<bean ref="fileToString" />
|
|
||||||
<setHeader headerName="pluginName">
|
|
||||||
<constant>mesowest</constant>
|
|
||||||
</setHeader>
|
|
||||||
<to uri="jms-durable:queue:Ingest.Mesowest" />
|
|
||||||
</route>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Begin MESOWest routes -->
|
|
||||||
<route id="mesowestIngestRoute">
|
|
||||||
<from uri="jms-durable:queue:Ingest.Mesowest"/>
|
|
||||||
<doTry>
|
|
||||||
<pipeline>
|
|
||||||
<bean ref="stringToFile" />
|
|
||||||
<bean ref="mesowestDecoder" method="decode" />
|
|
||||||
<bean ref="mesowestFilter" method="filter" />
|
|
||||||
<to uri="direct-vm:indexAlert" />
|
|
||||||
</pipeline>
|
|
||||||
<doCatch>
|
|
||||||
<exception>java.lang.Throwable</exception>
|
|
||||||
<to
|
|
||||||
uri="log:warning?level=ERROR" />
|
|
||||||
</doCatch>
|
|
||||||
</doTry>
|
|
||||||
</route>
|
|
||||||
</camelContext>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,148 +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.edex.plugin.mesowest;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import com.raytheon.edex.exception.DecoderException;
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestParser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 03, 2009 jkorman Initial creation
|
|
||||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MESOWestDecoder {
|
|
||||||
|
|
||||||
private final Log logger = LogFactory.getLog(getClass());
|
|
||||||
|
|
||||||
private String pluginName = "mesowest";
|
|
||||||
|
|
||||||
private final Map<String, MESOWestParser> parserMap = new HashMap<String, MESOWestParser>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
*/
|
|
||||||
public MESOWestDecoder(String name) {
|
|
||||||
this.pluginName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the next decoded data record.
|
|
||||||
*
|
|
||||||
* @return One record of decoded data.
|
|
||||||
* @throws DecoderException
|
|
||||||
* Thrown if no data is available.
|
|
||||||
*/
|
|
||||||
public PluginDataObject[] decode(IDecoderInput input) {
|
|
||||||
|
|
||||||
PluginDataObject[] decodedData = null;
|
|
||||||
String traceId = null;
|
|
||||||
|
|
||||||
logger.debug("MESOWestDecoder.decode()");
|
|
||||||
|
|
||||||
if (input != null) {
|
|
||||||
traceId = input.getProperty(MESOWestConstants.TRACEID);
|
|
||||||
|
|
||||||
MESOWestRecord record = null;
|
|
||||||
|
|
||||||
String type = input.getProperty(MESOWestConstants.K_DATATYPE);
|
|
||||||
if (MESOWestConstants.T_PARMHEADER.equals(type)) {
|
|
||||||
parserMap.put(input.getProperty("uuid"), new MESOWestParser(
|
|
||||||
input.getReport()));
|
|
||||||
logger.debug("Created parser ");
|
|
||||||
} else if (MESOWestConstants.T_LASTITEM.equals(type)) {
|
|
||||||
parserMap.remove(input.getProperty("uuid"));
|
|
||||||
logger.debug("Destroyed parser ");
|
|
||||||
} else {
|
|
||||||
MESOWestParser parser = parserMap
|
|
||||||
.get(input.getProperty("uuid"));
|
|
||||||
if (parser != null) {
|
|
||||||
if (input.getReport().length() > 10) {
|
|
||||||
if ((record = parser.decode(input.getReport())) != null) {
|
|
||||||
record.setTraceId(traceId);
|
|
||||||
record.setObsText(input.getReport() + "\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.error("Unexpected data in data stream");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (record != null) {
|
|
||||||
logger.info("Decoded obs " + record.getStationId());
|
|
||||||
|
|
||||||
try {
|
|
||||||
record.constructDataURI();
|
|
||||||
} catch (PluginException e) {
|
|
||||||
throw new DecoderException(
|
|
||||||
"Unable to construct dataURI", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
decodedData = new PluginDataObject[] { record };
|
|
||||||
} else {
|
|
||||||
logger.info(String.format("%s - Decoded no obs", traceId));
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Error in MESOWestDecoder", e);
|
|
||||||
} finally {
|
|
||||||
if (decodedData == null) {
|
|
||||||
decodedData = new PluginDataObject[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.error("null input data in MESOWestDecoder");
|
|
||||||
}
|
|
||||||
|
|
||||||
return decodedData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the pluginName
|
|
||||||
*/
|
|
||||||
public String getPluginName() {
|
|
||||||
return pluginName;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,212 +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.edex.plugin.mesowest;
|
|
||||||
|
|
||||||
import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.bind.Marshaller;
|
|
||||||
import javax.xml.bind.Unmarshaller;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|
||||||
import com.raytheon.uf.common.localization.IPathManager;
|
|
||||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
|
||||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
|
||||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.RectFilterElement;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A filter for mesowest data that is configured through XML.
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 23, 2009 jkorman Initial creation
|
|
||||||
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@XmlRootElement
|
|
||||||
@XmlAccessorType(XmlAccessType.NONE)
|
|
||||||
@DynamicSerialize
|
|
||||||
public class MESOWestFilter extends AbstractObsFilter {
|
|
||||||
|
|
||||||
private Log logger = LogFactory.getLog(getClass());
|
|
||||||
|
|
||||||
private static final String FILTER_CONFIG = "mesowest_filters.xml";
|
|
||||||
|
|
||||||
public MESOWestFilter() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public MESOWestFilter(String site) {
|
|
||||||
try {
|
|
||||||
IPathManager manager = PathManagerFactory.getPathManager();
|
|
||||||
|
|
||||||
LocalizationContext siteContext = manager.getContextForSite(
|
|
||||||
EDEX_STATIC, site);
|
|
||||||
|
|
||||||
File siteDir = manager.getFile(siteContext, "");
|
|
||||||
if (siteDir.exists()) {
|
|
||||||
try {
|
|
||||||
File srcFile = new File(siteDir, FILTER_CONFIG);
|
|
||||||
JAXBManager jaxb = new JAXBManager(MESOWestFilter.class,
|
|
||||||
PluginDataObjectFilter.class);
|
|
||||||
AbstractObsFilter filter = jaxb.unmarshalFromXmlFile(
|
|
||||||
AbstractObsFilter.class, srcFile);
|
|
||||||
this.setFilterElements(filter.getFilterElements());
|
|
||||||
this.setFilterName(filter.getFilterName());
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
logger.error("Unable to unmarshall filter config", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("Error creating filter. Creating default empty", e);
|
|
||||||
setFilterName("Default");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply the list of filters against given input data.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
|
||||||
int reportCount = 0;
|
|
||||||
if (reports != null) {
|
|
||||||
for (int i = 0; i < reports.length; i++) {
|
|
||||||
boolean keep = false;
|
|
||||||
for (AbstractFilterElement element : filterElements) {
|
|
||||||
PluginDataObject r = element.filter(reports[i]);
|
|
||||||
if (r != null) {
|
|
||||||
if (AbstractObsFilter.INCLUDE_TYPE.equals(element
|
|
||||||
.getFilterType())) {
|
|
||||||
keep = keep | true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!keep) {
|
|
||||||
reports[i] = null;
|
|
||||||
} else {
|
|
||||||
reportCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (reportCount == 0) {
|
|
||||||
reports = new PluginDataObject[0];
|
|
||||||
} else {
|
|
||||||
PluginDataObject[] newReports = new PluginDataObject[reportCount];
|
|
||||||
int i = 0;
|
|
||||||
for (PluginDataObject report : reports) {
|
|
||||||
if (report != null) {
|
|
||||||
newReports[i++] = report;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reports = newReports;
|
|
||||||
}
|
|
||||||
return reports;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final void main(String[] args) {
|
|
||||||
|
|
||||||
AbstractObsFilter filter = new MESOWestFilter();
|
|
||||||
filter.setFilterName("TestFilter");
|
|
||||||
|
|
||||||
RectFilterElement rect = new RectFilterElement();
|
|
||||||
rect.setLowerRightLat(40.0);
|
|
||||||
rect.setLowerRightLon(-90.0);
|
|
||||||
rect.setUpperLeftLat(45.0);
|
|
||||||
rect.setUpperLeftLon(-95.0);
|
|
||||||
rect.setFilterElementName("OAX.WFO");
|
|
||||||
rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
|
||||||
filter.addFilterElement(rect);
|
|
||||||
|
|
||||||
rect = new RectFilterElement();
|
|
||||||
rect.setLowerRightLat(46.0);
|
|
||||||
rect.setLowerRightLon(-90.0);
|
|
||||||
rect.setUpperLeftLat(49.0);
|
|
||||||
rect.setUpperLeftLon(-100.0);
|
|
||||||
rect.setFilterElementName("Upperbasin");
|
|
||||||
rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
|
||||||
filter.addFilterElement(rect);
|
|
||||||
|
|
||||||
String s = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
JAXBContext ctx = JAXBContext.newInstance(MESOWestFilter.class,
|
|
||||||
RectFilterElement.class);
|
|
||||||
|
|
||||||
Marshaller msh = ctx.createMarshaller();
|
|
||||||
|
|
||||||
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
|
||||||
|
|
||||||
ByteArrayOutputStream istrm = new ByteArrayOutputStream();
|
|
||||||
msh.marshal(filter, istrm);
|
|
||||||
|
|
||||||
s = istrm.toString();
|
|
||||||
|
|
||||||
System.out.println(s);
|
|
||||||
|
|
||||||
rect = null;
|
|
||||||
filter = null;
|
|
||||||
|
|
||||||
Unmarshaller umsh = ctx.createUnmarshaller();
|
|
||||||
|
|
||||||
ByteArrayInputStream ostrm = new ByteArrayInputStream(s.getBytes());
|
|
||||||
filter = (AbstractObsFilter) umsh.unmarshal(ostrm);
|
|
||||||
|
|
||||||
System.out.println(filter.getFilterName());
|
|
||||||
System.out.println(filter.getClass().getName());
|
|
||||||
|
|
||||||
List<AbstractFilterElement> elements = filter.getFilterElements();
|
|
||||||
for (AbstractFilterElement element : elements) {
|
|
||||||
System.out.println(element.getFilterElementName());
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,218 +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.edex.plugin.mesowest;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
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.edex.decodertools.core.DecoderInput;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* 20090310 1969 jkorman Initial Coding.
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
public class MESOWestSeparator extends AbstractRecordSeparator {
|
|
||||||
|
|
||||||
private Log logger = LogFactory.getLog(getClass());
|
|
||||||
|
|
||||||
private static final int MIN_LINE_LEN = 10;
|
|
||||||
|
|
||||||
private byte[] messageData = null;
|
|
||||||
|
|
||||||
private Headers headerData = null;
|
|
||||||
|
|
||||||
private List<String> reports = null;
|
|
||||||
|
|
||||||
private String traceId = null;
|
|
||||||
|
|
||||||
private int currentReport = -1;
|
|
||||||
|
|
||||||
private UUID uuid = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
* @param headers
|
|
||||||
*/
|
|
||||||
private MESOWestSeparator(byte[] data, Headers headers) {
|
|
||||||
headerData = headers;
|
|
||||||
if (headerData != null) {
|
|
||||||
traceId = (String) headerData.get(MESOWestConstants.TRACEID);
|
|
||||||
}
|
|
||||||
|
|
||||||
uuid = UUID.randomUUID();
|
|
||||||
|
|
||||||
setData(data, headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Empty constructor so Spring doesn't complain. TODO : Make sure this is
|
|
||||||
* needed.
|
|
||||||
*/
|
|
||||||
public MESOWestSeparator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an instance of a separator using the supplied data.
|
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
* @param headers
|
|
||||||
* @return
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public static MESOWestSeparator separate(byte[] data, Headers headers)
|
|
||||||
throws Exception {
|
|
||||||
return new MESOWestSeparator(data, headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the next record. This implementation returns the record as a String.
|
|
||||||
*
|
|
||||||
* @return The next observation record as a String.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IDecoderInput next() {
|
|
||||||
IDecoderInput data = null;
|
|
||||||
if (hasNext()) {
|
|
||||||
|
|
||||||
String rpt = reports.get(currentReport++);
|
|
||||||
data = new DecoderInput(null, rpt);
|
|
||||||
data.setProperty("uuid", uuid.toString());
|
|
||||||
|
|
||||||
if (rpt.startsWith(MESOWestConstants.D_PARMLEADER)) {
|
|
||||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
|
||||||
MESOWestConstants.T_PARMHEADER);
|
|
||||||
} else if (rpt.startsWith(MESOWestConstants.LAST_DATA_ITEM)) {
|
|
||||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
|
||||||
MESOWestConstants.T_LASTITEM);
|
|
||||||
} else {
|
|
||||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
|
||||||
MESOWestConstants.T_REPORTDATA);
|
|
||||||
}
|
|
||||||
data.setProperty(MESOWestConstants.TRACEID, traceId);
|
|
||||||
}
|
|
||||||
logger.debug("Separator.next()");
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is there another record available?
|
|
||||||
*
|
|
||||||
* @return Is there another record available?
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean hasNext() {
|
|
||||||
logger.debug("Separator.hasNext()");
|
|
||||||
boolean hasNext = false;
|
|
||||||
if (reports != null) {
|
|
||||||
if (reports.size() > 0) {
|
|
||||||
hasNext = currentReport < reports.size();
|
|
||||||
} else {
|
|
||||||
reports.clear();
|
|
||||||
reports = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the raw message data and invoke the internal message separation
|
|
||||||
* process.
|
|
||||||
*
|
|
||||||
* @param rawMessage
|
|
||||||
* The raw weather text message.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setData(byte[] rawMessage, Headers headers) {
|
|
||||||
currentReport = -1;
|
|
||||||
reports = new ArrayList<String>();
|
|
||||||
if (rawMessage != null) {
|
|
||||||
|
|
||||||
InputStream strm = new ByteArrayInputStream(rawMessage);
|
|
||||||
|
|
||||||
separate(strm);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((reports != null) && (reports.size() > 0)) {
|
|
||||||
currentReport = 0;
|
|
||||||
} else {
|
|
||||||
logger.info("No reports found in data.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the message data.
|
|
||||||
*
|
|
||||||
* @return The cleaned message data.
|
|
||||||
*/
|
|
||||||
public byte[] getMessage() {
|
|
||||||
return messageData;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Separate the mesonet data, one report per line. No need to account for
|
|
||||||
* reports spanning lines.
|
|
||||||
*
|
|
||||||
* @param strm
|
|
||||||
* An input stream to the meso data.
|
|
||||||
*/
|
|
||||||
private void separate(InputStream strm) {
|
|
||||||
BufferedReader in = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
in = new BufferedReader(new InputStreamReader(strm));
|
|
||||||
|
|
||||||
String s = null;
|
|
||||||
while ((s = in.readLine()) != null) {
|
|
||||||
if (s.length() > MIN_LINE_LEN) {
|
|
||||||
reports.add(s.trim());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reports.add(MESOWestConstants.LAST_DATA_ITEM);
|
|
||||||
|
|
||||||
} catch (IOException ioe) {
|
|
||||||
logger.error("Error reading mesowest data " + ioe);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,772 +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.edex.plugin.mesowest.common;
|
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import javax.measure.quantity.Angle;
|
|
||||||
import javax.measure.quantity.Length;
|
|
||||||
import javax.measure.quantity.Pressure;
|
|
||||||
import javax.measure.quantity.Temperature;
|
|
||||||
import javax.measure.quantity.Velocity;
|
|
||||||
import javax.measure.unit.NonSI;
|
|
||||||
import javax.measure.unit.SI;
|
|
||||||
import javax.measure.unit.Unit;
|
|
||||||
import javax.persistence.Access;
|
|
||||||
import javax.persistence.AccessType;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Embedded;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.SequenceGenerator;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
import javax.persistence.UniqueConstraint;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|
||||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
|
||||||
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
|
|
||||||
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|
||||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|
||||||
import com.vividsolutions.jts.geom.Geometry;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Record for mesowest data
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 03, 2009 jkorman Initial creation
|
|
||||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
|
||||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
|
||||||
* PluginDataObject.
|
|
||||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
|
||||||
* Oct 22, 2013 2361 njensen Remove XML annotations
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "mesowestseq")
|
|
||||||
@Table(name = "mesowest", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
|
|
||||||
@DynamicSerialize
|
|
||||||
public class MESOWestRecord extends PluginDataObject implements
|
|
||||||
ISpatialEnabled, IDecoderGettable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public static final String OBS_TEXT = "text";
|
|
||||||
|
|
||||||
public static final Unit<Length> LENGTH_UNIT = SI.METER;
|
|
||||||
|
|
||||||
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.KELVIN;
|
|
||||||
|
|
||||||
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
|
|
||||||
|
|
||||||
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
|
|
||||||
|
|
||||||
public static final Unit<Pressure> PRESSURE_UNIT = SI.PASCAL;
|
|
||||||
|
|
||||||
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
|
|
||||||
|
|
||||||
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
|
|
||||||
static {
|
|
||||||
PARM_MAP.put("T", SFC_TEMP);
|
|
||||||
PARM_MAP.put("DpT", SFC_DWPT);
|
|
||||||
PARM_MAP.put("WS", SFC_WNDSPD);
|
|
||||||
PARM_MAP.put("WD", SFC_WNDDIR);
|
|
||||||
PARM_MAP.put("WGS", SFC_WNDGST);
|
|
||||||
PARM_MAP.put("ASET", "SFC.PRESS.ALTIMETER");
|
|
||||||
PARM_MAP.put("PMSL", PRES_SLP);
|
|
||||||
PARM_MAP.put("NLAT", STA_LAT);
|
|
||||||
PARM_MAP.put("NLON", STA_LON);
|
|
||||||
PARM_MAP.put("STA", "STA");
|
|
||||||
PARM_MAP.put("stationid", "STA");
|
|
||||||
PARM_MAP.put("message", OBS_TEXT);
|
|
||||||
PARM_MAP.put(OBS_TEXT, OBS_TEXT);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataURI(position = 1)
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private String networkType;
|
|
||||||
|
|
||||||
// Time of the observation.
|
|
||||||
@DataURI(position = 2)
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Calendar timeObs;
|
|
||||||
|
|
||||||
@Embedded
|
|
||||||
@DataURI(position = 3, embedded = true)
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private SurfaceObsLocation location;
|
|
||||||
|
|
||||||
// Observation air temperature in degrees Kelvin.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double temp;
|
|
||||||
|
|
||||||
// Observation dewpoint temperature in degrees Kelvin.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double dwpt;
|
|
||||||
|
|
||||||
// 24 Hour maximum temperature in degrees Kelvin.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double maxT24;
|
|
||||||
|
|
||||||
// 24 Hour minimum temperature in degrees Kelvin.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double minT24;
|
|
||||||
|
|
||||||
// Relative Humidity in percent.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double humidity;
|
|
||||||
|
|
||||||
// Observation wind direction in angular degrees. Integer
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double windDirection;
|
|
||||||
|
|
||||||
// Observation wind speed in meters per second.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double windSpeed;
|
|
||||||
|
|
||||||
// Observation wind gust in meters per second.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double windGust;
|
|
||||||
|
|
||||||
// Observation pressure in Pa.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double pressure;
|
|
||||||
|
|
||||||
// Observation pressure in Pa.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double seaLevelPressure;
|
|
||||||
|
|
||||||
// Observation pressure in Pa.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double altimeter;
|
|
||||||
|
|
||||||
// Observation precip in mm.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip;
|
|
||||||
|
|
||||||
// 1 minute precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_01M;
|
|
||||||
|
|
||||||
// 5 minute precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_05M;
|
|
||||||
|
|
||||||
// 10 minute precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_10M;
|
|
||||||
|
|
||||||
// 15 minute precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_15M;
|
|
||||||
|
|
||||||
// 30 minute precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_30M;
|
|
||||||
|
|
||||||
// 1 hour precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_01H;
|
|
||||||
|
|
||||||
// 3 hour precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_03H;
|
|
||||||
|
|
||||||
// 6 hour precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_06H;
|
|
||||||
|
|
||||||
// 24 hour precip in inches.
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private Double precip_24H;
|
|
||||||
|
|
||||||
// Raw observation text
|
|
||||||
@Column
|
|
||||||
@DynamicSerializeElement
|
|
||||||
private String obsText;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public MESOWestRecord() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for DataURI construction through base class. This is used by
|
|
||||||
* the notification service.
|
|
||||||
*
|
|
||||||
* @param uri
|
|
||||||
* A data uri applicable to this class.
|
|
||||||
*/
|
|
||||||
public MESOWestRecord(String uri) {
|
|
||||||
super(uri);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get this observation's geometry.
|
|
||||||
*
|
|
||||||
* @return The geometry for this observation.
|
|
||||||
*/
|
|
||||||
public Geometry getGeometry() {
|
|
||||||
return location.getGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the geometry latitude.
|
|
||||||
*
|
|
||||||
* @return The geometry latitude.
|
|
||||||
*/
|
|
||||||
public double getLatitude() {
|
|
||||||
return location.getLatitude();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the geometry longitude.
|
|
||||||
*
|
|
||||||
* @return The geometry longitude.
|
|
||||||
*/
|
|
||||||
public double getLongitude() {
|
|
||||||
return location.getLongitude();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the station identifier for this observation.
|
|
||||||
*
|
|
||||||
* @return the stationId
|
|
||||||
*/
|
|
||||||
public String getStationId() {
|
|
||||||
return location.getStationId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the elevation, in meters, of the observing platform or location.
|
|
||||||
*
|
|
||||||
* @return The observation elevation, in meters.
|
|
||||||
*/
|
|
||||||
public Integer getElevation() {
|
|
||||||
return location.getElevation();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the location
|
|
||||||
*/
|
|
||||||
public SurfaceObsLocation getLocation() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param location
|
|
||||||
* the location to set
|
|
||||||
*/
|
|
||||||
public void setLocation(SurfaceObsLocation location) {
|
|
||||||
this.location = location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getNetworkType() {
|
|
||||||
return networkType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public void setNetworkType(String type) {
|
|
||||||
networkType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the timeObs
|
|
||||||
*/
|
|
||||||
public Calendar getTimeObs() {
|
|
||||||
return timeObs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param timeObs
|
|
||||||
* the timeObs to set
|
|
||||||
*/
|
|
||||||
public void setTimeObs(Calendar timeObs) {
|
|
||||||
this.timeObs = timeObs;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ******************************************
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the temp
|
|
||||||
*/
|
|
||||||
public Double getTemp() {
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param temp
|
|
||||||
* the temp to set
|
|
||||||
*/
|
|
||||||
public void setTemp(Double temp) {
|
|
||||||
this.temp = temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the dwpt
|
|
||||||
*/
|
|
||||||
public Double getDwpt() {
|
|
||||||
return dwpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param dwpt
|
|
||||||
* the dwpt to set
|
|
||||||
*/
|
|
||||||
public void setDwpt(Double dwpt) {
|
|
||||||
this.dwpt = dwpt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the maxT24
|
|
||||||
*/
|
|
||||||
public Double getMaxT24() {
|
|
||||||
return maxT24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param maxT24
|
|
||||||
* the maxT24 to set
|
|
||||||
*/
|
|
||||||
public void setMaxT24(Double maxT24) {
|
|
||||||
this.maxT24 = maxT24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the minT24
|
|
||||||
*/
|
|
||||||
public Double getMinT24() {
|
|
||||||
return minT24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param minT24
|
|
||||||
* the minT24 to set
|
|
||||||
*/
|
|
||||||
public void setMinT24(Double minT24) {
|
|
||||||
this.minT24 = minT24;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the humidity
|
|
||||||
*/
|
|
||||||
public Double getHumidity() {
|
|
||||||
return humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param humidity
|
|
||||||
* the humidity to set
|
|
||||||
*/
|
|
||||||
public void setHumidity(Double humidity) {
|
|
||||||
this.humidity = humidity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the windDirection
|
|
||||||
*/
|
|
||||||
public Double getWindDirection() {
|
|
||||||
return windDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param windDirection
|
|
||||||
* the windDirection to set
|
|
||||||
*/
|
|
||||||
public void setWindDirection(Double windDirection) {
|
|
||||||
this.windDirection = windDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the windSpeed
|
|
||||||
*/
|
|
||||||
public Double getWindSpeed() {
|
|
||||||
return windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param windSpeed
|
|
||||||
* the windSpeed to set
|
|
||||||
*/
|
|
||||||
public void setWindSpeed(Double windSpeed) {
|
|
||||||
this.windSpeed = windSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the windGust
|
|
||||||
*/
|
|
||||||
public Double getWindGust() {
|
|
||||||
return windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param windGust
|
|
||||||
* the windGust to set
|
|
||||||
*/
|
|
||||||
public void setWindGust(Double windGust) {
|
|
||||||
this.windGust = windGust;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the pressure
|
|
||||||
*/
|
|
||||||
public Double getPressure() {
|
|
||||||
return pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param pressure
|
|
||||||
* the pressure to set
|
|
||||||
*/
|
|
||||||
public void setPressure(Double pressure) {
|
|
||||||
this.pressure = pressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the seaLevelPressure
|
|
||||||
*/
|
|
||||||
public Double getSeaLevelPressure() {
|
|
||||||
return seaLevelPressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param seaLevelPressure
|
|
||||||
* the seaLevelPressure to set
|
|
||||||
*/
|
|
||||||
public void setSeaLevelPressure(Double seaLevelPressure) {
|
|
||||||
this.seaLevelPressure = seaLevelPressure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the altimeter
|
|
||||||
*/
|
|
||||||
public Double getAltimeter() {
|
|
||||||
return altimeter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param altimeter
|
|
||||||
* the altimeter to set
|
|
||||||
*/
|
|
||||||
public void setAltimeter(Double altimeter) {
|
|
||||||
this.altimeter = altimeter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip
|
|
||||||
*/
|
|
||||||
public Double getPrecip() {
|
|
||||||
return precip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip
|
|
||||||
* the precip to set
|
|
||||||
*/
|
|
||||||
public void setPrecip(Double precip) {
|
|
||||||
this.precip = precip;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_01M
|
|
||||||
*/
|
|
||||||
public Double getPrecip_01M() {
|
|
||||||
return precip_01M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_01M
|
|
||||||
* the precip_01M to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_01M(Double precip_01M) {
|
|
||||||
this.precip_01M = precip_01M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_05M
|
|
||||||
*/
|
|
||||||
public Double getPrecip_05M() {
|
|
||||||
return precip_05M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_05M
|
|
||||||
* the precip_05M to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_05M(Double precip_05M) {
|
|
||||||
this.precip_05M = precip_05M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_10M
|
|
||||||
*/
|
|
||||||
public Double getPrecip_10M() {
|
|
||||||
return precip_10M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_10M
|
|
||||||
* the precip_10M to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_10M(Double precip_10M) {
|
|
||||||
this.precip_10M = precip_10M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_15M
|
|
||||||
*/
|
|
||||||
public Double getPrecip_15M() {
|
|
||||||
return precip_15M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_15M
|
|
||||||
* the precip_15M to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_15M(Double precip_15M) {
|
|
||||||
this.precip_15M = precip_15M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_30M
|
|
||||||
*/
|
|
||||||
public Double getPrecip_30M() {
|
|
||||||
return precip_30M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_30M
|
|
||||||
* the precip_30M to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_30M(Double precip_30M) {
|
|
||||||
this.precip_30M = precip_30M;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_01H
|
|
||||||
*/
|
|
||||||
public Double getPrecip_01H() {
|
|
||||||
return precip_01H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_01H
|
|
||||||
* the precip_01H to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_01H(Double precip_01H) {
|
|
||||||
this.precip_01H = precip_01H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_03H
|
|
||||||
*/
|
|
||||||
public Double getPrecip_03H() {
|
|
||||||
return precip_03H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_03H
|
|
||||||
* the precip_03H to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_03H(Double precip_03H) {
|
|
||||||
this.precip_03H = precip_03H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_06H
|
|
||||||
*/
|
|
||||||
public Double getPrecip_06H() {
|
|
||||||
return precip_06H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_06H
|
|
||||||
* the precip_06H to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_06H(Double precip_06H) {
|
|
||||||
this.precip_06H = precip_06H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the precip_24H
|
|
||||||
*/
|
|
||||||
public Double getPrecip_24H() {
|
|
||||||
return precip_24H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param precip_24H
|
|
||||||
* the precip_24H to set
|
|
||||||
*/
|
|
||||||
public void setPrecip_24H(Double precip_24H) {
|
|
||||||
this.precip_24H = precip_24H;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the obsText
|
|
||||||
*/
|
|
||||||
public String getObsText() {
|
|
||||||
return obsText;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param obsText
|
|
||||||
* the obsText to set
|
|
||||||
*/
|
|
||||||
public void setObsText(String obsText) {
|
|
||||||
this.obsText = obsText;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ******************************************
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void setSpatialObject(SurfaceObsLocation loc) {
|
|
||||||
location = loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public SurfaceObsLocation getSpatialObject() {
|
|
||||||
return location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class implements IDecoderGettable so return this instance.
|
|
||||||
*
|
|
||||||
* @return The reference to this instance.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IDecoderGettable getDecoderGettable() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getString(String paramName) {
|
|
||||||
String retValue = null;
|
|
||||||
String pName = PARM_MAP.get(paramName);
|
|
||||||
if ("STA".matches(pName)) {
|
|
||||||
retValue = getStationId();
|
|
||||||
} else if (OBS_TEXT.equals(pName)) {
|
|
||||||
retValue = getStationId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return retValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getStrings(String paramName) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Amount getValue(String paramName) {
|
|
||||||
Amount a = null;
|
|
||||||
String pName = PARM_MAP.get(paramName);
|
|
||||||
|
|
||||||
if (SFC_TEMP.equals(pName)) {
|
|
||||||
a = new Amount(temp, TEMPERATURE_UNIT);
|
|
||||||
} else if (SFC_DWPT.equals(pName)) {
|
|
||||||
a = new Amount(dwpt, TEMPERATURE_UNIT);
|
|
||||||
} else if (SFC_WNDSPD.equals(pName)) {
|
|
||||||
a = new Amount(windSpeed, WIND_SPEED_UNIT);
|
|
||||||
} else if (SFC_WNDGST.equals(pName)) {
|
|
||||||
a = new Amount(windGust, WIND_SPEED_UNIT);
|
|
||||||
} else if (SFC_WNDDIR.equals(pName)) {
|
|
||||||
a = new Amount(windDirection, WIND_DIR_UNIT);
|
|
||||||
} else if (PRES_ALTSG.equals(pName)) {
|
|
||||||
a = new Amount(altimeter, PRESSURE_UNIT);
|
|
||||||
} else if (STA_LAT.equals(pName)) {
|
|
||||||
a = new Amount(getLatitude(), LOCATION_UNIT);
|
|
||||||
} else if (STA_LON.equals(pName)) {
|
|
||||||
a = new Amount(getLongitude(), LOCATION_UNIT);
|
|
||||||
} else if (PRES_SLP.equals(pName)) {
|
|
||||||
a = new Amount(seaLevelPressure, PRESSURE_UNIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Collection<Amount> getValues(String paramName) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Column
|
|
||||||
@Access(AccessType.PROPERTY)
|
|
||||||
public String getDataURI() {
|
|
||||||
return super.getDataURI();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPluginName() {
|
|
||||||
return "mesowest";
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,77 +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.edex.plugin.mesowest.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.raytheon.edex.db.dao.DefaultPluginDao;
|
|
||||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
|
||||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 9, 2009 1939 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MESOWestDao extends DefaultPluginDao {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new ReccoDao
|
|
||||||
* @throws PluginException
|
|
||||||
*/
|
|
||||||
public MESOWestDao(String pluginName) throws PluginException {
|
|
||||||
super(pluginName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves an bufrua report using the datauri .
|
|
||||||
*
|
|
||||||
* @param dataURI
|
|
||||||
* The dataURI to match against.
|
|
||||||
* @return The report record if it exists.
|
|
||||||
*/
|
|
||||||
public MESOWestRecord queryByDataURI(String dataURI) {
|
|
||||||
MESOWestRecord report = null;
|
|
||||||
List<?> obs = null;
|
|
||||||
try {
|
|
||||||
obs = queryBySingleCriteria("dataURI", dataURI);
|
|
||||||
} catch (DataAccessLayerException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if((obs != null)&&(obs.size() > 0)) {
|
|
||||||
report = (MESOWestRecord) obs.get(0);
|
|
||||||
}
|
|
||||||
return report;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,164 +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.edex.plugin.mesowest.decoder;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 10, 2009 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MESOWestConstants {
|
|
||||||
|
|
||||||
public static final String LAST_DATA_ITEM = "##### LAST DATA ITEM #####";
|
|
||||||
|
|
||||||
public static final String TRACEID = "traceId";
|
|
||||||
|
|
||||||
public static final String K_DATATYPE = "datatype";
|
|
||||||
|
|
||||||
public static final String T_PARMHEADER = "parmheader";
|
|
||||||
|
|
||||||
public static final String T_REPORTDATA = "report";
|
|
||||||
|
|
||||||
public static final String T_LASTITEM = LAST_DATA_ITEM;
|
|
||||||
|
|
||||||
public static final String D_PARMLEADER = "PARM =";
|
|
||||||
|
|
||||||
public static final String D_PARM_DELIMIT = ";";
|
|
||||||
|
|
||||||
public static final String P_STNID = "STNID";
|
|
||||||
|
|
||||||
public static final String P_LAT = "latitude";
|
|
||||||
|
|
||||||
public static final String P_LON = "longitude";
|
|
||||||
|
|
||||||
public static final String P_ELEV = "ELEV";
|
|
||||||
|
|
||||||
public static final String P_STNTYPE = "STNTYPE";
|
|
||||||
|
|
||||||
public static final String P_DATATIME = "DATETIME";
|
|
||||||
|
|
||||||
//*******************************************
|
|
||||||
|
|
||||||
public static final String P_SFCTEMP = "TMPF";
|
|
||||||
|
|
||||||
public static final String P_SFCDWPT = "DWPF";
|
|
||||||
//************************
|
|
||||||
|
|
||||||
public static final String P_MIN_T_24H = "LO24";
|
|
||||||
|
|
||||||
public static final String P_MAX_T_24H = "HI24";
|
|
||||||
|
|
||||||
//************************
|
|
||||||
public static final String P_WINDSPD = "SKNT";
|
|
||||||
|
|
||||||
public static final String P_WINDDIR = "DRCT";
|
|
||||||
|
|
||||||
public static final String P_WINDGST = "GUST";
|
|
||||||
|
|
||||||
public static final String P_HUMIDITY = "RELH";
|
|
||||||
|
|
||||||
public static final String P_PRESSURE = "PRES";
|
|
||||||
|
|
||||||
public static final String P_ALTIMETER = "ALTI";
|
|
||||||
|
|
||||||
public static final String P_SEA_LVL_PRES = "PMSL";
|
|
||||||
|
|
||||||
//************************
|
|
||||||
public static final String P_PRECIP_01M = "P1MI";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_05M = "P05I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_10M = "P10I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_15M = "P15I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_30M = "P30I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_01H = "P01I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_03H = "P03I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_06H = "P06I";
|
|
||||||
|
|
||||||
public static final String P_PRECIP_24H = "P24I";
|
|
||||||
|
|
||||||
private static int PARM_POS = 0;
|
|
||||||
private static Map<Integer,String> parmMap = new HashMap<Integer,String>();
|
|
||||||
static {
|
|
||||||
parmMap.put(PARM_POS++,P_STNID);
|
|
||||||
parmMap.put(PARM_POS++,P_LAT);
|
|
||||||
parmMap.put(PARM_POS++,P_LON);
|
|
||||||
parmMap.put(PARM_POS++,P_ELEV);
|
|
||||||
parmMap.put(PARM_POS++,P_STNTYPE);
|
|
||||||
parmMap.put(PARM_POS++,P_DATATIME);
|
|
||||||
}
|
|
||||||
|
|
||||||
// YYYYMMDD/HHMM
|
|
||||||
// 20090303/1950
|
|
||||||
|
|
||||||
public static final String D_DATEFMT = "yyyyMMdd/HHmm";
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static int getParmPos() {
|
|
||||||
return PARM_POS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Map<Integer,String> getParmMap() {
|
|
||||||
Map<Integer,String> map = new HashMap<Integer,String>();
|
|
||||||
map.putAll(parmMap);
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static Map<String, MESOWestElement> getValuesMap() {
|
|
||||||
Map<String, MESOWestElement> values = new HashMap<String, MESOWestElement>();
|
|
||||||
for(String s : parmMap.values()) {
|
|
||||||
values.put(s, new MESOWestElement(s));
|
|
||||||
}
|
|
||||||
return values;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,91 +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.edex.plugin.mesowest.decoder;
|
|
||||||
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 10, 2009 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MESOWestElement {
|
|
||||||
|
|
||||||
private final String elementName;
|
|
||||||
|
|
||||||
private String elementValue = null;
|
|
||||||
|
|
||||||
public MESOWestElement(String name) {
|
|
||||||
elementName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getElementName() {
|
|
||||||
return elementName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getElementValue() {
|
|
||||||
return elementValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void setElementValue(String value) {
|
|
||||||
elementValue = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param record
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
|
||||||
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return elementValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,345 +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.edex.plugin.mesowest.decoder;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
|
|
||||||
import com.raytheon.uf.common.time.DataTime;
|
|
||||||
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
|
|
||||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 10, 2009 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MESOWestParser {
|
|
||||||
|
|
||||||
private Log logger = LogFactory.getLog(getClass());
|
|
||||||
|
|
||||||
private Map<Integer, String> paramMap = null;
|
|
||||||
|
|
||||||
private Map<String, MESOWestElement> valuesMap = null;
|
|
||||||
|
|
||||||
private SimpleDateFormat dateFormat = new SimpleDateFormat(
|
|
||||||
MESOWestConstants.D_DATEFMT);
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param parameters
|
|
||||||
*/
|
|
||||||
public MESOWestParser(String parameters) {
|
|
||||||
|
|
||||||
paramMap = MESOWestConstants.getParmMap();
|
|
||||||
valuesMap = MESOWestConstants.getValuesMap();
|
|
||||||
parameters = parameters.trim();
|
|
||||||
if (parameters.startsWith(MESOWestConstants.D_PARMLEADER)) {
|
|
||||||
|
|
||||||
parameters = parameters.substring(
|
|
||||||
MESOWestConstants.D_PARMLEADER.length()).trim();
|
|
||||||
|
|
||||||
String[] parms = parameters.split(MESOWestConstants.D_PARM_DELIMIT,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
int index = MESOWestConstants.getParmPos();
|
|
||||||
for (String s : parms) {
|
|
||||||
paramMap.put(index, s);
|
|
||||||
valuesMap.put(s, new MESOWestElement(s));
|
|
||||||
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param report
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public MESOWestRecord decode(String report) {
|
|
||||||
// Clear out the old data!
|
|
||||||
clearValueMap();
|
|
||||||
String[] parts = report.split(",", -1);
|
|
||||||
|
|
||||||
if ((parts != null) && (parts.length > 5)) {
|
|
||||||
int index = 0;
|
|
||||||
for (String s : parts) {
|
|
||||||
String elementName = paramMap.get(index++);
|
|
||||||
|
|
||||||
MESOWestElement element = valuesMap.get(elementName);
|
|
||||||
if (element != null) {
|
|
||||||
element.setElementValue(s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return getDecodedData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private MESOWestRecord getDecodedData() {
|
|
||||||
|
|
||||||
MESOWestRecord record = getLocationInfo(new MESOWestRecord());
|
|
||||||
if (record != null) {
|
|
||||||
// Now go get specific data elements
|
|
||||||
Double val = getFloatValue(MESOWestConstants.P_SFCTEMP);
|
|
||||||
val = DecoderTools.fahrenheitToCelsius(val);
|
|
||||||
record.setTemp(DecoderTools.celsiusToKelvin(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_SFCDWPT);
|
|
||||||
val = DecoderTools.fahrenheitToCelsius(val);
|
|
||||||
record.setDwpt(DecoderTools.celsiusToKelvin(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_MAX_T_24H);
|
|
||||||
val = DecoderTools.fahrenheitToCelsius(val);
|
|
||||||
record.setMaxT24(DecoderTools.celsiusToKelvin(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_MIN_T_24H);
|
|
||||||
val = DecoderTools.fahrenheitToCelsius(val);
|
|
||||||
record.setMinT24(DecoderTools.celsiusToKelvin(val));
|
|
||||||
|
|
||||||
record.setHumidity(getFloatValue(MESOWestConstants.P_HUMIDITY));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_WINDSPD);
|
|
||||||
record.setWindSpeed(DecoderTools.ktsToMSec(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_WINDGST);
|
|
||||||
record.setWindGust(DecoderTools.ktsToMSec(val));
|
|
||||||
|
|
||||||
record.setWindDirection(getFloatValue(MESOWestConstants.P_WINDDIR));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_PRESSURE);
|
|
||||||
record.setPressure(DecoderTools.hPaToPa(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_ALTIMETER);
|
|
||||||
record.setAltimeter(DecoderTools.inToPa(val));
|
|
||||||
|
|
||||||
val = getFloatValue(MESOWestConstants.P_SEA_LVL_PRES);
|
|
||||||
record.setSeaLevelPressure(DecoderTools.hPaToPa(val));
|
|
||||||
|
|
||||||
|
|
||||||
record.setPrecip_01M(getFloatValue(MESOWestConstants.P_PRECIP_01M));
|
|
||||||
record.setPrecip_05M(getFloatValue(MESOWestConstants.P_PRECIP_05M));
|
|
||||||
record.setPrecip_10M(getFloatValue(MESOWestConstants.P_PRECIP_10M));
|
|
||||||
record.setPrecip_15M(getFloatValue(MESOWestConstants.P_PRECIP_15M));
|
|
||||||
record.setPrecip_30M(getFloatValue(MESOWestConstants.P_PRECIP_30M));
|
|
||||||
record.setPrecip_01H(getFloatValue(MESOWestConstants.P_PRECIP_01H));
|
|
||||||
record.setPrecip_03H(getFloatValue(MESOWestConstants.P_PRECIP_03H));
|
|
||||||
record.setPrecip_06H(getFloatValue(MESOWestConstants.P_PRECIP_06H));
|
|
||||||
record.setPrecip_24H(getFloatValue(MESOWestConstants.P_PRECIP_24H));
|
|
||||||
}
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear the parsed values from each element prior to accepting new data.
|
|
||||||
*/
|
|
||||||
private void clearValueMap() {
|
|
||||||
for (MESOWestElement element : valuesMap.values()) {
|
|
||||||
element.setElementValue(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param data
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private MESOWestRecord getLocationInfo(MESOWestRecord data) {
|
|
||||||
|
|
||||||
Calendar obsTime = null;
|
|
||||||
|
|
||||||
MESOWestElement m = valuesMap.get(MESOWestConstants.P_DATATIME);
|
|
||||||
if (m != null) {
|
|
||||||
String s = m.getElementValue();
|
|
||||||
if (s != null) {
|
|
||||||
try {
|
|
||||||
Date d = dateFormat.parse(s);
|
|
||||||
if (d != null) {
|
|
||||||
Calendar c = TimeTools.newCalendar(d.getTime());
|
|
||||||
if (c != null) {
|
|
||||||
obsTime = TimeTools.copy(c);
|
|
||||||
data.setTimeObs(obsTime);
|
|
||||||
|
|
||||||
DataTime t = new DataTime(TimeTools.copy(obsTime));
|
|
||||||
data.setDataTime(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (ParseException e) {
|
|
||||||
logger.error("Invalid date [" + s + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.error("Date missing");
|
|
||||||
data = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obsTime != null) {
|
|
||||||
|
|
||||||
Double lat = getFloatValue(MESOWestConstants.P_LAT);
|
|
||||||
Double lon = getFloatValue(MESOWestConstants.P_LON);
|
|
||||||
Integer elev = getIntValue(MESOWestConstants.P_ELEV);
|
|
||||||
|
|
||||||
if ((lat != null) && (lon != null) && (elev != null)) {
|
|
||||||
SurfaceObsLocation location = new SurfaceObsLocation();
|
|
||||||
location.assignLocation(lat, lon);
|
|
||||||
location.setElevation(elev);
|
|
||||||
|
|
||||||
String stnId = getStringValue(MESOWestConstants.P_STNID);
|
|
||||||
if (stnId != null) {
|
|
||||||
location.setStationId(stnId);
|
|
||||||
|
|
||||||
data.setSpatialObject(location);
|
|
||||||
data.setNetworkType(getStringValue(MESOWestConstants.P_STNTYPE));
|
|
||||||
} else {
|
|
||||||
data = null;
|
|
||||||
logger.error("Station Id missing");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
data = null;
|
|
||||||
logger.error("Spatial information missing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private String getStringValue(String key) {
|
|
||||||
String sValue = null;
|
|
||||||
|
|
||||||
MESOWestElement value = valuesMap.get(key);
|
|
||||||
if (value != null) {
|
|
||||||
sValue = value.getElementValue();
|
|
||||||
}
|
|
||||||
return sValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Double getFloatValue(String key) {
|
|
||||||
Double floatValue = null;
|
|
||||||
|
|
||||||
MESOWestElement value = valuesMap.get(key);
|
|
||||||
if (value != null) {
|
|
||||||
try {
|
|
||||||
floatValue = Double.parseDouble(value.getElementValue());
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return floatValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Integer getIntValue(String key) {
|
|
||||||
Integer intValue = null;
|
|
||||||
|
|
||||||
MESOWestElement value = valuesMap.get(key);
|
|
||||||
if (value != null) {
|
|
||||||
try {
|
|
||||||
intValue = Integer.parseInt(value.getElementValue());
|
|
||||||
} catch (NumberFormatException nfe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return intValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final void main(String[] args) {
|
|
||||||
|
|
||||||
String parms = " PARM = TMPF;RELH;SKNT;GUST;DRCT;QFLG;DWPF;PRES;PMSL;ALTI;P03D;SOLR;WNUM;VSBY;CHC1;CHC2;CHC3;CIG;TLKE;FT;FM;HI6;LO6;PEAK;HI24;LO24;PREC;P01I;P03I;P06I;P24I;P05I;P10I;P15I;SNOW;PACM;SACM;WEQS;P30I;PWVP;TSOI;MSOI;STEN;TSRD;EVAP;TRD1;TRD2;TRD3;TRD4;TFZ1;TFZ2;TFZ3;TFZ4;RSS1;RSS2;RSS3;RSS4";
|
|
||||||
|
|
||||||
String data1 = "KAAT,41.49139,-120.56444,4373,1,20090303/2009,32,92.96,18,27,230,2,30.2,,,29.81,,,740,0.5,36,73,194,700,,,,,,27,,,,0.01,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
|
|
||||||
|
|
||||||
String data2 = "KRSP,,,,1,20090312/1254,28.94,53.05,7,19,340,,14,,1031.2,30.39,,,,10,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
|
|
||||||
MESOWestParser parser = new MESOWestParser(parms);
|
|
||||||
|
|
||||||
MESOWestRecord record = parser.decode(data2);
|
|
||||||
|
|
||||||
System.out.println("******************************");
|
|
||||||
if (record != null) {
|
|
||||||
Calendar c = record.getTimeObs();
|
|
||||||
if (c != null) {
|
|
||||||
System.out.println(String.format(
|
|
||||||
"* time | %1$tY%1$tm%1$td%1$tH%1$tM", record
|
|
||||||
.getTimeObs()));
|
|
||||||
} else {
|
|
||||||
System.out.println("* time | null");
|
|
||||||
}
|
|
||||||
System.out.println("* latitude | " + record.getLatitude());
|
|
||||||
System.out.println("* longitude | " + record.getLongitude());
|
|
||||||
System.out.println("* station id | " + record.getStationId());
|
|
||||||
System.out.println("* network | " + record.getNetworkType());
|
|
||||||
|
|
||||||
System.out.println("*************");
|
|
||||||
System.out.println("* temperature = " + record.getTemp());
|
|
||||||
System.out.println("* dewpoint = " + record.getDwpt());
|
|
||||||
System.out.println("* humidity % = " + record.getHumidity());
|
|
||||||
System.out.println("* wind speed = " + record.getWindSpeed());
|
|
||||||
System.out.println("* wind gust = " + record.getWindGust());
|
|
||||||
System.out.println("* wind direction = "
|
|
||||||
+ record.getWindDirection());
|
|
||||||
System.out.println("* pressure = " + record.getPressure());
|
|
||||||
System.out.println("* slp = "
|
|
||||||
+ record.getSeaLevelPressure());
|
|
||||||
System.out.println("* altimeter = " + record.getAltimeter());
|
|
||||||
} else {
|
|
||||||
System.out.println("* No data decoded");
|
|
||||||
System.out.println("*************");
|
|
||||||
System.out.println("******************************");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,76 +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.edex.plugin.mesowest.decoder;
|
|
||||||
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 10, 2009 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MWFloatElement extends MESOWestElement {
|
|
||||||
|
|
||||||
private Double floatValue = null;
|
|
||||||
|
|
||||||
public MWFloatElement(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setElementValue(String value) {
|
|
||||||
super.setElementValue(value);
|
|
||||||
|
|
||||||
try {
|
|
||||||
floatValue = Double.parseDouble(value);
|
|
||||||
} catch(NumberFormatException nfe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param record
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,109 +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.edex.plugin.mesowest.decoder;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TODO Add Description
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
*
|
|
||||||
* SOFTWARE HISTORY
|
|
||||||
*
|
|
||||||
* Date Ticket# Engineer Description
|
|
||||||
* ------------ ---------- ----------- --------------------------
|
|
||||||
* Mar 10, 2009 jkorman Initial creation
|
|
||||||
*
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @author jkorman
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class MWIntElement extends MESOWestElement {
|
|
||||||
|
|
||||||
private Integer intValue = null;
|
|
||||||
|
|
||||||
public MWIntElement(String name) {
|
|
||||||
super(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setElementValue(String value) {
|
|
||||||
super.setElementValue(value);
|
|
||||||
|
|
||||||
try {
|
|
||||||
intValue = Integer.parseInt(value);
|
|
||||||
} catch(NumberFormatException nfe) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param record
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder(getElementName());
|
|
||||||
sb.setCharAt(0,Character.toUpperCase(sb.charAt(0)));
|
|
||||||
sb.insert(0,"get");
|
|
||||||
|
|
||||||
String methodName = sb.toString();
|
|
||||||
Method m = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
m = record.getClass().getDeclaredMethod(methodName, Integer.class);
|
|
||||||
if(m != null) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
m.invoke(record, intValue);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (NoSuchMethodException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return record;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue