Merge remote-tracking branch 'origin/master_16.2.1' into asm_16.2.1

Conflicts:
	cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java

Change-Id: Ie67d751b1c68099a98826e6542ebff4cf0aae7e5

Former-commit-id: b9b551d68ed55536b2480b60ef1269bcf5402004
This commit is contained in:
Shawn.Hooper 2016-01-04 16:47:59 -05:00
commit f3fafae42e
531 changed files with 23088 additions and 43013 deletions

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
* ------------ ---------- ----------- --------------------------
* Jun 5, 2015 4498 nabowle Use JAXBManager to unmarshal. Rename to
* RcmUtil.
* Oct 15,2015 17789 wkwock Change max TDWR radar ID to 3099
*
* </pre>
*
@ -52,7 +53,7 @@ public class RcmUtil {
public static RadarType getRadarType(RadarConfig rc) {
int id = rc.getNexradID();
if (id >= 3000 && id <= 3045) // TODO: 3045 is the current max, but...
if (id >= 3000 && id <= 3099) // TODO: 3099 is the current max, but...
return RadarType.TDWR;
else if (id >= 4000 && id < 4050) // TODO: may be 4050
return RadarType.ASR;

View file

@ -124,7 +124,7 @@ public class Loader {
// This is not in any baselined database yet.
switch (rp.pid) {
case 180: case 181: case 182: case 183: case 185:
case 180: case 181: case 182: case 183: case 184: case 185:
case 186: case 187:
rp.typeRestriction = EnumSet.of(RadarType.TDWR);
break;

View file

@ -60,6 +60,7 @@
25 | 16 | 0 | 0.25 | 60 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
26 | 16 | 0 | 0.50 | 115 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
27 | 16 | 0 | 1.00 | 230 | V | Velocity (V) | Radial | y | | | | V | | | | | 1 | |
184|256 | 0 | 0.15 | 90 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | | y
185| 8 | 0 | 0.15 | 90 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |
28 | 8 | 0 | 0.25 | 60 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |
29 | 8 | 0 | 0.50 | 115 | SW | Spectrum Width (SW) | Radial | y | | | | | | | | | 2 | |

View file

@ -64,6 +64,7 @@ import com.raytheon.rcm.server.Log;
* 2009 dfriedma Initial version
* 2012-04-30 DR 14904 D. Friedman Add backup links to dial ORPGs.
* 2015-06-10 4498 nabowle Rename Util->RcmUtil
* 2015-10-15 DCS 17789 wkwock Change max TDWR radar ID to 3099
* </pre>
*/
public class Awips1ConfigProvider implements ConfigurationProvider {
@ -502,8 +503,8 @@ public class Awips1ConfigProvider implements ConfigurationProvider {
if (name.substring(1, 4).equalsIgnoreCase(namelet)) {
int nexradId = radars.get(name).getNexradID();
if (linespeed.equals("D6")) {
// TODO: can we really rely on the 3045 number?
if (nexradId >= 3000 && nexradId <= 3045)
// TODO: can we really rely on the 3099 number?
if (nexradId >= 3000 && nexradId <= 3099)
return name;
} else {
if (nexradId < 3000

View file

@ -259,6 +259,9 @@
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.uf.viz.acarssounding.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.uf.viz.ncep.npp.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature" value="com.raytheon.viz.avnfps.feature" />
</antcall>

View file

@ -0,0 +1,76 @@
#!/bin/bash
# This script can be used to upgrade the currently installed CAVE features to the latest
# versions available in the repositories.
# This script currently expects one argument: the location of the Eclipse repository.
# Only the root user and the awips user are able to successfully run this script.
if [ "${USER}" != "root" -a "${USER}" != "awips" ]; then
echo "ERROR: ${USER} does not have the required privileges to run ${0}."
exit 1
fi
_awips_tmp_dir=/awips2/tmp
_cave_install_prefix=cave-upgrade-
# Common function to print usage information.
function usage() {
echo "Usage: ${0} <repository-location>"
echo "Example: ${0} /path/to/repo-location/eclipse/v2.7"
exit 1
}
# Verify that the expected arguments have been provided.
if [ $# -ne 1 ]; then
echo "ERROR: Invalid arguments provided!"
usage
fi
repository_loc=${1}
# Verify that the specified repository exists.
if [ ! -d ${repository_loc} ]; then
echo "ERROR: The specified repository does not exist!"
usage
fi
_unique_ident=`echo $$`
_staging_dir=${_awips_tmp_dir}/${_cave_install_prefix}${_unique_ident}
if [ -d ${_staging_dir} ]; then
rm -rf ${_staging_dir}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to remove the existing staging directory: ${_staging_dir}!"
exit 1
fi
fi
mkdir -p ${_staging_dir}
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create the staging directory: ${_staging_dir}!"
exit 1
fi
_output=${_staging_dir}/upgrades.txt
/awips2/java/bin/java -jar -DcaveInstall=/awips2/cave -DeclipseRepo=${repository_loc} \
-DoutputFile=${_output} /awips2/cave/VizUpdater.jar
if [ $? -ne 0 ]; then
echo "ERROR: The upgrade has failed!"
exit 1
fi
# Determine if any upgrades were found.
if [ ! -f ${_output} ]; then
echo "INFO: There are no upgrades to apply."
exit 0
fi
# Iterate through the upgrades and apply them.
for feature in `cat ${_output}`; do
echo "Upgrading feature: ${feature} ..."
/bin/bash /awips2/cave/caveInstall.sh "${repository_loc}" ${feature}
if [ $? -ne 0 ]; then
echo "Failed to upgrade feature: ${feature}!"
fi
done
echo "INFO: Upgrades Finished."

View file

@ -12,6 +12,7 @@ Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.viz.core.drawables,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.map,
com.raytheon.uf.viz.core.point.display,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.vividsolutions.jts.algorithm,

View file

@ -33,7 +33,6 @@ import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.Polygon;
/**
*
* A class containing all parameters necessary for an outline resource to be
@ -45,6 +44,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 2, 2009 bsteffen Initial creation
* Jul 7, 2015 10352 byin Added labelSymbolId
*
* </pre>
*
@ -52,7 +52,7 @@ import com.vividsolutions.jts.geom.Polygon;
* @version 1.0
*/
public class AdvisoryRecord {
private static GeometryFactory FACTORY = new GeometryFactory();
protected static final UnitConverter NM_TO_METERS = NonSI.NAUTICAL_MILE
@ -61,21 +61,23 @@ public class AdvisoryRecord {
protected static final int NUM_VERTICES = 40;
protected static final double ANGLE_STEP = 360.0 / NUM_VERTICES;
public enum AdvisoryResourceType {
LINE, ISOL, AREA, TEXT
}
private AdvisoryResourceType type;
private Polygon polygon;
private Coordinate[] line;
private Coordinate labelLoc;
private String label;
private char labelSymbolId = 0;
private String inspectString;
public AdvisoryRecord(Coordinate labelLoc, String label) {
@ -98,7 +100,7 @@ public class AdvisoryRecord {
this.label = label;
this.inspectString = inspectString;
}
public AdvisoryRecord(Coordinate[] line, double diameter, String label,
String inspectString) {
this.type = AdvisoryResourceType.LINE;
@ -144,7 +146,7 @@ public class AdvisoryRecord {
this.label = label;
this.inspectString = inspectString;
}
public AdvisoryRecord(Coordinate center, double diameter, String label,
String inspectString) {
this.type = AdvisoryResourceType.ISOL;
@ -167,7 +169,7 @@ public class AdvisoryRecord {
this.label = label;
this.inspectString = inspectString;
}
/**
* Convert a pair of Lat Lon coords to a pair of pixel coords in a certain
* direction and a certain distance away
@ -202,8 +204,7 @@ public class AdvisoryRecord {
* @return a new Coordinate at the correct location
*/
public static Coordinate getPointOnCircle(Coordinate center,
double distance,
double angle) {
double distance, double angle) {
while (angle > 180) {
angle -= 360;
}
@ -268,5 +269,12 @@ public class AdvisoryRecord {
return inspectString;
}
public char getLabelSymbolId() {
return labelSymbolId;
}
public void setLabelSymbolId(char labelSymbolId) {
this.labelSymbolId = labelSymbolId;
}
}

View file

@ -47,6 +47,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 2, 2009 bsteffen Initial creation
* Jul 7, 2015 10352 byin Display symbols for turb/icing
* and hazard types for IFR/MTOS
*
*
* </pre>
*
@ -56,14 +59,28 @@ import com.vividsolutions.jts.geom.Coordinate;
@XmlAccessorType(XmlAccessType.NONE)
public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
private static final String LABEL_FORMAT = "%d%s";
private static final String INSPECT_FORMAT = "Valid UNTIL %02d%02d%02d\n%s";
private static final String REPORT_INDICATOR = "AIRMET";
private static final String SEGMENT_SEPERATOR = "\n. \n";
private static final String TURBULENCE_TYPE = "TURBULENCE";
private static final String ICING_TYPE = "ICING";
private static final String IFR_TYPE = "INSTRUMENT FLIGHT RULES";
private static final String MTN_TYPE = "MOUNTAIN OBSCURATION";
private static final String IFR_LABEL = "IFR";
private static final String MTN_LABEL = "MTOS";
protected static final char TURBULENCE_SYMBOL = '\u007b';
protected static final char ICING_SYMBOL = '\u007e';
private static final float LINE_WIDTH = 1.5f;
private static final LineStyle LINE_STYLE = LineStyle.SOLID;
@ -111,7 +128,6 @@ public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
coords[loc.getIndex() - 1] = new Coordinate(loc.getLongitude(),
loc.getLatitude());
}
int updateNumber = parent.getUpdateNumber();
String sequenceId = report.getSequenceID();
if (sequenceId == null) {
sequenceId = "";
@ -134,11 +150,30 @@ public class AirmetDataAdapter extends AbstractAdvisoryDataAdapter {
} else {
segment = "";
}
String label = String.format(LABEL_FORMAT, updateNumber, sequenceId);
String inspectString = String.format(INSPECT_FORMAT, day, hour, min,
segment);
String hazType = report.getHazardType();
String label;
if (hazType.equalsIgnoreCase(IFR_TYPE)) {
label = IFR_LABEL;
} else if (hazType.equalsIgnoreCase(MTN_TYPE)) {
label = MTN_LABEL;
} else {
label = "";
}
AdvisoryRecord aRecord = new AdvisoryRecord(coords, label,
inspectString);
if (hazType.equalsIgnoreCase(ICING_TYPE)) {
aRecord.setLabelSymbolId(ICING_SYMBOL);
} else if (hazType.equalsIgnoreCase(TURBULENCE_TYPE)) {
aRecord.setLabelSymbolId(TURBULENCE_SYMBOL);
}
return aRecord;
}

View file

@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
@ -42,12 +43,15 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IFont.Style;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.point.display.SymbolLoader;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -75,6 +79,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Jun 13, 2011 9758 cjeanbap Set colorString of AdvisoryResourceData.
* Aug 14, 2014 3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments.
* Jul 7, 2015 10352 byin Added SymbolLoader to plot symbols
* </pre>
*
* @author bsteffen
@ -101,6 +106,8 @@ public class AdvisoryResource extends
private float magnification;
private SymbolLoader symbolLoader;
protected AdvisoryResource(AdvisoryResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
@ -188,6 +195,7 @@ public class AdvisoryResource extends
font.dispose();
}
this.font = target.initializeFont("Monospace", 10, new Style[] {});
this.symbolLoader = new SymbolLoader();
}
@Override
@ -209,6 +217,7 @@ public class AdvisoryResource extends
}
this.displayedDataTime = curDataTime;
double scale[] = getScale(paintProps);
if (mainShape == null || dottedShape == null || dashedShape == null) {
clearShapes();
@ -283,6 +292,21 @@ public class AdvisoryResource extends
RGB[] colors = new RGB[labels.length];
Arrays.fill(colors, color);
double x = pixelLoc[0];
double y = pixelLoc[1];
if (record.getLabelSymbolId() != 0) {
IImage symbolImg = symbolLoader.getImage(target, color,
(char) record.getLabelSymbolId());
Coordinate ul = new Coordinate(x, y);
Coordinate ur = new Coordinate(x + 12 * scale[0], y);
Coordinate lr = new Coordinate(ur.x, y + 12 * scale[1]);
Coordinate ll = new Coordinate(x, lr.y);
PixelCoverage extent = new PixelCoverage(ul, ur, lr, ll);
target.drawRaster(symbolImg, extent, paintProps);
}
DrawableString dStrings = new DrawableString(labels, colors);
dStrings.font = font;
dStrings.setCoordinates(pixelLoc[0], pixelLoc[1]);
@ -418,4 +442,13 @@ public class AdvisoryResource extends
clearShapes();
}
private double[] getScale(PaintProperties paintProps) {
IExtent extent = paintProps.getView().getExtent();
Rectangle canvasBounds = paintProps.getCanvasBounds();
double[] scale = new double[2];
scale[0] = extent.getWidth() / canvasBounds.width;
scale[1] = extent.getHeight() / canvasBounds.height;
return scale;
}
}

View file

@ -17,11 +17,6 @@
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.base.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.uf.common.dissemination"
download-size="0"

View file

@ -46,14 +46,17 @@ import com.raytheon.uf.common.time.DataTimeComparator;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 19, 2007 chammack Initial Creation.
* May 31, 2013 15908 dhuffman Removed a null from a method call to
* cease a null pointer exception.
* May 5, 2014 DR 17201 D. Friedman Make same-radar time matching work more like A1.
* Aug 08, 2013 2245 bsteffen Make all DataTime comparisons consistent.
* Jul 18, 2014 ASM #15049 D. Friedman Fix LAPS problem introduced by DR 17201
*
* Date Ticket# Engineer Description
* ------------- -------- ---------- -------------------------------------------
* Jun 19, 2007 chammack Initial Creation.
* May 31, 2013 15908 dhuffman Removed a null from a method call to cease
* a null pointer exception.
* May 05, 2014 17201 dfriedman Make same-radar time matching work more
* like A1.
* Aug 08, 2013 2245 bsteffen Make all DataTime comparisons consistent.
* Jul 18, 2014 15049 dfriedman Fix LAPS problem introduced by DR 17201
* Nov 03, 2015 4857 bsteffen Set radar on radar volume scan interval
*
* </pre>
*
@ -69,11 +72,8 @@ public class TimeMatcher {
// 2 minutes in milliseconds
private static final long TWO_MINUTES_MS = 2 * ONE_MINUTE_MS;
// 5 minutes in milliseconds
private static final long FIVE_MINUTES_MS = 5 * ONE_MINUTE_MS;;
// 11 minutes in milliseconds
private static final long ELEVEN_MINUTES_MS = 11 * ONE_MINUTE_MS;;
private static final long ELEVEN_MINUTES_MS = 11 * ONE_MINUTE_MS;
// 1 hour in milliseconds
private static final long ONE_HOUR_MS = 60 * ONE_MINUTE_MS;
@ -104,7 +104,7 @@ public class TimeMatcher {
private static long autoIntervals[] = { 300, 900, 1800, 3600, 10800, 21600,
43200, 86400 };
private boolean radarOnRadarYes = false;
private long radarOnRadarVolumeScanInterval = -1;
// Package access
TimeMatcher() {
@ -247,8 +247,9 @@ public class TimeMatcher {
if (haveForecasts) {
haveForecasts = haveFcst;
}
if (radarOnRadarYes) {
return new IntrinsicReturnVal(haveForecasts, FIVE_MINUTES_MS);
if (isRadarOnRadar()) {
return new IntrinsicReturnVal(haveForecasts,
radarOnRadarVolumeScanInterval);
}
return new IntrinsicReturnVal(haveForecasts, ONE_DAY_MS);
}
@ -307,7 +308,7 @@ public class TimeMatcher {
return new IntrinsicReturnVal(haveForecasts, ONE_DAY_MS);
}
if (dt2 < 0x7FFFFFFF && dt <= TWO_MINUTES_MS && dt2 > 50 * dt
&& !radarOnRadarYes) {
&& !isRadarOnRadar()) {
dt = dt2;
} else {
nn = 0;
@ -318,7 +319,7 @@ public class TimeMatcher {
if (haveForecasts) {
haveForecasts = haveFcst;
}
if (haveFcst || radarOnRadarYes) {
if (haveFcst || isRadarOnRadar()) {
return new IntrinsicReturnVal(haveForecasts, dt);
}
@ -376,8 +377,9 @@ public class TimeMatcher {
if (haveForecasts) {
haveForecasts = haveFcst;
}
if (radarOnRadarYes) {
return new IntrinsicReturnVal(haveForecasts, FIVE_MINUTES_MS);
if (isRadarOnRadar()) {
return new IntrinsicReturnVal(haveForecasts,
radarOnRadarVolumeScanInterval);
}
return new IntrinsicReturnVal(haveForecasts, ONE_DAY_MS);
}
@ -423,7 +425,7 @@ public class TimeMatcher {
return new IntrinsicReturnVal(haveForecasts, ONE_DAY_MS);
}
if (dt2 < 0x7FFFFFFF && dt <= TWO_MINUTES_MS && dt2 > 50 * dt
&& !radarOnRadarYes) {
&& !isRadarOnRadar()) {
dt = dt2;
} else {
nn = 0;
@ -434,7 +436,7 @@ public class TimeMatcher {
if (haveForecasts) {
haveForecasts = haveFcst;
}
if (haveFcst || radarOnRadarYes) {
if (haveFcst || isRadarOnRadar()) {
return new IntrinsicReturnVal(haveForecasts, dt);
}
@ -665,7 +667,7 @@ public class TimeMatcher {
// A1 TimeMatchFunctions.C ~ line 952
if (dt > ONE_MINUTE_MS && dt <= ELEVEN_MINUTES_MS
&& dtf > ONE_MINUTE_MS && dtf <= ELEVEN_MINUTES_MS
&& radarOnRadarYes) {
&& isRadarOnRadar()) {
if (dtf<dt) {
dt = dtf;
}
@ -673,18 +675,13 @@ public class TimeMatcher {
dt = dtf;
}
/* A1 TimeMatchingFunctions.C ~ line 960
* For 88D radar, dt is usually 300 seconds or larger
* For TDWR radar, dt is usually 180 seconds or less
* To allow 3 minutes overlay for TDWR products, dt is set to 300 seconds
*/
if (radarOnRadarYes && dt < FIVE_MINUTES_MS) {
dt = FIVE_MINUTES_MS;
if (isRadarOnRadar()) {
dt = radarOnRadarVolumeScanInterval;
}
if (tolerance > 99) {
dt = 0x7FFFFFl * 1000l;
} else {
} else if (!isRadarOnRadar()) {
dt = (int) (dt * tolerance);
}
if (dt == 0) {
@ -719,7 +716,8 @@ public class TimeMatcher {
vf = (frameTimes)[f].getMatchValid() + deltaTime;
v1 = vf - dt; // first usable valid time
v2 = vf + dt; // last usable valid time
if (!radarOnRadarYes && !dataFcsts && !frameFcsts && vf > latest.getTime()) {
if (!isRadarOnRadar() && !dataFcsts && !frameFcsts
&& vf > latest.getTime()) {
// if we are dealing with live data(without forecast times) then
// we want to allow extra time on the latest frame. For example
// LAPS data arrives hourly, and radar arrives every 6 minutes,
@ -1688,12 +1686,13 @@ public class TimeMatcher {
}
return intervals;
}
public boolean isRadarOnRadar() {
return radarOnRadarYes;
protected boolean isRadarOnRadar() {
return radarOnRadarVolumeScanInterval > 0;
}
public void setRadarOnRadar(boolean radarOnRadar) {
this.radarOnRadarYes = radarOnRadar;
public void setRadarOnRadar(long volumeScanInterval) {
this.radarOnRadarVolumeScanInterval = volumeScanInterval;
}
}

View file

@ -29,3 +29,4 @@ Export-Package: com.raytheon.uf.viz.d2d.nsharp,
com.raytheon.uf.viz.d2d.nsharp.rsc,
com.raytheon.uf.viz.d2d.nsharp.vb
Bundle-ClassPath: com.raytheon.uf.viz.d2d.nsharp.jar
Import-Package: gov.noaa.nws.ncep.viz.soundingrequest

View file

@ -62,6 +62,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
* 2/23/2015 RM#5694,7788 Chin Chen Use NCP's Nsharp text file loader
* and comment out openNspFile()
* Aug 05, 2015 4486 rjpeter Changed Timestamp to Date.
* Aug 31, 2011 bsteffen Initial creation
* 2/23/2015 RM#5694,7788 Chin Chen Use NCP's Nsharp text file loader
* and comment out openNspFile()
*
*
* </pre>
*

View file

@ -23,7 +23,7 @@ import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile.ObsSndType;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.Map;

View file

@ -25,7 +25,7 @@ import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigManager;
import gov.noaa.nws.ncep.ui.nsharp.NsharpConfigStore;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.List;

View file

@ -22,7 +22,7 @@ package com.raytheon.uf.viz.d2d.nsharp.rsc;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.viz.common.soundingQuery.NcSoundingQuery;
import gov.noaa.nws.ncep.viz.soundingrequest.NcSoundingQuery;
import java.util.Map;

View file

@ -23,7 +23,6 @@
<import feature="com.raytheon.uf.viz.displays.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.text.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.d2d.nsharp.feature" version="1.0.0.qualifier"/>
</requires>
<plugin

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="imagingCapability"
interpolationState="false" brightness="2.0"
contrast="1.0" alpha="1.0" />
<capability xsi:type="colorableCapability"
colorAsString="#00ff00" />
</capabilities>
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData"
plotSource="Spot Forecast Request"
plotModelFile="stqPlotDesign.svg" pixelSizeHint="45"
retrieveData="false" isUpdatingOnMetadataOnly="false"
isRequeryNecessaryOnTimeMatch="true">
<binOffset posOffset="43200"
negOffset="43200" virtualOffset="0" />
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="stq"
constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -33,4 +33,6 @@
fileName="menus/ncepHydro/cpc/baseCPC.xml"/>
<include installTo="menu:ncepHydro?after=AWC"
fileName="menus/ncepHydro/awc/baseAWC.xml"/>
<include installTo="menu:ncepHydro?after=STQ"
fileName="menus/ncepHydro/stq/baseSTQ.xml"/>
</menuContributionFile>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem"
file="bundles/ncepHydro/SpotRequestPlot.xml" menuText="Spot Forecast Requests"
id="spotRequestPlot">
</contribute>
</menuTemplate>

View file

@ -0,0 +1,54 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
class StqPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
projectName = rec.getString("projectName")
reqOfficial = rec.getString("reqOfficial")
emPhone = rec.getString("emPhone")
sampleString = "Project Name: %s\n\tOffcial Name: %s\n\tEmergency Phone: %s"%(projectName,reqOfficial,emPhone)
return sampleString
plotDelegate = StqPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1.2em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1.2em;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="stqsymbol" plotMode="text" class="text" plotParam="stqSymbol" x="0" y="0">0</text>
<text id="sample" plotMode="sample" class="text" plotParam="projectName,reqOfficial,emPhone">0</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -104,6 +104,14 @@
name="xyx"
visible="true">
</separator>
<command id="STQ"
commandId="com.raytheon.viz.ui.actions.titleAction"
label="------ STQ ------">
</command>
<separator
name="xxx"
visible="true">
</separator>
<command
commandId="com.raytheon.viz.ui.actions.titleAction"
label="------ Local Analyses/Statistical Guidance ------">

View file

@ -23,6 +23,7 @@
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<!-- Not High severity -->
<resource>
<loadProperties>
<capabilities>
@ -69,6 +70,53 @@
</resource>
</resourceData>
</resource>
<!-- High severity -->
<resource>
<loadProperties>
<capabilities>
</capabilities>
</loadProperties>
<resourceData xsi:type="plotBlendedResourceData">
<resource>
<loadProperties loadWithoutData="true"/>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData" plotSource="${legend} Sev"
plotModelFile="${svg2}"
retrieveData="false" isUpdatingOnMetadataOnly="false">
<binOffset posOffset="1800" negOffset="1800" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="pirep" constraintType="EQUALS" />
</mapping>
<mapping key="location.flightLevel">
<constraint constraintValue="${between}" constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
</resource>
<resource>
<loadProperties loadWithoutData="true"/>
<properties isSystemResource="false" isBlinking="false"
isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="plotResourceData" plotSource="${legend} Sev"
plotModelFile="${svg3}"
retrieveData="false" isUpdatingOnMetadataOnly="false">
<binOffset posOffset="1800" negOffset="1800" virtualOffset="0"/>
<metadataMap>
<mapping key="pluginName">
<constraint constraintValue="airep" constraintType="EQUALS" />
</mapping>
<mapping key="location.flightLevel">
<constraint constraintValue="${between}" constraintType="BETWEEN" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>

View file

@ -24,6 +24,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 000-180 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -31,6 +33,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 180-260 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -38,6 +42,8 @@
<substitute key="svg0" value="pirepPlotDesign.svg"/>
<substitute key="svg1" value="pirepPlotDesign.svg"/>
<substitute key="legend" value="PIREP Plot 260-500 hft"/>
<substitute key="svg2" value="pirepPlotDesignSev.svg"/>
<substitute key="svg3" value="pirepPlotDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
<contribute xsi:type="titleItem"
@ -47,6 +53,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 000-180 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -54,6 +62,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 180-260 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -61,6 +71,8 @@
<substitute key="svg0" value="pirepIcingDesign.svg"/>
<substitute key="svg1" value="airepIcingDesign.svg"/>
<substitute key="legend" value="PIREP Icing 260-500 hft"/>
<substitute key="svg2" value="pirepIcingDesignSev.svg"/>
<substitute key="svg3" value="airepIcingDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
<contribute xsi:type="titleItem"
@ -70,6 +82,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 000-180 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="0--18000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -77,6 +91,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 180-260 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="18000--26000"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/PirepPlot.xml"
@ -84,6 +100,8 @@
<substitute key="svg0" value="pirepTurbDesign.svg"/>
<substitute key="svg1" value="airepTurbDesign.svg"/>
<substitute key="legend" value="PIREP Turb 260-500 hft"/>
<substitute key="svg2" value="pirepTurbDesignSev.svg"/>
<substitute key="svg3" value="airepTurbDesignSev.svg"/>
<substitute key="between" value="26000--50000"/>
</contribute>
</menuTemplate>

View file

@ -107,6 +107,11 @@
class="com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord"
name="Metar Time Series Adapter">
</timeSeriesAdapter>
<timeSeriesAdapter
adapter="com.raytheon.uf.viz.d2d.xy.adapters.timeseries.PointDataTimeSeriesAdapter"
class="com.raytheon.uf.common.dataplugin.ldadmesonet.MesonetLdadRecord"
name="Mesonet Time Series Adapter">
</timeSeriesAdapter>
<timeSeriesAdapter
adapter="com.raytheon.uf.viz.d2d.xy.adapters.timeseries.PointDataTimeSeriesAdapter"
class="com.raytheon.uf.common.dataplugin.bufrmos.common.BufrMosData"

View file

@ -30,8 +30,6 @@
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.d2d.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.displays.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.avnfps.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.viz.satellite.feature" version="1.0.0.qualifier"/>
</requires>
<plugin

View file

@ -17,11 +17,6 @@
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.uf.common.dataplugin.obs"
download-size="0"

View file

@ -18,9 +18,7 @@
</license>
<requires>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.common.base.feature" version="1.0.0.qualifier"/>
</requires>
<plugin

View file

@ -201,6 +201,7 @@ import com.vividsolutions.jts.geom.Point;
* Dec 16, 2014 3026 mpduff Change location of text.
* Feb 13, 2015 4121 mpduff Change label caching.
* Sep 28, 2015 4756 dhladky Multiple guidance sources.
* Oct 26, 2015 5056 dhladky Simplified Guidance Interpolation.
* </pre>
*
* @author dhladky
@ -3411,10 +3412,6 @@ public class FFMPResource extends
if (guidanceInterpolator.isInterpolate()) {
guidancev = guidBasin.getInterpolatedValue(
guidanceInterpolator.getSource1(),
guidanceInterpolator.getSource2(),
guidanceInterpolator
.getInterpolationOffset(),
guidanceInterpolator,
getGuidSourceExpiration(ffgGraphType));
} else {
@ -3829,10 +3826,7 @@ public class FFMPResource extends
// interpolating
if (interp.isInterpolate()) {
// Interpolating between sources
String source1 = interp.getSource1();
String source2 = interp.getSource2();
dvalue = basin.getInterpolatedValue(source1, source2,
interp.getInterpolationOffset(), interp,
dvalue = basin.getInterpolatedValue(interp,
sourceExpiration);
} else {
dvalue = basin.getValue(interp.getStandardSource(), interp,

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResourceData;
* ------------ ---------- ----------- --------------------------
* Jun 04, 2013 2075 njensen Initial creation
* Jun 07, 2013 2075 njensen Added progress monitoring
* Oct 26, 2015 5056 dhladky Removed println.
*
* </pre>
*
@ -128,8 +129,8 @@ public class BackgroundLoadJob extends AbstractLoadJob {
}
smonitor.done();
System.out.println(this.getName() + " took: "
+ (System.currentTimeMillis() - t0));
statusHandler.debug(this.getName() + " took: "
+ (System.currentTimeMillis() - t0) + " ms");
} catch (Exception e) {
statusHandler.error("Couldn't complete " + this.getName(), e);

View file

@ -57,6 +57,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResourceData;
* ------------ ---------- ----------- --------------------------
* Jun 04, 2013 2075 njensen Initial creation
* Jun 07, 2013 2075 njensen Added progress monitoring
* Oct 26, 2015 5056 dhladky Removed println.
*
* </pre>
*
@ -154,8 +155,8 @@ public class InitialLoadJob extends AbstractLoadJob {
smonitor.subTask("Processing Guidance...");
doGuidance(startTime, smonitor.newChild(200));
System.out.println("Initial Load Job took: "
+ (System.currentTimeMillis() - t0));
statusHandler.debug(this.getName() + " took: "
+ (System.currentTimeMillis() - t0) + " ms");
return Status.OK_STATUS;
}

View file

@ -85,6 +85,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* Oct 19, 2015 3841 skorolev Corrected constructor.
* Oct 21, 2015 3873 dhladky Get Obs load off UI thread.
*
* </pre>
*
@ -352,6 +353,9 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
monitor.removeMonitorListener(zoneDialog);
monitor.fogResources.removeAll(getMonitorListeners());
stopObserver(OBS, this);
if (obsJob != null) {
obsJob.cancel();
}
monitor = null;
}
@ -634,4 +638,5 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
MonitoringArea.setPlatformMap(zones);
}
}

View file

@ -20,14 +20,13 @@
package com.raytheon.uf.viz.monitor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
@ -41,7 +40,6 @@ import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -66,6 +64,7 @@ import com.vividsolutions.jts.geom.Geometry;
* May 08, 2014 3086 skorolev Added current site definition.
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
* Sep 18, 2015 3873 skorolev Included common definitions.
* Oct 21, 2015 3873 dhladky Get Obs load off UI thread.
*
* </pre>
*
@ -78,6 +77,8 @@ public abstract class ObsMonitor extends Monitor {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObsMonitor.class);
protected ProcessObsJob obsJob = null;
/*
* (non-Javadoc)
@ -229,7 +230,7 @@ public abstract class ObsMonitor extends Monitor {
try {
Map<String, RequestConstraint> constraints = RequestConstraint
.toConstraintMapping(DataURIUtil.createDataURIMap(dataURI));
FSSObsRecord[] pdos = requestFSSObs(constraints, null);
FSSObsRecord[] pdos = requestFSSObs(constraints);
if (pdos.length > 0 && pdos[0].getTimeObs() != null) {
final FSSObsRecord objectToSend = pdos[0];
try {
@ -272,47 +273,19 @@ public abstract class ObsMonitor extends Monitor {
*/
public void processProductAtStartup() {
/**
* Assume this number for MaxNumObsTimes is larger enough to cover data
* of all observations (at least 24 hours' worth of data) in database
* [changed from 10 to 240 on May, 18, 2010 for DR #6015, zhao]
*/
int MaxNumObsTimes = 240;
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
try {
vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint(
FSSObsRecord.PLUGIN_NAME));
DataTime[] dataTimesAvailable = DataCubeContainer.performTimeQuery(
vals, false);
DataTime[] selectedTimes = dataTimesAvailable;
// Ensure that the latest product is retrieved.
// [Modified: retrieve at most MaxNumObsTimes data
// points, Feb
// 19, 2010, zhao]
if (dataTimesAvailable.length > 0) {
Arrays.sort(dataTimesAvailable);
// at most, MaxNumObsTimes observation times are
// considered
if (dataTimesAvailable.length > MaxNumObsTimes) {
selectedTimes = new DataTime[MaxNumObsTimes];
System.arraycopy(dataTimesAvailable,
dataTimesAvailable.length - MaxNumObsTimes,
selectedTimes, 0, MaxNumObsTimes);
}
FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes);
for (FSSObsRecord objectToSend : obsRecords) {
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
final long start = System.currentTimeMillis();
obsJob = null;
obsJob = new ProcessObsJob(this);
obsJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
// do nothing at this point
final long end = System.currentTimeMillis();
statusHandler.info("Obs Load took: "+(end-start)+" ms");
obsJob = null;
}
} catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM,
"No data in database at startup.");
}
});
obsJob.schedule();
}
/**
@ -324,17 +297,9 @@ public abstract class ObsMonitor extends Monitor {
* @throws VizException
* @throws DataCubeException
*/
private FSSObsRecord[] requestFSSObs(
Map<String, RequestConstraint> constraints, DataTime[] times)
protected FSSObsRecord[] requestFSSObs(
Map<String, RequestConstraint> constraints)
throws DataCubeException {
if (times != null) {
String[] timeStrs = new String[times.length];
for (int i = 0; i < times.length; ++i) {
timeStrs[i] = times[i].toString();
}
constraints.put(PluginDataObject.DATATIME_ID,
new RequestConstraint(timeStrs));
}
PointDataContainer pdc = DataCubeContainer.getPointData(
FSSObsRecord.PLUGIN_NAME, FSSObsRecordTransform.FSSOBS_PARAMS,
constraints);

View file

@ -0,0 +1,140 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.monitor;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.TimeZone;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.monitor.data.ObReport;
/**
*
* Load Obs off the UI thread.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 21, 2015 3873 dhladky Initial creation.
*
* </pre>
*
* @author dhladky
* @version 1.0
*
*/
public class ProcessObsJob extends Job {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcessObsJob.class);
protected static final int PROGRESS_FACTOR = 1;
/** how many hours do FSSObs go back we wish to load here **/
public static final int HOUR_BACK = 24;
private ObsMonitor obsMonitor;
public ProcessObsJob(ObsMonitor obsMonitor) {
super("Obs Load Process");
this.setSystem(false);
this.setPriority(INTERACTIVE);
this.obsMonitor = obsMonitor;
}
public IStatus run(IProgressMonitor monitor) {
try {
long backTime = TimeUtil.newCalendar().getTimeInMillis();
Date time = new Date(backTime - (HOUR_BACK * TimeUtil.MILLIS_PER_HOUR));
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
vals.put("dataTime.refTime", new RequestConstraint(
TimeUtil.formatToSqlTimestamp(time),
ConstraintType.GREATER_THAN_EQUALS));
long startPoint = System.currentTimeMillis();
FSSObsRecord[] recs = obsMonitor.requestFSSObs(vals);
long endPoint = System.currentTimeMillis();
SubMonitor smonitor = SubMonitor.convert(monitor, "Loading "+recs.length+" observations...",
recs.length);
smonitor.beginTask(null, recs.length);
statusHandler.info("Point Data Request, took: "
+ (endPoint - startPoint) + " ms");
for (FSSObsRecord rec : recs) {
if (rec != null) {
if (!this.shouldRun()) {
return Status.CANCEL_STATUS;
}
long start = System.currentTimeMillis();
doOb(rec, smonitor.newChild(PROGRESS_FACTOR));
long end = System.currentTimeMillis();
statusHandler.info("Processed "
+ rec.getIdentifier()
+ " in " + (end - start) + " ms");
}
}
statusHandler.info("Processed " + recs.length + " FSSObs records.");
} catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM,
"No data in database at startup.");
return Status.CANCEL_STATUS;
}
return Status.OK_STATUS;
}
/**
* Processes the Ob
*
* @param objectToSend
**/
protected void doOb(FSSObsRecord objectToSend, SubMonitor smonitor) {
smonitor.beginTask(null, PROGRESS_FACTOR);
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
obsMonitor.processAtStartup(result);
}
}

View file

@ -21,6 +21,8 @@ package com.raytheon.uf.viz.monitor.data;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
@ -30,6 +32,8 @@ import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
@ -52,6 +56,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
* Sep 18, 2015 3873 skorolev Added coordinates in the hover text for a newly added zones.Corrected code for Fog and SNOW table data.
* Oct 22, 2015 3873 dhladky Cached off the zone/station hover texts.
*
* </pre>
*
@ -61,15 +66,38 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
public final class TableUtil {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TableUtil.class);
/** Conversion coefficient of nautical miles to statute miles. */
public static final float milesPerNauticalMile = 1.15078f;
/**
* Constructor
*/
private TableUtil() {
}
/** Singleton instance of this class */
private static TableUtil tableUtil = new TableUtil();
/** Hover text lookup map **/
public Map<String, String> zoneHoverTextMap = null;
/** station text lookup map **/
public Map<String, String> stationHoverTextMap = null;
/**
* Actual initialization if necessary
*
* @return
*/
public static synchronized TableUtil getInstance() {
if (tableUtil == null) {
tableUtil = new TableUtil();
}
return tableUtil;
}
private TableUtil() {
zoneHoverTextMap = new ConcurrentHashMap<String, String>();
stationHoverTextMap = new ConcurrentHashMap<String, String>();
}
/**
* Returns the nominal time for a caller-specified time (to be consistent
* with D2D, here "Nominal time" is defined as the hour of an one-hour
@ -976,42 +1004,50 @@ public final class TableUtil {
private static String getZoneHoverText(AreaIdXML zoneXML) {
String zone = zoneXML.getAreaId();
ISpatialQuery sq = null;
String sql = null;
String hoverText = zone.substring(0, 2) + ", ";
String hoverText = tableUtil.zoneHoverTextMap.get(zone);
if (hoverText == null) {
ISpatialQuery sq = null;
String sql = null;
hoverText = zone.substring(0, 2) + ", ";
try {
if (MonitorAreaUtils.isMarineZone(zone)) {
sql = "select name from mapdata.marinezones where id = '"
+ zone + "'";
} else if (zone.charAt(2) == 'Z') { // forecast zone
String state_zone = zone.substring(0, 2) + zone.substring(3);
sql = "select name from mapdata.zone where state_zone = '"
+ state_zone + "'";
} else { // County
String state = zone.substring(0, 2);
String fipsLike = "%" + zone.substring(3);
sql = "select countyname from mapdata.county where state = '"
+ state + "' and fips like '" + fipsLike + "'";
}
try {
if (MonitorAreaUtils.isMarineZone(zone)) {
sql = "select name from mapdata.marinezones where id = '"
+ zone + "'";
} else if (zone.charAt(2) == 'Z') { // forecast zone
String state_zone = zone.substring(0, 2)
+ zone.substring(3);
sql = "select name from mapdata.zone where state_zone = '"
+ state_zone + "'";
} else { // County
String state = zone.substring(0, 2);
String fipsLike = "%" + zone.substring(3);
sql = "select countyname from mapdata.county where state = '"
+ state + "' and fips like '" + fipsLike + "'";
}
sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "maps");
if (results.length > 0) {
if (results[0] instanceof Object[]) {
Object[] res = (Object[]) results[0];
hoverText += (String) res[0];
sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "maps");
if (results.length > 0) {
if (results[0] instanceof Object[]) {
Object[] res = (Object[]) results[0];
hoverText += (String) res[0];
} else {
hoverText += (String) results[0].toString();
}
} else {
hoverText += (String) results[0].toString();
}
} else {
if (zoneXML.getCLat() != null) {
hoverText += "(" + zoneXML.getCLat() + ", "
+ zoneXML.getCLon() + ")";
if (zoneXML.getCLat() != null) {
hoverText += "(" + zoneXML.getCLat() + ", "
+ zoneXML.getCLon() + ")";
}
}
} catch (Exception e) {
statusHandler.error("Unable to query Zone Hover Text: sql: "+sql, e);
}
} catch (Exception e) {
e.printStackTrace();
tableUtil.zoneHoverTextMap.put(zone, hoverText);
}
return hoverText;
@ -1025,41 +1061,50 @@ public final class TableUtil {
*/
private static String getStationHoverText(String stnId) {
String sql = "select catalogtype, name from common_obs_spatial where ( catalogtype=1 or catalogtype=33 or catalogtype = 32 or catalogtype=1000) and stationid = '"
+ stnId + "'";
String hoverText = null;
ISpatialQuery sq = null;
Integer stnType = null;
String stnName = null;
try {
sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "metadata");
if (results.length > 0) {
if (results[0] instanceof Object[]) {
Object[] res = (Object[]) results[0];
stnType = (Integer) res[0];
stnName = (String) res[1];
String hoverText = tableUtil.stationHoverTextMap.get(stnId);
if (hoverText == null) {
String sql = "select catalogtype, name from common_obs_spatial where ( catalogtype=1 or catalogtype=33 or catalogtype = 32 or catalogtype=1000) and stationid = '"
+ stnId + "'";
ISpatialQuery sq = null;
Integer stnType = null;
String stnName = null;
try {
sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "metadata");
if (results.length > 0) {
if (results[0] instanceof Object[]) {
Object[] res = (Object[]) results[0];
stnType = (Integer) res[0];
stnName = (String) res[1];
} else {
stnType = (Integer) results[0];
stnName = (String) results[1];
}
if (stnType.intValue() == 1) {
hoverText = stnId + "#METAR -- " + stnName;
} else if (stnType.intValue() == 33
|| stnType.intValue() == 32) {
hoverText = stnId + "#MARITIME -- " + stnName;
} else if (stnType.intValue() == 1000) {
hoverText = stnId + "#MESONET -- " + stnName;
}
} else {
stnType = (Integer) results[0];
stnName = (String) results[1];
}
if (stnType.intValue() == 1) {
hoverText = stnId + "#METAR -- " + stnName;
} else if (stnType.intValue() == 33 || stnType.intValue() == 32) {
hoverText = stnId + "#MARITIME -- " + stnName;
} else if (stnType.intValue() == 1000) {
hoverText = stnId + "#MESONET -- " + stnName;
}
} else {
hoverText = stnId;
}
} catch (Exception e) {
statusHandler.error("Unable to query Station Hover Text: sql: "+sql, e);
}
} catch (Exception e) {
e.printStackTrace();
tableUtil.stationHoverTextMap.put(stnId, hoverText);
}
return hoverText;
}
/**

View file

@ -100,6 +100,7 @@ import com.vividsolutions.jts.io.ParseException;
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
* Sep 25, 2015 3873 skorolev Added center definition for moving platforms.
* Nov 09, 2015 3841 dhladky Update all tables when zones/stations are updated.
*
* </pre>
*
@ -490,10 +491,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
public void updateTableDlg(ObHourReports obHrData) {
nominalTime = obHrData.getNominalTime();
updateZoneTable(nominalTime);
if (!selectedZone.equals("")
&& obHrData.getHourReports().containsKey(selectedZone)) {
updateStationTable(nominalTime);
}
updateStationTable(nominalTime);
updateNominalTimeLabel(nominalTime);
}

View file

@ -18,9 +18,7 @@
</license>
<requires>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.common.base.feature" version="1.0.0.qualifier"/>
</requires>
<plugin

View file

@ -17,11 +17,6 @@
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.uf.common.dataplugin.modelsounding"
download-size="0"

View file

@ -20,7 +20,6 @@
<requires>
<import feature="com.raytheon.uf.viz.cots.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.nwsauth.feature" version="1.0.0.qualifier"/>
</requires>

View file

@ -58,7 +58,7 @@
</productCreator>
<productCreator
creatorClass="com.raytheon.viz.volumebrowser.loader.TimeSeriesProductCreator"
plugins="goessounding,poessounding,profiler,bufrmosLAMP,modelsounding,radar"
plugins="goessounding,poessounding,profiler,bufrmosLAMP,modelsounding,radar,ldadmesonet"
resourceType="time_series">
</productCreator>
<productCreator

View file

@ -75,6 +75,7 @@ import com.vividsolutions.jts.geom.LineString;
* Jul 23, 2014 3410 bclement location changed to floats
* Sep 09, 2014 3356 njensen Remove CommunicationException
* Aug 03, 2015 3861 bsteffen Move resource creation to ProductCreators
* Oct 22, 2015 4970 bsteffen Add ldadmesonet to supported plugins.
*
* </pre>
*
@ -320,7 +321,7 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
@Override
protected String[] getPlugins() {
return new String[] { "goessounding", "poessounding", "profiler",
"bufrua", "obs", "bufrmosLAMP" };
"bufrua", "obs", "bufrmosLAMP", "ldadmesonet" };
// njensen removed bufrmosAVN, bufrmosETA, bufrmosGFS, bufrmosHPC,
// bufrmosMRF, bufrmosNGM
// TODO ideally this list should not be in code, and should contain all

View file

@ -36,8 +36,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.style.level.Level.LevelType;
import com.raytheon.uf.common.topo.TopoException;
import com.raytheon.uf.common.topo.TopoQuery;
import com.raytheon.uf.common.topo.CachedTopoQuery;
import com.raytheon.uf.common.wxmath.Hgt2Pres;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -74,13 +73,14 @@ import com.vividsolutions.jts.geom.Point;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 3, 2010 bsteffen Initial creation
* Feb 15, 2013 1638 mschenke Got rid of viz/edex topo classes
* and moved into common
* Aug 13, 2013 2262 dgilling Use new wxmath hgt2pres method.
* Jun 14, 2014 3242 njensen Null safety checks
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------
* Jul 03, 2010 bsteffen Initial creation
* Feb 15, 2013 1638 mschenke Got rid of viz/edex topo classes
* and moved into common
* Aug 13, 2013 2262 dgilling Use new wxmath hgt2pres method.
* Jun 14, 2014 3242 njensen Null safety checks
* Oct 27, 2015 5051 bsteffen Use cached topo
*
* </pre>
*
@ -422,15 +422,9 @@ public class CrossSectionGraph extends AbstractGraph {
case PRESSURE:
Coordinate[] lineData;
lineData = GeoUtil.splitLine(numPoints, line.getCoordinates());
heights = CachedTopoQuery.getInstance().getHeight(lineData);
try {
heights = TopoQuery.getInstance().getHeight(lineData);
} catch (TopoException e) {
statusHandler
.error("Error occured requesting Topo data, topo will be unavailable.",
e);
return new double[numPoints];
}
if (csDesc.getHeightScale().getHeightType() == LevelType.PRESSURE) {
for (int i = 0; i < heights.length; i++) {
heights[i] = Hgt2Pres.hgt2pres((float) heights[i]);

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.common.style.StyleManager;
import com.raytheon.uf.common.style.StyleManager.StyleType;
import com.raytheon.uf.common.style.StyleRule;
import com.raytheon.uf.common.style.image.ColorMapParameterFactory;
import com.raytheon.uf.common.style.image.ImagePreferences;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -177,12 +178,13 @@ public class CrossSectionImageResource extends AbstractCrossSectionResource {
float[] floatData = sliceMap.get(time).get(0);
StyleRule styleRule = loadStyleRule();
try {
if (styleRule == null) {
if (styleRule == null
|| !(styleRule.getPreferences() instanceof ImagePreferences)) {
colorMapParams = ColorMapParameterFactory.build(floatData,
resourceData.getParameter(), getUnit(), null);
} else {
colorMapParams = ColorMapParameterFactory.build(styleRule,
getUnit());
floatData, null, getUnit());
}
} catch (StyleException e) {
throw new VizException(

View file

@ -42,6 +42,7 @@ import com.raytheon.viz.aviation.xml.WxPlotCfg;
* ------------ ---------- ----------- --------------------------
* 25 JUN 2008 1119 lvenable Initial creation
* 18 Nov 2010 6701 rferrel Use PlotViewerCfg class name.
* 03 Nov 2016 5060 rferrel No longer scale {@link #top}.
*
* </pre>
*
@ -91,8 +92,14 @@ public class WeatherCigCanvasComp extends WeatherCanvasComp {
private WeatherPlotDataManager dataMgr;
/**
* Max value displayed on the plot.
*/
private double top;
/**
* Minimum value displayed on the plot.
*/
private double bottom;
/**
@ -107,8 +114,6 @@ public class WeatherCigCanvasComp extends WeatherCanvasComp {
WxPlotCfg wxPlotCfg) {
super(parent, "CEILING", currentTime, wxPlotCfg);
dataMgr = WeatherPlotDataManager.getInstance();
// this.parent = parent;
}
/**
@ -118,14 +123,16 @@ public class WeatherCigCanvasComp extends WeatherCanvasComp {
* Graphics context.
*/
@Override
public void drawCanvasData(GC gc) {// need to check for changes in labels
// for graph and reset them if
// necessary
public void drawCanvasData(GC gc) {
/*
* need to check for changes in labels for graph and reset them if
* necessary
*/
WxPlotCfg config = dataMgr.getWxPlotCfg();
top = config.getCeilingTop() / 100;
bottom = config.getCeilingBottom() / 100;
String ceilingTop = String.format("%03.0f", top);
String ceilingBottom = String.format("%03.0f", bottom);
top = config.getCeilingTop();
bottom = config.getCeilingBottom();
String ceilingTop = String.format("%03.0f", top / 100);
String ceilingBottom = String.format("%03.0f", bottom / 100);
int fontHeight = gc.getFontMetrics().getHeight();
int halfFontHeight = fontHeight / 2;

View file

@ -31,6 +31,7 @@ import java.util.regex.Pattern;
import javax.xml.bind.JAXB;
import org.apache.commons.collections.ListUtils;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@ -51,8 +52,10 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.tafqueue.ServerResponse;
import com.raytheon.uf.common.tafqueue.TafQueueRecord;
import com.raytheon.uf.common.tafqueue.TafQueueRecord.TafQueueState;
import com.raytheon.uf.common.tafqueue.TafQueueRequest;
import com.raytheon.uf.common.tafqueue.TafQueueRequest.Type;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@ -84,6 +87,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 06May2014 3091 rferrel Use OUP authorization to bring up send dialog.
* 20May2015 4510 rferrel Added {@link #getForecasterId()}.
* Sep 25, 2015 4918 rferrel Allow selection of forecaster to send a TAF.
* Nov 06, 2015 5108 rferrel Display warning when forecast xmittime will result in a
* header time the same as any existing pending forecast.
*
* </pre>
*
@ -456,15 +461,66 @@ public class SendDialog extends CaveSWTDialog {
request.setType(Type.CREATE);
request.setUser(UserController.getUserObject());
Calendar xmitTime = Calendar.getInstance();
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
Calendar xmitTime = TimeUtil.newGmtCalendar();
xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection());
xmitTime.set(Calendar.MINUTE, minuteSpnr.getSelection());
xmitTime.set(Calendar.SECOND, secondSpnr.getSelection());
xmitTime.set(Calendar.MILLISECOND, 0);
String xmitTimestamp = String.format(TIMESTAMP_FORMAT,
xmitTime.get(Calendar.DAY_OF_MONTH),
xmitTime.get(Calendar.HOUR_OF_DAY),
xmitTime.get(Calendar.MINUTE));
/*
* Check for pending entries with same xmitTimestamp. The header
* timestamp is always adjusted to the xmitTimestamp.
*/
TafQueueRequest pendingRequest = new TafQueueRequest();
pendingRequest.setType(Type.GET_TAFS);
pendingRequest.setUser(UserController.getUserObject());
pendingRequest.setXmitTime(xmitTime.getTime());
pendingRequest.setState(TafQueueState.PENDING);
ServerResponse<List<String>> pendingResponse = null;
try {
pendingResponse = (ServerResponse<List<String>>) ThriftClient
.sendRequest(pendingRequest);
} catch (VizException e1) {
String msg = "Unable to get pending TAFs. ";
statusHandler.handle(Priority.PROBLEM, msg, e1);
msgStatComp.setMessageText(msg,
shell.getDisplay().getSystemColor(SWT.COLOR_RED).getRGB());
return;
}
List<String> pendingList = pendingResponse.getPayload();
if (!pendingList.isEmpty()) {
StringBuilder message = new StringBuilder("The pending queue ");
if (pendingList.size() == 1) {
message.append("has a product with the same header time");
} else {
message.append("has products with the same header time");
}
msgStatComp.setMessageText(message.toString() + ".", shell
.getDisplay().getSystemColor(SWT.COLOR_RED).getRGB());
message.append(":\n");
for (String filename : pendingList) {
message.append(filename.split(",", 2)[1]).append("\n");
}
message.append("\nSelect OK to transmit this product with the same header time.");
MessageDialog dlg = new MessageDialog(shell,
"Duplicate Transmission Time", null, message.toString(),
MessageDialog.WARNING, new String[] { "OK", "Cancel" }, 1);
if (0 != dlg.open()) {
return;
} else {
statusHandler
.info("WARNING multiple products with same header time in the pending queue.");
}
}
// BBB
String in = tabComp.getTextEditorControl().getText();
String bbb = tabComp.getBBB();

View file

@ -1076,19 +1076,11 @@ class Decoder(tpg.VerboseParser):
add_msg(self._group['obv'], 'error', 13)
def check_vsby_wx(self, g):
# NWSI 10-813, 1.2.6
if 'vsby' in g and g['vsby']['str'] == 'P6SM':
if 'obv' in g and 'nsw' not in g:
for wx in g['obv']['str'].split():
if wx not in _UnltdVsbyWx:
raise Error(_Errors[18])
else:
if 'vsby' in g:
try:
vsby = g['vsby']['value']
except KeyError:
return
if not ('pcp' in g or 'obv' in g or 'nsw' in g):
add_msg(g['vsby'], 'error', 12)
# visibility consistent with precipitation
snow = 0
if 'pcp' in g:
@ -1103,29 +1095,40 @@ class Decoder(tpg.VerboseParser):
elif ptype in ('SN', 'DZ'):
snow = invalid_sn_vsby(i, vsby)
except TypeError: # TS
pass
if 'obv' in g:
for tok in g['obv']['str'].split():
wx = tok[-2:]
if wx == 'FG' and \
invalid_fg_vsby(tok, vsby):
raise Error(_Errors[14])
if wx == 'BR' and invalid_br_vsby(vsby):
raise Error(_Errors[15])
if wx in ('DS', 'SS'):
if tok[0] in '+-':
i = tok[0]
pass
if g['vsby']['str'] == 'P6SM':
if 'obv' in g and 'nsw' not in g:
for wx in g['obv']['str'].split():
if wx not in _UnltdVsbyWx:
raise Error(_Errors[18])
if snow == -1:
raise Error(_Errors[54])
# NWSI 10-813, 1.2.6
else:
if not ('pcp' in g or 'obv' in g or 'nsw' in g):
add_msg(g['vsby'], 'error', 12)
if 'obv' in g:
for tok in g['obv']['str'].split():
wx = tok[-2:]
if wx == 'FG' and \
invalid_fg_vsby(tok, vsby):
raise Error(_Errors[14])
if wx == 'BR' and invalid_br_vsby(vsby):
raise Error(_Errors[15])
if wx in ('DS', 'SS'):
if tok[0] in '+-':
i = tok[0]
else:
i = ''
if invalid_ds_vsby(i, vsby):
raise Error(_Errors[55])
if snow == -1:
raise Error(_Errors[54])
else:
if snow:
raise Error(_Errors[54])
if snow == -1:
raise Error(_Errors[54])
else:
if snow:
raise Error(_Errors[54])
#######################################################################
########################################################################
# Methods called by the parser
def prefix(self, s):
pass

View file

@ -17,10 +17,6 @@
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.viz.dataaccess"
download-size="0"

View file

@ -40,6 +40,7 @@
# 02/05/15 4099 randerso Fixed exception handling in __getActiveTable
# 05/07/2015 4027 randerso Fixed error handling,
# added NOTE about false postives for duplicate ETNs
# 10/16/2015 17771 dgilling Remove __sitesIgnoreNatlEtn.
# 10/29/2015 17701 yteng Correct parm selection for Hazards to exclude Hazardsnc
#
@ -109,8 +110,6 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
self.__ufnKeys = [('HU', 'A'), ('HU', 'W'), ('TR', 'A'), ('TR', 'W'),
('TY', 'A'), ('TY', 'W'), ('SS', 'A'), ('SS', 'W')]
self.__sitesIgnoreNatlEtn = self.__processJavaCollection(GFEVtecUtil.IGNORE_NATIONAL_ETN, str)
self.__marineZonesPrefix = ["AM", "GM", "PZ", "PK", "PH", "PM", "AN",
"PS", "SL"] #list of zone name prefix that are marine zones
@ -723,18 +722,18 @@ class HazardsTable(VTECTableUtil.VTECTableUtil):
phensig = (phen, sig)
# find the max ETN...
# 1. highest ETN period for non-tropical and all GUM products (tpcKeys)
# 1. highest ETN period for non-tropical
# or
# 2. highest ETN > 1000 for the tropical, non-GUM products (tpcKeys)
#
# Local WFOs do not assign these numbers, so they should have
# numbers < 1000
if phensig not in self.__tpcKeys or self.__siteID4 in self.__sitesIgnoreNatlEtn:
if phensig not in self.__tpcKeys:
etn_base = GFEVtecUtil.getNextEtn(self.__siteID4, '.'.join(phensig), False, self.__activeTableMode).getNextEtn() - 1
else:
presentyear = time.gmtime(self.__time)[0]
presentyear = time.gmtime(self.__time).tm_year
for active in activeTable:
activeyear = time.gmtime(active['issueTime'])[0]
activeyear = time.gmtime(active['issueTime']).tm_year
activephensig = (active['phen'], active['sig'])
if phensig == activephensig and presentyear == activeyear:
# causes failure if tropical hazards are less than 1001

View file

@ -1920,6 +1920,14 @@ class FWS_Overrides:
argDict["creationTime"] = self._getTime(self._creationDate, self._creationTime)
return None
def _parseTime(self,date,t,rtz):
try:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%y %Z')
except ValueError:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%Y %Z')
return cTime
def _getTime(self, date, t):
# Make a unix time integer from the given date and time strings
if t == "":
@ -1934,7 +1942,7 @@ class FWS_Overrides:
ptz = rtz[0:1]
offset = 0
if otz == ptz:
cTime = time.strptime(t + ' ' + date + ' ' + rtz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,rtz)
else:
if ptz == "E":
if otz == "E":
@ -1973,9 +1981,9 @@ class FWS_Overrides:
elif otz == "P":
offset = 0
if stz[1:3] == rtz[1:3]:
cTime = time.strptime(t + ' ' + date + ' ' + stz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,stz)
else:
cTime = time.strptime(t + ' ' + date + ' ' + dtz, '%H%M %m/%d/%y %Z')
cTime = self._parseTime (date,t,dtz)
return time.mktime(cTime) + offset*3600
@ -2004,9 +2012,7 @@ class FWS_Overrides:
otz = stz[0:1]
ptz = rtz[0:1]
if otz == ptz:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + rtz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,rtz)
fcst = fcst + time.strftime(
'Forecast is based on ' + requestWords + ' time of %H%M %Z on %B %d. ',
self._fireDateTime)
@ -2049,19 +2055,19 @@ class FWS_Overrides:
elif otz == "P":
offset = 0
if stz[1:3] == rtz[1:3]:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + stz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,stz)
tempTime = time.mktime(self._fireDateTime) + offset*3600
self._fireDateTime = time.localtime(tempTime)
else:
self._fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate + ' ' + dtz,
'%H%M %m/%d/%y %Z')
self._fireDateTime = self._parseTime (self._fireDate,self._fireTime,dtz)
tempTime = time.mktime(self._fireDateTime) + offset*3600
self._fireDateTime = time.localtime(tempTime)
fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate, '%H%M %m/%d/%y')
try:
fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate, '%H%M %m/%d/%y')
except ValueError:
fireDateTime = time.strptime(
self._fireTime + ' ' + self._fireDate, '%H%M %m/%d/%Y')
fcst = fcst + time.strftime(
'Forecast is based on ' + requestWords + ' time of %H%M ' + rtz + ' on %B %d. ',
fireDateTime)

View file

@ -1795,9 +1795,9 @@ class SampleAnalysis(CommonUtils.CommonUtils):
timeRange = subRange
exec "result = " + primaryMethod
# Handle no data
# If a subRange has no data return None
# If a subRange has no data continue
if result is None:
return None
continue
statsByRange.append((result, subRange))
return statsByRange

View file

@ -10,11 +10,6 @@
</bean>
<bean id="gfeVtecConfig" class="com.raytheon.viz.gfe.vtec.GFEVtecConfig" factory-method="getInstance">
<property name="sitesIgnoreNationalEtn">
<set>
<value>PGUM</value>
</set>
</property>
<property name="nationalEtnPhensigs">
<set>
<value>TO.A</value>

View file

@ -115,6 +115,8 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
* Stepping is enabled. Cleaned up deprecated warnings.
* 06/20/2013 #2111 dgilling Prevent NullPointerException in mouse handler's
* displayContextMenu() method.
* 11/03/2015 #4961 randerso Make topo grids visible in the grid manager when
* mutable dbType is EditTopo
*
* </pre>
*
@ -702,7 +704,9 @@ public class GridCanvas extends Canvas implements IMessageClient {
if (additions != null) {
for (Parm parm : additions) {
if (!parm.getGridInfo().isTimeIndependentParm()) {
if (!parm.getGridInfo().isTimeIndependentParm()
|| dataMgr.getParmManager().getMutableDatabase()
.getDbType().equals("EditTopo")) {
GridBar gridBar = new GridBar(this, parm, gridManager);
gridBarList.add(gridBar);
}

View file

@ -108,7 +108,7 @@ public final class TextProductTransmitter {
*/
public ProductStateEnum transmitProduct(boolean practice)
throws VizException, SimulatedTimeProhibitedOpException {
if (SimulatedTimeOperations.isTransmitAllowed()) {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("Transmit GFE text products.");
}

View file

@ -34,6 +34,7 @@ import java.util.Set;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 14, 2013 #1842 dgilling Initial creation
* Oct 16, 2015 DR17771 dgilling Remove sitesIgnoreNationalEtn.
*
* </pre>
*
@ -45,8 +46,6 @@ public class GFEVtecConfig {
private static final GFEVtecConfig INSTANCE = new GFEVtecConfig();
private Set<String> sitesIgnoreNationalEtn = Collections.emptySet();
private Set<String> nationalEtnPhensigs = Collections.emptySet();
private Set<String> tropicalEtnPhensigs = Collections.emptySet();
@ -58,17 +57,10 @@ public class GFEVtecConfig {
return INSTANCE;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("GFEVtecConfig [sitesIgnoreNationalEtn=");
builder.append(sitesIgnoreNationalEtn);
builder.append(", nationalEtnPhensigs=");
builder.append("GFEVtecConfig [nationalEtnPhensigs=");
builder.append(nationalEtnPhensigs);
builder.append(", tropicalEtnPhensigs=");
builder.append(tropicalEtnPhensigs);
@ -76,10 +68,6 @@ public class GFEVtecConfig {
return builder.toString();
}
public Set<String> getSitesIgnoreNationalEtn() {
return sitesIgnoreNationalEtn;
}
public Set<String> getNationalEtnPhensigs() {
return nationalEtnPhensigs;
}
@ -88,10 +76,6 @@ public class GFEVtecConfig {
return tropicalEtnPhensigs;
}
public void setSitesIgnoreNationalEtn(Set<String> sitesIgnoreNationalEtn) {
this.sitesIgnoreNationalEtn = sitesIgnoreNationalEtn;
}
public void setNationalEtnPhensigs(Set<String> nationalEtnPhensigs) {
this.nationalEtnPhensigs = nationalEtnPhensigs;
}

View file

@ -65,6 +65,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* getVtecLinesThatNeedEtn().
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
* Apr 28, 2015 #4027 randerso Added getNextEtn parameter to specify ActiveTableMode
* Oct 16, 2015 DR17771 dgilling Removed IGNORE_NATIONAL_ETN.
*
* </pre>
*
@ -80,9 +81,6 @@ public class GFEVtecUtil {
public static final Collection<String> NATIONAL_PHENSIGS = ImmutableSet
.copyOf(GFEVtecConfig.getInstance().getNationalEtnPhensigs());
public static final Collection<String> IGNORE_NATIONAL_ETN = ImmutableSet
.copyOf(GFEVtecConfig.getInstance().getSitesIgnoreNationalEtn());
private static final Comparator<VtecObject> VTEC_COMPARATOR = new Comparator<VtecObject>() {
@Override
@ -299,9 +297,7 @@ public class GFEVtecUtil {
while (vtecMatcher.find()) {
VtecObject vtec = new VtecObject(vtecMatcher.group());
if (("NEW".equals(vtec.getAction()))
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
&& (!NATIONAL_PHENSIGS.contains(vtec.getPhensig()))) {
List<VtecObject> vtecsForPhensig = cache.get(vtec.getPhensig());
if (vtecsForPhensig == null) {
vtecsForPhensig = new ArrayList<VtecObject>();
@ -344,13 +340,13 @@ public class GFEVtecUtil {
StringBuffer finalOutput = new StringBuffer();
while (vtecMatcher.find()) {
VtecObject vtec = new VtecObject(vtecMatcher.group());
// To best match the ETN assignment logic in HazardsTable.py, it
// seems we should assume all ETNs assigned to tropical products are
// automatically correct
/*
* To best match the ETN assignment logic in HazardsTable.py, it
* seems we should assume all ETNs assigned to tropical products are
* automatically correct
*/
if (("NEW".equals(vtec.getAction()))
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
&& (!NATIONAL_PHENSIGS.contains(vtec.getPhensig()))) {
String phensig = vtec.getPhensig();
TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime());

View file

@ -23,7 +23,6 @@
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.grid.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.dataplugin.obs.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.maps.feature" version="1.0.0.qualifier"/>
</requires>
<plugin

View file

@ -84,6 +84,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Both not existing, set as MISSING
* Dec 07, 2012 1353 rferrel Make dialog non-blocking.
* Feb 05, 2013 1578 rferrel Changes for non-blocking singleton TimeSeriesDlg.
* Jun 15, 2015 16579 wkwock Add HSA filter.
*
* </pre>
*
@ -116,6 +117,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
*/
private Combo exceedingCbo;
/**
* HSA combo box.
*/
private Combo hsaCbo;
/**
* Sort by time radio button.
*/
@ -263,7 +269,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
*/
private void createTopControls() {
Composite topControlComp = new Composite(shell, SWT.NONE);
GridLayout topControlGl = new GridLayout(6, false);
GridLayout topControlGl = new GridLayout(8, false);
topControlComp.setLayout(topControlGl);
Label showLbl = new Label(topControlComp, SWT.NONE);
@ -326,6 +332,25 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
}
});
GridData hsagd = new GridData(100, SWT.DEFAULT);
Label hsaLbl = new Label(topControlComp, SWT.RIGHT);
hsaLbl.setText("HSA");
hsaLbl.setLayoutData(hsagd);
hsaCbo = new Combo(topControlComp, SWT.DROP_DOWN | SWT.READ_ONLY);
populateHsa();
hsaCbo.select(0);
hsaCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
queryAlertalarmval();
super.widgetSelected(e);
}
});
gd = new GridData(370, SWT.DEFAULT);
Label noteLbl = new Label(topControlComp, SWT.CENTER);
noteLbl.setText("Note: SupVal is ObsValue for forecast diff threats\n"
@ -333,6 +358,28 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
noteLbl.setLayoutData(gd);
}
/**
* Populate the HsaCbo
*/
private void populateHsa() {
hsaCbo.add("All HSAs");
String hsaSql = "select distinct(hsa) from location order by hsa";
java.util.List<Object[]> rs;
try {
rs = (java.util.List<Object[]>) DirectDbQuery.executeQuery(
hsaSql , HydroConstants.IHFS, QueryLanguage.SQL);
if (rs.size() > 0) {
for (Object[] oa : rs) {
hsaCbo.add((String) oa[0]);
}
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
}
}
/**
* Create the controls for sorting the data.
*/
@ -499,6 +546,11 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
myQuery.append(DIFF_CHECKSTR);
}
//HSA filter
if (!hsaCbo.getItem(hsaCbo.getSelectionIndex()).equalsIgnoreCase("All HSAs")) {
myQuery.append(" and hsa='"+hsaCbo.getItem(hsaCbo.getSelectionIndex())+"'");
}
// Build 'sort' options based on toggle buttons on the dialog.
if (locationRdo.getSelection()) {

View file

@ -94,6 +94,7 @@ import com.raytheon.viz.hydrocommon.texteditor.TextEditorDlg;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.HydroQC;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* This class displays the Tabular Time Series dialog for Hydroview.
@ -131,6 +132,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Jul 16, 2013 2088 rferrel Changes for non-blocking TextEditorDlg.
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
* Oct 13, 2015 4933 rferrel Refactored to use selected variables.
* Oct 27, 2015 4900 mduff Don't transmit SHEF files if in DRT.
* </pre>
*
* @author lvenable
@ -2650,8 +2652,7 @@ public class TabularTimeSeriesDlg extends CaveSWTDialog implements
/* Find the flood stg/flow if a river station */
java.util.List<Object[]> floodList = null;
try {
floodList = (java.util.List<Object[]>) dataManager
.getFloodStage(lid);
floodList = dataManager.getFloodStage(lid);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to get Flood Stage List: ", e);
@ -2962,6 +2963,13 @@ public class TabularTimeSeriesDlg extends CaveSWTDialog implements
* Broadcast the SHEF product.
*/
private void sendProduct() {
// Check for DTR and don't transmit if in DRT
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(this.shell,
"Transmission of SHEF products");
return;
}
if (sendConfirmation()) {
// check shef issue configuration
ShefIssueMgr sim = ShefIssueMgr.getInstance();

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.hydro.timeseries.util.GraphData;
import com.raytheon.viz.hydro.timeseries.util.GroupInfo;
import com.raytheon.viz.hydro.timeseries.util.LIDData;
import com.raytheon.viz.hydro.timeseries.util.PageInfo;
import com.raytheon.viz.hydro.timeseries.util.PreferredOrderManager;
import com.raytheon.viz.hydro.timeseries.util.TimeSeriesUtil;
import com.raytheon.viz.hydro.timeseries.util.TraceData;
import com.raytheon.viz.hydrocommon.HydroConstants;
@ -126,6 +127,8 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
* Jul 21, 2015 4500 rjpeter Use Number in blind cast.
* Oct 13, 2015 4933 rferrel Log error if unable to find group definition file
* Fixed formatter resource leaks.
* 30 Oct, 2015 15102 wkwock Implements preferred order for PE-D-TS-EXT list
*
* </pre>
*
* @author lvenable
@ -1512,9 +1515,13 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
ArrayList<Object[]> data = (ArrayList<Object[]>) dataManager
.getSitePEData(selectedLid);
PreferredOrderManager pom = PreferredOrderManager.getInstance();
Map<String, String[]> peMap = pom.getPreferedOrder(selectedLid);
bottomDataList.removeAll();
/* Get the lists of PE data */
LinkedHashMap<String, ArrayList<SiteInfo>> preferredMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> hMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> qMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
LinkedHashMap<String, ArrayList<SiteInfo>> pMap = new LinkedHashMap<String, ArrayList<SiteInfo>>();
@ -1533,7 +1540,30 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
si.setExt((String) row[3]);
si.setDur(((Number) row[4]).intValue());
if (si.getPe().startsWith("H")) {
boolean preferredLstFlg = false;
if (peMap!=null){
String[] typeSrcLst = peMap.get(si.getPe());
if (typeSrcLst != null) {
for (String typesrc : typeSrcLst) {
if (typesrc.equalsIgnoreCase(si.getTs())) {
preferredLstFlg = true;
break;
}
}
} else if (peMap.containsKey(si.getPe())) {
preferredLstFlg = true;
}
}
if (preferredLstFlg) {
if (!si.getPe().equals(prevPE)) {
preferredMap.put(si.getPe(), new ArrayList<SiteInfo>());
prevPE = si.getPe();
}
preferredMap.get(si.getPe()).add(si);
} else if (si.getPe().startsWith("H")) {
if (!si.getPe().equals(prevPE)) {
hMap.put(si.getPe(), new ArrayList<SiteInfo>());
prevPE = si.getPe();
@ -1591,6 +1621,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
tsSelected = false;
}
populatePreferredDataInOrder(preferredMap,peMap);
processDataList(hMap, tsSelected);
processDataList(qMap, tsSelected);
processDataList(pMap, tsSelected);
@ -1601,7 +1632,41 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
selectedDataLbl.setText(selectedLid);
bottomDataList.setSelection(0);
} catch (VizException e) {
e.printStackTrace();
statusHandler.error("Failed to populate time series list",e);
}
}
/**
* populate data to bottomDataList base on preferred predefined order
* @param preferredMap
* @param peMap
*/
private void populatePreferredDataInOrder (LinkedHashMap<String, ArrayList<SiteInfo>>preferredMap, Map<String, String[]> peMap) {
if (peMap!=null && preferredMap!=null ){
for (String pe:peMap.keySet()){
java.util.List<SiteInfo> siList = preferredMap.get(pe);
if (siList == null) {
continue;
}
String[] tsList = peMap.get(pe);
if (tsList==null) { //There's PE but no TS in preffered_order.txt
for(SiteInfo si : siList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
} else { //There's both PE and TS in preferred_order.txt
for (String ts: tsList){
for(SiteInfo si : siList) {
if (ts.equalsIgnoreCase(si.getTs())) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
}
}
}
}
}

View file

@ -0,0 +1,156 @@
package com.raytheon.viz.hydro.timeseries.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.viz.hydrocommon.HydroConstants;
/**
* This class read the user preferred predefined PE-D-TS-EXT list from file:
* hydro/preferred_order.txt File format: lines start with # is a comment One
* line per LID LID PE1:TS1,TS2 PE2:TS2,TS3 ... Duplicated LID will replaced by
* last one.
*
* @author wkwock
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 6/22/2015 DCS15102 wkwock Initial creation.
* </pre>
*/
public class PreferredOrderManager implements ILocalizationFileObserver {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PreferredOrderManager.class);
private static PreferredOrderManager pom = null;
private Map<String, LinkedHashMap<String, String[]>> lidHm = new LinkedHashMap<String, LinkedHashMap<String, String[]>>();
private boolean readFileFlag = true;
private static final String COMMA_REGEX = "\\s*,\\s*";
// For remove space around commas.
private static final String COLON_REGEX = "\\s*:\\s*";
// For remove spaces around colons.
private static final String SPACE_REGEX = "\\s+";
private PreferredOrderManager() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile file = pm
.getStaticLocalizationFile(HydroConstants.PREFERRED_ORDER);
if (file == null || !file.exists()) {
return;
}
file.addFileUpdatedObserver(this);
}
private void readPreferredOrderFile() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile file = pm
.getStaticLocalizationFile(HydroConstants.PREFERRED_ORDER);
lidHm.clear();
if (file == null || !file.exists()) {
return;
}
StringBuilder message = new StringBuilder();
BufferedReader in = null;
try {
in = new BufferedReader(new InputStreamReader(
file.openInputStream()));
String line;
inloop: while ((line = in.readLine()) != null) {
String str = line.trim();
if (str.startsWith("#") || str.length() == 0) {
continue;// This is a comment or blank line
}
str = str.replaceAll(COMMA_REGEX, ",").replaceAll(COLON_REGEX,
":");
String[] lineSplit = str.split(SPACE_REGEX);
if (lineSplit.length < 2) {
message.append(line + "\n");
continue;
}
String lid = lineSplit[0].toUpperCase();
LinkedHashMap<String, String[]> peHm = new LinkedHashMap<String, String[]>();
for (int index = 1; index < lineSplit.length; index++) {
String[] peSplit = lineSplit[index].split(":");
if (peSplit.length > 2) {
message.append(line + "\n");
continue inloop;
}
String pe = peSplit[0].toUpperCase();
if (peSplit.length == 2) {
String[] tsSplit = peSplit[1].split(",");
peHm.put(pe, tsSplit);
} else {
peHm.put(pe, null);
}
}
lidHm.put(lid, peHm);
}
if (message.length() > 0) {
message.insert(0,"Invalid line in file "+HydroConstants.PREFERRED_ORDER+":\n");
message.append("Valid example: ACCM2 PP:RZ,RG TA:RZ\n");
}
} catch (IOException | LocalizationException e) {
message.append("Failed to read file "+HydroConstants.PREFERRED_ORDER);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
message.append("Failed to close file "+HydroConstants.PREFERRED_ORDER);
}
}
}
if (message.length() > 0) {
statusHandler.warn(message.toString());
}
}
public final static synchronized PreferredOrderManager getInstance() {
if (pom == null) {
pom = new PreferredOrderManager();
}
return pom;
}
public Map<String, String[]> getPreferedOrder(String lid) {
if (readFileFlag) {
readPreferredOrderFile();
readFileFlag = false;
}
Map<String, String[]> peMap = lidHm.get(lid);
return peMap;
}
@Override
public void fileUpdated(FileUpdatedMessage message) {
readFileFlag = true;
}
}

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.hydrobase;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@ -39,6 +40,7 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDataManager;
* ------------ ---------- ----------- --------------------------
* Sep 2, 2009 2259 mpduff Initial creation
* May 14, 2012 14965 wkwock Fix crash in query for data
* Jun 10, 2015 DCS15095 wkwock Added edit/insert flood event feature.
*
* </pre>
*
@ -69,7 +71,7 @@ public class FloodReportDataManager extends HydroDataManager {
* The selected location id.
*/
private String selectedLid = null;
/**
* The selected key for the dataMap.
*/
@ -149,6 +151,28 @@ public class FloodReportDataManager extends HydroDataManager {
return lidList;
}
/**
* Get a list of lids from the riverstat table.
*
* @param where
* The where clause to constrain the query
* @return ArrayList<String> of location ids
*/
public List<String> getLidListFromRiverStat(String where) {
List<String> lidList = new ArrayList<String>();
String query = "select distinct lid from riverstat ";
List<Object[]> rs = runQuery(query + where);
if (rs!=null) {
for (Object[] oa : rs) {
lidList.add((String) oa[0]);
}
}
return lidList;
}
/**
* Get Flood Report data.
*
@ -157,7 +181,8 @@ public class FloodReportDataManager extends HydroDataManager {
* @return FloodReportData object populated with data, null if problem or no
* data
*/
public ArrayList<FloodReportData> getFloodRptData(String lid, String start, String end) {
public ArrayList<FloodReportData> getFloodRptData(String lid, String start,
String end) {
ArrayList<FloodReportData> dataList = new ArrayList<FloodReportData>();
String lname = HydroDataCache.getInstance().getLocationMap().get(lid);
double fs = getFloodStage(lid);
@ -180,10 +205,10 @@ public class FloodReportDataManager extends HydroDataManager {
data.setLastCrest((Double) lastCrest[0]);
data.setLastCrestDate((Date) lastCrest[1]);
}
dataList.add(data);
}
return dataList;
}
@ -191,15 +216,14 @@ public class FloodReportDataManager extends HydroDataManager {
* Get the flood stage for the site.
*
* @param lid
* The site
* @return The flood stage for the site
*/
public double getFloodStage(String lid) {
double fs = -999;
ArrayList<Object[]> rs = runQuery("select fs from riverstat where lid = '"
List<Object[]> rs = runQuery("select fs from riverstat where lid = '"
+ lid + "'");
if ((rs != null) && (rs.size() > 0) && rs.get(0)[0]!=null) {
if ((rs != null) && (rs.size() > 0) && rs.get(0)[0] != null) {
fs = (Double) rs.get(0)[0];
}
@ -216,7 +240,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getRiverBasin(String lid) {
String basin = null;
ArrayList<Object[]> rs = runQuery("select rb from location where lid = '"
List<Object[]> rs = runQuery("select rb from location where lid = '"
+ lid + "'");
if (rs != null) {
basin = (String) rs.get(0)[0];
@ -235,7 +259,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getState(String lid) {
String state = null;
ArrayList<Object[]> rs = runQuery("select state from location where lid = '"
List<Object[]> rs = runQuery("select state from location where lid = '"
+ lid + "'");
if (rs != null) {
state = (String) rs.get(0)[0];
@ -254,7 +278,7 @@ public class FloodReportDataManager extends HydroDataManager {
public String getRiver(String lid) {
String river = null;
ArrayList<Object[]> rs = runQuery("select stream from riverstat where lid = '"
List<Object[]> rs = runQuery("select stream from riverstat where lid = '"
+ lid + "'");
if (rs != null) {
river = (String) rs.get(0)[0];
@ -273,9 +297,13 @@ public class FloodReportDataManager extends HydroDataManager {
public int[] getFloodEventIds(String lid, String start, String end) {
int[] id = null;
ArrayList<Object[]> rs = runQuery("select distinct flood_event_id from floodts where lid = '"
+ lid + "' and obstime >= '" + start + "' and obstime <= '" + end + "'");
List<Object[]> rs = runQuery("select distinct flood_event_id from floodts where lid = '"
+ lid
+ "' and obstime >= '"
+ start
+ "' and obstime <= '"
+ end + "'");
if ((rs != null) && (rs.size() > 0)) {
id = new int[rs.size()];
for (int i = 0; i < rs.size(); i++) {
@ -301,7 +329,7 @@ public class FloodReportDataManager extends HydroDataManager {
String query = "Select value, obstime from floodts where lid = '" + lid
+ "' and flood_event_id = " + id + " order by obstime";
ArrayList<Object[]> rs = runQuery(query);
List<Object[]> rs = runQuery(query);
lastCrest = new Object[rs.get(0).length];
Object[] retVal = new Object[2];
if ((rs != null) && (rs.size() > 0)) {
@ -343,6 +371,27 @@ public class FloodReportDataManager extends HydroDataManager {
return retVal;
}
/**
* get the max flood_event_id of a lid. Default to 0.
*
* @param lid
* @return
*/
public int getMaxFloodeventID(String lid) {
String query = "Select max(flood_event_id) from floodts where lid = '"
+ lid + "' and flood_event_id > 0";
List<Object[]> rs = runQuery(query);
Integer feID = new Integer(0);
if ((rs != null) && (rs.size() > 0)) {
feID = (Integer) rs.get(0)[0];
if (feID == null) {
return 0;
}
}
return feID.intValue();
}
/**
* Get the value and obstime from the floodts table.
*
@ -429,8 +478,7 @@ public class FloodReportDataManager extends HydroDataManager {
if ((ptsMissing[INDEX_PT_A] == false)
&& (ptsMissing[INDEX_PT_B] == false)) {
anchor1 = FloodReportUtils
.floodreptInterp(ptA, ptB, floodStage);
anchor1 = FloodReportUtils.floodreptInterp(ptA, ptB, floodStage);
ptsMissing[INDEX_ANCHOR1] = false;
} else {
if (ptA.getCrest() == floodStage) {
@ -443,8 +491,7 @@ public class FloodReportDataManager extends HydroDataManager {
}
/*
* get last Anchor point, use index to continue loop where we left
* off
* get last Anchor point, use index to continue loop where we left off
*/
for (int i = index; i < rs.size(); i++) {
if (findLastAnchor == false) {
@ -495,8 +542,7 @@ public class FloodReportDataManager extends HydroDataManager {
/* interpolate to find time of recession below flood stage */
if ((ptsMissing[INDEX_PT_C] == false)
&& (ptsMissing[INDEX_PT_D] == false)) {
anchor2 = FloodReportUtils
.floodreptInterp(ptC, ptD, floodStage);
anchor2 = FloodReportUtils.floodreptInterp(ptC, ptD, floodStage);
ptsMissing[INDEX_ANCHOR2] = false;
} else {
if (ptC.getCrest() == floodStage) {
@ -650,7 +696,8 @@ public class FloodReportDataManager extends HydroDataManager {
}
/**
* @param selectedKey the selectedKey to set
* @param selectedKey
* the selectedKey to set
*/
public void setSelectedKey(String selectedKey) {
this.selectedKey = selectedKey;

View file

@ -68,6 +68,7 @@ import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.hydrobase.addEditFloodTS.AddEditFloodEventDlg;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.util.DbUtils;
import com.raytheon.viz.hydrocommon.util.RatingUtils;
@ -79,15 +80,16 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2008 2259 lvenable Initial creation
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2008 2259 lvenable Initial creation
* Dec 3, 2010 4952 lbousaidi
* Jan 13, 2011 5415 lbousaidi added a dialog when
* "Compute Latest data" button runs
* Jan 13, 2011 5415 lbousaidi added a dialog when
* "Compute Latest data" button runs
* May 14, 2012 14965 wkwock fix crash in query for data
* Jun 18, 2012 14377 wkwock Correct insert data into crest table.
* Jun 27, 2013 2088 rferrel Made dialog non-blocking.
* Jun 10, 2015 DCS15095 wkwock Added edit/insert flood event feature.
*
* </pre>
*
@ -140,6 +142,16 @@ public class FloodReportDlg extends CaveSWTDialog {
*/
private Button deleteBtn;
/**
* Edit event button
*/
private Button editEventBtn;
/**
* New event button
*/
private Button newEventBtn;
/**
* Above flood stage text control.
*/
@ -208,6 +220,8 @@ public class FloodReportDlg extends CaveSWTDialog {
private SimpleDateFormat dbFormat = null;
private SimpleDateFormat fr = null;
private AddEditFloodEventDlg efeDlg = null;
/**
* Constructor.
@ -335,6 +349,7 @@ public class FloodReportDlg extends CaveSWTDialog {
* Create the middle list and canvas controls.
*/
private void createMiddleControls() {
final int BUTTON_WIDTH=165;
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(new GridLayout(2, false));
@ -405,7 +420,7 @@ public class FloodReportDlg extends CaveSWTDialog {
buttonComp.setLayoutData(gd);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = 165;
gd.widthHint = BUTTON_WIDTH;
saveEventsBtn = new Button(buttonComp, SWT.PUSH);
saveEventsBtn.setText("Save Events to File...");
saveEventsBtn.setLayoutData(gd);
@ -417,7 +432,7 @@ public class FloodReportDlg extends CaveSWTDialog {
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = 165;
gd.widthHint = BUTTON_WIDTH;
deleteBtn = new Button(buttonComp, SWT.PUSH);
deleteBtn.setText("Delete Event");
deleteBtn.setLayoutData(gd);
@ -456,6 +471,30 @@ public class FloodReportDlg extends CaveSWTDialog {
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = BUTTON_WIDTH;
editEventBtn = new Button(buttonComp, SWT.PUSH);
editEventBtn.setText("Edit Event");
editEventBtn.setLayoutData(gd);
editEventBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
editEvent(false);
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = BUTTON_WIDTH;
newEventBtn = new Button(buttonComp, SWT.PUSH);
newEventBtn.setText("New Event");
newEventBtn.setLayoutData(gd);
newEventBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
editEvent(true);
}
});
// ----------------------------------------------------
// Create the Stage canvas composite
// ----------------------------------------------------
@ -980,6 +1019,32 @@ public class FloodReportDlg extends CaveSWTDialog {
}
}
/**
* Edit selected event or edit a new event base on @param newEvent.
*
* @param newEvent
*/
private void editEvent(boolean newEventFlg) {
String key = null;
if (!newEventFlg && locationList.getSelectionIndex() < 0) {
MessageBox mb = new MessageBox(shell, SWT.OK);
mb.setText("Make a Selection");
mb.setMessage("You must select a river observation!");
mb.open();
} else {
if (!newEventFlg) {
key=selectedKey;
}
if (efeDlg==null || efeDlg.isDisposed()) {
efeDlg = new AddEditFloodEventDlg(this.getParent(), key, this);
efeDlg.open();
} else {
efeDlg.bringToTop();
}
}
}
/**
* Get the text to output to the file.
*
@ -1265,4 +1330,9 @@ public class FloodReportDlg extends CaveSWTDialog {
}
shell.setCursor(cursor);
}
public void refreshReport() {
clearCanvas();
updateFloodList();
}
}

View file

@ -0,0 +1,450 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map;
import java.util.TimeZone;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.viz.hydrobase.FloodReportData;
import com.raytheon.viz.hydrobase.FloodReportDataManager;
import com.raytheon.viz.hydrobase.FloodReportDlg;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* This class display the Edit Flood Event dialog.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 6/10/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public class AddEditFloodEventDlg extends CaveSWTDialog implements ITSCompositeAction {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AddEditFloodEventDlg.class);
/**
* Location list control.
*/
private List lidsLst;
private Label lidLbl;
private Label stageLbl;
private SimpleDateFormat dateFormat = null;
private String lid = null;
private int floodEventID = -1;
private double floodStage = 0;
private String selectedKey;
private Composite obsComp;
private ScrolledComposite obsSComp;
private FloodReportDlg owner;
private LinkedList<TSComposite> tsLinkedList = null;
/**
* Constructor
*
* @param parent
* @param key
* @param owner
*/
public AddEditFloodEventDlg(Shell parent, String key, FloodReportDlg owner) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
this.owner = owner;
this.selectedKey = key;
if (selectedKey == null) {
setText("Adding New Flood Event");
} else {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
lid = dman.getSelectedLid();
floodStage = dman.getFloodStage(lid);
floodEventID = dman.getReportData().get(selectedKey)
.getFloodEventId();
setText("Editing Flood Event for " + lid);
}
dateFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
tsLinkedList = new LinkedList<TSComposite>();
};
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 2;
mainLayout.marginWidth = 2;
mainLayout.verticalSpacing = 2;
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
}
/*
* initialize components
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
// Initialize all of the controls and layouts
initializeComponents();
}
/**
* Initialize the components on the display.
*/
private void initializeComponents() {
createControls();
createBottomButtons();
populateLIDLst();
populateObsComp();
}
/**
* Create the middle list and canvas controls.
*/
private void createControls() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(new GridLayout(2, false));
mainComp.setLayoutData(gd);
gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
Composite leftComp = new Composite(mainComp, SWT.NONE);
leftComp.setLayout(new GridLayout(1, false));
leftComp.setLayoutData(gd);
Label listLbl = new Label(leftComp, SWT.NONE);
listLbl.setText("Select a LID");
if (selectedKey == null) {
gd = new GridData(50, 400);
gd.horizontalSpan = 2;
lidsLst = new List(leftComp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL);
lidsLst.setLayoutData(gd);
} else {
listLbl.setText("");// not use it
lidLbl = new Label(leftComp, SWT.None);
lidLbl.setText("LID: " + selectedKey);
stageLbl = new Label(leftComp, SWT.None);
stageLbl.setText("flood stage: " + floodStage);
}
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
Composite rightComp = new Composite(mainComp, SWT.NONE);
rightComp.setLayout(new GridLayout(1, false));
rightComp.setLayoutData(gd);
gd = new GridData();
gd.horizontalIndent = 4;
gd.horizontalSpan = 2;
Label obsListLbl = new Label(rightComp, SWT.NONE);
obsListLbl.setText("Observation");
obsListLbl.setLayoutData(gd);
obsSComp = new ScrolledComposite(rightComp, SWT.BORDER | SWT.V_SCROLL);
obsSComp.setLayoutData(new GridData(350, 400));
obsComp = new Composite(obsSComp, SWT.NONE);
obsComp.setLayout(new FormLayout());
obsSComp.setAlwaysShowScrollBars(true);
obsSComp.setContent(obsComp);
obsSComp.setExpandHorizontal(true);
obsSComp.setExpandVertical(true);
obsSComp.setMinSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
Label topInsertLbl = new Label(obsComp, SWT.NONE);
topInsertLbl.setForeground(obsSComp.getDisplay().getSystemColor(
SWT.COLOR_GREEN));
topInsertLbl.setText("-->");
Cursor handCursor = this.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
topInsertLbl.setCursor(handCursor);
FormData insertFd = new FormData();
insertFd.top = new FormAttachment(0, 4);
insertFd.left = new FormAttachment(0, 4);
topInsertLbl.setLayoutData(insertFd);
final AddEditFloodEventDlg floodEventDlg = this;
topInsertLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
TSComposite tsComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(),floodEventDlg );
tsLinkedList.add(0,tsComp);
reorganizeGui();
}
});
}
/**
* Create the buttons at the bottom of the dialog.
*/
private void createBottomButtons() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, true));
buttonComp.setLayoutData(gd);
int buttonWidth = 120;
gd = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button saveBtn = new Button(buttonComp, SWT.PUSH|SWT.LEFT);
saveBtn.setText("Save Event");
saveBtn.setLayoutData(gd);
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
int status = saveNewEditTS();
if (status >= 0) {
close();
owner.refreshReport();
}
}
});
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth;
Button cancelBtn = new Button(buttonComp, SWT.PUSH|SWT.RIGHT);
cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
close();
}
});
}
/**
* populate LIDLst. LIDs are from riverstat table
*/
private void populateLIDLst() {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
if (selectedKey == null) {
java.util.List<String> lidList = dman.getLidListFromRiverStat("");
Collections.sort(lidList);
lidsLst.removeAll();
for (String lid : lidList) {
lidsLst.add(lid);
}
} else {
dman.setSelectedKey(selectedKey);
lidLbl.setText("LID: " + lid);
}
}
/**
* Populate the observation composite
*/
private void populateObsComp() {
if (selectedKey == null) {
TSComposite tsComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(), this);
tsLinkedList.add(0,tsComp);
reorganizeGui();
} else {
FloodReportDataManager dataManager = FloodReportDataManager
.getInstance();
Map<String, FloodReportData> dataMap = dataManager.getReportData();
dataManager.setSelectedKey(selectedKey);
FloodReportData floodData = dataMap.get(selectedKey);
java.util.List<Object[]> eventData = dataManager.getFloodEventData(
floodData.getLid(), floodData.getFloodEventId());
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm");
try {
for (Object[] oa : eventData) {
double val = (Double) oa[0];
String date = dateFormat.format((Date) oa[1]);
Calendar cal = Calendar.getInstance();
cal.setTime(sdf.parse(date));
TSComposite tsComp= new TSComposite(obsComp, val,cal,this);
tsLinkedList.add(tsComp);
reorganizeGui();
}
} catch (ParseException e) {
statusHandler.error("Failed to parse time", e);
}
}
}
/**
* Save this new time series to table floodts
*
* @return status:0 succeed to save data, -1 failed to save data.
*/
private int saveNewEditTS() {
FloodReportDataManager dman = FloodReportDataManager.getInstance();
String tsLID = this.lid;
int eventID = this.floodEventID;
if (selectedKey == null) {
tsLID = lidsLst.getSelection()[0];
eventID = dman.getMaxFloodeventID(tsLID) + 1;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
StringBuilder sqlStr = new StringBuilder(
"insert into floodts (lid,obstime,flood_event_id,value) ");
boolean firstOneFlg = true;
try {
ListIterator<TSComposite> listIterator = tsLinkedList.listIterator();
while (listIterator.hasNext()) {
if (firstOneFlg) {
sqlStr.append("values ");
} else {
sqlStr.append(",");
}
TSComposite tsComp = listIterator.next();
sqlStr.append("('").append(tsLID).append("','")
.append(sdf.format(tsComp.getDateTime().getTime()))
.append("',").append(eventID).append(",")
.append(tsComp.getValue()).append(")");
firstOneFlg = false;
}
} catch (NumberFormatException nfe) {
MessageBox mbe = new MessageBox(shell, SWT.OK | SWT.ERROR);
mbe.setMessage("Error: an observe value is invalid. Please fix and try again.");
mbe.open();
return -1;
}
int status = 0;
try {
if (selectedKey != null) {
StringBuilder deleteSql = new StringBuilder();
deleteSql.append("delete from floodts where lid='")
.append(tsLID).append("' and flood_event_id=")
.append(eventID);
status = DirectDbQuery.executeStatement(deleteSql.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
}
status = DirectDbQuery.executeStatement(sqlStr.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
} catch (Exception e) {
MessageBox mbe = new MessageBox(shell, SWT.OK | SWT.ERROR);
mbe.setMessage("Failed to save data. Please check for observe time confliction.");
mbe.open();
return -1;
}
return status;
}
/**
* add a new TS composite to the linked list and the GUI
*/
@Override
public void addTSComp (TSComposite tsComp) {
int index = tsLinkedList.indexOf(tsComp);
TSComposite newTSComp= new TSComposite(obsComp, 0.0,TimeUtil.newGmtCalendar(),this);
tsLinkedList.add(index+1, newTSComp);
reorganizeGui();
}
/**
* Remove a TS composite from the linked list and the GUI
*/
@Override
public void removeTSComp (TSComposite tsComp) {
if (tsLinkedList.size()>1){
tsLinkedList.remove(tsComp);
tsComp.dispose();
reorganizeGui();
} else {
tsComp.setValue(0.0);
}
}
/**
* Reflect the tsLinkedList on the AddEditFloodEvent GUI
*/
private void reorganizeGui () {
ListIterator<TSComposite> listIterator = tsLinkedList.listIterator();
TSComposite lastTSComp = null;
TSComposite tsComp= null;
while (listIterator.hasNext()) {
tsComp=listIterator.next();
FormData tfd = new FormData();
if (lastTSComp==null) {
tfd.top = new FormAttachment(0, 20);
} else {
tfd.top = new FormAttachment(lastTSComp, 1);
}
tsComp.setLayoutData(tfd);
lastTSComp = tsComp;
}
obsComp.setSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
obsSComp.setMinSize(obsComp.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
}

View file

@ -0,0 +1,22 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
/**
* Action interface in AddEditFloodEventDlg
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 11/09/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public interface ITSCompositeAction {
public void removeTSComp (TSComposite tsComp);
public void addTSComp(TSComposite tsComp);
}

View file

@ -0,0 +1,172 @@
package com.raytheon.viz.hydrobase.addEditFloodTS;
import java.util.Calendar;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
* This composite customized with a insert label, an observation(a value text, 2
* time widgets), and a delete label.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ---------- ---------- ----------- --------------------------
* 11/05/2015 DCS15095 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public class TSComposite extends Composite {
private Text valueTxt;
private DateTime date;
private DateTime time;
private Label deleteLbl;
private Label insertLbl;
private ITSCompositeAction actionCallback = null;
/**
* Constructor for composite with observe value and time
*
* @param parent
* @param obsValue
* @param cal
* @param owner
*/
public TSComposite(Composite parent, double obsValue, Calendar cal, ITSCompositeAction owner) {
super(parent, SWT.NONE);
this.actionCallback = owner;
createAnObsComp();
setValue(obsValue);
setDateTime(cal);
}
/**
* set the value to the value text box
*
* @param obsValue
*/
public void setValue(double obsValue) {
valueTxt.setText(Double.toString(obsValue));
}
/**
* Get the value from the value text box
*
* @return double value
* @throws NumberFormatException
*/
public double getValue() throws NumberFormatException {
return Double.parseDouble(valueTxt.getText());
}
/**
* set date time to both date time box
*
* @param cal
*/
public void setDateTime(Calendar cal) {
date.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DATE));
date.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), 0);
time.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DATE));
time.setTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), 0);
}
/**
* Get date time
* @return date time
*/
public Calendar getDateTime() {
Calendar cal = Calendar.getInstance();
cal.set(date.getYear(), date.getMonth(), date.getDay(),
time.getHours(), time.getMinutes(), 0);
return cal;
}
/**
* create an observe composite
*/
private void createAnObsComp() {
FormLayout cfl = new FormLayout();
cfl.marginWidth = 5;
cfl.marginHeight = 2;
this.setLayout(cfl);
valueTxt = new Text(this, SWT.BORDER);
FormData vfd = new FormData();
vfd.width = 50;
vfd.height = 18;
valueTxt.setLayoutData(vfd);
valueTxt.setText("0.0");
date = new DateTime(this, SWT.DATE | SWT.BORDER);
FormData fd = new FormData();
fd.left = new FormAttachment(valueTxt, 10);
fd.width = 100;
date.setLayoutData(fd);
time = new DateTime(this, SWT.TIME | SWT.BORDER | SWT.SHORT);
FormData timeFd = new FormData();
timeFd.left = new FormAttachment(date, 10);
timeFd.width = 100;
time.setLayoutData(timeFd);
Cursor handCursor = this.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
deleteLbl = new Label(this, SWT.NONE);
deleteLbl
.setForeground(this.getDisplay().getSystemColor(SWT.COLOR_RED));
deleteLbl.setText("x");
deleteLbl.setCursor(handCursor);
FormData dfd = new FormData();
dfd.left = new FormAttachment(time, 10);
dfd.top = new FormAttachment(this, 5);
deleteLbl.setLayoutData(dfd);
insertLbl = new Label(this, SWT.NONE);
insertLbl.setForeground(this.getDisplay().getSystemColor(
SWT.COLOR_GREEN));
insertLbl.setText("-->");
insertLbl.setCursor(handCursor);
FormData insertFd = new FormData();
insertFd.top = new FormAttachment(valueTxt, 4);
insertLbl.setLayoutData(insertFd);
final TSComposite tsComp=this;
deleteLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
actionCallback.removeTSComp(tsComp);
}
});
insertLbl.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent event) {
actionCallback.addTSComp(tsComp);
}
});
}
}

View file

@ -33,6 +33,7 @@ import org.eclipse.swt.graphics.RGB;
* ------------ ---------- ----------- --------------------------
* Jun 17, 2008 1194 M. Duff Initial creation.
* 11/18/2008 1662 grichard Added physical element enum type.
* 14 Sep, 2015 15102 wkwock Implements preferred order for PE-D-TS-EXT list
*
* </pre>
*
@ -262,6 +263,8 @@ public class HydroConstants {
public static final String RFCMOSAIC_DIR_TOKEN = "gaq_xmrg_1hr_dir";
public static final String PREFERRED_ORDER = "/hydro/preferred_order.txt";
/**
* Enumeration used for selection of physical element.
*/

View file

@ -22,8 +22,10 @@ package com.raytheon.viz.lightning;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
@ -34,12 +36,18 @@ import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -50,16 +58,19 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 18, 2009 chammack Initial creation
* Feb 27, 2013 DCS 152 jgerth Support for WWLLN and multiple sources
* Jun 19, 2014 3214 bclement added pulse and cloud flash support
* Jul 07, 2014 3333 bclement removed plotLightSource field
* Mar 05, 2015 4233 bsteffen include source in cache key.
* Jul 01, 2015 4597 bclement added DisplayType
* Jul 02, 2015 4605 bclement don't show current bin as available
* Sep 25, 2015 4605 bsteffen repeat binning
*
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------------------------
* Feb 18, 2009 1959 chammack Initial creation
* Feb 27, 2013 DCS 152 jgerth Support for WWLLN and multiple sources
* Jun 19, 2014 3214 bclement added pulse and cloud flash support
* Jul 07, 2014 3333 bclement removed plotLightSource field
* Mar 05, 2015 4233 bsteffen include source in cache key.
* Jul 01, 2015 4597 bclement added DisplayType
* Jul 02, 2015 4605 bclement don't show current bin as available
* Sep 25, 2015 4605 bsteffen repeat binning
* Nov 04, 2015 5090 bsteffen Add ability to get available times from a
* range.
*
* </pre>
*
@ -158,6 +169,55 @@ public class LightningResourceData extends AbstractRequestableResourceData {
return rval;
}
@Override
protected DataTime[] getAvailableTimes(
Map<String, RequestConstraint> constraintMap, BinOffset binOffset)
throws VizException {
if (binOffset != null
&& binOffset.getInterval() <= TimeUtil.SECONDS_PER_MINUTE) {
return getAvailableTimesFromRange(constraintMap, binOffset);
} else {
return super.getAvailableTimes(constraintMap, binOffset);
}
}
/**
* Replacement for {@link #getAvailableTimes(Map, BinOffset)} that includes
* the binned end times in the result. Normally binning is only applied to
* the start time of the range, so it is possible to miss frames where data
* is available at the end of the range. For very small bins it is necessary
* to use both start and end time to ensure all frames are displayed.
*/
protected DataTime[] getAvailableTimesFromRange(
Map<String, RequestConstraint> constraintMap, BinOffset binOffset)
throws VizException {
DbQueryRequest request = new DbQueryRequest(constraintMap);
request.addRequestField(PluginDataObject.STARTTIME_ID);
request.addRequestField(PluginDataObject.ENDTIME_ID);
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
Date[] startTimes = response.getFieldObjects(
PluginDataObject.STARTTIME_ID, Date.class);
Date[] endTimes = response.getFieldObjects(PluginDataObject.ENDTIME_ID,
Date.class);
Set<DataTime> binnedTimes = new HashSet<>(startTimes.length);
for (Date time : startTimes) {
DataTime dataTime = new DataTime(time);
dataTime = binOffset.getNormalizedTime(dataTime);
binnedTimes.add(dataTime);
}
for (Date time : endTimes) {
DataTime dataTime = new DataTime(time);
dataTime = binOffset.getNormalizedTime(dataTime);
binnedTimes.add(dataTime);
}
DataTime[] allTimes = binnedTimes.toArray(new DataTime[0]);
Arrays.sort(allTimes);
return allTimes;
}
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {

View file

@ -30,6 +30,7 @@ import java.util.Map;
import java.util.Map.Entry;
import com.raytheon.uf.common.dataplugin.HDF5Util;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.binlightning.BinLightningRecord;
import com.raytheon.uf.common.dataplugin.binlightning.LightningConstants;
@ -65,12 +66,15 @@ import com.raytheon.uf.viz.core.cache.CacheObject.IObjectRetrieverAndDisposer;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 09, 2014 3333 bclement moved from LightningResource
* Jul 22, 2014 3214 bclement fixed typos in populatePulseData() and updateAndGet()
* Sep 11, 2014 3608 bclement index records by group and dataset name for better error handling
* Sep 25, 2015 4605 bsteffen repeat binning
* Date Ticket# Engineer Description
* ------------- -------- --------- --------------------------------------------
* Jul 09, 2014 3333 bclement moved from LightningResource
* Jul 22, 2014 3214 bclement fixed typos in populatePulseData() and
* updateAndGet()
* Sep 11, 2014 3608 bclement index records by group and dataset name for
* better error handling
* Sep 25, 2015 4605 bsteffen repeat binning
* Nov 05, 2015 5090 bsteffen Use constants for datatime start/end
*
* </pre>
*
@ -149,9 +153,9 @@ public class LightningFrameRetriever implements
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(BinLightningRecord.class);
request.addConstraint(LightningConstants.SOURCE, sourceRC);
request.addConstraint("dataTime.validPeriod.start",
request.addConstraint(PluginDataObject.STARTTIME_ID,
startRC);
request.addConstraint("dataTime.validPeriod.end", endRC);
request.addConstraint(PluginDataObject.ENDTIME_ID, endRC);
try {
DbQueryResponse response = (DbQueryResponse) RequestRouter
.route(request);

View file

@ -9,6 +9,7 @@
47.5281 -97.3250 2219.321 KMVX
64.5114 -165.2950 1806.983 PAEC
18.1157 -66.0782 1769.318 TJUA
35.3930 -97.6280 1769.318 TPSF
27.7839 -97.5108 1615.021 KCRP
45.7150 -122.9650 1510.339 KRTX
37.5908 -83.3131 1452.663 KJKL

View file

@ -74,6 +74,7 @@ import com.raytheon.viz.mpe.ui.dialogs.polygon.PolygonEditManager;
* Apr29, 2014 16308 lbousaidi transmit RFC Bias when an hour
* MPE is saved via the GUI.
* Mar 10, 2015 14554 snaples Added check to remove Best Estimate polygons after saving.
* Oct 19, 2015 18090 lbousaidi Added date format when the token st3_date_form token is set to Ymd.
* </pre>
*
* @author mschenke
@ -106,6 +107,8 @@ public class SaveBestEstimate {
if ((date_form == null) || date_form.isEmpty()
|| date_form.equals("mdY")) {
ST3_FORMAT_STRING = MPEDateFormatter.MMddyyyyHH;
} else if (date_form.equals("Ymd")){
ST3_FORMAT_STRING = MPEDateFormatter.yyyyMMddHH;
}
/*----------------------------------------------------------*/
/* create date in desired format for use in xmrg filename */

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.mpe.MPEDateFormatter;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
import com.raytheon.viz.mpe.ui.DisplayFieldData;
@ -60,9 +61,10 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 28, 2010 4415 mpduff Fixed problem with column
* header creation.
* May 20, 2013 15962 lbousaidi Added a new routine getRadarIdsTrue()
* for Radar Sites dialog.
* for Radar Sites dialog.
* Mar 05, 2014 17114 lbousaidi display PC data in gage table.
* Sep 04, 2014 16699 cgobs Fixed 14.3.1 issue with reading MPE field data.
* Oct 19, 2015 18090 lbousaidi fixed best estimate qpe display.
* </pre>
*
* @author mpduff
@ -1135,12 +1137,29 @@ public class GageTableDataManager {
.getInstance();
MPEDisplayManager displayManager = MPEDisplayManager.getCurrent();
double returnValue = -999.0;
String ST3_FORMAT_STRING = MPEDateFormatter.yyyyMMddHH;
String date_form = appsDefaults.getToken("st3_date_form");// non need just change format of sdf
if ((date_form == null) || date_form.isEmpty()
|| date_form.equals("mdY")) {
ST3_FORMAT_STRING = MPEDateFormatter.MMddyyyyHH;
} else if (date_form.equals("Ymd")){
ST3_FORMAT_STRING = MPEDateFormatter.yyyyMMddHH;
}
try {
String dirname = appsDefaults.getToken(dataType.getDirToken());
String fname = FileUtil.join(dirname,
String fname= null;
if (dataType.getFileNamePrefix().contains("XMRG")) {
String cdate = MPEDateFormatter.format(displayManager.getCurrentEditDate(), ST3_FORMAT_STRING);
fname= FileUtil.join(dirname,
dataType.getFileNamePrefix().toLowerCase() + cdate + "z");
//System.out.println(" in gageTable Datamanager.java fname= "+fname );
}else {
fname = FileUtil.join(dirname,
dataType.getFileNamePrefix() + sdf.format(displayManager.getCurrentEditDate()) + "z");
}
Rectangle extent = dataManager.getHRAPExtent();
short[][] data = gageTableDataManager.getXmrgData(fname, prodType,
@ -1158,7 +1177,7 @@ public class GageTableDataManager {
// Needed to flip the grid
int gridY = extent.height - (y - extent.y) - 1;
short value = data[gridY][gridX];
// Any value < 0 is considered missing
if ((value == -899.0) || (value == -999.0) || (value < 0)) {
returnValue = -999.0;

View file

@ -56,6 +56,32 @@ class AirepPlotDelegate(PlotDelegate):
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing or hazard
# only show non-severe / no severity
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
else:
iceInten = ""
if rec.isValidParameter("iceType"):
iceType = rec.getString("iceType")
else:
iceType = ""
if rec.isValidParameter("flightHazard"):
flightHazard = rec.getInt("flightHazard")
else:
flightHazard = -1
if (iceInten == "") and (iceType == "") and (flightHazard == -1):
# no icing or hazard data
return False
elif (iceInten == "SEV") or (iceInten == "EXTRM") or (flightHazard == 8) or (flightHazard == 9):
# incorrect severity/hazard level (from AIREPWeather)
return False
else:
# low or no severity, and has some icing data
return True
plotDelegate = AirepPlotDelegate()
</script>
@ -83,6 +109,7 @@ plotDelegate = AirepPlotDelegate()
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="iceType,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="airep_icing_intens_trans.txt" plotParam="flightHazard" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
</symbol>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View file

@ -0,0 +1,112 @@
<?xml version="1.0"?>
<svg width="80" height="80"
viewBox="0 0 80 80"
overflow="visible"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255,255,255);">
<defs>
<script type="text/python" plotDelegate="plotDelegate">
import time
class AirepPlotDelegate(PlotDelegate):
def __init__(self):
PlotDelegate.__init__(self)
def getSampleText(self, rec):
sampleString = "ARP "
sampleString += rec.getString("stationId")
sampleString += " "
lat = rec.getFloat("latitude")
if(lat &lt; 0):
sampleString += "%.3fS " % (-1*lat)
else:
sampleString += "%.3fN " % (lat)
lon = rec.getFloat("longitude")
if(lon &lt; 0):
sampleString += "%.3fW " % (-1*lon)
else:
sampleString += "%.3fE " % (lon)
timeObs = rec.getLong("timeObs")
sampleString += time.strftime("%H%M",time.localtime(timeObs/1000))
sampleString += " F%d" % (rec.getInt("flightLevel")/100)
temp = rec.getFloat("temperature")
if temp &lt; -273.15:
pass
elif temp &lt; 0:
sampleString += " M%d" % (int(-1*temp))
else:
sampleString += " P%d" % (int(temp))
windDir = int(rec.getFloat("windDir"))
windSpeed = int(rec.getFloat("windSpeed"))
if windDir > -1080 or windSpeed > 0:
sampleString += " %d/%dKT" % (windDir, windSpeed)
turbFreq = rec.getString("turbFreq")
turbInten = rec.getString("turbInten")
turbType = rec.getString("turbType")
if turbFreq != "" or turbInten != "" or turbType != "":
sampleString += " TB"
if turbFreq != "":
sampleString += " "
sampleString += turbFreq
if turbInten != "":
sampleString += " "
sampleString += turbInten
if turbType != "":
sampleString += " "
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need icing severity or ice hazard
# only show severe
if rec.isValidParameter("iceInten"):
iceInten = rec.getString("iceInten")
else:
iceInten = ""
if rec.isValidParameter("flightHazard"):
flightHazard = rec.getInt("flightHazard")
else:
flightHazard = -1
if (iceInten == "SEV") or (iceInten == "EXTRM") or (flightHazard == 8) or (flightHazard == 9):
# high severity/hazard level (from AIREPWeather)
return True
else:
# low or no severity, and has some icing data
return False
plotDelegate = AirepPlotDelegate()
</script>
<style type="text/css">
<![CDATA[
@font-face { font-family: "WindSymbolFont";
src: url(WindSymbols.svg#WindSymbols); }
@font-face { font-family: "StandardFont";
src: url(Standard.svg#Standard); }
@font-face { font-family: "WxSymbolFont";
src: url(WxSymbols.svg#WxSymbols); }
@font-face { font-family: "SpecialSymbolFont";
src: url(SpecialSymbols.svg#SpecialSymbols); }
text.text
{
fill: none;
font-size: 1em;
stroke-width: 1px;
font-family: StandardFont;
font-size: 1em;
}
]]>
</style>
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="iceType,iceInten" x="0" y="0" visibility="hidden">0</text>
<text id="iceInensity" plotMode="table" class="weather" plotLookupTable="airep_icing_intens_trans.txt" plotParam="flightHazard" x="0" y="0">0</text>
<text id="fltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>
</symbol>
</defs>
<use id="wind" x="40" y="40" width="80" height="80" visibility="visible" xlink:href="#plotData"/>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View file

@ -56,6 +56,32 @@ class AirepPlotDelegate(PlotDelegate):
sampleString += turbType
return sampleString
def isValid(self, rec):
# DCS10257
# need some turbulence data
# only show non-severe / no severity
if rec.isValidParameter("turbInten"):
turbInten = rec.getString("turbInten")
else:
turbInten = ""
if rec.isValidParameter("turbFreq"):
turbFreq = rec.getString("turbFreq")
else:
turbFreq = ""
if rec.isValidParameter("turbType"):
turbType = rec.getString("turbType")
else:
turbType = ""
if (turbInten == "") and (turbFreq == "") and (turbType == ""):
# no turbulence data present
return False
elif (turbInten == "SEV") or (turbInten == "EXTRM"):
# turbulence data present, but not correct severity
return False
else:
# turbulence data present, and if severity is present it is not high
return True
plotDelegate = AirepPlotDelegate()
</script>
@ -91,6 +117,7 @@ plotDelegate = AirepPlotDelegate()
<symbol overflow="visible" id="plotData" class="info">
<text id="sampleParams1" plotMode="sample" plotParam="stationId,longitude,latitude,timeObs,flightLevel"> </text>
<text id="sampleParams2" plotMode="sample" plotParam="temperature,windDir,windSpeed,turbInten,turbFreq,turbType"> </text>
<text id="validityParams" plotMode="null" class="text" plotParam="turbType" x="0" y="0" visibility="hidden">0</text>
<text id="airepturbIntensity" plotMode="table" class="weather" plotLookupTable="turb_intens_trans.txt" plotParam="turbInten" x="0" y="0">0</text>
<text id="airepturbFreq" plotMode="table" class="weather" plotLookupTable="turb_freq_trans.txt" plotParam="turbFreq" style="text-anchor: end" x="0" y="-10">0</text>
<text id="airepfltLvlText" plotMode="text" plotParam="flightLevel" plotFormat="%3.0f" plotUnit="hft" style="text-anchor: end;" x="-15px" y="0px">75</text>

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Some files were not shown because too many files have changed in this diff Show more