diff --git a/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF index 0d11b931ce..368d2be29f 100644 --- a/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.acarssounding/META-INF/MANIFEST.MF @@ -15,11 +15,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - com.raytheon.uf.common.dataquery;bundle-version="1.0.0", - com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.common.derivparam;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.sounding;bundle-version="1.12.1174", com.raytheon.uf.viz.core;bundle-version="1.12.1174", com.raytheon.uf.viz.derivparam;bundle-version="1.12.1174", com.raytheon.viz.pointdata;bundle-version="1.12.1174", diff --git a/cave/com.raytheon.uf.viz.acarssounding/plugin.xml b/cave/com.raytheon.uf.viz.acarssounding/plugin.xml deleted file mode 100644 index 7b63413bba..0000000000 --- a/cave/com.raytheon.uf.viz.acarssounding/plugin.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - diff --git a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSoundingAdapter.java b/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSoundingAdapter.java deleted file mode 100644 index ec6297746e..0000000000 --- a/cave/com.raytheon.uf.viz.acarssounding/src/com/raytheon/uf/viz/acarssounding/AcarsSoundingAdapter.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.acarssounding; - -import java.util.ArrayList; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingLayer; -import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.common.wxmath.ZToPsa; - -/** - * - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 01, 2008  1747      jkorman     Initial creation
- * Aug 14, 2013  2262      dgilling    Use new wxmath method for ztopsa.
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class AcarsSoundingAdapter extends AbstractVerticalSoundingAdapter { - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - ACARSSoundingRecord obs = (ACARSSoundingRecord) obj; - VerticalSounding sounding = createVerticalSounding(obs); - if (sounding != null) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(ACARSSoundingRecord record) { - VerticalSounding sounding = null; - - if (record != null) { - sounding = new VerticalSounding(); - SurfaceObsLocation location = record.getLocation(); - sounding.setSpatialInfo(location); - - sounding.setElevation(location.getElevation()); - sounding.setStationId(location.getStationId()); - sounding.setObsTime(record.getDataTime().getRefTimeAsCalendar()); - sounding.setDataTime(record.getDataTime()); - - sounding.setName(String.format("ACARS %.1f%c %.1f%c %s", Math - .abs(location.getLatitude()), - (location.getLatitude() >= 0 ? 'N' : 'S'), Math - .abs(location.getLongitude()), (location - .getLongitude() >= 0 ? 'E' : 'W'), record - .getLocation().getStationId())); - for (ACARSSoundingLayer layer : record.getLevels()) { - SoundingLayer sndLayer = new SoundingLayer(); - if (layer.getDwpt() != null) { - sndLayer.setDewpoint(layer.getDwpt().floatValue()); - } - if (layer.getTemp() != null) { - sndLayer.setTemperature(layer.getTemp().floatValue()); - } - if (layer.getWindDirection() != null) { - - sndLayer.setWindDirection(layer.getWindDirection() - .floatValue()); - } - if (layer.getWindSpeed() != null) { - sndLayer.setWindSpeed(layer.getWindSpeed().floatValue()); - } - if (layer.getPressure() != null) { - sndLayer.setPressure(layer.getPressure().floatValue() / 100); - } else if (layer.getFlightLevel() != null) { - sndLayer.setPressure(ZToPsa.ztopsa(layer.getFlightLevel())); - } - if (layer.getFlightLevel() != null) { - sndLayer.setGeoHeight(layer.getFlightLevel().floatValue()); - } - sounding.addLayer(sndLayer); - } - - } - return sounding; - } - -} \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF index d5cb068b33..3026cf6823 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/MANIFEST.MF @@ -9,21 +9,15 @@ Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: org.eclipse.core.runtime, com.raytheon.uf.common.serialization;bundle-version="1.12.1174", gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", - org.eclipse.core.commands;bundle-version="3.6.0", com.raytheon.uf.viz.core;bundle-version="1.12.1174", com.raytheon.viz.ui;bundle-version="1.12.1174", - org.eclipse.swt;bundle-version="3.6.1", org.eclipse.ui;bundle-version="3.6.1", - org.geotools;bundle-version="2.6.4", gov.noaa.nws.ncep.viz.common;bundle-version="1.0.0", gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.time;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1174", com.raytheon.uf.common.topo;bundle-version="1.12.1174", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.ui;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174", com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", com.raytheon.viz.pointdata;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0", diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index a7d91e0739..f3c7e1ac2d 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -2,6 +2,4 @@ com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData com.raytheon.uf.viz.d2d.nsharp.rsc.GribNSharpResourceData com.raytheon.uf.viz.d2d.nsharp.rsc.MdlSndNSharpResourceData com.raytheon.uf.viz.d2d.nsharp.rsc.PoesSndNSharpResourceData -com.raytheon.uf.viz.d2d.nsharp.rsc.GoesSndNSharpResourceData -com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDescriptor -com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDisplay \ No newline at end of file +com.raytheon.uf.viz.d2d.nsharp.rsc.GoesSndNSharpResourceData \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDescriptor.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDescriptor.java deleted file mode 100644 index a8ec1e5405..0000000000 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDescriptor.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.d2d.nsharp.display; - -import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor; - -/** - * This class only exists for backwards compatibility with serialized displayed, - * once all serialized procedures/bundles have been modified then this can be - * deleted. - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 31, 2012            bsteffen     Initial creation
- *
- * 
- * - * @author bsteffen - * @version 1.0 - */ - -public class D2DNSharpDescriptor extends NsharpSkewTPaneDescriptor { - -} diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDisplay.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDisplay.java deleted file mode 100644 index fa32696825..0000000000 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/display/D2DNSharpDisplay.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.d2d.nsharp.display; - -import javax.xml.bind.annotation.XmlRootElement; - -import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay; - -/** - * This class only exists for backwards compatibility with serialized displayed, - * once all serialized procedures/bundles have been modified then this can be - * deleted. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 31, 2012            bsteffen     Initial creation
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -@XmlRootElement -public class D2DNSharpDisplay extends NsharpSkewTPaneDisplay { - -} diff --git a/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml b/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml index 1616f31998..4ece90827e 100644 --- a/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.d2d.skewt.feature/feature.xml @@ -36,12 +36,6 @@ install-size="0" version="0.0.0"/> - - * @@ -198,7 +199,7 @@ public class CrimssDataDefinition @Override protected Class getDescriptorClass() { if (resourceData instanceof CrimssNSharpResourceData) { - return D2DNSharpDescriptor.class; + return NsharpSkewTPaneDescriptor.class; } else { return super.getDescriptorClass(); } @@ -214,7 +215,7 @@ public class CrimssDataDefinition @Override protected IDisplayPaneContainer openNewEditor(String editorId) { if (NsharpEditor.EDITOR_ID.equals(editorId)) { - return UiUtil.createEditor(editorId, new D2DNSharpDisplay()); + return UiUtil.createEditor(editorId, new NsharpSkewTPaneDisplay()); } else { return super.openNewEditor(editorId); } diff --git a/cave/com.raytheon.uf.viz.sounding/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.sounding/META-INF/MANIFEST.MF index a260f5c23c..4d8b6270bb 100644 --- a/cave/com.raytheon.uf.viz.sounding/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.sounding/META-INF/MANIFEST.MF @@ -7,27 +7,16 @@ Bundle-Activator: com.raytheon.uf.viz.sounding.Activator Bundle-Vendor: RAYTHEON Require-Bundle: org.eclipse.core.runtime, com.raytheon.uf.common.sounding;bundle-version="1.12.1174";visibility:=reexport, - com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", com.raytheon.uf.common.pointdata;bundle-version="1.12.1174", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", com.raytheon.uf.common.datastorage;bundle-version="1.12.1174", - com.raytheon.uf.common.dataquery;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.goessounding;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.poessounding;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.profiler;bundle-version="1.12.1174", - com.raytheon.uf.common.topo;bundle-version="1.12.1174", - com.raytheon.viz.pointdata;bundle-version="1.12.1174", com.raytheon.uf.viz.core;bundle-version="1.12.1174", - com.raytheon.edex.meteolib;bundle-version="1.12.1174", - com.raytheon.edex.plugin.modelsounding;bundle-version="1.12.1174", - javax.measure;bundle-version="1.0.0" + com.raytheon.viz.core;bundle-version="1.12.1174" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Eclipse-BuddyPolicy: registered Export-Package: com.raytheon.uf.viz.sounding, - com.raytheon.uf.viz.sounding.adapters, com.raytheon.uf.viz.sounding.providers -Import-Package: com.raytheon.viz.core.map diff --git a/cave/com.raytheon.uf.viz.sounding/plugin.xml b/cave/com.raytheon.uf.viz.sounding/plugin.xml index 6f92291355..7a35320265 100644 --- a/cave/com.raytheon.uf.viz.sounding/plugin.xml +++ b/cave/com.raytheon.uf.viz.sounding/plugin.xml @@ -20,43 +20,8 @@ --> - - - - - - - - - - - - - - - - - + - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [Enter the first release in which this extension point appears.] - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/SoundingParams.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/SoundingParams.java deleted file mode 100644 index c7431d21f8..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/SoundingParams.java +++ /dev/null @@ -1,2689 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding; - -import static com.raytheon.uf.common.sounding.SoundingLayer.MISSING; - -import java.util.Arrays; -import java.util.Calendar; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.SI; - -import com.raytheon.edex.meteoLib.Controller; -import com.raytheon.edex.meteoLib.PHT; -import com.raytheon.edex.meteoLib.Tsoar; -import com.raytheon.edex.meteoLib.Velocity; -import com.raytheon.edex.meteoLib.WindComp; -import com.raytheon.uf.common.sounding.ParcelLift.PARCEL_TYPE; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.common.time.DataTime; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * contains all the function calls to existing FORTRAN routines for computing - * the convective parameters table; used by the skew-t depictable and the - * interactive skew-t extension. - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Oct 5, 2009            randerso     Initial creation
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -public class SoundingParams { - private VerticalSounding interleavedData; - - private VerticalSounding analysisData; - - private float[] _pressure; - - private float[] _height; - - private float[] _temp; - - private float[] _dewPoint; - - private double[] _wetbulbs; - - private float[] _uComp; - - private float[] _vComp; - - private int _hour; - - private float[] _virtTemp; - - private float[] _parcelP; - - private float[] _parcelZ; - - private float[] _parcelT; - - private float[] _parcelVirtT; - - private float[] _envVirtTemp; - - private float[] _environTemp; - - private int _numParLvls; - - private int _gustPotential; - - private float _precipWater; - - private float _LIdx; - - private float _KIndex; - - private float _Totals; - - private float _sweatIdx; - - private float _convTemp; - - private float _maxTemp; - - private float _frzgLvlZ; - - private float _frzgLvlP; - - private float _pressWBZ; - - private float _tempWBZ; - - private float _hgtWBZ; - - private float _soarIndex; - - private float _triggerTemp_C; - - private float _pLFC1; - - private float _zLFC1; - - private float _tLFC1; - - private float _pLFC2; - - private float _zLFC2; - - private float _tLFC2; - - private float _pEqLvl; - - private float _zEqLvl; - - private float _tEqLvl; - - private float _maxVVel; - - private float _hailSize; - - private float _hgtCldTop; - - private float _posBuoy; - - private float _negBuoy; - - private float _CINfrmCAPE; - - private float _richNum; - - private float _mdpi; - - private float _windex; - - private WindComp avgWind; - - private WindComp helicity; - - private float _meanMixRatio; - - private float _initParT_C; - - private float _initParTd_C; - - private float _initParP; - - private float _pressLCL; - - private float _hgtLCL; - - private float _tempLCL; - - private float _mixLCL; - - private float _thetaLCL; - - private float _theta_eLCL; - - private float _temp500; - - private float _pressCCL; - - private float _tempCCL; - - private float _hgtCCL; - - private PARCEL_TYPE _liftingMethod = PARCEL_TYPE.SURFACE; - - private boolean _restoreSkewT; - - private boolean _isInitialDisplay = true; - - private boolean _useFcstMax = true; - - private float _userLevel = 0f; - - private boolean _is12ZTime = false; - - private float _ghx = 0; - - private float _ghy = 0; - - private static final UnitConverter kelvinToCelsius = SI.KELVIN - .getConverterTo(SI.CELSIUS); - - private static final UnitConverter celciusToKelvin = SI.CELSIUS - .getConverterTo(SI.KELVIN); - - private float _hgtHelLyr = 3000.0f; // hgt of the layer for determining - - // helicity - - /** - * Constructor for the sounding parameters. Used for RaobOA - */ - public SoundingParams(VerticalSounding vs, float[] levels) { - interleavedData = vs; - fillOutHeights(interleavedData, false); - - analysisData = down_interp(interleavedData, levels); - } - - /** - * Constructor for the sounding parameters. Used for SkewT - */ - public SoundingParams(VerticalSounding vs) { - interleavedData = vs; - - // interpolate the current raob data - int hgtDiff = 50; - fillOutHeights(interleavedData, false); - interleavedData.invalidate(); - analysisData = rebuildDataInHgt(vs, hgtDiff); - - _temp500 = transDataStyle(); - - _hour = vs.getDataTime().getValidTime().get(Calendar.HOUR_OF_DAY); - - // _temp500 = interleavedData.getLayerNearest(500).getTemperature(); - - clearIndices(); - - // calculate the preliminary parcel info - if (_temp.length > 3) { - _maxTemp = computeFcstMaxTemp(); - - // calculate the convective temperature; essential for - // determining other parameters - computeConvTemp(); - - // determine the parcel temp/pressures needed for buoyancy - // calculations - computeParcelInfo(); - } - } - - /** - * @return the _pressure - */ - public float[] getPressures() { - return _pressure; - } - - /** - * @return the _height - */ - public float[] getHeights() { - return _height; - } - - /** - * @return the _temp - */ - public float[] getTemperatures() { - return _temp; - } - - /** - * @return the _wetbulbs in Celcius - */ - public double[] getWetbulbs() { - return _wetbulbs; - } - - /** - * @return the _dewPoint - */ - public float[] getDewPoints() { - return _dewPoint; - } - - /** - * @return the _uComp - */ - public float[] getWindUs() { - return _uComp; - } - - /** - * @return the _vComp - */ - public float[] getWindVs() { - return _vComp; - } - - private void clearIndices() { - _gustPotential = (int) MISSING; - _precipWater = MISSING; - _LIdx = MISSING; - _KIndex = MISSING; - _Totals = MISSING; - _sweatIdx = MISSING; - _convTemp = MISSING; - _maxTemp = MISSING; - _frzgLvlZ = MISSING; - _frzgLvlP = MISSING; - _pressWBZ = MISSING; - _tempWBZ = MISSING; - _hgtWBZ = MISSING; - _soarIndex = MISSING; - _triggerTemp_C = MISSING; - _pLFC1 = MISSING; - _zLFC1 = MISSING; - _tLFC1 = MISSING; - _pLFC2 = MISSING; - _zLFC2 = MISSING; - _tLFC2 = MISSING; - _pEqLvl = MISSING; - _zEqLvl = MISSING; - _tEqLvl = MISSING; - _maxVVel = MISSING; - _hailSize = MISSING; - _hgtCldTop = MISSING; - _posBuoy = MISSING; - _negBuoy = MISSING; - _CINfrmCAPE = MISSING; - _richNum = MISSING; - _mdpi = MISSING; - _windex = MISSING; - _meanMixRatio = MISSING; - _initParT_C = MISSING; - _initParTd_C = MISSING; - _initParP = MISSING; - _pressLCL = MISSING; - _hgtLCL = MISSING; - _tempLCL = MISSING; - _mixLCL = MISSING; - _thetaLCL = MISSING; - _theta_eLCL = MISSING; - _pressCCL = MISSING; - _tempCCL = MISSING; - _hgtCCL = MISSING; - } - - private float computeFcstMaxTemp() { - float elev = analysisData.get(0).getGeoHeight(); - float maxTemp; - - // do nothing if no data or not a sounding between 06Z & 17Z - if (elev >= MISSING || _hour < 6 || _hour >= 18 || _temp[0] >= MISSING) { - // maxTemp = 999.0f; - maxTemp = MISSING; - return maxTemp; - } - - maxTemp = computeFcstMaxTemp(_pressure, _height, _temp, _dewPoint, - interleavedData.getStationId(), interleavedData.getDataTime(), - (float) interleavedData.getLatitude(), - (float) interleavedData.getLongitude()); - return maxTemp; - } - - private void computeConvTemp() { - int n = _temp.length; - - float levelDewPt; - float e = 0.0f; - // morning soundings are between 6Z and 18Z - if (_hour >= 6 && _hour < 18) { - // calculate the mean mixing ratio in lowest 50 mb of sounding. - // Used for later parcel and parameter calculations. - int j = 0; - while (j < n && _temp[j] >= MISSING) { - j++; - } - int i = j; - _meanMixRatio = 0.0f; - while (++i < n && _pressure[0] - _pressure[i] <= 50) { - levelDewPt = _dewPoint[i]; - e = Controller.esat(levelDewPt); - _meanMixRatio += (0.622 * e) / (_pressure[i] - e); - } - levelDewPt = _dewPoint[i]; - e = Controller.esat(levelDewPt); - _meanMixRatio += (0.622 * e) / (_pressure[i] - e); - _meanMixRatio /= (i - j); - } else // at other times compute the mixing ratio at the surface - // dewpoint - { - levelDewPt = _dewPoint[0]; - e = Controller.esat(levelDewPt); - _meanMixRatio = (0.622f * e) / (_pressure[0] - e); - } - - computeConvTemp(_pressure, _height, _temp, _meanMixRatio); - } - - private void computeParcelInfo() { - int n = _temp.length; - // lack of data, so no need to continue - if (n < 3) { - return; - } - // if 06Z - 17Z sounding, use the calculated max temp as a sfctemp - if (_hour >= 6 && _hour < 18) { - _is12ZTime = true; - } - - if (_liftingMethod != PARCEL_TYPE.USERSELECT) { - _initParP = MISSING; - _initParT_C = MISSING; - _initParTd_C = MISSING; - _numParLvls = 0; - } - - if (_restoreSkewT) { - _liftingMethod = PARCEL_TYPE.SURFACE; - } - - switch (_liftingMethod) { - - case PMAX: // pmax method of lifting - computePmaxLifting(_initParP, _initParT_C, _initParTd_C); - break; - - case MEANTEMP: // mean thermal lifting - computeMeanTLifting(_initParP, _initParT_C, _initParTd_C); - break; - - case USERSELECT: // user-selected level - _initParP = _userLevel; - computeUserLifting(_initParP, _initParT_C, _initParTd_C); - break; - - case SURFACE: // lift from the surface - default: - computeSurfaceLifting(_initParP, _initParT_C, _initParTd_C); - break; - } - - // compute buoyancy and hailsize - hailSize(); - // compute the Wetbulb profile - computeWBS(_pressure, _temp, _dewPoint); - } - - /** - * Based upon the surface values, compute the associated LCL and parcel - * track trajectory. - * - * @param parTd_C - * @param parT_C - * @param parP - * - */ - private void computeSurfaceLifting(float parP, float parT_C, float parTd_C) { - float parcelTd_C = 0.0f; - float newParcelT = 0f; - float newParcelP = 0f; - float testNewParcelT = 0f; - - // find first occurrance in the array of valid temps and assign - // accordingly - for (int i = 0; i < _temp.length; i++) { - if (_temp[i] > SoundingLayer.NODATA) { - continue; - } - newParcelP = _pressure[i]; - newParcelT = (float) kelvinToCelsius.convert(_temp[i]); - parcelTd_C = (float) kelvinToCelsius.convert(_dewPoint[i]); - testNewParcelT = _temp[i]; - if (testNewParcelT > _maxTemp) { - _maxTemp = computeFcstMaxTemp(); - } - break; - } - - if (!_is12ZTime) { - _useFcstMax = false; - _maxTemp = SoundingLayer.NODATA; - } - if (_isInitialDisplay) { - if (_is12ZTime) { - _maxTemp = computeFcstMaxTemp(); - newParcelT = (float) kelvinToCelsius.convert(_maxTemp); - } - _isInitialDisplay = false; - } - - if (!_restoreSkewT) { - // use the forecast max temp for parcel temp - if (_useFcstMax) { - newParcelT = (float) kelvinToCelsius.convert(_maxTemp); - } - - } - _initParT_C = newParcelT; - _initParP = newParcelP; - _initParTd_C = parcelTd_C; - float sfcTemp = MISSING; - - if (_initParT_C != MISSING) { - sfcTemp = (float) celciusToKelvin.convert(_initParT_C); - } - // compute the LCL - computeLCL(_pressure, _height, _temp, _dewPoint, sfcTemp, _meanMixRatio); - _meanMixRatio = _mixLCL; - - // compute the Wetbulb profile - computeWBS(_pressure, _temp, _dewPoint); - - // compute parcel characteristics at each sounding level; - computeParcelLvls(_pressure, _height, _temp, _dewPoint, newParcelP, - newParcelT, _pressLCL, _hgtLCL, _tempLCL, _thetaLCL, - _theta_eLCL, _mixLCL); - - } - - /** - * - */ - private void computeUserLifting(float newParcelP, float parcelT, - float parcelTd) { - float parcelT_K = 0f; - float parcelTd_K = 0f; - float ParcelP = newParcelP; - float[] parcelVals = { ParcelP, parcelT_K, parcelTd_K }; - selectLevel(parcelVals); - ParcelP = parcelVals[0]; - parcelT_K = parcelVals[1]; - parcelTd_K = parcelVals[2]; - parcelT = (float) kelvinToCelsius.convert(parcelT_K); - parcelTd = (float) kelvinToCelsius.convert(parcelTd_K); - float newParcelT = parcelT; - - // compute the LCL - computeLCL(_pressure, _height, _temp, _dewPoint, parcelT_K, - _meanMixRatio); - _meanMixRatio = _mixLCL; - - _initParP = ParcelP; - _initParT_C = parcelT; - _initParTd_C = parcelTd; - - // compute the Wetbulb profile - computeWBS(_pressure, _temp, _dewPoint); - - if (_hgtLCL < MISSING) { - // compute parcel characteristics at each sounding level; - computeParcelLvls(_pressure, _height, _temp, _dewPoint, newParcelP, - newParcelT, _pressLCL, _hgtLCL, _tempLCL, _thetaLCL, - _theta_eLCL, _meanMixRatio); - } - - } - - /** - * @param parcelVals - */ - private void selectLevel(float[] parcelVals) { - float parcelT = MISSING; - float parcelTd = MISSING; - - float newParcelP = parcelVals[0]; - int index = 0; - // An invalid pressure level below the observed surface value - if (newParcelP > _pressure[0]) { - return; - } - // loop thru each level, finding the closest pressure and calculate - // it's index pointer to that level - while ((newParcelP <= _pressure[index]) && index < _pressure.length) { - index++; - } - - if (_pressure[index - 1] == newParcelP) { - parcelT = _temp[index - 1]; - parcelTd = _dewPoint[index - 1]; - } else // interpolate new parcel values - { - float logNewP = (float) Math.log(newParcelP); - float logP1 = (float) Math.log(_pressure[index - 1]); - float logP2 = (float) Math.log(_pressure[index]); - parcelT = _temp[index] - + ((_temp[index - 1] - _temp[index]) * ((logNewP - logP2) / (logP1 - logP2))); - parcelTd = _dewPoint[index] - + ((_dewPoint[index - 1] - _dewPoint[index]) * ((parcelT - _temp[index]) / (_temp[index - 1] - _temp[index]))); - } - parcelVals[1] = parcelT; - parcelVals[2] = parcelTd; - } - - /** - * - */ - private void computeMeanTLifting(float parcelP, float parcelT, - float parcelTd) { - float parcelT_K = 0f; - float parcelTd_K = 0f; - float ParcelP = parcelP; - float[] parcelVals = { ParcelP, parcelT_K, parcelTd_K }; - meanThermalParams(parcelVals); - ParcelP = parcelVals[0]; - parcelT_K = parcelVals[1]; - parcelTd_K = parcelVals[2]; - parcelT = (float) kelvinToCelsius.convert(parcelT_K); - parcelTd = (float) kelvinToCelsius.convert(parcelTd_K); - float newParcelT = parcelT; - float newParcelP = parcelP; - float[] newP = new float[_pressure.length]; - float[] newT = new float[_pressure.length]; - float[] newTd = new float[_pressure.length]; - float[] newZ = new float[_pressure.length]; - int i = 0; - int j = 0; - for (i = 0; i < _pressure.length; i++) { - if (_pressure[i] > parcelP) { - continue; - } - newP[j] = _pressure[i]; - newZ[j] = _height[i]; - newT[j] = _temp[i]; - newTd[j] = _dewPoint[i]; - j++; - } - int newn = j; - j = 0; - float levelDewPt; - float e = 0.0f; - while (j < newn && newT[j] > 99998.0) { - j++; - } - i = j; - float meanMixRatio = 0.0f; - while (++i < newn && newP[0] - newP[i] <= 100) { - levelDewPt = newTd[i]; - e = Controller.esat(levelDewPt); - meanMixRatio += (0.622 * e) / (newP[i] - e); - } - levelDewPt = newTd[i]; - e = Controller.esat(levelDewPt); - meanMixRatio /= (i - j); - _meanMixRatio = meanMixRatio; - - // compute the LCL - computeLCL(_pressure, _height, _temp, _dewPoint, parcelT_K, - _meanMixRatio); - _mixLCL = _meanMixRatio; - - _initParP = ParcelP; - _initParT_C = parcelT; - _initParTd_C = parcelTd; - - // compute the Wetbulb profile - computeWBS(_pressure, _temp, _dewPoint); - - if (_hgtLCL < MISSING) { - // compute parcel characteristics at each sounding level; - computeParcelLvls(newP, newZ, newT, newTd, newParcelP, newParcelT, - _pressLCL, _hgtLCL, _tempLCL, _thetaLCL, _theta_eLCL, - _mixLCL); - } - - } - - /** - * @param parcelVals - */ - private void meanThermalParams(float[] vals) { - // initialize variables - float sumTheta = 0.0f; // sum of potential temps - float meanTP = 0.0f; // mean potential temp - int index = 0; // count of levels in lowest 100 mb - boolean foundSurfaceP = false; - float sfcPressure = MISSING; - float parcelP = MISSING; - float parcelT = MISSING; - float parcelTd = MISSING; - - // loop thru each level, summing up the potential temperatures - // until we are 100 mb above the surface - while ((_pressure[0] - _pressure[index + 1] <= 100) - && index < _pressure.length) { - if (!foundSurfaceP && _temp[index] > -99999.0) { - sfcPressure = _pressure[index]; - foundSurfaceP = true; - } - // don't want to sum up missing values, so skip if missing - if (_temp[index] <= -99998.0) { - continue; - } - - sumTheta += _temp[index] - * Math.pow((1000.0 / _pressure[index]), 0.286); - index++; - } - - // compute the mean potential temp in the layer (sfc+100mb) - float pTop = (float) (sfcPressure - 100.0); - meanTP = (float) ((sumTheta + (_temp[index] * Math.pow((1000.0 / pTop), - 0.286))) / (index + 1)); - - float thetaFirst, thetaSecond; - - // iterate thru the layer and determine mean parcel characteristics - // by comparing mean pot temp with adjacent sounding levels - for (int i = 0; i < index; i++) { - thetaFirst = (float) (_temp[i] * Math.pow((1000.0 / _pressure[i]), - 0.286)); - thetaSecond = (float) (_temp[i + 1] * Math.pow( - (1000.0 / _pressure[i + 1]), 0.286)); - // determine if level representative of the mean pot temp... - if ((thetaFirst <= meanTP && meanTP < thetaSecond) - || (thetaSecond <= meanTP && meanTP < thetaFirst)) { - // ...it is, so interpolate to find P, T, & Td - parcelT = _temp[i + 1] - + ((_temp[i] - _temp[i + 1]) * ((meanTP - thetaSecond) / (thetaFirst - thetaSecond))); - parcelTd = _dewPoint[i + 1] - + ((_dewPoint[i] - _dewPoint[i + 1]) * ((meanTP - thetaSecond) / (thetaFirst - thetaSecond))); - float logP1 = (float) Math.log(_pressure[i]); - float logP2 = (float) Math.log(_pressure[i + 1]); - parcelP = (float) Math - .exp(logP2 - + ((logP1 - logP2) * ((meanTP - thetaSecond) / (thetaFirst - thetaSecond)))); - break; - } - } - vals[0] = parcelP; - vals[1] = parcelT; - vals[2] = parcelTd; - } - - /** - * Based upon the pmax values, compute the associated LCL and parcel track. - * - * @param parTd_C - * @param parT_C - * @param parP - * - */ - private void computePmaxLifting(float parcelP, float parcelT, float parcelTd) { - float parcelT_K = 0f; - float parcelTd_K = 0f; - float ParcelP = parcelP; - float[] parcelVals = { ParcelP, parcelT_K, parcelTd_K }; - pmax(parcelVals); - ParcelP = parcelVals[0]; - parcelT_K = parcelVals[1]; - parcelTd_K = parcelVals[2]; - parcelT = (float) kelvinToCelsius.convert(parcelT_K); - parcelTd = (float) kelvinToCelsius.convert(parcelTd_K); - float newParcelT = parcelT; - float newParcelP = parcelP; - - // compute the LCL - computeLCL(_pressure, _height, _temp, _dewPoint, parcelT_K, - _meanMixRatio); - _meanMixRatio = _mixLCL; - - _initParP = ParcelP; - _initParT_C = parcelT; - _initParTd_C = parcelTd; - - // compute the Wetbulb profile - computeWBS(_pressure, _temp, _dewPoint); - - if (_hgtLCL < MISSING) { - // compute parcel characteristics at each sounding level; - computeParcelLvls(_pressure, _height, _temp, _dewPoint, newParcelP, - newParcelT, _pressLCL, _hgtLCL, _tempLCL, _thetaLCL, - _theta_eLCL, _mixLCL); - } - - } - - /** - * @param parcelP - * @param parcelT_K - * @param parcelTd_K - */ - private void pmax(float[] vals) { - Float theta_e = 0f; - Float twTest = 0f; - Float parcelTw = 0f; - Float temp = 0f; - Float dewPoint = 0f; - Float pressure = 0f; - int i = 0; - float parcelTd = -MISSING; - float parcelP = -MISSING; - float parcelT = -MISSING; - parcelTw = -MISSING; - - // loop thru each level, testing it's wet bulb potential temp against - // the max value. - while (((_pressure[0] - _pressure[++i]) <= 50) && (i < _temp.length)) { - temp = _temp[i]; - dewPoint = _dewPoint[i]; - pressure = _pressure[i]; - theta_e = Controller.ept(temp, dewPoint, pressure); - twTest = Controller.tsa(theta_e, pressure); - if (twTest > parcelTw) { - parcelTw = twTest; - parcelP = _pressure[i]; - parcelT = _temp[i]; - parcelTd = _dewPoint[i]; - } - } - vals[0] = parcelP; - vals[1] = parcelT; - vals[2] = parcelTd; - } - - public VerticalSounding getAnalysisData() { - return analysisData; - } - - public void recomputeSoundingParams(VerticalSounding vs) { - interleavedData = vs; - - // interpolate the current raob data - int hgtDiff = 50; - fillOutHeights(interleavedData, false); - interleavedData.invalidate(); - analysisData = rebuildDataInHgt(vs, hgtDiff); - - _temp500 = transDataStyle(); - - _hour = vs.getDataTime().getValidTime().get(Calendar.HOUR_OF_DAY); - - // _temp500 = interleavedData.getLayerNearest(500).getTemperature(); - - clearIndices(); - - // calculate the preliminary parcel info - if (_temp.length > 3) { - _maxTemp = computeFcstMaxTemp(); - - // calculate the convective temperature; essential for - // determining other parameters - computeConvTemp(); - - // determine the parcel temp/pressures needed for buoyancy - // calculations - computeParcelInfo(); - } - } - - public void recomputeParcelInfo() { - this.computeParcelInfo(); - } - - public VerticalSounding getInterleavedData() { - return interleavedData; - } - - public WindComp avgWind() { - if (avgWind == null) { - int n = _uComp.length; - if (n <= 3) { - return avgWind; - } - float elev = analysisData.get(0).getGeoHeight(); - - if (elev >= MISSING - || analysisData.get(n - 1).getGeoHeight() < (elev + 6000.0f)) { - return avgWind; - } - if (_height.length > 0 && _pressure.length > 0 && _temp.length > 0 - && _uComp.length > 0 && _vComp.length > 0) { - compute0_6kmAvgWind(_height, _pressure, _temp, _uComp, _vComp, - elev); - } - } - return avgWind; - } - - /** - * @return the _hgtHelLyr - */ - public float get_hgtHelLyr() { - return _hgtHelLyr; - } - - public WindComp helicity() { - if (helicity == null) { - int n = _uComp.length; - float elev = _height[0]; - WindComp avgWind = avgWind(); - // _SRelHelicity = 99999.0; - // _helicity = 99999.0; - - // don't calculate anything if no data or only data below 6 km AGL - if (elev >= MISSING || avgWind == null - || avgWind.getWindDirection() >= MISSING - || (analysisData.get(n - 1).getGeoHeight() < elev + 6000.0)) { - return helicity; - } - - computeSHelicity(_pressure, _height, _uComp, _vComp, elev, - avgWind.getWindDirection(), avgWind.getWindSpeed()); - } - - return helicity; - } - - public int gustPotential() { - if (_gustPotential == (int) MISSING) { - computeGustPot(_pressure, _temp, _dewPoint); - } - return _gustPotential; - } - - public float precipWater() { - if (_precipWater == MISSING) { - computePrecipWater(_pressure, _dewPoint); - } - return _precipWater; - } - - public float liftedI() { - if (_LIdx == MISSING) { - int n = _temp.length; - if (_temp500 >= MISSING - || analysisData.get(0).getPressure() - - analysisData.get(n - 1).getPressure() < 100) { - return _LIdx; - } - - float T0, meanTd, p0; - - if (_hour >= 6 && _hour < 18) { - // calculate the mean Td of the lowest 50 mb & use the fcst max - // temp - int j = 0; - while (j < n && _temp[j] >= MISSING) { - j++; - } - p0 = _pressure[j]; - T0 = _maxTemp; - meanTd = _dewPoint[j] / 2; - int i = j; - while (i < n && (_pressure[0] - _pressure[++i] <= 50)) { - meanTd += _dewPoint[i]; - } - meanTd += _dewPoint[i] / 2; - meanTd /= (i - j); - } else // use the sfc temp and sfc Td - { - int j = 0; - while (j < n && _temp[j] >= MISSING) { - j++; - } - T0 = _temp[j]; - meanTd = _dewPoint[j]; - p0 = _pressure[j]; - } - - computeLiftIdx(T0, meanTd, p0, _temp500); - } - return _LIdx; - } - - public float KIndex() { - if (_KIndex == MISSING) { - int n = _temp.length; - if (n < 1) { - return _KIndex; - } - if (analysisData.get(n - 1).getPressure() > 500 - || analysisData.get(0).getPressure() < 800 - || _temp[1] >= MISSING) { - return _KIndex; - } - computeKandTotal(_pressure, _temp, _dewPoint, _temp500); - } - return _KIndex; - } - - public float Totals() { - if (_Totals == MISSING) { - int n = _temp.length; - if (n < 1) { - return _Totals; - } - if (analysisData.get(n - 1).getPressure() > 500 - || analysisData.get(0).getPressure() < 800 - || _temp[1] >= MISSING) { - KIndex(); - } - } - return _Totals; - } - - public float sweatIdx() { - if (_sweatIdx == MISSING) { - int nTemp = _temp.length; - int nWind = _uComp.length; - float elev = analysisData.get(0).getGeoHeight(); - - if (nTemp == 0 || nWind == 0 || elev >= MISSING - || _temp[1] >= MISSING) { - return _sweatIdx; - } - - computeSweatIndex(_pressure, _temp, _dewPoint, _uComp, _vComp); - } - return _sweatIdx; - } - - public float convTemp() { - return _convTemp; - } - - public float maxtemp() { - return _maxTemp; - } - - public float frzgLvlZ() { - if (_frzgLvlZ == MISSING) { - int n = _temp.length; - float elev = analysisData.get(0).getGeoHeight(); - - if (n == 0 || elev >= MISSING || _temp.length < 2 - || _temp[0] >= MISSING) { - return _frzgLvlZ; - } - - computeFrzgLvl(_pressure, _temp, _height); - } - return _frzgLvlZ; - } - - public float frzgLvlP() { - if (_frzgLvlP == MISSING) { - frzgLvlZ(); - } - return _frzgLvlP; - } - - public float pressWBZ() { - if (_pressWBZ == MISSING) { - float elev = analysisData.get(0).getGeoHeight(); - - if (elev >= MISSING || _temp.length < 2 || _temp[0] >= MISSING) { - return _pressWBZ; - } - - computeWetbulbZero(_pressure, _temp, _height, _dewPoint); - } - return _pressWBZ; - } - - public float tempWBZ() { - if (_tempWBZ == MISSING) { - pressWBZ(); - } - return _tempWBZ; - } - - public float hgtWBZ() { - if (_hgtWBZ == MISSING) { - pressWBZ(); - } - return _hgtWBZ; - } - - public float soarIndex() { - if (_hour != 12) { - return MISSING; - } - if (_soarIndex >= MISSING) { - triggerTemp_C(); - } - return _soarIndex; - } - - public float triggerTemp_C() { - if (_triggerTemp_C >= MISSING) { - float elev = analysisData.get(0).getGeoHeight(); - - if (elev >= MISSING || _temp.length < 2 || _temp[0] >= MISSING) { - return _triggerTemp_C; - } - - computeSoaringIdx(_pressure, _height, _temp, _maxTemp); - } - return _triggerTemp_C; - } - - public float pEqLvl() { - return _pEqLvl; - } - - public float zEqLvl() { - return _zEqLvl; - } - - public float tEqLvl() { - return _tEqLvl; - } - - public float zLFC1() { - return _zLFC1; - } - - public float pLFC1() { - return _pLFC1; - } - - public float tLFC1() { - return _tLFC1; - } - - public float zLFC2() { - return _zLFC2; - } - - public float pLFC2() { - return _pLFC2; - } - - public float tLFC2() { - return _tLFC2; - } - - public float maxVVel() { - if (_maxVVel >= MISSING) { - hailSize(); - } - return _maxVVel; - } - - public float hailSize() { - int n = _temp.length; - if (n <= 3 || _uComp.length <= 3) { - return _hailSize; - } - if (_hailSize >= MISSING) { - float elev = analysisData.get(0).getGeoHeight(); - - if (elev >= MISSING || _initParT_C >= MISSING - || _pressLCL >= MISSING || _hgtLCL >= MISSING - || _tempLCL >= MISSING || _temp.length < 2 - || _temp[0] >= MISSING) { - return _hailSize; - } - // if no LFC or equilibrium level return with no values to compute - if (zLFC1() >= MISSING || pEqLvl() == 99999.0) { - return _hailSize; - } - - // compute buoyancies, hailsize, cloud top, and Bulk Richardson - // Number - buoyancyProcess(_pressure, _height, _uComp, _vComp, n, _pressLCL, - _hgtLCL, _tempLCL, _mixLCL, _thetaLCL, _theta_eLCL); - } - return _hailSize; - } - - public float hgtCldTop() { - if (_hgtCldTop >= MISSING) { - hailSize(); - } - return _hgtCldTop; - } - - public float posBuoy() { - if (_posBuoy >= MISSING) { - hailSize(); - } - return _posBuoy; - } - - public float negBuoy() { - if (_negBuoy >= MISSING) { - hailSize(); - } - return _negBuoy; - } - - public float richNum() { - if (_richNum >= MISSING) { - hailSize(); - } - return _richNum; - } - - public float mdpi() { - if (_mdpi >= MISSING) { - computeMDPIwindex(_pressure, _height, _temp, _dewPoint); - } - return _mdpi; - } - - public float windex() { - if (_windex >= MISSING) { - mdpi(); - } - return _windex; - } - - public float initParT_C() { - return _initParT_C; - } - - public float initParTd_C() { - return _initParTd_C; - } - - public float initParP() { - return _initParP; - } - - public float pressLCL() { - return _pressLCL; - } - - public float hgtLCL() { - return _hgtLCL; - } - - public float tempLCL() { - return _tempLCL; - } - - public float pressCCL() { - return _pressCCL; - } - - public float tempCCL() { - return _tempCCL; - } - - public float hgtCCL() { - return _hgtCCL; - } - - /** - * @param method - * the _liftingMethod to set - */ - public void set_liftingMethod(PARCEL_TYPE method) { - _liftingMethod = method; - this.computeParcelInfo(); - } - - /** - * @return the _ghx - */ - public float get_ghx() { - return _ghx; - } - - /** - * @return the _ghy - */ - public float get_ghy() { - return _ghy; - } - - /** - * @param level - * the _userLevel to set - */ - public void set_userLevel(float level) { - _userLevel = level; - } - - /** - * @param fcstMax - * the _useFcstMax to set - */ - public void set_useFcstMax(boolean fcstMax) { - _useFcstMax = fcstMax; - } - - /** - * @return the _useFcstMax - */ - public boolean is_useFcstMax() { - return _useFcstMax; - } - - /** - * calculate the amount of total precipitable water - * - * @param pressure - * millibars - * @param dewPoint - * Kelvin - */ - public void computePrecipWater(float[] pressure, float[] dewPoint) { - int ni = _temp.length; - float[] mixRatio = new float[ni]; - if (ni < 1) { - return; - } - - mixRatio = Controller.spechum2(pressure, dewPoint); - - _precipWater = 0.0f; - - int i; - for (i = 1; i < ni; i++) { - if (mixRatio[i - 1] < SoundingLayer.NODATA - && mixRatio[i] < SoundingLayer.NODATA) { - _precipWater += ((mixRatio[i - 1] + mixRatio[i]) * 0.5 * (pressure[i - 1] - pressure[i])); - } - } - _precipWater = _precipWater / (float) (2.54 * 980.7); // in inch - } - - /** - * calculate the lifted index
- *
- * Based upon the computed low-level (50 mb) moisture profile, compute the - * the lifted index via calls to existing DARE FORTRAN library routines. - * Pass the index back to the calling routine. - * - * @param initTemp - * Kelvin - * @param initTd - * Kelvin - * @param initial_p - * millibar - * @param temp500 - * Kelvin - */ - public void computeLiftIdx(float initTemp, float initTd, float initial_p, - float temp500) { - - // calculate the lifted index - float p500 = 500.0f; - int mni, nj, ni; - mni = nj = ni = 1; - float[] relaHumi = Controller.calcrh(new float[] { initTemp }, - new float[] { initTd }, mni, ni, nj); - _LIdx = Controller.calcli(new float[] { initial_p }, - new float[] { initTemp }, relaHumi, new float[] { temp500 }, - p500, mni, ni, nj)[0]; - } - - /** - * calculate the K index and Total-totals index - * - * @param pressure - * millibar - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - * @param temp500 - * Kelvin - */ - public void computeKandTotal(final float[] pressure, final float[] temp, - final float[] dewPoint, final float temp500) { - float temp700 = 0; - float td700 = 0; - float lowLevel = pressure[0] > 900 ? 850 : 800; - float temp850 = 0; - float td850 = 0; - for (int i = 1; i < temp.length; i++) { - if (pressure[i] < 700) { - break; - } - temp700 = temp[i]; - td700 = dewPoint[i]; - if (pressure[i] < lowLevel) { - continue; - } - temp850 = temp[i]; - td850 = dewPoint[i]; - } - if ((temp700 == MISSING || td700 == MISSING) - || (temp850 == MISSING || td850 == MISSING)) { - _KIndex = MISSING; - _Totals = MISSING; - return; - } - _KIndex = (temp850 - 273.15f) + (td850 - temp500) - (temp700 - td700); - _Totals = temp850 + td850 - 2 * temp500; - } - - /** - * calculate the sweat index - * - * @param pressure - * millibar - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - * @param uComp - * meters/second - * @param vComp - * meters/second - */ - public void computeSweatIndex(float[] pressure, float[] temp, - float[] dewPoint, float[] uComp, float[] vComp) { - - _sweatIdx = 0.0f; - - _sweatIdx = Controller.sweat(pressure, temp, dewPoint, temp.length, - pressure, uComp, vComp, uComp.length); - - } - - /** - * calculate the average wind from the sfc to 6 km
- *
- * Define the top of the layer to average; based on the u & v components of - * the wind, calculates the avg direction (deg) and speed (m/s) - * - * @param height - * meters - * @param pressure - * millibar - * @param temp - * Kelvin - * @param uComp - * meters/second - * @param vComp - * meters/second - * @param elev - * meters - */ - public void compute0_6kmAvgWind(float[] height, float[] pressure, - float[] temp, float[] uComp, float[] vComp, float elev) { - float top = 6.0f; // km - float bottom = 0.0f; - - avgWind = Controller.avwind(elev, top, bottom, height, pressure, temp, - uComp, vComp); - } - - /** - * calculate the 0-3 km storm relative helicity and the 0-3 km storm motion
- *
- * Based upon the pre-defined layer-depth (3 km), compute the storm relative - * helicity and storm motion via calls to existing FORTRAN library routines. - * Pre-process the wind data to throw out bad/no data areas (99999.0). - * Passes back to the calling class other parameters used in computing the - * helicity contours and storm motion plot (stormDir, stormSpd, ghx, ghy, - * uCompStorm, & vCompStorm). - * - * @param pressure - * millibar - * @param height - * meters asl - * @param uComp - * meters/second - * @param vComp - * meters/second - * @param elev - * meters - * @param averageDir - * degrees - * @param averageSpd - * meters/second - */ - public void computeSHelicity(final float[] pressure, final float[] height, - final float[] uComp, final float[] vComp, final float elev, - final float averageDir, final float averageSpd) { - // calculate the helicity - int numLvls = uComp.length; - float[] windHeights = new float[numLvls]; - float[] windPressures = new float[numLvls]; - float[] windUComp = new float[numLvls]; - float[] windVComp = new float[numLvls]; - float ghx[] = new float[1]; - float ghy[] = new float[1]; - float average_Dir = averageDir; - float average_Spd = averageSpd; - float elevation = elev; - - // preprocess the wind data, excluding any missing data levels - int index; - for (index = 0; index < uComp.length; index++) { - // TODO are the 999s below going to work? - if (uComp[index] > 999.0 || vComp[index] > 999.0 - || uComp[index] < -999.0 || vComp[index] < -999.0) { - continue; - } - windHeights[index] = height[index]; - windPressures[index] = pressure[index]; - windUComp[index] = uComp[index]; - windVComp[index] = vComp[index]; - } - - helicity = Controller.calchelicity(windHeights, windPressures, - windUComp, windVComp, elevation, _hgtHelLyr, ghx, ghy, - average_Dir, average_Spd); - _ghx = ghx[0]; - _ghy = ghy[0]; - } - - /** - * calculate the convective temperature
- *
- * Uses FORTRAN routine originally written for DARE to compute the - * convective temperature. Uses the mean mixing ratio in the lowest 50 mb of - * sounding as part of the calculation of the CCL, which gives the conv - * temp. Passes back the meanMixRatio and the CCL info (press, height, and - * temp). - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param mixRatio - */ - public void computeConvTemp(float[] pressure, float[] height, float[] temp, - float mixRatio) { - PHT ccl = Controller.cclpar(mixRatio, pressure, height, temp); - _pressCCL = ccl.getPressure(); - _tempCCL = ccl.getTemperature(); - _hgtCCL = ccl.getHeight(); - - // calculate theta at the CCL - float potTempCCL = (float) (ccl.getTemperature() * Math.pow( - (1000.0 / ccl.getPressure()), 0.286)); - // calculate the convective temp - _convTemp = (float) (potTempCCL * Math.pow((pressure[0] / 1000.0), - 0.286)); - } - - /** - * calculate the forecast max temperature
- *
- * Uses FORTRAN routine originally written for DARE to compute the modeled - * forecast max temperature valid for only the 12Z sounding. Routine is - * based on a climo model with solar heating added to it to arrive at this - * temp. The dataTimes object is passed into method for DTG calculations; - * dataLoc contains the lat/lon location of the sounding; legend contains - * the RAOB station id (used in model's lookup climo table). maxTemp is used - * in later methods (initial parcel calculations) to compute buoyancy. - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - * @param stnId - * @param dataTimes - * @param lat - * degrees - * @param lon - * degrees - * @return forecast max temp in Kelvin - */ - public float computeFcstMaxTemp(float[] pressure, float[] height, - float[] temp, float[] dewPoint, final String stnId, - final DataTime dataTimes, final float lat, final float lon) { - // initialize boundary conditions to the model - Calendar cal = null; - int year = 0; - int month = 0; - int day = 0; - int hour = 0; - int minute = 0; - - cal = dataTimes.getRefTimeAsCalendar(); - year = cal.get(Calendar.YEAR); - month = cal.get(Calendar.MONTH) + 1; - day = cal.get(Calendar.DAY_OF_MONTH); - hour = cal.get(Calendar.HOUR_OF_DAY); - minute = cal.get(Calendar.MINUTE); - - int snowDepth = 0; - int nLvls = temp.length; - - // Default value for the max temp - float maxTemp; - if (temp.length > 0) { - maxTemp = temp[0]; - } else { - maxTemp = 1e37f; - } - - while (nLvls > 0 && pressure[nLvls - 1] < 100.0) { - nLvls--; - } - if (nLvls < 5 || pressure[nLvls - 1] > 400.0) { - return maxTemp; - } - - // Verify that our inputs are useful - if (nLvls > pressure.length || nLvls > height.length - || nLvls > temp.length || nLvls > dewPoint.length || nLvls < 5 - || dewPoint[0] > temp[0] + 5) { - return maxTemp; - } - - maxTemp = Controller.forecast(year, month, day, hour, minute, stnId, - snowDepth, lat, lon, pressure, height, temp, dewPoint); - - return maxTemp; - } - - /** - * calculate the freezing level of the sounding
- *
- * Uses FORTRAN routine originally written for DARE to compute the freezing - * level height (meters and mb). - * - * @param pressure - * millibar - * @param temp - * Kelvin - * @param height - * meters - */ - public void computeFrzgLvl(float[] pressure, float[] temp, float[] height) { - // assume level starts at sfc - _frzgLvlP = 0.0f; - _frzgLvlZ = 0.0f; - float elev = height[0]; - - PHT frzlev = Controller.frzlev(elev, pressure, height, temp); - _frzgLvlP = frzlev.getPressure(); - _frzgLvlZ = frzlev.getHeight(); - } - - /** - * calculate the height of the wet-bulb zero
- *
- * Uses FORTRAN routine originally written for DARE to compute the height of - * the wet-bulb zero. - * - * @param pressure - * millibar - * @param temp - * Kelvin - * @param height - * meters - * @param dewPoint - * Kelvin - */ - public void computeWetbulbZero(float[] pressure, float[] temp, - float[] height, float[] dewPoint) { - // compute the height of the wet-bulb zero from sounding data - float elev = height[0]; - - _hgtWBZ = MISSING; - _pressWBZ = MISSING; - _tempWBZ = MISSING; - - PHT wbzero = Controller.wbzero(elev, pressure, height, temp, dewPoint); - - _hgtWBZ = wbzero.getHeight(); - _pressWBZ = wbzero.getPressure(); - _tempWBZ = wbzero.getTemperature(); - } - - /** - * calculate the Dry Microburst Potential, a.k.a. Convective Gust Potential
- *
- * Uses FORTRAN routine originally written for DARE to compute the - * convective gust potential. Based on a nomogram for the Western US. - * - * @param pressure - * millibar - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - */ - public void computeGustPot(float[] pressure, float[] temp, float[] dewPoint) { - if (pressure.length > 0 && temp.length > 0 && dewPoint.length > 0) { - _gustPotential = Controller.gusts(pressure, temp, dewPoint); - } - } - - /** - * calculate a measure of both the wet (mdpi) and dry (windex) microburst - * potential. If mdpi>1, wet microbursts are likely. The windex value is an - * actual maximum potential wind speed for dry microburst gusts.
- *
- * User should have called computeFrzgLvl first. - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - */ - public void computeMDPIwindex(float[] pressure, float[] height, - float[] temp, float[] dewPoint) { - // Check whether we have the bare minimum to calculate either. - _windex = _mdpi = MISSING; - int numLvls = temp.length; - if (numLvls < 5 || _frzgLvlZ >= MISSING) { - return; - } - int top = numLvls - 1; - float zbound = height[0] + 1000; - if (pressure[top] > 660 - && (height[top] <= zbound || _frzgLvlZ <= zbound - || temp[0] < 273.15 || temp[top] > 273.15)) { - return; - } - int nLvls = numLvls; - int one = 1; - int i; - - // First calculate max theta E from sfc to 150mb above sfc, min - // theta E above 660mb, use this to calculate mdpi. - float[] thetae; - if (pressure[top] <= 660) { - thetae = Controller.calcthetae2(pressure, temp, dewPoint, nLvls, - nLvls, one); - float maxLo = 0; - float pbound = pressure[0] - 150; - for (i = 0; i < nLvls && pressure[i] >= pbound; i++) { - if (thetae[i] > maxLo) { - maxLo = thetae[i]; - } - } - pbound = 660; - while (i < nLvls && pressure[i] > pbound) { - i++; - } - float minHi = 1e37f; - for (; i < nLvls; i++) { - if (thetae[i] < minHi) { - minHi = thetae[i]; - } - } - if (maxLo > 0 && minHi < 1e36) { - _mdpi = (maxLo - minHi) / 30; - } - } - - // We will reuse thetae for specific humidity and calculate windex. - if (height[top] <= zbound || _frzgLvlZ <= zbound || temp[0] < 273.15 - || temp[top] > 273.15) { - return; - } - thetae = Controller.spechum2(pressure, dewPoint);// produces g/Kg - float hm = (_frzgLvlZ - height[0]) / 1000; - float lapse = (temp[0] - 273.15f) / hm; - float q1km = 0; - for (i = 1; i < nLvls && height[i] < zbound; i++) { - q1km += (height[i] - height[i - 1]) * (thetae[i] + thetae[i - 1]) - / 2; - } - float q2 = thetae[i - 1] + (zbound - height[i - 1]) - * (thetae[i] + thetae[i - 1]) / (height[i] - height[i - 1]); - q1km += (zbound - height[i - 1]) * (q2 + thetae[i - 1]) / 2; - q1km /= 1000; - float rq = q1km > 12 ? 1 : q1km / 12; - while (height[i] < _frzgLvlZ) { - i++; - } - float qm = thetae[i - 1] + (_frzgLvlZ - height[i - 1]) - * (thetae[i] + thetae[i - 1]) / (height[i] - height[i - 1]); - _windex = lapse * lapse - 30 + q1km - 2 * qm; - if (_windex < 0) { - _windex = 0; - } - _windex = (float) (5 * Math.sqrt(hm * rq * _windex)); - } - - /** - * calculate the soaring parameters trigger temp and soaring index (ft/min)
- *
- * Uses FORTRAN routine originally written for DARE to compute the aircraft - * soaring parameters of trigger temp and soaring index. - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param maxTemp - * Kelvin - */ - public void computeSoaringIdx(float[] pressure, float[] height, - float[] temp, float maxTemp) { - // compute a series of pot temps based on sounding data - float elev = height[0]; - int numLvls = temp.length; - float[] potTemp = new float[numLvls]; - for (int i = 0; i < numLvls; i++) { - potTemp[i] = (float) (temp[i] * Math.pow((1000.0 / pressure[i]), - 0.286)); - } - - Tsoar tsoar = Controller.tsoar(elev, pressure, height, temp, potTemp, - maxTemp); - _soarIndex = tsoar.getSoarIndex(); - _triggerTemp_C = tsoar.getTriggerTemperature(); - } - - /** - * calculate the lifted condensation level (LCL).
- *
- * Uses FORTRAN routine originally written for DARE. Based upon the LCL, - * calculate potential temperature at the LCL. - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - * @param sfcTemp - * Kelvin - * @param meanMixRatio - */ - public void computeLCL(float[] pressure, float[] height, float[] temp, - float[] dewPoint, float sfcTemp, float meanMixRatio) { - - PHT lcl = Controller.lclpar(meanMixRatio, sfcTemp, pressure, height, - temp, dewPoint); - - // compute theta theta-e, and w at LCL - _pressLCL = lcl.getPressure(); - _hgtLCL = lcl.getHeight(); - _tempLCL = lcl.getTemperature(); - _mixLCL = meanMixRatio; - _thetaLCL = (float) (lcl.getTemperature() * Math.pow( - (1000.0 / lcl.getPressure()), 0.286)); - float equivTemp = Controller.adiabatic_te(lcl.getTemperature(), - lcl.getPressure()); - _theta_eLCL = (float) (equivTemp * Math.pow( - (1000.0 / lcl.getPressure()), 0.286)); - } - - /** - * @param _pressure2 - * @param _temp2 - * @param point - */ - private void computeWBS(float[] _pressure, float[] _temp, float[] _dewpoint) { - _wetbulbs = new double[_temp.length]; - UnitConverter kelvinToCelsius = SI.KELVIN.getConverterTo(SI.CELSIUS); - for (int i = 0; i < _temp.length; i++) { - if ((i % 3) != 0) { - _wetbulbs[i] = MISSING; - continue; - } - _wetbulbs[i] = WxMath.wetbulb(_pressure[i], - kelvinToCelsius.convert(_temp[i]), - kelvinToCelsius.convert(_dewpoint[i])); - // sanity check, wetbulb should never be higher than 200 kelvin - // anyway - if (_wetbulbs[i] > 999) { - _wetbulbs[i] = MISSING; - } - } - } - - /** - * calculate the initial parcel pressure (mb), temp, and dewpoints (C); - * compute the parameters needed to calculate the Level of Free Convection - * (LFC), the lifted parcel arrays, and the equilibrium level.
- *
- * Uses FORTRAN routines originally written for DARE. Step 1 of computing - * the buoyancy parameters. Compute the lifted parcel arrays according to - * the type of lifting desired. For the depictable, simply choose the 12Z - * fcst max temp or the sfc temp of sounding. For the interactive skew-t, - * lifted parcels are computed either from the sfc, the mean temp lowest 50 - * mb, or a user-defined temp/level. These are used to compute subsequent - * buoyancy parameters. LFC and equilibrium level values are passed back to - * the calling class. If no LFC can be found, then the value is flagged as - * 99999.0 (missing) & buoyancy calculations are skipped. - * - * @param pressure - * millibar - * @param height - * meters - * @param temp - * Kelvin - * @param dewPoint - * Kelvin - * @param initParP - * millibar - * @param initParT_C - * Celsius - * @param pressLCL - * millibar - * @param hgtLCL - * meters - * @param tempLCL - * Kelvin - * @param thetaLCL - * Kelvin - * @param theta_eLCL - * Kelvin - * @param mixLCL - */ - public void computeParcelLvls(float[] pressure, float[] height, - float[] temp, float[] dewPoint, float initParP, float initParT_C, - float pressLCL, float hgtLCL, float tempLCL, float thetaLCL, - float theta_eLCL, float mixLCL) { - // compute virtual temp and potential temp at sounding levels - int numLvls = temp.length; - _virtTemp = Controller.virtualt(temp, dewPoint, pressure, numLvls); - - // initially define the array bounds of the computed parcel arrays - // as one + the number of levels in the sounding. Used for the - // call to the FORTRAN routine 'liftedp()'. - int numPars = numLvls + 1; - - // determine the parcel characteristics at each sounding level - - PHT liftedp = Controller.liftedp(pressure, temp, height, _virtTemp, - numPars, pressLCL, hgtLCL, tempLCL, mixLCL, thetaLCL, - theta_eLCL, initParP, initParT_C); - _parcelP = liftedp.getPressureArray(); - _parcelZ = liftedp.getHeightArray(); - _parcelT = liftedp.getTemperatureArray(); - _parcelVirtT = liftedp.getVirtualTemps(); - _environTemp = liftedp.getSoundingTemps(); - _envVirtTemp = liftedp.getSoundingVirtTemps(); - _numParLvls = liftedp.getNumLevels(); - - // copy the contents of parcel temps and parcel pressures for later - // plotting - // parcelP.setLength(_numParLvls); - // parcelT.setLength(_numParLvls); - // for (int i = 0; i < _numParLvls; i++) { - // parcelP[i] = _parcelP[i]; - // parcelT[i] = _parcelT[i]; - // } - - // calculate the Level of Free Convection (LFC) via lifting - PHT lfc = Controller.lfcpar(theta_eLCL, pressLCL, tempLCL, hgtLCL, - _parcelT, _environTemp, _parcelP, _parcelZ, _numParLvls); - _pLFC1 = lfc.getPressure(); - _zLFC1 = lfc.getHeight(); - _tLFC1 = lfc.getTemperature(); - _pLFC2 = lfc.getPressure1(); - _zLFC2 = lfc.getHeight1(); - _tLFC2 = lfc.getTemperature1(); - - // calculate the equilibrium level, if LFC exists - _pEqLvl = MISSING; - - if (_pLFC1 < MISSING) { - PHT eqlev = Controller.eqlev(_parcelP, _parcelZ, _parcelT, - _environTemp, _pLFC1, theta_eLCL, _numParLvls); - - _pEqLvl = eqlev.getPressure(); - _zEqLvl = eqlev.getHeight(); - _tEqLvl = eqlev.getTemperature(); - } - } - - public void buoyancyProcess(float[] pressure, float[] height, - float[] uComp, float[] vComp, int numLvls, float pressLCL, - float hgtLCL, float tempLCL, float mixLCL, float thetaLCL, - float theta_eLCL) { - // compute the vertical velocity of a lifted parcel - - Velocity vvel = Controller.vvel(pressLCL, _pEqLvl, _parcelP, _parcelZ, - _parcelT, _envVirtTemp, _parcelVirtT, mixLCL, _numParLvls); - float[] parcelVVel = vvel.getVerticalVelocity(); - _maxVVel = vvel.getMaxVerticalVelocity(); - - // find the max hailsize - _hailSize = Controller.hailsiz(_maxVVel); - - // calculate the estimated cloud top - _hgtCldTop = Controller.ctop(_parcelP, _parcelZ, parcelVVel, _pEqLvl, - _numParLvls); - - // calculate the positive and negative buoyant energies - _posBuoy = 0.0f; - _negBuoy = 0.0f; - - PHT posarea = Controller.posarea(_pLFC1, _pEqLvl, _tLFC1, _tEqLvl, - _zLFC1, _zEqLvl, theta_eLCL, _parcelP, _parcelZ, _environTemp, - _parcelT, _numParLvls); - _posBuoy = posarea.getPositiveEnergy(); - _CINfrmCAPE = posarea.getCin(); - - _negBuoy = Controller.negarea(pressLCL, tempLCL, hgtLCL, _pLFC1, - _zLFC1, _tLFC1, thetaLCL, theta_eLCL, _parcelP, _parcelZ, - _environTemp, _parcelT, _numParLvls, _CINfrmCAPE); - - float[] soundingRho = Controller.density(pressure, _virtTemp); - - // compute the Bulk Richardson Number - int numWindLvls = uComp.length; - int tmpLen = numLvls; - if (numWindLvls > numLvls) { - numWindLvls = numLvls; - } - if (numWindLvls < numLvls) { - tmpLen = numWindLvls; - } - - _richNum = Controller.richno(height, height, uComp, vComp, soundingRho, - tmpLen, numWindLvls, _posBuoy); - } - - /** - * This routine creates a set of densely packed levels for which the data - * set is completely filled out, using interpolation to fill in the missing - * data. - * - * @param inputData - * original data - * @param hgtDiff - * desired height spacing in meters - * @return interpolated data - */ - private VerticalSounding rebuildDataInHgt(VerticalSounding inputData, - final int hgtDiff) { - int numInterleaveLvls = inputData.size(); - VerticalSounding rebuildData = new VerticalSounding(); - rebuildData.setDataTime(inputData.getDataTime()); - rebuildData.setElevation(inputData.getElevation()); - rebuildData.setName(inputData.getName()); - rebuildData.setObsTime(inputData.getObsTime()); - rebuildData.setSpatialInfo(inputData.getSpatialInfo()); - - // check for lack of data and set length appropriately and exit - if (numInterleaveLvls < 5) { - return rebuildData; - } - // set length of analysisData to 0 & exit if data above 100 mb - if (inputData.getMaxPressurelayer().getPressure() < 100.0f) { - return rebuildData; - } - - // Place the input data into linear arrays. - int i, k; - float[] zOrig = new float[inputData.size()]; - float[] pOrig = new float[inputData.size()]; - float[] tOrig = new float[inputData.size()]; - float[] tdOrig = new float[inputData.size()]; - float[] uOrig = new float[inputData.size()]; - float[] vOrig = new float[inputData.size()]; - - for (i = 0; i < inputData.size(); i++) { - SoundingLayer layer = inputData.get(i); - zOrig[i] = layer.getGeoHeight(); - pOrig[i] = (float) Math.log(layer.getPressure()); - tOrig[i] = layer.getTemperature(); - tdOrig[i] = layer.getDewpoint(); - uOrig[i] = layer.getWindU(); - vOrig[i] = layer.getWindV(); - } - - // Set up an array that contains up to 500 levels every hgtDiff. Make - // sure that the surface 700, 500 and 850 mb are included.. - float p850 = (float) Math.log(850.0); - float p700 = (float) Math.log(700.0); - float p500 = (float) Math.log(500.0); - float pNext, zNext, r; - float[] zNew = new float[500]; - float[] pNew = new float[500]; - int k850 = -1; - int k700 = -1; - int k500 = -1; - int i1 = 0; - k = 0; - zNew[k] = zOrig[i1]; - pNew[k] = pOrig[i1]; - int zVal = hgtDiff * (int) (zNew[k] / hgtDiff); - if (zVal <= zNew[k]) { - zVal += hgtDiff; - } - if (pOrig[i1] == p850) { - k850 = k; - } - i = 1; - while (k < 499 && i < inputData.size()) { - r = (pOrig[i] - pOrig[i1]) / (zOrig[i] - zOrig[i1]); - while (k < 499) { - if (zVal <= zOrig[i]) { - zNext = zVal; - pNext = pOrig[i1] + r * (zNext - zOrig[i1]); - } else { - zNext = zOrig[i]; - pNext = pOrig[i]; - } - if (k850 < 0 && p850 > pNext && p850 < pNew[k]) { - k850 = ++k; - pNew[k] = p850; - zNew[k] = zOrig[i1] + (p850 - pOrig[i1]) / r; - continue; - } else if (k700 < 0 && p700 > pNext && p700 < pNew[k]) { - k700 = ++k; - pNew[k] = p700; - zNew[k] = zOrig[i1] + (p700 - pOrig[i1]) / r; - continue; - } else if (k500 < 0 && p500 > pNext && p500 < pNew[k]) { - k500 = ++k; - pNew[k] = p500; - zNew[k] = zOrig[i1] + (p500 - pOrig[i1]) / r; - continue; - } else if (k850 < 0 && pNext == p850) { - k850 = k + 1; - } else if (k700 < 0 && pNext == p700) { - k700 = k + 1; - } else if (k500 < 0 && pNext == p500) { - k500 = k + 1; - } else if (zVal > zNext) { - break; - } - zNew[++k] = zNext; - pNew[k] = pNext; - zVal += hgtDiff; - if (zVal > zOrig[i]) { - break; - } - } - i1 = (i++); - } - if (k < 499) { - zNew[++k] = zOrig[inputData.size() - 1]; - pNew[k] = pOrig[inputData.size() - 1]; - } - k++; - - // Do the interpolation among the rest of the items versus height. - float[] tNew = new float[500]; - float[] tdNew = new float[500]; - float[] uNew = new float[500]; - float[] vNew = new float[500]; - vertInterp(zOrig, tOrig, inputData.size(), zNew, tNew, k, 99999); - vertInterp(zOrig, tdOrig, inputData.size(), zNew, tdNew, k, 99999); - vertInterp(zOrig, uOrig, inputData.size(), zNew, uNew, k, 99999); - vertInterp(zOrig, vOrig, inputData.size(), zNew, vNew, k, 99999); - - // Put this data into the output data structure - for (i = 0; i < k; i++) { - SoundingLayer layer = new SoundingLayer(); - layer.setGeoHeight(zNew[i]); - layer.setPressure((float) Math.exp(pNew[i])); - layer.setTemperature(tNew[i]); - layer.setDewpoint(tdNew[i]); - Coordinate spdDir = WxMath.speedDir(uNew[i], vNew[i]); - layer.setWindSpeed((float) spdDir.x); - layer.setWindDirection((float) spdDir.y); - - rebuildData.addLayer(layer); - } - - // Clean up our memory, make sure that our man levels are set exactly. - if (k850 >= 0) { - rebuildData.get(k850).setPressure(850); - } - if (k700 >= 0) { - rebuildData.get(k700).setPressure(700); - } - if (k500 >= 0) { - rebuildData.get(k500).setPressure(500); - } - - return rebuildData; - } - - /** - * Assumes vertical coordinates increase with height, except that the first - * item in the input arrays might be the earth's surface. Can produce - * unpredictable results if items in inVert or outVert are undefined. Items - * in outData which cannot be interpolated for are flagged with a 1e37. The - * optional parameters gapTest and dVert refer to how large a vertical gap - * will be considered 'missing' data. The default of gapTest is 2, which - * means it is possible to interpolate data over a layer with one undefined - * level in it. A value of 1 for gapTest means interpolation will only be - * done through layers with no undefined levels, and 0 means no - * interpolation at all; values will be assigned only when there is an exact - * match between the input and output vertical coordinate values. The - * parameter dVert is the largest vertical gap in terms of the vertical - * coordinate value over which interpolation can occur. When a vertical gap - * is identified as having undefined data, how it is treated can depend on - * how many items in the output vertical coordinate array fall within the - * gap. If there is only one, it will be marked undedefined in all cases. If - * there is more than one, output levels immediately adjacent to the border - * of the vertical gap can be assigned meaningful values. - * - * @param inVert - * @param inData - * @param nIn - * @param outVert - * @param outData - * @param nOut - * @param gapTest - */ - private void vertInterp(final float[] inVert, final float[] inData, - int nIn, float[] outVert, float[] outData, int nOut, int gapTest) { - if (nOut == 0) { - return; - } - - float dVert = MISSING; - - // get lowest useable input vertical coordinate and useable level - int endIn = nIn; - float bottom = inVert[0]; - int index = 0; - if (nIn == 0 || bottom < MISSING && inData[0] < MISSING) { - ; - } else if (bottom < MISSING) { - do { - index++; - } while (index < endIn - && (inVert[index] <= bottom || inVert[index] >= MISSING || inData[index] >= MISSING)); - } else { - do { - index++; - if (inVert[index] < bottom) { - bottom = inVert[index]; - } - } while (index < endIn - && (inVert[index] >= MISSING || inData[index] >= MISSING)); - } - - // Handle case of no useable input data at all. - int endOut = nOut; - int outdex = 0; - if (index >= endIn) { - while (outdex < endOut) { - outData[outdex] = MISSING; - outdex++; - } - return; - } - - // fill stuff below first level with flags - float prevVert = MISSING; - while (outdex < endOut - && (outVert[outdex] < inVert[index] || outVert[outdex] >= MISSING)) { - outData[outdex] = MISSING; - prevVert = outVert[outdex++]; - } - - // See if we put data into the output level immediately below our - // column. - if (prevVert >= MISSING || bottom < inVert[index] && prevVert < bottom) { - prevVert = MISSING; - } else if (dVert < MISSING) { - if (gapTest >= 2 && inVert[index] - prevVert < dVert / 2) { - outData[outdex - 1] = inData[index]; - } - prevVert = MISSING; - } else if (gapTest == 2) { - prevVert = MISSING; - } - if (outdex >= endOut && prevVert >= MISSING) { - return; - } - - // initialize second input data level - int endAt = endOut - 1; - float dprev = 0; - int next = index + 1; - while (next < endIn - && (inVert[next] <= bottom || inData[next] >= MISSING)) { - dprev = inVert[next] - inVert[next - 1]; - next++; - } - - // See if we put data into the output level immediately below our - // column. - if (prevVert < MISSING && inVert[index] - prevVert < dprev / 2) { - outData[outdex - 1] = inData[index]; - } - - // Always copy if vert coord exactly the same - if (outVert[outdex] == inVert[index]) { - outData[outdex] = inData[index]; - outdex++; - } - if (outdex >= endOut) { - return; - } - - // Loop through each pair of bracketing input levels - float wgt; - float dnow; - while (next < endIn) { - dnow = inVert[next] - inVert[index]; - - if (dnow == 0 || outVert[outdex] >= inVert[next]) { - ; - } else if (next - index <= gapTest && dnow <= dVert) { - // Usual case of interpolating with no gap - do { - wgt = (outVert[outdex] - inVert[index]) / dnow; - outData[outdex] = inData[index] + wgt - * (inData[next] - inData[index]); - outdex++; - } while (outdex < endOut && outVert[outdex] < inVert[next]); - } else if (nOut < 3 || gapTest == 0) { - // Just mark everything between as undefined - do { - outData[outdex] = MISSING; - outdex++; - } while (outdex < endOut && outVert[outdex] < inVert[next]); - } else { - if (dprev <= 0 || dprev > dnow / 3) { - dprev = dnow / 3; - } - int gapstat = 0; - do { - if (gapstat == 0 - && outVert[outdex] - inVert[index] <= dprev) { - wgt = (outVert[outdex] - inVert[index]) / dnow; - outData[outdex] = inData[index] + wgt - * (inData[next] - inData[index]); - gapstat = 1; - } else if (outdex != endAt && outVert[1] <= inVert[next]) { - outData[outdex] = MISSING; - gapstat |= 2; - } else if ((gapstat & 2) != 0 - && inVert[next] - outVert[outdex] <= dprev) { - wgt = (outVert[outdex] - inVert[index]) - / (inVert[next] - inVert[index]); - outData[outdex] = inData[index] + wgt - * (inData[next] - inData[index]); - } else { - if (gapstat == 1) { - outData[outdex - 1] = MISSING; - } - outData[outdex] = MISSING; - } - outdex++; - } while (outdex < endOut && outVert[outdex] < inVert[next]); - } - - // Always copy if vert coord exactly the same - if (outdex >= endOut) { - break; - } - if (outVert[outdex] == inVert[next]) { - outData[outdex] = inData[next]; - outdex++; - if (outdex >= endOut) { - break; - } - } - - // Advance to next avaliable input level, check if there are still - // any levels to process yet. - index = next; - do { - next++; - } while (next < endIn && inData[next] >= MISSING); - if (next >= endIn) { - break; - } - dprev = inVert[index] - inVert[index - 1]; - } - - // See if we put data into the output level immediately above our - // column. - if (outdex >= endOut || index >= endIn || gapTest < 2) { - ; - } else if (dVert < MISSING - && outVert[outdex] - inVert[index] < dVert / 2 || gapTest > 2 - && dVert >= MISSING - && outVert[outdex] - inVert[index] < dprev / 2) { - outData[outdex] = inData[index]; - outdex++; - } - - // flag rest of levels - while (outdex < endOut) { - outData[outdex] = MISSING; - outdex++; - } - } - - /** - * transfer the SeqOf data to each SeqOf and - * return the 500mb temperature. - * - * @return - */ - private float transDataStyle() - - { - int i; - float temp500 = MISSING; - _pressure = new float[analysisData.size()]; - _dewPoint = new float[analysisData.size()]; - _temp = new float[analysisData.size()]; - _height = new float[analysisData.size()]; - _uComp = new float[analysisData.size()]; - _vComp = new float[analysisData.size()]; - - int nTemp = -1; - int nWind = -1; - for (i = 0; i < analysisData.size(); i++) { - SoundingLayer layer = analysisData.get(i); - _pressure[i] = layer.getPressure(); - _height[i] = layer.getGeoHeight(); - _temp[i] = layer.getTemperature(); - _dewPoint[i] = layer.getDewpoint(); - _uComp[i] = layer.getWindU(); - _vComp[i] = layer.getWindV(); - - if (_pressure[i] == 500 || (int) _pressure[i] == 500 - && temp500 == MISSING) { - temp500 = _temp[i]; - } - if (_temp[i] < MISSING) { - nTemp = i; - } - if (_uComp[i] < MISSING) { - nWind = i; - } - } - - // resize arrays - _temp = Arrays.copyOf(_temp, ++nTemp); - _dewPoint = Arrays.copyOf(_dewPoint, nTemp); - _uComp = Arrays.copyOf(_uComp, ++nWind); - _vComp = Arrays.copyOf(_vComp, nWind); - - return temp500; - } - - private void fillOutHeights(VerticalSounding levels, boolean recursive) { - if (levels.size() < 3) { - return; - } - - SoundingLayer level; - int k; - - // If not a nested call, remove any levels with no pressure or height. - float zTop = -100; - float pTop = 1250; - if (!recursive) { - for (k = 0; k < levels.size();) { - level = levels.get(k); - if ((level.getGeoHeight() < zTop || level.getGeoHeight() > 88888) - && (level.getPressure() > pTop || level.getPressure() < 5)) { - levels.removeLayer(level); - } else { - k++; - } - } - } - - int l1, l2; - l1 = l2 = -1; - SoundingLayer level1 = null; - SoundingLayer level2 = null; - double lp1, lp2, r, r1, r2; - boolean pNo, zNo; - int kTop = -1; - int nOk = 0; - - // Make the surface level with std atmosphere if we can. - level = levels.get(0); - if ((level.getGeoHeight() <= zTop || level.getGeoHeight() > 88888) - && level.getPressure() <= pTop && level.getPressure() > 5) { - level.setGeoHeight(Controller.ptozsa(level.getPressure())); - - } else if ((level.getPressure() >= pTop || level.getPressure() < 5) - && level.getGeoHeight() >= zTop && level.getGeoHeight() < 88888) { - level.setPressure(Controller.ztopsa(level.getGeoHeight())); - } - - // Do interpolation of height vs log pressure. - for (k = 0; k < levels.size(); k++) { - level = levels.get(k); - if (level.getGeoHeight() <= zTop || level.getGeoHeight() > 88888) { - continue; - } - if (level.getPressure() >= pTop || level.getPressure() < 5) { - continue; - } - nOk++; - zTop = level.getGeoHeight(); - pTop = level.getPressure(); - kTop = k; - level1 = level2; - l1 = l2; - level2 = level; - l2 = k; - if (l1 < 1 || l2 - l1 <= 1) { - continue; - } - lp1 = Math.log(level1.getPressure()); - lp2 = Math.log(level2.getPressure()); - r = (level2.getGeoHeight() - level1.getGeoHeight()) / (lp2 - lp1); - for (int i = l1 + 1; i < l2; i++) { - SoundingLayer intLvl = levels.get(i); - pNo = intLvl.getPressure() >= level1.getPressure() - || intLvl.getPressure() <= level2.getPressure(); - zNo = intLvl.getGeoHeight() <= level1.getGeoHeight() - || intLvl.getGeoHeight() >= level2.getGeoHeight(); - if (pNo == zNo) { - continue; - } - nOk++; - if (zNo) { - intLvl.setGeoHeight((float) (level1.getGeoHeight() + r - * (Math.log(intLvl.getPressure()) - lp1))); - } else { - intLvl.setPressure((float) Math.exp(lp1 - + (intLvl.getGeoHeight() - level1.getGeoHeight()) - / r)); - } - } - } - - // If all levels have p and z defined, we are done. - if (nOk >= levels.size()) { - return; - } - - // Perform the hypsometric calculation for remaining levels if possible. - if (kTop < levels.size() - && kTop >= 0 - && l2 > 0 - && (l1 > 0 || level2.getTemperature() > 100 - && level2.getTemperature() < 350)) { - lp2 = Math.log(level2.getPressure()); - if (l1 > 0) { - lp1 = Math.log(level1.getPressure()); - r1 = (level2.getGeoHeight() - level1.getGeoHeight()) - / (lp2 - lp1); - } else { - r1 = -Controller.dzdlnp(level2.getPressure(), - level2.getTemperature(), level2.getDewpoint()); - } - level1 = level2; - l1 = l2; - lp1 = lp2; - for (k = kTop + 1; k < levels.size(); k++) { - SoundingLayer intLvl = levels.get(k); - pNo = intLvl.getPressure() >= pTop || intLvl.getPressure() < 5; - zNo = intLvl.getGeoHeight() <= zTop - || intLvl.getGeoHeight() > 88888; - if (pNo == zNo) { - continue; - } - nOk++; - if (!pNo && intLvl.getTemperature() > 100 - && intLvl.getTemperature() < 373) { - r2 = -Controller.dzdlnp(intLvl.getPressure(), - intLvl.getTemperature(), intLvl.getDewpoint()); - r = (r1 + r2) / 2; - lp2 = Math.log(intLvl.getPressure()); - intLvl.setGeoHeight((float) (level1.getGeoHeight() + r - * (lp2 - lp1))); - r1 = r2; - level1 = intLvl; - l1 = k; - lp1 = lp2; - } else if (zNo) { - intLvl.setGeoHeight((float) (level1.getGeoHeight() + r1 - * (Math.log(intLvl.getPressure()) - lp1))); - } else { - intLvl.setPressure((float) Math.exp(lp1 - + (intLvl.getGeoHeight() - level1.getGeoHeight()) - / r1)); - } - } - } - - // If all levels have p and z defined, we are done. - if (nOk >= levels.size()) { - return; - } - - // If this is a recursive call, just define all heights by std atm. - if (recursive) { - for (k = 0; k < levels.size(); k++) { - level = levels.get(k); - if (level.getGeoHeight() < -100 - || level.getGeoHeight() >= 88888) { - level.setGeoHeight(Controller.ptozsa(level.getPressure())); - } - } - return; - } - - // If there are any undefined pressures, set them by standard atmosphere - // sort by pressure, and call this method recursively. - for (k = 0; k < levels.size(); k++) { - level = levels.get(k); - if (level.getPressure() < 5 || level.getPressure() > 1250) { - level.setPressure(Controller.ztopsa(level.getGeoHeight())); - } - } - levels.sortByPressure(); - fillOutHeights(levels, true); - } - - private VerticalSounding down_interp(VerticalSounding inputData, - float[] levels) { - VerticalSounding outputData = new VerticalSounding(); - outputData.setDataTime(inputData.getDataTime()); - outputData.setElevation(inputData.getElevation()); - outputData.setName(inputData.getName()); - outputData.setObsTime(inputData.getObsTime()); - outputData.setSpatialInfo(inputData.getSpatialInfo()); - - // Place the input data into linear arrays. - float[] zOrig = new float[inputData.size()]; - float[] pOrig = new float[inputData.size()]; - float[] tOrig = new float[inputData.size()]; - float[] tdOrig = new float[inputData.size()]; - float[] uOrig = new float[inputData.size()]; - float[] vOrig = new float[inputData.size()]; - - for (int i = 0; i < inputData.size(); i++) { - SoundingLayer layer = inputData.get(i); - zOrig[i] = layer.getGeoHeight(); - pOrig[i] = (float) -Math.log(layer.getPressure()); - tOrig[i] = layer.getTemperature(); - tdOrig[i] = layer.getDewpoint(); - uOrig[i] = layer.getWindU(); - vOrig[i] = layer.getWindV(); - } - - int ni = inputData.size(); - int nio = levels.length; - float[] val = new float[nio]; - for (int k = 0; k < nio; k++) { - if (levels[k] > 1e36) { - val[k] = 1e37f; - } else if (levels[k] <= 0) { - val[k] = -levels[k]; - } else { - val[k] = (float) -Math.log(levels[k]); - } - } - float[] zNew = new float[nio]; - float[] tNew = new float[nio]; - float[] tdNew = new float[nio]; - float[] uNew = new float[nio]; - float[] vNew = new float[nio]; - vertInterp(pOrig, zOrig, ni, val, zNew, nio, 2); - vertInterp(pOrig, tOrig, ni, val, tNew, nio, 2); - vertInterp(pOrig, tdOrig, ni, val, tdNew, nio, 2); - vertInterp(pOrig, uOrig, ni, val, uNew, nio, 2); - vertInterp(pOrig, vOrig, ni, val, vNew, nio, 2); - - // Put this data into the output data structure - for (int i = 0; i < nio; i++) { - SoundingLayer layer = new SoundingLayer(); - layer.setGeoHeight(zNew[i]); - layer.setPressure(levels[i]); - layer.setTemperature(tNew[i]); - layer.setDewpoint(tdNew[i]); - Coordinate spdDir = WxMath.speedDir(uNew[i], vNew[i]); - layer.setWindSpeed((float) spdDir.x); - layer.setWindDirection((float) spdDir.y); - - outputData.addLayer(layer); - } - - return outputData; - } - -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/BufrSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/BufrSoundingAdapter.java deleted file mode 100644 index 7beb53faba..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/BufrSoundingAdapter.java +++ /dev/null @@ -1,164 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.edex.plugin.modelsounding.common.SoundingSite; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.pointdata.PointDataContainer; -import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.status.StatusConstants; -import com.raytheon.uf.viz.sounding.Activator; - -/** - * - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 1, 2008        1747 jkorman     Initial creation
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class BufrSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(BufrSoundingAdapter.class); - - private static final String[] requiredParameters = new String[] { "P", "T", - "DpT", "wSp", "WD" }; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - SoundingSite obs = (SoundingSite) obj; - VerticalSounding sounding = createVerticalSounding(obs); - if (sounding != null) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(SoundingSite sndngSite) { - VerticalSounding sounding = null; - - if (sndngSite != null) { - - Map rcMap = new HashMap(); - rcMap.put("dataURI", new RequestConstraint("" - + sndngSite.getDataURI())); - PointDataContainer container; - try { - container = DataCubeContainer.getPointData(sndngSite - .getPluginName(), requiredParameters, rcMap); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving sounding", e1); - return sounding; - } - - if (container == null || container.getAllocatedSz() == 0) { - return sounding; - } - PointDataView pdv = container.readRandom(0); - - Number[] p = pdv.getNumberAllLevels("P"); - Number[] temp = pdv.getNumberAllLevels("T"); - Number[] dpt = pdv.getNumberAllLevels("DpT"); - Number[] windSpd = pdv.getNumberAllLevels("wSp"); - Number[] windDir = pdv.getNumberAllLevels("WD"); - - if (p != null && p.length != 0) { - sounding = new VerticalSounding(); - SurfaceObsLocation location = sndngSite.getLocation(); - sounding.setSpatialInfo(location); - - sounding.setElevation(sndngSite.getElevation()); - sounding.setStationId(sndngSite.getStationId()); - sounding.setObsTime(sndngSite.getDataTime() - .getRefTimeAsCalendar()); - sounding.setDataTime(sndngSite.getDataTime()); - - String type = sndngSite.getReportType(); - - type = ("ETA".equals(type)) ? "NAM" : "GFS"; - - sounding.setDisplayFormat(String.format("%sBUFR{$pointId$}%s ", - type, sndngSite.getStationId())); - - sounding.setName(sndngSite.getStationId()); - - for (int i = 0; i < p.length; i++) { - Number level = p[i]; - if (level != null && level.intValue() != -9999) { - SoundingLayer layer = new SoundingLayer(); - - layer.setPressure((level.floatValue() != -9999) ? level - .floatValue() : SoundingLayer.MISSING); - float t = temp[i].floatValue(); - layer.setTemperature((t != -9999) ? t - : SoundingLayer.MISSING); - - Float d = dpt[i].floatValue(); - layer.setDewpoint((d != -9999) ? d - : SoundingLayer.MISSING); - - Float s = windSpd[i].floatValue(); - layer.setWindSpeed((s != -9999) ? s - : SoundingLayer.MISSING); - - Float w = windDir[i].floatValue(); - layer.setWindDirection((w != -9999) ? w - : SoundingLayer.MISSING); - - sounding.addLayer(layer); - } - } // for - } - } - return sounding; - } -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GOESSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GOESSoundingAdapter.java deleted file mode 100644 index 734dfc5e8f..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GOESSoundingAdapter.java +++ /dev/null @@ -1,171 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.SI; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.goessounding.GOESSounding; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.pointdata.PointDataContainer; -import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -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.core.exception.VizException; -import com.raytheon.viz.pointdata.PointDataRequest; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 01, 2008 1747       jkorman     Initial creation
- * May 15, 2013 1869       bsteffen    Remove DataURI from goes/poes soundings.
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class GOESSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(GOESSoundingAdapter.class); - - private static UnitConverter pascalsToHectoPascals = SI.PASCAL - .getConverterTo(SI.HECTO(SI.PASCAL)); - - private static final String[] requiredParameters = new String[] { - "pressure", "height", "temperature", "dewPoint" }; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - GOESSounding obs = (GOESSounding) obj; - VerticalSounding sounding = createVerticalSounding(obs); - if (sounding != null) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(GOESSounding obsData) { - VerticalSounding sounding = null; - - if (obsData != null) { - - Map rcMap = new HashMap(); - rcMap.put("location.stationId", new RequestConstraint(obsData - .getLocation().getStationId())); - rcMap.put( - "dataTime.refTime", - new RequestConstraint(TimeUtil.formatToSqlTimestamp(obsData - .getDataTime().getRefTime()))); - PointDataContainer container; - try { - container = PointDataRequest.requestPointDataAllLevels(null, - obsData.getPluginName(), requiredParameters, null, - rcMap); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving sounding", e1); - return sounding; - } - PointDataView pdv; - if (container == null || container.getAllocatedSz() == 0) { - return sounding; - } - - pdv = container.readRandom(0); - Number[] p = pdv.getNumberAllLevels("pressure"); - Number[] gh = pdv.getNumberAllLevels("height"); - Number[] temp = pdv.getNumberAllLevels("temperature"); - Number[] dp = pdv.getNumberAllLevels("dewPoint"); - - if (p != null) { - sounding = new VerticalSounding(); - SurfaceObsLocation location = obsData.getLocation(); - sounding.setSpatialInfo(location); - - sounding.setElevation(obsData.getElevation()); - sounding.setStationId(obsData.getStationId()); - sounding.setObsTime(obsData.getTimeObs()); - sounding.setDataTime(obsData.getDataTime()); - - sounding.setName(String.format("GoesBufr %.1f%c %.1f%c %s", - Math.abs(location.getLatitude()), (location - .getLatitude() >= 0 ? 'N' : 'S'), Math - .abs(location.getLongitude()), (location - .getLongitude() >= 0 ? 'E' : 'W'), obsData - .getStationId())); - - for (int i = 0; i < p.length; i++) { - Number level = p[i]; - if (level != null && level.intValue() != -9999) { - SoundingLayer layer = new SoundingLayer(); - - Integer n = level.intValue(); - layer - .setPressure((n != -9999) ? (float) (pascalsToHectoPascals - .convert(n.doubleValue())) - : SoundingLayer.MISSING); - - n = gh[i].intValue(); - layer.setGeoHeight((n != -9999) ? n.floatValue() - : SoundingLayer.MISSING); - - float t = temp[i].floatValue(); - layer.setTemperature((t != -9999) ? t - : SoundingLayer.MISSING); - - t = dp[i].floatValue(); - layer.setDewpoint((t != -9999) ? t - : SoundingLayer.MISSING); - - sounding.addLayer(layer); - } - } // for - } - } - return sounding; - } -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GridSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GridSoundingAdapter.java deleted file mode 100644 index 335e68c4b3..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/GridSoundingAdapter.java +++ /dev/null @@ -1,233 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.awt.Point; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.common.datastorage.Request; -import com.raytheon.uf.common.datastorage.records.IDataRecord; -import com.raytheon.uf.common.geospatial.ISpatialObject; -import com.raytheon.uf.common.geospatial.MapUtil; -import com.raytheon.uf.common.geospatial.PointUtil; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -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.common.topo.TopoQuery; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.sounding.SoundingParams; -import com.raytheon.viz.core.map.GeoUtil; -import com.vividsolutions.jts.geom.GeometryFactory; - -/** - * Sounding adapter for grid data, used for cloud height sampling - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 15, 2009            mschenke     Initial creation
- * Feb 15, 2013 1638       mschenke    Got rid of viz/edex topo classes 
- *                                     and moved into common
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public class GridSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(GridSoundingAdapter.class); - - /** Interface for getting point information */ - private IPointSounding pointSounding; - - /** Map used for skewt sounding generation */ - private Map> soundingMap; - - /** The SurfaceObsLocation used for skewt */ - private SurfaceObsLocation location; - - /** - * Skewt constructor - * - * @param pointSounding - * Object which will provide information on point location and - * name - */ - public GridSoundingAdapter(IPointSounding pointSounding) { - this.pointSounding = pointSounding; - soundingMap = new HashMap>(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.adapters.AbstractVerticalSoundingAdapter - * #createSoundings() - */ - @Override - public VerticalSounding[] createSoundings() { - long t0 = System.currentTimeMillis(); - List soundings = new ArrayList(); - try { - GridRecord sampleRecord = (GridRecord) objects[0]; - ISpatialObject spatial = sampleRecord.getSpatialObject(); - Point point = PointUtil.determineIndex( - pointSounding.getCoordinate(), spatial.getCrs(), - MapUtil.getGridGeometry(spatial)); - if (point.y < 0 || point.y >= spatial.getNy() || point.x < 0 - || point.x >= spatial.getNx()) { - statusHandler.handle(Priority.SIGNIFICANT, - "Point is outside bounds of grid", new VizException( - "Point is outside bounds of grid")); - return new VerticalSounding[0]; - } - String name = String.format("%s pt%s %s", - sampleRecord.getDatasetId(), pointSounding.getPointName(), - GeoUtil.formatCoordinate(pointSounding.getCoordinate())); - location = new SurfaceObsLocation(name); - location.setGeometry(new GeometryFactory() - .createPoint(pointSounding.getCoordinate())); - location.setLatitude(pointSounding.getCoordinate().y); - location.setLongitude(pointSounding.getCoordinate().x); - location.setElevation(new Double(TopoQuery.getInstance().getHeight( - pointSounding.getCoordinate())).intValue()); - - // TODO: Request data for a single point for all records, which is - // the fastest way to get data from the data cube. - DataCubeContainer.getDataRecords(Arrays.asList(objects), - Request.buildPointRequest(point), null); - for (PluginDataObject pdo : objects) { - IDataRecord[] rec = (IDataRecord[]) pdo.getMessageData(); - if (rec != null && rec.length > 0) { - float[] data = (float[]) rec[0].getDataObject(); - float val = data[0]; - addToSoundingMap((GridRecord) pdo, val); - } - } - for (DataTime time : soundingMap.keySet()) { - VerticalSounding sounding = new VerticalSounding(); - sounding.setDataTime(time); - sounding.setElevation(location.getElevation()); - sounding.setName(name); - sounding.setObsTime(time.getValidTime()); - sounding.setSpatialInfo((SurfaceObsLocation) location.clone()); - sounding.setStationId(location.getStationId()); - Map layerMap = soundingMap.get(time); - for (SoundingLayer layer : layerMap.values()) { - sounding.addLayer(layer); - } - - SoundingParams params = new SoundingParams(sounding); - sounding = params.getAnalysisData(); - sounding.checkSfcLayer(); - sounding.removeBelowSfcLayers(); - // Make sure that the surface layer is defined and all values - // are set to a value other than MISSING before adding it to the - // soundings list - SoundingLayer abv = sounding.get(1); - if (sounding.get(0).getTemperature() > SoundingLayer.NODATA - && abv.getTemperature() < SoundingLayer.NODATA) { - sounding.get(0).setTemperature( - (float) (Math.pow(sounding.get(0).getPressure() - / abv.getPressure(), 0.286) * abv - .getTemperature())); - } - if (sounding.get(0).getDewpoint() > SoundingLayer.NODATA - && abv.getDewpoint() < SoundingLayer.NODATA) { - sounding.get(0).setDewpoint(abv.getDewpoint()); - } - if (sounding.get(0).getWindU() > SoundingLayer.NODATA - && abv.getWindU() < SoundingLayer.NODATA) { - sounding.get(0).setWindU(abv.getWindU()); - } - if (sounding.get(0).getWindV() > SoundingLayer.NODATA - && abv.getWindV() < SoundingLayer.NODATA) { - sounding.get(0).setWindV(abv.getWindV()); - } - params = new SoundingParams(sounding); - sounding = params.getAnalysisData(); - sounding.checkSfcLayer(); - soundings.add(sounding); - } - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Error creating grib soundings", e); - } - System.out.println("Time to createSoundings = " - + (System.currentTimeMillis() - t0)); - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - /** - * Add record to the skewt sounding map - * - * @param record - * @param dataVal - * @throws VizException - */ - private void addToSoundingMap(GridRecord record, float dataVal) - throws VizException { - DataTime dt = record.getDataTime(); - Map layerMap = soundingMap.get(dt); - if (layerMap == null) { - layerMap = new HashMap(); - soundingMap.put(dt, layerMap); - } - - Double l1val = record.getLevel().getLevelonevalue(); - SoundingLayer layer = layerMap.get(l1val); - if (layer == null) { - layer = new SoundingLayer(); - layer.setPressure(l1val.floatValue()); - layerMap.put(l1val, layer); - } - String param = record.getParameter().getAbbreviation(); - - if ("T".equals(param)) { - layer.setTemperature(dataVal); - } else if ("GH".equals(param)) { - layer.setGeoHeight(dataVal); - } else if ("uW".equals(param)) { - layer.setWindU(dataVal); - } else if ("vW".equals(param)) { - layer.setWindV(dataVal); - } else if ("DpT".equals(param)) { - layer.setDewpoint(dataVal); - } - } - -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IPointSounding.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IPointSounding.java deleted file mode 100644 index 2ba16aaa78..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IPointSounding.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import com.vividsolutions.jts.geom.Coordinate; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 16, 2009            mschenke     Initial creation
- * 
- * 
- * - * @author mschenke - * @version 1.0 - */ - -public interface IPointSounding { - - public Coordinate getCoordinate(); - - public String getPointName(); - -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IVerticalSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IVerticalSoundingAdapter.java deleted file mode 100644 index 6189ae8e40..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/IVerticalSoundingAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import com.raytheon.uf.common.sounding.VerticalSounding; - -public interface IVerticalSoundingAdapter { - - /** - * - * @return - */ - VerticalSounding createVerticalSounding(); -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/POESSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/POESSoundingAdapter.java deleted file mode 100644 index 39e5de7aa0..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/POESSoundingAdapter.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.SI; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.poessounding.POESSounding; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.pointdata.PointDataContainer; -import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -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.core.exception.VizException; -import com.raytheon.viz.pointdata.PointDataRequest; - -/** - * - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 01, 2008 1747       jkorman     Initial creation
- * May 15, 2013 1869       bsteffen    Remove DataURI from goes/poes soundings.
- * 
- * 
- * - * @author jkorman - * @version 1.0 - */ - -public class POESSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(POESSoundingAdapter.class); - - private static UnitConverter pascalsToHectoPascals = SI.PASCAL - .getConverterTo(SI.HECTO(SI.PASCAL)); - - private static final String[] requiredParameters = new String[] { - "pressure", "temperature", "mixingRatio" }; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - POESSounding obs = (POESSounding) obj; - VerticalSounding sounding = createVerticalSounding(obs); - if (sounding != null) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(POESSounding obsData) { - VerticalSounding sounding = null; - - if (obsData != null) { - - Map rcMap = new HashMap(); - rcMap.put("location.stationId", new RequestConstraint(obsData - .getLocation().getStationId())); - rcMap.put( - "dataTime.refTime", - new RequestConstraint(TimeUtil.formatToSqlTimestamp(obsData - .getDataTime().getRefTime()))); - PointDataContainer container; - try { - container = PointDataRequest.requestPointDataAllLevels(null, - obsData.getPluginName(), requiredParameters, null, - rcMap); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving sounding", e1); - return sounding; - } - - if (container == null || container.getAllocatedSz() == 0) { - return sounding; - } - PointDataView pdv = container.readRandom(0); - - Number[] p = pdv.getNumberAllLevels("pressure"); - Number[] temp = pdv.getNumberAllLevels("temperature"); - Number[] mr = pdv.getNumberAllLevels("mixingRatio"); - - if (p != null) { - sounding = new VerticalSounding(); - SurfaceObsLocation location = obsData.getLocation(); - sounding.setSpatialInfo(location); - - sounding.setElevation(obsData.getElevation()); - sounding.setStationId(obsData.getStationId()); - sounding.setObsTime(obsData.getDataTime() - .getRefTimeAsCalendar()); - sounding.setDataTime(obsData.getDataTime()); - - sounding.setName(String.format("PoesBufr %.1f%c %.1f%c %s", - Math.abs(location.getLatitude()), (location - .getLatitude() >= 0 ? 'N' : 'S'), Math - .abs(location.getLongitude()), (location - .getLongitude() >= 0 ? 'E' : 'W'), obsData - .getStationId())); - - for (int i = 0; i < p.length; i++) { - Number level = p[i]; - if (level != null && level.intValue() != -9999) { - SoundingLayer layer = new SoundingLayer(); - - Integer n = level.intValue(); - layer - .setPressure((n != -9999) ? (float) pascalsToHectoPascals - .convert(n.doubleValue()) - : SoundingLayer.MISSING); - - float t = temp[i].floatValue(); - layer.setTemperature((t != -9999) ? t - : SoundingLayer.MISSING); - - // POES data doesn't contain dewpoint, but does have - // mixing ratio so - // we need to calculate the dewpoint from available - // data. - Double m = mr[i].doubleValue(); - if ((n != -9999) && (t != -9999) && (m != -9999)) { - - double dewPoint = WxMath.tempAtMixingRatio( - pascalsToHectoPascals.convert(n - .doubleValue()), m * 1000); - - layer.setDewpoint((float) dewPoint); - } else { - layer.setDewpoint(SoundingLayer.MISSING); - } - sounding.addLayer(layer); - } - } // for - } - } - return sounding; - } - -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/ProfilerSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/ProfilerSoundingAdapter.java deleted file mode 100644 index 90c5eb814c..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/ProfilerSoundingAdapter.java +++ /dev/null @@ -1,178 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataplugin.profiler.ProfilerObs; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.pointdata.PointDataContainer; -import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.status.StatusConstants; -import com.raytheon.uf.viz.sounding.Activator; - -/** - * - * Profiler sounding adapter - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 11, 2009 3953       jelkins     Initial creation
- * 
- * 
- * - * @author jelkins - * @version 1.0 - */ -public class ProfilerSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ProfilerSoundingAdapter.class); - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - ProfilerObs obs = (ProfilerObs) obj; - VerticalSounding sounding = createVerticalSounding(obs); - if (sounding != null) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(ProfilerObs record) { - VerticalSounding sounding = null; - - String[] requiredParameters = new String[] { "P", "height", - "uComponent", "vComponent" }; - - if (record != null) { - - Map numbers = getParameterNumberMap( - requiredParameters, record); - if (numbers == null) { - return sounding; - } - - if (numbers.get("P") != null) { - sounding = new VerticalSounding(); - SurfaceObsLocation location = record.getLocation(); - sounding.setSpatialInfo(location); - - sounding.setElevation(record.getElevation()); - sounding.setStationId(record.getStationId()); - sounding - .setObsTime(record.getDataTime().getRefTimeAsCalendar()); - sounding.setDataTime(record.getDataTime()); - - sounding.setName(String.format("Profiler %.1f%c %.1f%c %s", - Math.abs(location.getLatitude()), (location - .getLatitude() >= 0 ? 'N' : 'S'), Math - .abs(location.getLongitude()), (location - .getLongitude() >= 0 ? 'E' : 'W'), record - .getStationId())); - - for (int i = 0; i < numbers.get("P").length; i++) { - Number level = numbers.get("P")[i]; - if (level != null && level.intValue() != -9999) { - SoundingLayer layer = new SoundingLayer(); - - layer.setGeoHeight(getSoundingLayerValue(numbers - .get("height")[i])); - layer.setWindU(getSoundingLayerValue(numbers - .get("uComponent")[i])); - layer.setWindV(getSoundingLayerValue(numbers - .get("vComponent")[i])); - layer.setPressure(getSoundingLayerValue(numbers - .get("P")[i])); - - sounding.addLayer(layer); - } - } // for - } - } - return sounding; - } - - /** - * @param h - * @return - */ - private float getSoundingLayerValue(Number number) { - float value = number.floatValue(); - return (value != -9999) ? value : SoundingLayer.MISSING; - } - - /** - * @param requiredParameters2 - * @return - */ - private Map getParameterNumberMap( - String[] requiredParameters, ProfilerObs record) { - - Map rcMap = new HashMap(); - rcMap.put("dataURI", new RequestConstraint("" + record.getDataURI())); - PointDataContainer container; - try { - container = DataCubeContainer.getPointData(record.getPluginName(), - requiredParameters, rcMap); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving sounding", e1); - return null; - } - - if (container == null || container.getAllocatedSz() == 0) { - return null; - } - PointDataView pdv = container.readRandom(0); - - Map parameterNumberMap = new HashMap(); - - for (String parameter : requiredParameters) { - parameterNumberMap - .put(parameter, pdv.getNumberAllLevels(parameter)); - } - - return parameterNumberMap; - } -} diff --git a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/VwpSoundingAdapter.java b/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/VwpSoundingAdapter.java deleted file mode 100644 index 900ae9e988..0000000000 --- a/cave/com.raytheon.uf.viz.sounding/src/com/raytheon/uf/viz/sounding/adapters/VwpSoundingAdapter.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.viz.sounding.adapters; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.pointdata.PointDataContainer; -import com.raytheon.uf.common.pointdata.PointDataView; -import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.status.StatusConstants; -import com.raytheon.uf.viz.sounding.Activator; - -/** - * - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Descriptio
- * ------------ ---------- ----------- --------------------------
- * Jan 4, 2010            bsteffen     Initial creation
- * 
- * 
- * - * @author bsteffen - * @version 1.0 - */ -public class VwpSoundingAdapter extends AbstractVerticalSoundingAdapter { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(VwpSoundingAdapter.class); - - private static final String[] requiredParameters = new String[] { "P", - "uW", "vW", "GH", "latitude", "longitude", "stationId" }; - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.sounding.AbstractVerticalSoundingAdapter#createSoundings - * () - */ - @Override - public VerticalSounding[] createSoundings() { - ArrayList soundings = new ArrayList(); - for (PluginDataObject obj : objects) { - VerticalSounding sounding = createVerticalSounding(obj); - if (sounding != null && sounding.size() >= 5) { - soundings.add(sounding); - } - } - return soundings.toArray(new VerticalSounding[soundings.size()]); - } - - private VerticalSounding createVerticalSounding(PluginDataObject pdo) { - VerticalSounding sounding = null; - - if (pdo != null) { - Map rcMap = new HashMap(); - rcMap.put("dataURI", new RequestConstraint("" + pdo.getDataURI())); - PointDataContainer container; - try { - container = DataCubeContainer.getPointData(pdo.getPluginName(), - requiredParameters, rcMap); - } catch (VizException e1) { - statusHandler.handle(Priority.PROBLEM, - "Error retrieving sounding", e1); - return sounding; - } - - if (container == null || container.getAllocatedSz() == 0) { - return sounding; - } - PointDataView pdv = container.readRandom(0); - - Number[] p = pdv.getNumberAllLevels("P"); - Number[] uWind = pdv.getNumberAllLevels("uW"); - Number[] vWind = pdv.getNumberAllLevels("vW"); - Number[] gh = pdv.getNumberAllLevels("GH"); - Number lat = pdv.getNumber("latitude"); - Number lon = pdv.getNumber("longitude"); - String stationId = pdv.getString("stationId"); - if (p != null && p.length != 0) { - sounding = new VerticalSounding(); - sounding.setName("VWP " + stationId.toUpperCase()); - sounding.setObsTime(pdo.getDataTime().getRefTimeAsCalendar()); - sounding.setDataTime(pdo.getDataTime()); - SurfaceObsLocation obs = new SurfaceObsLocation(stationId); - obs.setLatitude(lat.doubleValue()); - obs.setLongitude(lon.doubleValue()); - sounding.setSpatialInfo(obs); - for (int i = 0; i < p.length; i++) { - Number level = p[i]; - if (level != null && level.intValue() != -9999) { - SoundingLayer layer = new SoundingLayer(); - Float g = gh[i].floatValue(); - layer.setGeoHeight((g != -9999) ? g * 30.48f - : SoundingLayer.MISSING); - layer.setPressure((level.floatValue() != -9999) ? level - .floatValue() : SoundingLayer.MISSING); - Float s = uWind[i].floatValue(); - layer - .setWindU((s != -9999) ? s - : SoundingLayer.MISSING); - - Float w = vWind[i].floatValue(); - layer - .setWindV((w != -9999) ? w - : SoundingLayer.MISSING); - // layer.setDewpoint(0); - // layer.setTemperature(0); - sounding.addLayer(layer); - } - } - } - } - return sounding; - } -} diff --git a/cave/com.raytheon.viz.skewT/.classpath b/cave/com.raytheon.viz.skewT/.classpath deleted file mode 100644 index 1fa3e6803d..0000000000 --- a/cave/com.raytheon.viz.skewT/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/cave/com.raytheon.viz.skewT/.project b/cave/com.raytheon.viz.skewT/.project deleted file mode 100644 index 0acf65ebe3..0000000000 --- a/cave/com.raytheon.viz.skewT/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.raytheon.viz.skewt - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/cave/com.raytheon.viz.skewT/.settings/org.eclipse.jdt.core.prefs b/cave/com.raytheon.viz.skewT/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 2fdb69ad35..0000000000 --- a/cave/com.raytheon.viz.skewT/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Thu Mar 26 10:53:12 CDT 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/cave/com.raytheon.viz.skewT/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.skewT/META-INF/MANIFEST.MF deleted file mode 100644 index 085c728a5c..0000000000 --- a/cave/com.raytheon.viz.skewT/META-INF/MANIFEST.MF +++ /dev/null @@ -1,32 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: SkewT Plug-in -Bundle-SymbolicName: com.raytheon.viz.skewt;singleton:=true -Bundle-Version: 1.12.1174.qualifier -Bundle-Activator: com.raytheon.viz.skewt.Activator -Bundle-Vendor: Raytheon -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization -Require-Bundle: org.eclipse.ui, - org.eclipse.core.runtime, - com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", - com.raytheon.uf.common.serialization;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", - com.raytheon.uf.viz.core;bundle-version="1.12.1174", - com.raytheon.viz.ui;bundle-version="1.12.1174", - com.raytheon.uf.viz.sounding;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1174", - com.raytheon.uf.viz.xy;bundle-version="1.12.1174", - com.raytheon.edex.meteolib;bundle-version="1.12.1174", - javax.measure;bundle-version="1.0.0" -Bundle-ActivationPolicy: lazy -Export-Package: com.raytheon.viz.skewt, - com.raytheon.viz.skewt.mockdata, - com.raytheon.viz.skewt.mouse, - com.raytheon.viz.skewt.rsc, - com.raytheon.viz.skewt.rscdata, - com.raytheon.viz.skewt.ui -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Import-Package: com.raytheon.viz.core diff --git a/cave/com.raytheon.viz.skewT/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.viz.skewT/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index d0f8098dee..0000000000 --- a/cave/com.raytheon.viz.skewT/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1,5 +0,0 @@ -com.raytheon.viz.skewt.rscdata.SkewTResourceData -com.raytheon.viz.skewt.rscdata.SkewTBkgResourceData -com.raytheon.viz.skewt.rscdata.GribSoundingSkewTResourceData -com.raytheon.viz.skewt.SkewTDescriptor -com.raytheon.viz.skewt.SkewtDisplay diff --git a/cave/com.raytheon.viz.skewT/build.properties b/cave/com.raytheon.viz.skewT/build.properties deleted file mode 100644 index 8f92da8356..0000000000 --- a/cave/com.raytheon.viz.skewT/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - config.xml diff --git a/cave/com.raytheon.viz.skewT/com.raytheon.viz.skewT.ecl b/cave/com.raytheon.viz.skewT/com.raytheon.viz.skewT.ecl deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/cave/com.raytheon.viz.skewT/config.xml b/cave/com.raytheon.viz.skewT/config.xml deleted file mode 100644 index 7d3a2cb9d0..0000000000 --- a/cave/com.raytheon.viz.skewT/config.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - -50.0 - 90.0 - -60.0 - 60.0 - - - 15.0 - 300.0 - 1050.0 - - diff --git a/cave/com.raytheon.viz.skewT/icons/skewt.gif b/cave/com.raytheon.viz.skewT/icons/skewt.gif deleted file mode 100644 index a5be5460ef..0000000000 Binary files a/cave/com.raytheon.viz.skewT/icons/skewt.gif and /dev/null differ diff --git a/cave/com.raytheon.viz.skewT/plugin.xml b/cave/com.raytheon.viz.skewT/plugin.xml deleted file mode 100644 index 1192439a4d..0000000000 --- a/cave/com.raytheon.viz.skewT/plugin.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/Activator.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/Activator.java deleted file mode 100644 index 8415999a06..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/Activator.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt; - -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import com.raytheon.uf.common.localization.exception.LocalizationException; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; - -/** - * The activator class controls the plug-in life cycle - */ -public class Activator extends AbstractUIPlugin { - - // The plug-in ID - public static final String PLUGIN_ID = "com.raytheon.viz.skewt"; - - // The shared instance - private static Activator plugin; - - private HierarchicalPreferenceStore prefs; - - /** - * The constructor - */ - public Activator() { - plugin = this; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext - * ) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext - * ) - */ - @Override - public void stop(BundleContext context) throws Exception { - plugin = null; - super.stop(context); - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static Activator getDefault() { - return plugin; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#getPreferenceStore() - */ - @Override - public HierarchicalPreferenceStore getPreferenceStore() { - try { - if (prefs == null) { - prefs = new HierarchicalPreferenceStore(this); - } - } catch (LocalizationException e) { - UFStatus.getHandler().handle( - Priority.PROBLEM, - "Error reading preference store: " - + e.getLocalizedMessage(), e); - } - - return prefs; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTDescriptor.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTDescriptor.java deleted file mode 100644 index 5e089e011c..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTDescriptor.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; -import com.raytheon.viz.core.graphing.GraphDescriptor; -import com.raytheon.viz.skewt.ui.SkewTConstants; - -/** - * Descriptor for SkewTs - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Dec 19, 2007            njensen     Initial creation
- * 
- * 
- * - * @author njensen - * @version 1.0 - */ -@XmlAccessorType(XmlAccessType.NONE) -@XmlType(name = "skewTDescriptor") -public class SkewTDescriptor extends GraphDescriptor { - - public SkewTDescriptor() { - this(new PixelExtent(SkewTConstants.skewTRectangle)); - } - - public SkewTDescriptor(PixelExtent pe) { - super(pe); - setTimeMatcher(new D2DTimeMatcher()); - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTEditor.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTEditor.java deleted file mode 100644 index 08ad316dc2..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewTEditor.java +++ /dev/null @@ -1,1373 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt; - -import java.util.ArrayList; -import java.util.List; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.SashForm; -import org.eclipse.swt.events.FocusAdapter; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.MouseTrackAdapter; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -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.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorSite; -import org.eclipse.ui.PartInitException; - -import com.raytheon.edex.meteoLib.WindComp; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.VerticalSounding; -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.IDisplayPane; -import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener; -import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.IInputHandler; -import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; -import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.uf.viz.core.rsc.ResourceList.AddListener; -import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener; -import com.raytheon.uf.viz.sounding.SoundingParams; -import com.raytheon.uf.viz.xy.map.IInsetMapContainer; -import com.raytheon.uf.viz.xy.map.IInsetMapContainer.InsetMapUtil; -import com.raytheon.uf.viz.xy.map.IInsetMapDisplayPaneContainer; -import com.raytheon.viz.skewt.mouse.SkewtMouseInspectAdapter; -import com.raytheon.viz.skewt.rsc.InteractiveSkewTResource; -import com.raytheon.viz.skewt.rsc.SkewTResource; -import com.raytheon.viz.skewt.rsc.SkewTResource.ISkewTDataChangedListener; -import com.raytheon.viz.skewt.ui.SkewtControlsDialog; -import com.raytheon.viz.ui.editor.AbstractEditor; -import com.raytheon.viz.ui.input.InputManager; -import com.raytheon.viz.ui.panes.PaneManager; -import com.raytheon.viz.ui.panes.VizDisplayPane; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * - * This class was merged with AbstractXyEditor so that AbstractXyEditor could go - * IMultiPaneEditor without affecting SkewT. - * - * SkewTEditor , 3 frames, SkewT, Hodo, and 24 Hour TempChange - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 29, 2008            dhladky     Initial creation
- * Dec 07, 2008            dhladky     Got rid of problematic View window, consolidated.
- * 
- * - * @author dhladky - * @version 1.0 - */ -public class SkewTEditor extends AbstractEditor implements AddListener, - RemoveListener, ISkewTDataChangedListener, - IRenderableDisplayChangedListener, IInsetMapDisplayPaneContainer { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(SkewTEditor.class); - - public static final String EDITOR_ID = "com.raytheon.viz.skewt.SkewTEditor"; - - private static UnitConverter metersToFeet = javax.measure.unit.SI.METER - .getConverterTo(NonSI.FOOT); - - private static UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND - .getConverterTo(NonSI.KNOT); - - private static UnitConverter kelvinToCelsius = SI.KELVIN - .getConverterTo(SI.CELSIUS); - - private static UnitConverter kelvinToFahrenheit = SI.KELVIN - .getConverterTo(NonSI.FAHRENHEIT); - - private static UnitConverter celsiusToFahrenheit = SI.CELSIUS - .getConverterTo(NonSI.FAHRENHEIT); - - private static UnitConverter centimetersToInches = SI.CENTIMETER - .getConverterTo(NonSI.INCH); - - private static final char degree = '\u00B0'; - - private static final char squared = '\u00B2'; - - private Table paramTable = null; - - // private Composite paramComp = null; - - private TableColumn paramLabelColumn = null; - - private TableColumn paramValueColumn = null; - - private static List rscList = new ArrayList(); - - private static SkewTResource displayedRsc = null; - - protected SkewtControlsDialog skewtControlsDialog = null; - - /** The plan is to make these read from some config file eventually */ - public static String[] generalParams = new String[] { "Precipitable Water", - "K-Index", "Total Totals", "SWEAT Index", - "Dry Microburst Potential", "Freezing Level", "Wet-bulb Zero HGT", - "0-6 KM AVG Wind", "0-6 KM Storm Relative Motion", - "0-3 KM Storm Relative Helicity", "Forecast Max Temp", - "Trigger Temp", "Soaring Index", "MDPI / WINDEX" }; - - /** The plan is to make these read from some config file eventually */ - public static String[] parcelParams = new String[] { "Parcel Pressure", - "Parcel Temp", "Parcel Dewpoint", "Convective Temp", - "Lifted Index", "CCL", "LCL", "LFC", "Max Hail Size", - "Max Vertical Velocity", "Equilibrium Level", - "Approximate Cloud Top", "+ Energy Above LFC", - "- Energy Below LFC", "Bulk Richardson Number" }; - - public String dialogTitle; - - private Composite baseComposite; - - private boolean manSelection = false; - - protected VizDisplayPane activeDisplayPane; - - protected VizDisplayPane graphPane; - - protected VizDisplayPane insetMap; - - /** The input manager */ - protected InputManager inputManager; - - protected boolean hasCornerMap = false; - - protected Composite parent; - - /** The renderable display object */ - protected IRenderableDisplay renderableDisplay; - - public SkewTEditor() { - addRenderableDisplayChangedListener(this); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets - * .Composite) - */ - @Override - public void createPartControl(Composite parent) { - if (renderableDisplay == null) { - renderableDisplay = new SkewtDisplay(); - } - - SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL); - FormData sfd = new FormData(); - sfd.left = new FormAttachment(0, 0); - sfd.top = new FormAttachment(0, 0); - sfd.bottom = new FormAttachment(100, 0); - sfd.right = new FormAttachment(100, 0); - sashForm.setLayoutData(sfd); - sashForm.SASH_WIDTH = 3; - - // baseComposite - baseComposite = new Composite(sashForm, SWT.NONE); - FormLayout bfl = new FormLayout(); - baseComposite.setLayout(bfl); - - // parameter composite - final Composite paramsComposite = new Composite(sashForm, SWT.NONE); - GridLayout gl2 = new GridLayout(1, false); - gl2.horizontalSpacing = 3; - gl2.verticalSpacing = 3; - gl2.marginHeight = 0; - gl2.marginWidth = 0; - paramsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, - true)); - paramsComposite.setLayout(gl2); - - paramTable = new Table(paramsComposite, SWT.BORDER | SWT.VIRTUAL); - GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); - data.heightHint = 200; - paramTable.setLayoutData(data); - - paramTable.setLinesVisible(true); - paramTable.setHeaderVisible(true); - - paramLabelColumn = new TableColumn(paramTable, SWT.NONE); - paramValueColumn = new TableColumn(paramTable, SWT.NONE); - paramValueColumn.setToolTipText("Click to select sounding"); - paramValueColumn.addSelectionListener(new SelectionAdapter() { - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse - * .swt.events.SelectionEvent) - */ - @Override - public void widgetSelected(SelectionEvent e) { - Menu menu = new Menu(paramsComposite); - if (rscList.size() == 0) { - MenuItem item = new MenuItem(menu, SWT.PUSH); - item.setText("No soundings loaded"); - } else { - for (SkewTResource rsc : rscList) { - MenuItem item = new MenuItem(menu, SWT.RADIO); - item.setText(SkewTEditor.this.getRscTitle(rsc)); - item.setData(rsc); - item.setSelection(rsc == displayedRsc); - item.addSelectionListener(new SelectionAdapter() { - - @Override - public void widgetSelected(SelectionEvent e) { - manSelection = true; - setDisplayedRsc((SkewTResource) e.widget - .getData()); - } - }); - } - } - Rectangle rect = paramsComposite.getBounds(); - Point pt = new Point(rect.x + rect.width - - paramValueColumn.getWidth(), rect.y); - pt = paramsComposite.getParent().toDisplay(pt); - menu.setLocation(pt); - menu.setVisible(true); - } - }); - inititializeTableValues(); - paramLabelColumn.pack(); - paramValueColumn.pack(); - // set the default splits - sashForm.setWeights(new int[] { 65, 35 }); - createPartControlParent(baseComposite); - registerListener(graphPane); - - } - - /* - * - * (non-Javadoc) - * - * @see org.eclipse.ui.part.WorkbenchPart#dispose() - */ - @Override - public void dispose() { - if (skewtControlsDialog != null) { - skewtControlsDialog.exit(); - } - super.dispose(); - } - - /** - * Perform a refresh asynchronously - * - */ - @Override - public void refresh() { - graphPane.refresh(); - if (insetMap != null) { - insetMap.refresh(); - } - - if (graphPane.getRenderableDisplay() instanceof SkewtDisplay) { - SkewtDisplay gp = (SkewtDisplay) graphPane.getRenderableDisplay(); - if (displayedRsc == null) { - if (gp.getRsc() instanceof SkewTResource - || gp.getRsc() instanceof InteractiveSkewTResource) { - displayedRsc = (SkewTResource) gp.getRsc(); - } - } else if ((gp.getRsc() instanceof SkewTResource || gp.getRsc() instanceof InteractiveSkewTResource) - && manSelection == false) { - setDisplayedRsc((SkewTResource) gp.getRsc()); - } - updateColumn(displayedRsc); - } - } - - /** - * Sets the General Parameters table - * - * @param paramTable - */ - private void inititializeTableValues() { - TableItem item; - item = new TableItem(paramTable, SWT.BORDER); - item.setText(0, "General Parameters"); - item.setText(1, ""); - item.setBackground(item.getDisplay() - .getSystemColor(SWT.COLOR_DARK_GRAY)); - item.setForeground(item.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - - for (int i = 0; i < generalParams.length; i++) { - item = new TableItem(paramTable, SWT.BORDER); - - item.setText(0, " " + generalParams[i] + " "); - item.setText(1, ""); - - } - - item = new TableItem(paramTable, SWT.BORDER); - item.setText(0, "Parcel Parameters"); - item.setText(1, ""); - item.setBackground(item.getDisplay() - .getSystemColor(SWT.COLOR_DARK_GRAY)); - item.setForeground(item.getDisplay().getSystemColor(SWT.COLOR_WHITE)); - - for (int i = 0; i < parcelParams.length; i++) { - item = new TableItem(paramTable, SWT.BORDER); - item.setText(0, " " + parcelParams[i] + " "); - item.setText(1, ""); - - } - } - - /* - * (non-Javadoc) - * - * @seecom.raytheon.viz.skewt.rsc.SkewTResource.ISkewTDataChangedListener# - * skewTResourceChanged(com.raytheon.viz.skewt.rsc.SkewTResource) - */ - @Override - public void skewTResourceChanged(SkewTResource rsc) { - if (rsc == displayedRsc) { - updateColumn(rsc); - - } else { - setDisplayedRsc(rsc); - } - if (insetMap != null) { - insetMap.refresh(); - } - } - - protected void setDisplayedRsc(SkewTResource rsc) { - displayedRsc = rsc; - updateColumn(rsc); - } - - protected SkewTResource getDisplayedRsc() { - return displayedRsc; - } - - /** - * @param rsc - * @return - */ - private String getRscTitle(final SkewTResource rsc) { - if (rsc == null) { - return ""; - } - String title = ""; - if (rsc.getDataTimes().length == 0) { - return "NO DATA"; - } - - DataTime dt = null; - dt = rsc.getDisplayedDate(); - if (dt == null) { - return title; - } - VerticalSounding sounding = rsc.getSoundingByDataTime( - rsc.getDisplayedDate()).getInterleavedData(); - - title = sounding.getName(); - String id = sounding.getStationId(); - if (title == null || title.isEmpty()) { - title = id; - } - if ("Interactive".equals(id)) { - title = id; - } - return title; - } - - private void updateColumn(final SkewTResource rsc) { - if (!paramTable.isDisposed()) { - - VizApp.runSync(new Runnable() { - @Override - public void run() { - paramValueColumn.setText(getRscTitle(rsc)); - if (rsc == null) { - for (TableItem item : paramTable.getItems()) { - item.setText(1, ""); - } - - return; - } - SoundingParams sp = rsc.getSoundingParameters(); - - if (sp == null || sp.getInterleavedData().size() == 0) { - for (TableItem item : paramTable.getItems()) { - int i = 0; - if (i != 0 && i != generalParams.length) { - item.setText(1, "N/A"); - } - i++; - } - return; - } - // general parameters - paramTable.getItem(1).setText(1, getPrecipWaterString(sp)); - paramTable.getItem(2).setText(1, getKIndexString(sp)); - paramTable.getItem(3).setText(1, getTotalTotalsString(sp)); - paramTable.getItem(4).setText(1, getSWEATIndexString(sp)); - paramTable.getItem(5).setText(1, - getConvectiveGustPotentialString(sp)); - paramTable.getItem(6).setText(1, getFreezeLevelString(sp)); - paramTable.getItem(7).setText(1, - getWetBulbZeroHeightString(sp)); - paramTable.getItem(8).setText(1, - getZeroTo6KmAvgWndString(sp)); - paramTable.getItem(9).setText(1, - getStormRelativeMotionString(sp)); - paramTable.getItem(10).setText(1, - getStormRelativeHelicityString(sp)); - paramTable.getItem(11).setText(1, getFcstMaxTempString(sp)); - paramTable.getItem(12).setText(1, getTriggerTempString(sp)); - paramTable.getItem(13) - .setText(1, getSoaringIndexString(sp)); - paramTable.getItem(14).setText(1, - getMDPIwindexParmsString(sp)); - - // parcel parameters - paramTable.getItem(16).setText(1, - getParcelStartPressureString(sp)); - paramTable.getItem(17).setText(1, - getParcelStartTempString(sp)); - paramTable.getItem(18).setText(1, - getParcelStartDewpointString(sp)); - paramTable.getItem(19).setText(1, - getConvectiveTempString(sp)); - paramTable.getItem(20).setText(1, getLiftedIndexString(sp)); - paramTable.getItem(21).setText(1, getCCLHeightString(sp)); - paramTable.getItem(22).setText(1, getLCLHeightString(sp)); - paramTable.getItem(23).setText(1, getLFCHeightString(sp)); - paramTable.getItem(24).setText(1, getHailString(sp)); - paramTable.getItem(25).setText(1, getMaxVertVelString(sp)); - paramTable.getItem(26).setText(1, getEQHeightString(sp)); - paramTable.getItem(27).setText(1, getCloudTopString(sp)); - paramTable.getItem(28).setText(1, getCAPEString(sp)); - paramTable.getItem(29).setText(1, getCINString(sp)); - paramTable.getItem(30).setText(1, getRichardsonString(sp)); - paramValueColumn.pack(); - } - }); - } - - } - - private void addColumn(SkewTResource rsc) { - rscList.add(rsc); - rsc.addListener(SkewTEditor.this); - setDisplayedRsc(rsc); - } - - /** - * Get rid of column - * - * @param index - */ - private void removeColumn(SkewTResource rsc) { - rsc.removeListener(SkewTEditor.this); - rscList.remove(rsc); - - if (displayedRsc == rsc) { - int n = rscList.size(); - if (n > 0) { - setDisplayedRsc(rscList.get(n - 1)); - } else { - setDisplayedRsc(null); - } - } - } - - /** - * Add the listenerList - * - * @param main - */ - private void registerListener(VizDisplayPane pane) { - synchronized (this) { - if (pane != null) { - try { - ResourceList rscList = pane.getRenderableDisplay() - .getDescriptor().getResourceList(); - // add the Editor as a resource listener - rscList.addPostAddListener(this); - rscList.addPostRemoveListener(this); - for (ResourcePair rp : rscList) { - notifyAdd(rp); - } - } catch (Exception e) { - statusHandler - .handle(Priority.PROBLEM, - "Error recovering Resource, Can't add listenerList", - e); - } - } - } - } - - protected void addCustomHandlers(InputManager manager) { - /** - * TODO: The skewt mouse inspect adapter should be added and live in a - * resource - */ - manager.registerMouseHandler(new SkewtMouseInspectAdapter()); - } - - @Override - public void notifyAdd(ResourcePair rp) throws VizException { - if (rp.getResource() instanceof SkewTResource) { - SkewTResource rsc = (SkewTResource) rp.getResource(); - addColumn(rsc); - } - } - - @Override - public void notifyRemove(ResourcePair rp) throws VizException { - if (rp.getResource() instanceof SkewTResource) { - SkewTResource rsc = (SkewTResource) rp.getResource(); - removeColumn(rsc); - } - } - - /** - * Add a resource listener on first pane - * - * @param SkewTResource - */ - public void addResource(SkewTResource str) { - if (str != null) { - // This is the way grib resources are added - graphPane.getRenderableDisplay().getDescriptor().getResourceList() - .add(str); - } - } - - /** - * @param rsc - * The resource to activate the dialog for. - * @param activate - * If true, create and activate, or if false, remove. - * @throws VizException - */ - public void showControlsDialog(SkewTResource rsc) throws VizException { - - if (skewtControlsDialog != null) { - closeControlDialog(); - } - final SkewTResource frsc = rsc; - Display.getDefault().asyncExec(new Runnable() { - - public void run() { - // skewtControlsDialog = SkewtControlsDialog.getInstance( - // new Shell(), frsc.getName(), - // (SkewtDisplay) displayPane[0].getRenderableDisplay()); - // skewtControlsDialog.open(); - skewtControlsDialog = SkewtControlsDialog.getInstance( - new Shell(), frsc.getName()); - skewtControlsDialog.open(); - } - }); - } - - /** - * Close param dialogs - */ - public void closeControlDialog() { - if (skewtControlsDialog.getShell() != null) { - skewtControlsDialog.close(); - skewtControlsDialog = null; - } - } - - private String getConvertedValue(String fmt, float value) { - if (value < SoundingLayer.NODATA) { - return String.format(fmt, value); - } - return "N/A"; - } - - private String getPrecipWaterString(SoundingParams sp) { - int n = sp.getTemperatures().length; - if (n == 0 || sp.getPressures()[0] - sp.getPressures()[n - 1] < 300) { - return "N/A"; - } - return getConvertedValue("%.2f in", sp.precipWater()); - } - - private String getKIndexString(SoundingParams sp) { - int n = sp.getTemperatures().length; - if (n <= 1 || sp.getPressures()[n - 1] > 500 - || sp.getPressures()[0] < 800 - || sp.getTemperatures()[1] > SoundingLayer.NODATA) { - return "N/A"; - } - return getConvertedValue("%.0f", sp.KIndex()); - } - - private String getTotalTotalsString(SoundingParams sp) { - int n = sp.getTemperatures().length; - if (n <= 1 || sp.getPressures()[n - 1] > 500 - || sp.getPressures()[0] < 800 - || sp.getTemperatures()[1] > SoundingLayer.NODATA) { - return "N/A"; - } - return getConvertedValue("%.0f", sp.Totals()); - } - - private String getSWEATIndexString(SoundingParams sp) { - float sweat = sp.sweatIdx(); - if (sweat >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d", (int) sweat); - } - - private String getConvectiveGustPotentialString(SoundingParams sp) { - switch (sp.gustPotential()) { - case 1: // (LOW LVL TOO MOIST) - return "1: GST < 30 kts"; - case 2: // (UPR LVL TOO STABLE) - return "2: GST < 30 kts"; - case 3: - return "3: GST 30-40 kts"; - case 4: - return "4: GST > 40 kts"; - default: - return "N/A"; - } - } - - private String getFreezeLevelString(SoundingParams sp) { - float frzgLvlZ = sp.frzgLvlZ(); - if (frzgLvlZ >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%.0f ft ASL", metersToFeet.convert(frzgLvlZ)); - } - - private String getWetBulbZeroHeightString(SoundingParams sp) { - float hgtWBZ = sp.hgtWBZ(); - if (hgtWBZ >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d ft ASL", (int) metersToFeet.convert(hgtWBZ)); - } - - private String getZeroTo6KmAvgWndString(SoundingParams sp) { - WindComp avgWind = sp.avgWind(); - - if (avgWind == null - || avgWind.getWindDirection() >= SoundingLayer.NODATA - || avgWind.getWindSpeed() >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d%c/%d kts", (int) avgWind.getWindDirection(), - degree, - (int) metersPerSecondToKnots.convert(avgWind.getWindSpeed())); - } - - private String getStormRelativeMotionString(SoundingParams sp) { - WindComp helicity = sp.helicity(); - - if (helicity == null - || helicity.getStormMotionDir() >= SoundingLayer.NODATA - || helicity.getStormMotionSpd() >= SoundingLayer.NODATA) { - return "N/A"; - } - float stormDir = helicity.getStormMotionDir(); - float stormSpd = helicity.getStormMotionSpd(); - return String.format("%d%c/%d kts", (int) stormDir, degree, - (int) stormSpd); - } - - private String getStormRelativeHelicityString(SoundingParams sp) { - WindComp helicity = sp.helicity(); - - if (helicity == null - || helicity.getStormRelativeHelicity() >= SoundingLayer.NODATA) { - return "N/A"; - } - - float _SRelHelicity = helicity.getStormRelativeHelicity(); - return String.format("%d m%c/s%c", (int) _SRelHelicity, squared, - squared); - } - - private String getFcstMaxTempString(SoundingParams sp) { - float maxTemp = sp.maxtemp(); - - if (maxTemp >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d%cC/%d%cF", - (int) kelvinToCelsius.convert(maxTemp), degree, - (int) kelvinToFahrenheit.convert(maxTemp), degree); - } - - private String getTriggerTempString(SoundingParams sp) { - float trigTemp = sp.triggerTemp_C(); - - if (trigTemp >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d%cC/%d%cF", (int) trigTemp, degree, - (int) celsiusToFahrenheit.convert(trigTemp), degree); - } - - private String getSoaringIndexString(SoundingParams sp) { - float soarIndex = sp.soarIndex(); - - if (soarIndex >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d ft/min", (int) soarIndex); - } - - private String getMDPIwindexParmsString(SoundingParams sp) { - float mdpi = sp.mdpi(); - float windex = sp.windex(); - - String s; - if (mdpi < SoundingLayer.NODATA) { - s = String.format("%.2f/", mdpi); - } else { - s = "NA/"; - } - - if (windex < SoundingLayer.NODATA) { - s += String.format("%.0f", windex); - } else { - s += "NA"; - } - - return s; - } - - private String getParcelStartPressureString(SoundingParams sp) { - float initParP = sp.initParP(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.pressLCL() == SoundingLayer.MISSING - || sp.hgtLCL() == SoundingLayer.MISSING - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (initParP >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d mb", (int) initParP); - } - - private String getParcelStartTempString(SoundingParams sp) { - float initParT_C = sp.initParT_C(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.pressLCL() == SoundingLayer.MISSING - || sp.hgtLCL() == SoundingLayer.MISSING - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (initParT_C >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d%cC/%d%cF", (int) initParT_C, degree, - (int) celsiusToFahrenheit.convert(initParT_C), degree); - } - - private String getParcelStartDewpointString(SoundingParams sp) { - float initParTd_C = sp.initParTd_C(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.pressLCL() == SoundingLayer.MISSING - || sp.hgtLCL() == SoundingLayer.MISSING - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (initParTd_C >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%d%cC/%d%cF", (int) initParTd_C, degree, - (int) celsiusToFahrenheit.convert(initParTd_C), degree); - } - - private String getConvectiveTempString(SoundingParams sp) { - float convTemp = sp.convTemp(); - if (convTemp >= SoundingLayer.NODATA) { - return "N/A"; - } - float tempCCL = sp.tempCCL(); - if (tempCCL == SoundingLayer.MISSING) { - return "N/A"; - } - - return String.format("%d%cC/%d%cF", - (int) kelvinToCelsius.convert(convTemp), degree, - (int) kelvinToFahrenheit.convert(convTemp), degree); - } - - private String getLiftedIndexString(SoundingParams sp) { - float liftedI = sp.liftedI(); - if (liftedI >= SoundingLayer.NODATA) { - return "N/A"; - } - - return String.format("%.1f", liftedI); - } - - private String getCCLHeightString(SoundingParams sp) { - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d ft ASL/ %d mb", - (int) metersToFeet.convert(sp.hgtCCL()), (int) sp.pressCCL()); - } - - private String getLCLHeightString(SoundingParams sp) { - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d ft ASL/ %d mb", - (int) metersToFeet.convert(sp.hgtLCL()), (int) sp.pressLCL()); - } - - private String getLFCHeightString(SoundingParams sp) { - float pLFC1 = sp.pLFC1(); - float zLFC1 = sp.zLFC1(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (zLFC1 >= SoundingLayer.NODATA) { - return "N/A"; - } - String s = String.format("%d ft ASL/ %d mb", - (int) metersToFeet.convert(zLFC1), (int) pLFC1); - - float pLFC2 = sp.pLFC2(); - float zLFC2 = sp.zLFC2(); - if (zLFC2 < SoundingLayer.NODATA) { - s += String.format("\n%d ft ASL/ %d mb", - (int) metersToFeet.convert(zLFC2), (int) pLFC2); - } - - return s; - } - - private String getHailString(SoundingParams sp) { - float hailSize = sp.hailSize(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (hailSize >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%.1f cm/%.1f in", hailSize, - centimetersToInches.convert(hailSize)); - } - - private String getMaxVertVelString(SoundingParams sp) { - float maxVVel = sp.maxVVel(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (maxVVel >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d m/s", (int) maxVVel); - } - - private String getEQHeightString(SoundingParams sp) { - float zEqLvl = sp.zEqLvl(); - float pEqLvl = sp.pEqLvl(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (zEqLvl >= SoundingLayer.NODATA || pEqLvl >= SoundingLayer.NODATA) { - return "N/A"; - } - return String.format("%d ft ASL/%d mb", - (int) metersToFeet.convert(zEqLvl), (int) pEqLvl); - } - - private String getCloudTopString(SoundingParams sp) { - float hgtCldTop = sp.hgtCldTop(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (hgtCldTop >= SoundingLayer.NODATA) { - return "N/A"; - } - return String - .format("%d ft ASL", (int) metersToFeet.convert(hgtCldTop)); - } - - private String getCAPEString(SoundingParams sp) { - float posBuoy = sp.posBuoy(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (posBuoy >= SoundingLayer.NODATA) { - return "N/A"; - } - if ((int) posBuoy == 0) { - return "NONE"; - } - return String.format("%d J/KG", (int) posBuoy); - } - - private String getCINString(SoundingParams sp) { - float negBuoy = sp.negBuoy(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (negBuoy >= SoundingLayer.NODATA) { - return "N/A"; - } - if ((int) negBuoy == 0) { - return "NONE"; - } - return String.format("%d J/KG", (int) negBuoy); - } - - private String getRichardsonString(SoundingParams sp) { - if (sp.zLFC1() >= SoundingLayer.NODATA - || sp.pEqLvl() >= SoundingLayer.NODATA) { - return "N/A"; - } - float richNum = sp.richNum(); - float elev = sp.getHeights()[0]; - if (elev > SoundingLayer.NODATA - || sp.initParT_C() > SoundingLayer.NODATA - || sp.pressLCL() > SoundingLayer.NODATA - || sp.hgtLCL() > SoundingLayer.NODATA - || sp.tempLCL() > SoundingLayer.NODATA - || sp.getTemperatures().length < 2 - || sp.getTemperatures()[0] > SoundingLayer.NODATA) { - return "N/A"; - } - if (richNum == 0 || richNum >= SoundingLayer.NODATA) { - return "NONE"; - } - return String.format("%.1f", richNum); - } - - // Methods copied from AbstractXyEditor Jan 18th, 2010 - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.editor.AbstractEditor#init(org.eclipse.ui.IEditorSite - * , org.eclipse.ui.IEditorInput) - */ - @Override - public void init(IEditorSite site, IEditorInput input) - throws PartInitException { - inputManager = new InputManager(this); - super.init(site, input); - this.renderableDisplay = displaysToLoad[0]; - if (renderableDisplay instanceof IInsetMapContainer - && ((IInsetMapContainer) renderableDisplay) - .getInsetMapLocation() != null) { - hasCornerMap = true; - } - } - - /** - * Copied from AbstractXyEditor's createPartControl when making SkewTEditor - * separate - * - * @param parent - */ - public void createPartControlParent(Composite parent) { - this.parent = parent; - parent.setLayout(new FormLayout()); - parent.addFocusListener(new FocusAdapter() { - @Override - public void focusLost(FocusEvent e) { - activeDisplayPane = graphPane; - } - }); - parent.addMouseTrackListener(new MouseTrackAdapter() { - @Override - public void mouseExit(MouseEvent e) { - activeDisplayPane = graphPane; - } - }); - try { - if (hasCornerMap) { - constructInsetMap(renderableDisplay); - } - Composite graphComposite = new Composite(parent, SWT.NONE); - graphComposite.setLayout(new FormLayout()); - graphComposite.setLayoutData(getFullFormData()); - graphPane = new VizDisplayPane(this, graphComposite, - renderableDisplay); - activeDisplayPane = graphPane; - graphPane.getCanvas().setLayoutData(getFullFormData()); - graphPane.getCanvas().addMouseTrackListener( - new MouseTrackAdapter() { - @Override - public void mouseEnter(MouseEvent e) { - activeDisplayPane = graphPane; - } - }); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error setting up xy editor", e); - } - graphPane.setRenderableDisplay(this.renderableDisplay); - addCustomHandlers(inputManager); - registerListeners(graphPane); - if (insetMap != null) { - registerListeners(insetMap); - } - - graphPane.setRenderableDisplay(this.renderableDisplay); - - contributePerspectiveActions(); - } - - private void registerListeners(IDisplayPane pane) { - pane.addListener(SWT.MouseUp, inputManager); - pane.addListener(SWT.MouseDown, inputManager); - pane.addListener(SWT.MouseMove, inputManager); - pane.addListener(SWT.MouseWheel, inputManager); - pane.addListener(SWT.MouseHover, inputManager); - pane.addListener(SWT.MouseDoubleClick, inputManager); - pane.addListener(SWT.KeyDown, inputManager); - pane.addListener(SWT.KeyUp, inputManager); - pane.addListener(SWT.MenuDetect, inputManager); - pane.addListener(SWT.MouseExit, inputManager); - } - - /** - * @param renderableDisplay - */ - private void constructInsetMap(IRenderableDisplay renderableDisplay) - throws VizException { - if (insetMap != null) { - insetMap.setRenderableDisplay(InsetMapUtil - .loadInsetMap(renderableDisplay)); - } else { - Composite insetParent = new Composite(this.parent, SWT.NONE); - insetParent.setLayout(new FormLayout()); - insetParent.setLayoutData(((IInsetMapContainer) renderableDisplay) - .getInsetMapLocation()); - insetMap = new VizDisplayPane(this, insetParent, - InsetMapUtil.loadInsetMap(renderableDisplay), true); - insetMap.getCanvas().setLayoutData(getFullFormData()); - insetMap.getCanvas().addMouseTrackListener(new MouseTrackAdapter() { - @Override - public void mouseEnter(MouseEvent e) { - activeDisplayPane = insetMap; - } - - @Override - public void mouseExit(MouseEvent e) { - activeDisplayPane = graphPane; - } - }); - } - } - - /** - * @return - */ - private static FormData getFullFormData() { - FormData fd = new FormData(); - fd.right = new FormAttachment(100, 0); - fd.left = new FormAttachment(0, 0); - fd.top = new FormAttachment(0, 0); - fd.bottom = new FormAttachment(100, 0); - return fd; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.editor.AbstractEditor#getDisplayPane() - */ - @Override - public IDisplayPane[] getDisplayPanes() { - return new IDisplayPane[] { activeDisplayPane }; - } - - @Override - public void registerMouseHandler(IInputHandler handler, - InputPriority priority) { - inputManager.registerMouseHandler(handler, priority); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.editor.AbstractEditor#registerMouseHandler(com.raytheon - * .viz.ui.mouse.IMouseHandler) - */ - @Override - public void registerMouseHandler(IInputHandler handler) { - inputManager.registerMouseHandler(handler); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.editor.AbstractEditor#unregisterMouseHandler(com. - * raytheon.viz.ui.mouse.IMouseHandler) - */ - @Override - public void unregisterMouseHandler(IInputHandler handler) { - inputManager.unregisterMouseHandler(handler); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.editor.AbstractEditor#translateClick(double, - * double) - */ - @Override - public Coordinate translateClick(double x, double y) { - double[] grid = getActiveDisplayPane().screenToGrid(x, y, 0); - - return new Coordinate(grid[0], grid[1], grid[2]); - } - - /* - * (non-Javadoc) - * - * @seecom.raytheon.viz.ui.editor.AbstractEditor#translateInverseClick(com. - * vividsolutions.jts.geom.Coordinate) - */ - @Override - public double[] translateInverseClick(Coordinate c) { - - if (Double.isNaN(c.z)) { - c.z = 0.0; - } - return getActiveDisplayPane().gridToScreen( - new double[] { c.x, c.y, c.z }); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.editor.AbstractEditor#getActiveDisplayPane() - */ - @Override - public IDisplayPane getActiveDisplayPane() { - return activeDisplayPane; - } - - @Override - public void setFocus() { - activeDisplayPane = graphPane; - activeDisplayPane.setFocus(); - } - - @Override - public void renderableDisplayChanged(IDisplayPane pane, - IRenderableDisplay newRenderableDisplay, DisplayChangeType type) { - if (pane == graphPane && hasCornerMap && type == DisplayChangeType.ADD) { - // the graph pane was updated, update the inset map - try { - constructInsetMap(newRenderableDisplay); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error reconstructing inset map", e); - } - } - } - - @Override - public void doSave(IProgressMonitor monitor) { - // TODO Auto-generated method stub - - } - - @Override - public void doSaveAs() { - // TODO Auto-generated method stub - - } - - @Override - public InputManager getMouseManager() { - return inputManager; - } - - @Override - public boolean isSaveAsAllowed() { - // TODO Auto-generated method stub - return false; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.editor.AbstractEditor#getNewPaneManager() - */ - @Override - protected PaneManager getNewPaneManager() { - return null; - } - - @Override - public IDisplayPane addPane(IRenderableDisplay renderableDisplay) { - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.xy.map.IInsetMapDisplayPaneContainer#getInsetPanes() - */ - @Override - public IDisplayPane[] getInsetPanes() { - return new IDisplayPane[] { insetMap }; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.xy.map.IInsetMapDisplayPaneContainer#getInsetPanes - * (com.raytheon.uf.viz.core.IDisplayPane) - */ - @Override - public IDisplayPane[] getInsetPanes(IDisplayPane pane) { - if (pane == graphPane) { - return getInsetPanes(); - } else { - return new IDisplayPane[] {}; - } - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewtDisplay.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewtDisplay.java deleted file mode 100644 index 1f2ea4dd51..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/SkewtDisplay.java +++ /dev/null @@ -1,371 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt; - -/** - * SkewTGraph plot the skewt temperature, dewpoint in addition to all background - * lines and wind data. - * - * Used extensive work from SkewTGraph and associated codebase. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 15 Nov 2007  #371       ebabin     Initial Coding
- * 27 Nov 2007  #371       ebabin     Updates from initial code.
- * 04Jan2007    #670       ebabin     Updated to include sounding location on inset map.
- * 07Jan2007    #673       ebabin     Fix moving of hodograph points.
- * 09Jan2007    #672       ebabin     Fix for w parameter on sampling.
- * 09Jan2007    #729       ebabin     Update for CAVE crashing on SkewT zoom.
- * 14Jan2007   #682        ebabin     Update for sampling bug. 
- * 15Jan2008           682 ebabin      Updated to remove non calculated parameters. 
- * 16Jan2008           682 ebabin      Updates for grib model traps on multiple loads. 
- * 28sep2008   #1529       dhladky     redone.
- * 12May2010   #1952       snaples    Cleaned up again after refactor.
- * 
- * 
- * - * @author ebabin - * @version 1.0 - */ - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; - -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; - -import com.raytheon.uf.common.serialization.ISerializableObject; -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.VizConstants; -import com.raytheon.uf.viz.core.datastructure.LoopProperties; -import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; -import com.raytheon.uf.viz.core.drawables.IDescriptor; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.globals.VizGlobalsManager; -import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.IResourceGroup; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.uf.viz.core.rsc.ResourceProperties; -import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; -import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay; -import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; -import com.raytheon.uf.viz.xy.map.IInsetMapContainer; -import com.raytheon.viz.core.graphing.WGraphics; -import com.raytheon.viz.skewt.rsc.SkewTBackgroundResource; -import com.raytheon.viz.skewt.rsc.SkewTResource; -import com.raytheon.viz.skewt.rscdata.SkewTBkgResourceData; -import com.raytheon.viz.skewt.ui.HodoBackground; -import com.raytheon.viz.skewt.ui.SkewTConstants; -import com.raytheon.viz.skewt.ui.SkewtBackground; -import com.raytheon.viz.skewt.ui.TempChangeBackground; -import com.raytheon.viz.ui.EditorUtil; -import com.vividsolutions.jts.geom.GeometryFactory; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.NONE) -public class SkewtDisplay extends AbstractRenderableDisplay implements - ID2DRenderableDisplay, IInsetMapContainer, ISerializableObject { - - /** The magnification */ - @XmlAttribute - protected double magnification = ((Double) VizGlobalsManager - .getCurrentInstance().getPropery(VizConstants.MAGNIFICATION_ID)) - .doubleValue(); - - /** The density */ - @XmlAttribute - protected double density = ((Double) VizGlobalsManager.getCurrentInstance() - .getPropery(VizConstants.DENSITY_ID)).doubleValue(); - - /** The current display scale */ - @XmlAttribute - protected String scale = (String) VizGlobalsManager.getCurrentInstance() - .getPropery(VizConstants.SCALE_ID); - - private static GeometryFactory gf = new GeometryFactory(); - - private PaintProperties paintProps = null; - - private IGraphicsTarget target = null; - - private SkewTBackgroundResource bkgRsc; - - private AbstractVizResource rsc; - - /** - * Constructor - */ - public SkewtDisplay() { - this(new PixelExtent(SkewTConstants.skewTRectangle)); - } - - private SkewtDisplay(PixelExtent pixelExtent) { - super(pixelExtent, new SkewTDescriptor(pixelExtent)); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.drawables.AbstractRenderableDisplay#setDescriptor - * (com.raytheon.uf.viz.core.drawables.IDescriptor) - */ - @Override - public void setDescriptor(IDescriptor desc) { - super.setDescriptor(desc); - - if (!(desc.getTimeMatcher() instanceof D2DTimeMatcher)) { - desc.setTimeMatcher(new D2DTimeMatcher()); - } - } - - @Override - public void paint(IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - super.paint(target, paintProps); - - this.target = target; - this.paintProps = paintProps; - - // If no loop properties, use the default values - LoopProperties loopProperties = paintProps.getLoopProperties(); - if (loopProperties == null) { - loopProperties = new LoopProperties(); - } - - drawTheData(target, paintProps); - } - - /** - * Draws the data on the screen. - * - * @throws VizException - */ - protected void drawTheData(IGraphicsTarget target, - PaintProperties paintProps) throws VizException { - ArrayList resourceList = new ArrayList( - descriptor.getResourceList()); - PaintProperties myProps = new PaintProperties(paintProps); - - for (ResourcePair pair : resourceList) { - if (pair.getProperties().isVisible()) { - rsc = pair.getResource(); - if (rsc != null) { - myProps = calcPaintDataTime(myProps, rsc); - - if (rsc instanceof SkewTResource) { - ((SkewTResource) rsc).setDisplay(this); - } - rsc.paint(target, myProps); - } - } - } - } - - /** - * @return the rsc - */ - public AbstractVizResource getRsc() { - return rsc; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.AbstractSkewTDisplay#getHodoWorld() - */ - public WGraphics getHodoWorld() { - return getHodoBackground().getWorld(); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.AbstractSkewTDisplay#getSkewTWorld() - */ - public WGraphics getSkewTWorld() { - return getSkewTBackground().getWorld(); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.AbstractSkewTDisplay#getTempChangeWorld() - */ - public WGraphics getTempChangeWorld() { - return getTempChangeBackground().getWorld(); - } - - public GeometryFactory getGeometry() { - return gf; - } - - public IGraphicsTarget getTarget() { - return target; - } - - public PaintProperties getPaintProperties() { - return paintProps; - } - - public SkewtBackground getSkewTBackground() { - return bkgRsc.getSkewTBackground(); - } - - public HodoBackground getHodoBackground() { - return bkgRsc.getHodoBackground(); - } - - public TempChangeBackground getTempChangeBackground() { - return bkgRsc.getTempChangeBackground(); - } - - @Override - public double getDensity() { - return density; - } - - @Override - public double getMagnification() { - return magnification; - } - - @Override - public String getScale() { - return scale; - } - - @Override - public void setDensity(double density) { - target.setNeedsRefresh(true); - this.density = density; - List rps = new ArrayList( - descriptor.getResourceList()); - for (int i = 0; i < rps.size(); i++) { - AbstractVizResource resource = rps.get(i).getResource(); - if (resource != null) { - if (resource instanceof IResourceGroup) { - rps.addAll(((IResourceGroup) resource).getResourceList()); - } - if (resource.hasCapability(DensityCapability.class)) { - resource.getCapability(DensityCapability.class).setDensity( - density); - } - } - } - } - - @Override - public void setMagnification(double magnification) { - target.setNeedsRefresh(true); - this.magnification = magnification; - List rps = new ArrayList( - descriptor.getResourceList()); - for (int i = 0; i < rps.size(); i++) { - AbstractVizResource resource = rps.get(i).getResource(); - if (resource != null) { - if (resource instanceof IResourceGroup) { - rps.addAll(((IResourceGroup) resource).getResourceList()); - } - if (resource.hasCapability(MagnificationCapability.class)) { - resource.getCapability(MagnificationCapability.class) - .setMagnification(magnification); - } - } - } - } - - @Override - public void setScale(String scale) { - this.scale = scale; - } - - public SkewTEditor getEditor() { - try { - return (SkewTEditor) EditorUtil.getActiveEditor(); - } catch (Exception e) { - return null; - } - } - - @Override - public void clear() { - super.clear(); - IWorkbenchPage page = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - page.closeEditor(getEditor(), false); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.xy.map.IInsetMapContainer#getInsetMapLocation() - */ - @Override - public FormData getInsetMapLocation() { - FormData fd = new FormData(); - fd.right = new FormAttachment(15, 0); - fd.left = new FormAttachment(0, 0); - fd.top = new FormAttachment(0, 0); - fd.bottom = new FormAttachment(10, 0); - return fd; - } - - @Override - protected void customizeResourceList(ResourceList resourceList) { - resourceList.add(ResourcePair - .constructSystemResourcePair(legendRscData)); - resourceList.add(ResourcePair - .constructSystemResourcePair(samplingRscData)); - - LoadProperties loadProperties = new LoadProperties(); - ColorableCapability colorable = new ColorableCapability(); - colorable.setColor(SkewTConstants.backgroundColor); - loadProperties.getCapabilities().addCapability(colorable); - bkgRsc = new SkewTBackgroundResource(new SkewTBkgResourceData(), - loadProperties); - ResourceProperties props = new ResourceProperties(); - props.setVisible(true); - props.setMapLayer(true); - ResourcePair rp = new ResourcePair(); - rp.setResource(bkgRsc); - rp.setProperties(props); - rp.setLoadProperties(bkgRsc.getLoadProperties()); - resourceList.add(rp); - } - -} \ No newline at end of file diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mockdata/UpperAirRepository.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mockdata/UpperAirRepository.java deleted file mode 100644 index ee4e7b57ac..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mockdata/UpperAirRepository.java +++ /dev/null @@ -1,230 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.mockdata; - -import java.util.HashMap; -import java.util.Map; - -import com.raytheon.uf.common.sounding.VerticalSounding; - -/** - * This class implements an Upper Air sounding repository for test and demo - * purposes. Current data includes soundings for Valley, Nebraska and Jackson, - * Mississippi for Sept. 22, 2006 at 12Z. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 06 Nov 2006             jkorman     Initial Coding
- * 
- * - * @author jkorman - * @version 1.0 - */ -public class UpperAirRepository { - // private static final int SFC = LayerType.SURFACE.ordinal(); - - // private static final int MANP = LayerType.MAN_PRESSURE.ordinal(); - - // private static final int SIGP = LayerType.SIG_PRESSURE.ordinal(); - - // private static final int SIGW = LayerType.SIG_WIND.ordinal(); - - // private static final int TROP = LayerType.TROPOPAUSE.ordinal(); - - // private static final int MAXW = LayerType.MAX_WIND.ordinal(); - - public static final double INVALID = -9999; - - public static final double MISSING = -9998; - - // No reported value for this type of layer - public static final double NREPORT = -9997; - - public static final double FENCE = -9900; - - /** - * Source data for KJAN, 72235 20060922:12Z - * - * Currently the pilot data is not part of the sounding. - * - * USUS44 KJAN 221223 MANJAN 72235 TTAA 72121 72235 99000 24416 18006 00089 - * ///// ///// 92772 21205 20540 85503 17218 22044 70136 09040 23538 50584 - * 07191 24532 40754 183// 25532 30962 35377 25047 25086 43772 24560 20232 - * 54767 24069 15412 65563 25567 10653 71161 24543 88125 71361 25061 77182 - * 25075 41112 51515 10164 00051 10194 20036 22041= - * - * UMUS44 KJAN 221226 SGLJAN 72235 TTBB 72120 72235 00000 24416 11985 23605 - * 22889 20018 33779 13049 44764 12864 55739 10660 66734 10222 77725 09213 - * 88716 09656 99706 09024 11689 08858 22663 06658 33652 06069 44643 05461 - * 55618 02656 66589 00260 77585 00156 88582 00360 99579 00556 11569 01756 - * 22550 03158 33528 04590 44500 07191 55397 18787 66324 31579 77230 48969 - * 88120 71561 99100 71161 31313 05102 81103 41414 66400= - * - * PPBB 72120 72235 90012 18006 19033 20037 90346 21042 21544 22042 90789 - * 22042 22042 22539 91124 24036 24031 23532 916// 23038 9205/ 24535 25532 - * 93035 25031 25053 24559 9425/ 24574 25569 9504/ 25061 25046= - * - */ - // private static final String icaoKJAN = "KJAN"; - // private static final String bsnKJAN = "72235"; - // private static double[][] dataKJAN = { - // { SFC, 1000, 101, 244, 16, 180, 06, }, - // { SIGP, 985, NREPORT, 236, 5, NREPORT, NREPORT, }, - // { MANP, 925, 772, 212, 5, 205, 40, }, - // { SIGP, 889, NREPORT, 200, 18, NREPORT, NREPORT, }, - // { MANP, 850, 1503, 172, 18, 220, 44, }, - // { SIGP, 779, NREPORT, 130, 49, NREPORT, NREPORT, }, - // { SIGP, 764, NREPORT, 128, 64, NREPORT, NREPORT, }, - // { SIGP, 739, NREPORT, 106, 60, NREPORT, NREPORT, }, - // { SIGP, 734, NREPORT, 102, 22, NREPORT, NREPORT, }, - // { SIGP, 725, NREPORT, 92, 13, NREPORT, NREPORT, }, - // { SIGP, 716, NREPORT, 96, 56, NREPORT, NREPORT, }, - // { SIGP, 706, NREPORT, 90, 24, NREPORT, NREPORT, }, - // { MANP, 700, 3136, 90, 40, 235, 38, }, - // { SIGP, 689, NREPORT, 88, 58, NREPORT, NREPORT, }, - // { SIGP, 663, NREPORT, 66, 58, NREPORT, NREPORT, }, - // { SIGP, 652, NREPORT, 60, 69, NREPORT, NREPORT, }, - // { SIGP, 643, NREPORT, 54, 61, NREPORT, NREPORT, }, - // { SIGP, 618, NREPORT, 26, 56, NREPORT, NREPORT, }, - // { SIGP, 589, NREPORT, 2, 60, NREPORT, NREPORT, }, - // { SIGP, 585, NREPORT, -1, 56, NREPORT, NREPORT, }, - // { SIGP, 582, NREPORT, -3, 60, NREPORT, NREPORT, }, - // { SIGP, 579, NREPORT, -5, 56, NREPORT, NREPORT, }, - // { SIGP, 569, NREPORT, -17, 56, NREPORT, NREPORT, }, - // { SIGP, 550, NREPORT, -31, 58, NREPORT, NREPORT, }, - // { SIGP, 528, NREPORT, -45, 90, NREPORT, NREPORT, }, - // { MANP, 500, 5840, -71, 91, 245, 32, }, - // { MANP, 400, 7540, -183, MISSING, 255, 32, }, - // { SIGP, 397, NREPORT, -187, 87, NREPORT, NREPORT, }, - // { SIGP, 324, NREPORT, -315, 79, NREPORT, NREPORT, }, - // { MANP, 300, 9620, -353, 77, 250, 47, }, - // { MANP, 250, 10860, -437, 72, 245, 60, }, - // { SIGP, 230, NREPORT, -489, 69, NREPORT, NREPORT, }, - // { MANP, 200, 12320, -547, 67, 240, 69, }, - // { MANP, 150, 14120, -655, 63, 255, 67, }, - // { TROP, 125, NREPORT, -713, 61, 250, 61, }, - // { SIGP, 120, NREPORT, -715, 61, NREPORT, NREPORT, }, - // { MANP, 100, 16530, -711, 61, 245, 43, } }; - /** - * Source data for KOAX, 72558 20060922:12Z - * - * Currently the pilot data is not part of the sounding. - * - * USUS43 KOAX 221214 MANOAX 72558 TTAA 72121 72558 99951 14016 22512 00578 - * ///// ///// 92583 12412 23524 85288 08610 26028 70874 00208 25031 50551 - * 14557 24545 40716 27158 23537 30917 43141 21526 25037 53128 22522 20183 - * 48972 24043 15371 50176 23538 10633 53775 23025 88245 54128 23026 77999 - * 51515 10164 00004 10194 25026 25027= - * - * UMUS43 KOAX 221215 SGLOAX 72558 TTBB 72120 72558 00951 14016 11850 08610 - * 22792 06434 33676 01903 44670 00915 55612 03925 66597 04156 77512 13924 - * 88508 14156 99474 17159 11458 19350 22441 21356 33354 33962 44343 35556 - * 55319 39958 66281 46518 77245 54128 88228 48160 99209 49569 11172 50376 - * 22122 51175 33110 55974 44100 53775 31313 45202 81107 41414 855//= - * - * PPBB 72120 72558 90023 22512 24530 25530 90467 26028 25023 24525 9089/ - * 24527 25029 91246 25538 25045 24543 92056 23544 23534 23533 93013 21526 - * 21525 22018 9357/ 23032 23042 9402/ 24538 23039 9503/ 23025 22523= - */ - // private static final String icaoKOAX = "KOAX"; - // private static final String bsnKOAX = "72558"; - // private static double[][] dataKOAX = { - // { SFC, 951, 350, 140, 16, 225, 12, }, - // { MANP, 1000, 578, MISSING, MISSING, MISSING, MISSING, }, - // { SIGP, 951, NREPORT, 140, 16, NREPORT, NREPORT, }, - // { MANP, 925, 583, 124, 12, 235, 24, }, - // { MANP, 850, 1288, 86, 10, 260, 28, }, - // { SIGP, 792, NREPORT, 64, 34, NREPORT, NREPORT, }, - // { MANP, 700, 2874, 2, 8, 250, 31, }, - // { SIGP, 676, NREPORT, -19, 3, NREPORT, NREPORT, }, - // { SIGP, 670, NREPORT, -9, 15, NREPORT, NREPORT, }, - // { SIGP, 612, NREPORT, -39, 25, NREPORT, NREPORT, }, - // { SIGP, 597, NREPORT, -41, 56, NREPORT, NREPORT, }, - // { SIGP, 512, NREPORT, -139, 24, NREPORT, NREPORT, }, - // { SIGP, 508, NREPORT, -141, 56, NREPORT, NREPORT, }, - // { MANP, 500, 5510, -145, 57, 245, 45, }, - // { SIGP, 474, NREPORT, -171, 59, NREPORT, NREPORT, }, - // { SIGP, 458, NREPORT, -193, 50, NREPORT, NREPORT, }, - // { SIGP, 441, NREPORT, -213, 56, NREPORT, NREPORT, }, - // { MANP, 400, 7160, -271, 58, 235, 37, }, - // { SIGP, 354, NREPORT, -339, 62, NREPORT, NREPORT, }, - // { SIGP, 343, NREPORT, -355, 56, NREPORT, NREPORT, }, - // { SIGP, 319, NREPORT, -399, 58, NREPORT, NREPORT, }, - // { MANP, 300, 9170, -431, 41, 215, 26, }, - // { SIGP, 281, NREPORT, -465, 18, NREPORT, NREPORT, }, - // { MANP, 250, 10370, -531, 28, 225, 22, }, - // { TROP, 245, NREPORT, -541, 28, 230, 26, }, - // { SIGP, 228, NREPORT, -481, 60, NREPORT, NREPORT, }, - // { SIGP, 209, NREPORT, -495, 69, NREPORT, NREPORT, }, - // { MANP, 200, 11830, -489, 72, 240, 43, }, - // { SIGP, 172, NREPORT, -503, 76, NREPORT, NREPORT, }, - // { MANP, 150, 13710, -501, 76, 235, 38, }, - // { SIGP, 122, NREPORT, -511, 75, NREPORT, NREPORT, }, - // { SIGP, 110, NREPORT, -559, 74, NREPORT, NREPORT, }, - // { MANP, 100, 16330, -537, 75, 230, 25, }, }; - private static Map soundings = null; - - /** - * Retrieve a VerticalSounding instance corresponding to the specified - * station id. Returns a null reference if no data is available to the - * requested data. - * - * @param stationId - * A station identifier. The identifier may be either an ICAO - * (KJAN) or WMO Block Station Number (72235). - * @return The VerticalSounding instance, or null if not found. - */ - public static VerticalSounding getSounding(String stationId) { - if (soundings == null) { - createSoundingData(); - } - - VerticalSounding sounding = null; - - if (soundings.containsKey(stationId)) { - sounding = soundings.get(stationId); - } - return sounding; - } - - /** - * Create the mock sounding data. - */ - private static void createSoundingData() { - VerticalSounding s = null; - soundings = new HashMap(); - - s = new VerticalSounding(); - - s.setStationId("72558"); - // s = new VerticalSounding(icaoKJAN, dataKJAN, Calendar.getInstance() - // .getTime(), 32.31972, -90.0775); - // soundings.put(bsnKJAN, s); - // soundings.put(icaoKJAN, s); - - // s = new VerticalSounding(icaoKOAX, dataKOAX, Calendar.getInstance() - // .getTime(), 41.3166, -96.366); - // soundings.put(bsnKOAX, s); - // soundings.put(icaoKOAX, s); - } -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mouse/SkewtMouseInspectAdapter.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mouse/SkewtMouseInspectAdapter.java deleted file mode 100644 index 1320634c94..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/mouse/SkewtMouseInspectAdapter.java +++ /dev/null @@ -1,305 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt.mouse; - -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; - -import com.raytheon.uf.viz.core.IDisplayPaneContainer; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.viz.skewt.SkewTDescriptor; -import com.raytheon.viz.skewt.SkewtDisplay; -import com.raytheon.viz.skewt.rsc.InteractiveSkewTResource; -import com.raytheon.viz.ui.EditorUtil; -import com.raytheon.viz.ui.input.InputAdapter; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * Mouse inspect adapter for graphs - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Oct 18, 2007            njensen     Initial creation
- * 20Nov2007               ebabin      Added support for middle click resource (editable)
- * 30Sept2008              dhladky     Re-worked some.
- * 
- * 
- * - * @author njensen - */ -public class SkewtMouseInspectAdapter extends InputAdapter { - - public enum Mode { - CREATE, MOVE_LINE, MOVE_POINT, PAN, HOVER - }; - - private Display display; - - private Cursor cross; - - private Cursor hand; - - private Cursor arrow; - - private Coordinate coordinateFound = null; - - private Mode mode = Mode.CREATE; - - /** The last mouse position - x */ - private int lastMouseX = -1; - - /** The last mouse position - y */ - private int lastMouseY = -1; - - private int zoomIndex = 0; - - private SkewtDisplay st = null; - - private InteractiveSkewTResource rsc = null; - - public SkewtMouseInspectAdapter() { - display = Display.getCurrent(); - cross = display.getSystemCursor(SWT.CURSOR_SIZEALL); - hand = display.getSystemCursor(SWT.CURSOR_HAND); - arrow = display.getSystemCursor(SWT.CURSOR_ARROW); - } - - @Override - public boolean handleMouseDown(int x, int y, int mouseButton) { - IDisplayPaneContainer editor = EditorUtil.getActiveVizContainer(); - if (editor == null) { - return false; - } - Coordinate c = editor.translateClick(x, y); - if (getSkewtDisplay() == null) { - return false; - } - st = getSkewtDisplay(); - ResourceList rl = st.getDescriptor().getResourceList(); - Iterator it = rl.iterator(); - while (it.hasNext()) { - ResourcePair rp = (ResourcePair) it.next(); - if (rp.getResource() instanceof InteractiveSkewTResource) { - rsc = (InteractiveSkewTResource) rp.getResource(); - break; - } - } - - if (mouseButton == 2) { - // notifyResourceMiddleClicked(x, y); - if (rsc != null && rsc.isEditable() == true - && rsc.isPoint(c) == true) { - rsc.removeLayer(rsc.getEp()); - } - } - - else if (mouseButton == 1) { - if (rsc != null && rsc.isEditable() == true - && rsc.isPoint(c) == true) { - mode = Mode.MOVE_POINT; - rsc.getSelectedPoint(c); - } else { - mode = Mode.PAN; - } - changeMouse(mode); - } else { - if (rsc != null && rsc.isEditable() == true - && rsc.isPoint(c) == true) { - mode = Mode.MOVE_POINT; - } else if (rsc != null && rsc.isEditable() == true - && rsc.isPoint(c) == false) { - rsc.addLayer(c); - mode = Mode.CREATE; - } - changeMouse(mode); - return false; - } - editor.refresh(); - - return false; - } - - public boolean handleMouseDownMove(int x, int y, int button) { - IDisplayPaneContainer editor = EditorUtil.getActiveVizContainer(); - if (editor == null) { - return false; - } - boolean mouse = false; - - if (getSkewtDisplay() == null) { - mouse = false; - } else { - st = getSkewtDisplay(); - ResourceList rl = st.getDescriptor().getResourceList(); - Iterator it = rl.iterator(); - while (it.hasNext()) { - ResourcePair rp = (ResourcePair) it.next(); - if (rp.getResource() instanceof InteractiveSkewTResource) { - rsc = (InteractiveSkewTResource) rp.getResource(); - break; - } else { - break; - } - } - } - if (button != 1) { - mouse = false; - } - - if (mode == Mode.PAN) { - changeMouse(mode); - mouse = false; - } - - if (mode == Mode.MOVE_POINT) { - Coordinate c = editor.translateClick(x, y); - changeMouse(mode); - rsc.moveMousePoint(c); - lastMouseX = x; - lastMouseY = y; - editor.refresh(); - mouse = true; - } - - return mouse; - } - - @Override - public boolean handleMouseHover(int x, int y) { - // try { - // if (!mode.name().equals(Mode.MOVE_POINT)) { - // if (getSkewtDisplay().isInsideEndpoint(lastMouseX, lastMouseY) != - // null) { - // coordinateFound = getSkewtDisplay().isInsideEndpoint( - // lastMouseX, lastMouseY); - // this.mode = Mode.HOVER; - // } else { - // this.mode = Mode.CREATE; - // - // } - // } - // } catch (NullPointerException npe) { - mode = Mode.CREATE; - // } - - return true; - } - - @Override - public boolean handleMouseUp(int x, int y, int mouseButton) { - IDisplayPaneContainer editor = EditorUtil.getActiveVizContainer(); - if (editor == null) { - return false; - } - boolean mouse = false; - if (getSkewtDisplay() == null) { - mouse = false; - } else { - st = getSkewtDisplay(); - ResourceList rl = st.getDescriptor().getResourceList(); - Iterator it = rl.iterator(); - while (it.hasNext()) { - ResourcePair rp = (ResourcePair) it.next(); - if (rp.getResource() instanceof InteractiveSkewTResource) { - rsc = (InteractiveSkewTResource) rp.getResource(); - break; - } - } - } - - if (mouseButton == 1) { - // getSkewtDisplay().handleMouseUp(); - } else if (mouseButton == 2) { - - double[] grid = editor.getActiveDisplayPane().screenToGrid(x, y, 0); - lastMouseX = (int) grid[0]; - lastMouseY = (int) grid[1]; - - // if (getSkewtDisplay().isInsideEndpoint(lastMouseX, lastMouseY) != - // null) { - // getSkewtDisplay().deleteLayer(); - // } - } - - mode = Mode.CREATE; - changeMouse(mode); - // editor.refresh(); - - return false; - } - - /** - * Gets the display you are using - * - * @return SkewTDisplay - */ - private SkewtDisplay getSkewtDisplay() { - IDisplayPaneContainer editor = EditorUtil.getActiveVizContainer(); - if (editor == null) { - return null; - } - if (editor.getActiveDisplayPane().getDescriptor() instanceof SkewTDescriptor) { - // the ordering in the editor is paramount here!!!!! - if (editor.getActiveDisplayPane().getRenderableDisplay() instanceof SkewtDisplay) { - return ((SkewtDisplay) (editor.getActiveDisplayPane() - .getRenderableDisplay())); - } - } - return null; - } - - /** - * Swap out out mouse pointers - * - * @param mode - */ - public void changeMouse(Mode mode) { - IDisplayPaneContainer editor = EditorUtil.getActiveVizContainer(); - if (editor == null) { - return; - } - if (editor instanceof IWorkbenchPart) { - IWorkbenchPartSite site = ((IWorkbenchPart) editor).getSite(); - Cursor cursor = site.getShell().getCursor(); - if (mode == Mode.HOVER) { - if (!hand.equals(cursor)) { - site.getShell().setCursor(hand); - } - } else if (mode == Mode.MOVE_POINT) { - if (!cross.equals(cursor)) { - site.getShell().setCursor(cross); - } - } else { - if (!arrow.equals(cursor)) { - site.getShell().setCursor(arrow); - } - } - } - } -} \ No newline at end of file diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/InteractiveSkewTResource.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/InteractiveSkewTResource.java deleted file mode 100644 index b875b4d1c0..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/InteractiveSkewTResource.java +++ /dev/null @@ -1,1398 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rsc; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Date; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; - -import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.sounding.ParcelLift.PARCEL_TYPE; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.SoundingLayer.DATA_TYPE; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.common.sounding.util.Equations; -import com.raytheon.uf.common.sounding.util.UAPoint; -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.IGraphicsTarget; -import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; -import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.drawables.IFont; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.sounding.SoundingParams; -import com.raytheon.viz.core.graphing.WGraphics; -import com.raytheon.viz.skewt.ui.SkewTConstants; -import com.raytheon.viz.skewt.ui.SkewtControlsDialog; -import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; -import com.raytheon.viz.ui.cmenu.IContextMenuContributor; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * SkewT Interactive resource to perform edit functions on soundings. - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 22, 2009            randerso     Initial creation
- * Feb 15, 2013 1638       mschenke    Moved Equations/UAPoint from edex.common util
- *                                     to common.sounding
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -public class InteractiveSkewTResource extends SkewTResource implements - IContextMenuContributor { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(InteractiveSkewTResource.class); - - Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); - - protected IFont smallFont; - - private VerticalSounding sounding; - - private static enum editMode { - HODO, SKEWT, TEMPCHG - }; - - private static editMode emode; - - private static final UnitConverter kelvinToCelsius = SI.KELVIN - .getConverterTo(SI.CELSIUS); - - private static final UnitConverter celciusToFahrenheit = SI.CELSIUS - .getConverterTo(NonSI.FAHRENHEIT); - - private static final UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND - .getConverterTo(NonSI.KNOT); - - private static final UnitConverter celciusToKelvin = SI.CELSIUS - .getConverterTo(SI.KELVIN); - - private static final UnitConverter metersToFeet = SI.METER - .getConverterTo(NonSI.FOOT); - - private Hashtable windMap = new Hashtable(); - - private Hashtable soundMap = new Hashtable(); - - private Coordinate ep; - - private SoundingLayer sl = null; - - private boolean dpt = false; - - private boolean wb = false; - - private SkewTResource skwt; - - private boolean _plotStorm = false; - - private static PARCEL_TYPE ptype = PARCEL_TYPE.SURFACE; - - private SoundingParams sp; - - private boolean ispoint = false; - - private PaintProperties paintProp; - - private static class EditableAction extends AbstractRightClickAction { - - public EditableAction() { - super("Editable", IAction.AS_CHECK_BOX); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - AbstractVizResource avr = getSelectedRsc(); - if (avr instanceof InteractiveSkewTResource) { - InteractiveSkewTResource rsc = (InteractiveSkewTResource) avr; - rsc.setEditable(!rsc.isEditable()); - - this.setChecked(rsc.isEditable()); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.ui.cmenu.AbstractRightClickAction#setSelectedRsc(com - * .raytheon.viz.core.rsc.IVizResource) - */ - @Override - public void setSelectedRsc(ResourcePair selectedRsc) { - super.setSelectedRsc(selectedRsc); - AbstractVizResource avr = getSelectedRsc(); - if (avr instanceof InteractiveSkewTResource) { - InteractiveSkewTResource rsc = (InteractiveSkewTResource) avr; - this.setChecked(rsc.isEditable()); - } - } - - } - - public InteractiveSkewTResource(SkewTResource rsc) { - super(null, null); - skwt = rsc; - - try { - for (VerticalSounding vs : rsc.getResourceData().getSoundings()) { - sounding = (VerticalSounding) vs.clone(); - sounding.setStationId("Interactive"); - addSounding(vs.getDataTime(), sounding); - soundMap.put(vs.getDataTime(), sounding); - } - } catch (CloneNotSupportedException e) { - // Shouldn't happen - statusHandler.handle(Priority.PROBLEM, - "Exception creating InteractiveSkewTResource", e); - } - sp = getSoundingParameters(); - } - - public boolean isEditable() { - return editable; - } - - /** - * @return the wb - */ - public boolean isWb() { - return wb; - } - - /** - * @param wb - * the wb to set - */ - public void setWb(boolean wb) { - this.wb = wb; - } - - public void setEditable(boolean editable) { - this.editable = editable; - SkewtControlsDialog sd = SkewtControlsDialog.getInstance(shell, - this.getName()); - if (editable == true) { - skwt.editable = true; - sd.open(); - } else { - setWb(false); - set_plotStorm(false); - skwt.editable = false; - sd.close(); - } - this.issueRefresh(); - } - - // @Override - // public void middleClicked() throws VizException { - // - // if (editable) { - // setEditable(false); - // if (PopupSkewTDialog.isOpen(shell)) { - // PopupSkewTDialog.getDialog(shell).close(); - // } - // } else { - // setEditable(true); - // PopupSkewTDialog.getDialog(shell).open(); - // } - // } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.rsc.SkewTResource#getName() - */ - @Override - public String getName() { - return "Interactive Skew-T"; - } - - /** - * @return the ptype - */ - public PARCEL_TYPE getPtype() { - return ptype; - } - - @Override - public void addContextMenuItems(IMenuManager menuManager, int x, int y) { - EditableAction editableAction = new EditableAction(); - ResourcePair rp = new ResourcePair(); - rp.setLoadProperties(getLoadProperties()); - rp.setProperties(descriptor.getResourceList().getProperties(this)); - rp.setResource(this); - rp.setResourceData(resourceData); - editableAction.setSelectedRsc(rp); - menuManager.add(editableAction); - if (isEditable() == true && ispoint == true) { - menuManager.add(new DeleteVertex()); - } else if (isEditable() == true && ispoint == false) { - menuManager.add(new AddVertex()); - } - } - - /** - * @return - */ - private class DeleteVertex extends AbstractRightClickAction { - public DeleteVertex() { - super("Delete Vertex"); - } - - @Override - public void run() { - removeLayer(ep); - } - } - - /** - * @return - */ - private class AddVertex extends AbstractRightClickAction { - public AddVertex() { - super("Add Vertex"); - } - - @Override - public void run() { - double pressure = ep.y; - double dewpoint = SoundingLayer.MISSING; - double temp = SoundingLayer.MISSING; - - if (dpt == true) { - dewpoint = ep.x; - temp = sounding.interpolateValue((float) pressure, - DATA_TYPE.TEMPERATURE); - } else { - temp = ep.x; - dewpoint = sounding.interpolateValue((float) pressure, - DATA_TYPE.DEWPOINT); - } - addSkewtPointAction(pressure, temp, dewpoint); - } - } - - @Override - protected void drawHodo(IGraphicsTarget target, double zoomLevel, - WGraphics world, SoundingParams sp) throws VizException { - RGB color = getCapability(ColorableCapability.class).getColor(); - int width = getCapability(OutlineCapability.class).getOutlineWidth(); - LineStyle lineStyle = getCapability(OutlineCapability.class) - .getLineStyle(); - - PixelExtent extent = new PixelExtent(getDisplay().getHodoBackground() - .getRectangle()); - target.setupClippingPlane(extent); - - windMap.clear(); - Coordinate c0 = null; - Coordinate c1; - for (SoundingLayer layer : sp.getInterleavedData()) { - double pressure = layer.getPressure(); - if (pressure < SoundingLayer.MISSING && pressure < 100) { - continue; - } - float u = layer.getWindU(); - float v = layer.getWindV(); - if (u >= SoundingLayer.MISSING || v >= SoundingLayer.MISSING) { - continue; - } - - c1 = new Coordinate(u, v); - windMap.put(c1, layer); - if (c0 != null) { - target.drawLine(world.mapX(c0.x), world.mapY(c0.y), 0, - world.mapX(c1.x), world.mapY(c1.y), 0, color, width, - lineStyle); - - } - if (editable) { - drawEditHandle(target, world, zoomLevel, world.mapX(c1.x), - world.mapY(c1.y), color); - } - c0 = c1; - } - - target.clearClippingPlane(); - } - - @Override - protected void disposeInternal() { - if (smallFont != null) { - smallFont.dispose(); - smallFont = null; - } - if (normalFont != null) { - normalFont.dispose(); - normalFont = null; - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.skewt.rsc.SkewTResource#paintInternal(com.raytheon.uf - * .viz.core.IGraphicsTarget, - * com.raytheon.uf.viz.core.drawables.PaintProperties) - */ - @Override - protected void paintInternal(IGraphicsTarget target, - PaintProperties paintProps) throws VizException { - super.paintInternal(target, paintProps); - paintProp = paintProps; - sounding = soundMap.get(paintProps.getDataTime()); - double zoomLevel = paintProps.getZoomLevel(); - WGraphics skewTWorld = getSkewTWorld(); - WGraphics hodoWorld = getHodoWorld(); - drawParcelLine(target, zoomLevel, skewTWorld); - drawWetBulb(target, skewTWorld); - plotStormInflow(target, hodoWorld, zoomLevel); - } - - /** - * This will return the x,y from the sounding that is nearest to the - * selected screen point - * - * @param c - * @return Coordinate from sounding based on selected point. - */ - public Coordinate getSelectedPoint(Coordinate c) { - - ep = null; - float p_mb = 0; - sl = null; - if (this.getDisplay().getHodoBackground().contains(c)) { - c = this.getDisplay().getHodoBackground().getWorld() - .unMap(c.x, c.y); - Coordinate cc = getWindfromSounding(c); - sl = windMap.get(cc); - p_mb = sl.getPressure(); - float u_ms = sounding.interpolateValue(p_mb, DATA_TYPE.WIND_U); - float v_ms = sounding.interpolateValue(p_mb, DATA_TYPE.WIND_V); - ep = WxMath.speedDir(u_ms, v_ms); - emode = editMode.HODO; - return ep; - } else if (this.getDisplay().getSkewTBackground().contains(c)) { - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - emode = editMode.SKEWT; - } else if (getDisplay().getTempChangeBackground().contains(c)) { - c = getTempChangeWorld().unMap(c.x, c.y); - c.y = WxMath.reverseSkewTXY(c).y; - emode = editMode.TEMPCHG; - } - ep = c; - p_mb = (float) c.y; - sl = sounding.getLayerNearest(p_mb); - p_mb = sl.getPressure(); - - // Check if editing Temp or Dewpoint - ep.y = p_mb; - checkDwpt(c); - return ep; - } - - /** - * @return the ep - */ - public Coordinate getEp() { - return ep; - } - - /** - * Checks to see if point is a dewpoint or temperature - * - * @param Coordinate - * c Coordinate of point - */ - private void checkDwpt(Coordinate c) { - float p_mb = (float) c.y; - c.x = celciusToKelvin.convert(c.x); - SoundingLayer sle = sounding.getLayerNearest(p_mb); - p_mb = sle.getPressure(); - double zoomLevel = paintProp.getZoomLevel(); - double t = sle.getTemperature(); - double td = sle.getDewpoint(); - double tb = t - zoomLevel; - double tt = t + zoomLevel; - double tdb = td - zoomLevel; - double tdt = td + zoomLevel; - if (c.x >= tb && c.x <= tt) { - ep.x = t; - dpt = false; - } else if (c.x >= tdb && c.x <= tdt) { - ep.x = td; - dpt = true; - } - } - - /** - * This will return the x,y from the sounding that is nearest to the - * selected screen point - * - * @param c - * @return Coordinate from sounding based on selected point. - */ - public void moveMousePoint(Coordinate c) { - - switch (emode) { - case HODO: - c = this.getDisplay().getHodoBackground().getWorld() - .unMap(c.x, c.y); - sl.setWindU((float) c.x); - sl.setWindV((float) c.y); - c = WxMath.speedDir((float) c.x, (float) c.y); - sl.setWindSpeed((float) c.x); - sl.setWindDirection((float) c.y); - sp.recomputeSoundingParams(sounding); - fireListeners(); - break; - case SKEWT: - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - double ctemp = celciusToKelvin.convert(c.x); - if (dpt == false) { - sl.setTemperature((float) ctemp); - } else { - if (ctemp >= sl.getTemperature()) { - sl.setDewpoint(sl.getTemperature()); - } else { - sl.setDewpoint((float) ctemp); - } - } - sp.recomputeSoundingParams(sounding); - fireListeners(); - break; - case TEMPCHG: - c = getTempChangeWorld().unMap(c.x, c.y); - c.y = WxMath.reverseSkewTXY(c).y; - break; - } - } - - /** - * Draw the parcel specific lines from control panel. - * - * @param target - * @param world - * @param zoomLevel - * @param moistPoints - * @throws VizException - */ - protected void drawParcelLine(IGraphicsTarget target, double zoomLevel, - WGraphics world) throws VizException { - PixelExtent extent = new PixelExtent(getDisplay().getSkewTBackground() - .getRectangle()); - target.setupClippingPlane(extent); - - if (getSoundingParameters().liftedI() != SoundingLayer.MISSING) { - drawMoist(target, world, zoomLevel, - createParcelSaturatedCoordinates()); - drawDry(target, world); - } - target.clearClippingPlane(); - } - - /** - * Draws the moist portion of the adiabatic lifting line. - * - * @param target - * @param world - * @param zoomLevel - * @param moistPoints - * @throws VizException - */ - protected void drawMoist(IGraphicsTarget target, WGraphics world, - double zoomLevel, List moistPoints) throws VizException { - - if (moistPoints != null && moistPoints.size() > 0) { - - Coordinate coor1 = WxMath.getSkewTXY(sp.pressLCL(), - kelvinToCelsius.convert(sp.tempLCL())); - // draw the LCL circle - target.drawFilledCircle(world.mapX(coor1.x), world.mapY(coor1.y), - 0.0, SkewTConstants.endpointRadius * zoomLevel, - SkewTConstants.parcelColor); - - for (int i = 0; i < moistPoints.size(); i++) { - UAPoint p = moistPoints.get(i); - if (p.pressure != SoundingLayer.MISSING - && p.temperature != SoundingLayer.MISSING) { - Coordinate coor2 = WxMath.getSkewTXY(p.pressure, - kelvinToCelsius.convert(p.temperature)); - if (coor1 != null) { - target.drawLine(world.mapX(coor1.x), - world.mapY(coor1.y), 0.0, world.mapX(coor2.x), - world.mapY(coor2.y), 0.0, - SkewTConstants.parcelColor, - SkewTConstants.parcelLineWidth, - IGraphicsTarget.LineStyle.SOLID); - } - coor1 = coor2; - } - } - } - } - - /** - * Draws the dry adiabatic portion of the lifting line. - * - * @param moistPoints - * @throws VizException - */ - protected void drawDry(IGraphicsTarget target, WGraphics world) - throws VizException { - - float pressures[] = sp.getPressures(); - float temps[] = sp.getTemperatures(); - - if (pressures[0] != SoundingLayer.MISSING - && temps[0] != SoundingLayer.MISSING - && sp.pressLCL() != SoundingLayer.MISSING - && sp.tempLCL() != SoundingLayer.MISSING) { - Coordinate sfc = WxMath.getSkewTXY(pressures[0], - kelvinToCelsius.convert(temps[0])); - - Coordinate lcl = WxMath.getSkewTXY(sp.pressLCL(), - kelvinToCelsius.convert(sp.tempLCL())); - - target.drawLine(world.mapX(sfc.x), world.mapY(sfc.y), 0.0, - world.mapX(lcl.x), world.mapY(lcl.y), 0.0, - SkewTConstants.parcelColor, SkewTConstants.parcelLineWidth, - IGraphicsTarget.LineStyle.SOLID); - } - } - - /** - * Draws the WetBulb Profile line. - * - * @throws VizException - */ - protected void drawWetBulb(IGraphicsTarget target, WGraphics world) - throws VizException { - - if (!isEditable()) { - return; - } - double[] wetBulbs = sp.getWetbulbs(); - - // Check to see if we are editing and that the show Wet-Bulb Profile is - // checked. - if (isWb() && isEditable()) { - float[] press = sp.getPressures(); - // first coordinate - Coordinate coor1 = null; - - // number of wetbulb points - int n = (wetBulbs.length < press.length) ? wetBulbs.length - : press.length; - - for (int i = 1; i < n; i++) { - if (press[i] != SoundingLayer.MISSING - && wetBulbs[i] != SoundingLayer.MISSING - && wetBulbs[i] < 999) { - Coordinate coor2 = WxMath.getSkewTXY(press[i], wetBulbs[i]); - if (coor1 != null) { - target.drawLine(world.mapX(coor1.x), - world.mapY(coor1.y), 0.0, world.mapX(coor2.x), - world.mapY(coor2.y), 0.0, - SkewTConstants.wetBulbColor, - SkewTConstants.wetBulbLineWidth, - IGraphicsTarget.LineStyle.SOLID); - } - coor1 = coor2; - } - } - } - } - - /** - * Gets the saturated parcel coordinates for the lifted parcel - * - * @return - */ - protected List createParcelSaturatedCoordinates() { - - if (sp.pressLCL() != SoundingLayer.MISSING - && sp.tempLCL() != SoundingLayer.MISSING) { - double tLCL_C = kelvinToCelsius.convert(sp.tempLCL()); - double thetaW = WxMath.thetaw(sp.pressLCL(), tLCL_C, tLCL_C); - return Equations.saturatedAdiabats(sp.pressLCL(), sounding - .getMinPressureLayer().getPressure(), - SkewTConstants.moistAdiabaticIncrement, celciusToKelvin - .convert(thetaW)); - } else { - return null; - } - - } - - /** - * Updates Parcel line when a value is changed. - * - * Fire when ever a value changes! - */ - public void changeParcel(PARCEL_TYPE pt, float level) { - ptype = pt; - if (!ptype.equals(PARCEL_TYPE.USERSELECT)) { - sp.set_liftingMethod(ptype); - } else { - if (checkUserLevelValid(level)) { - sp.set_userLevel(level); - sp.set_liftingMethod(ptype); - } else { - MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK); - mb.setText("Error"); - mb.setMessage("Level must be between " - + sounding.getMinPressureLayer().getPressure() - + "mb and " - + sounding.getMaxPressurelayer().getPressure() + "mb."); - mb.open(); - } - } - this.issueRefresh(); - } - - /** - * @param c - * @return - */ - private Coordinate getWindfromSounding(Coordinate c) { - double dist = 4; - Coordinate eo = null; - Coordinate ee = null; - Iterator iter = windMap.keySet().iterator(); - - while (iter.hasNext()) { - eo = iter.next(); - if (eo.distance(c) < dist) { - dist = eo.distance(c); - ee = eo; - } - } - return ee; - } - - /** - * @param b - */ - public void setFcstMax(boolean b) { - sp.set_useFcstMax(b); - } - - /** - * @return boolean useFcstMax - * - */ - public boolean getFcstMax() { - return sp.is_useFcstMax(); - } - - @Override - public SoundingParams getSoundingParameters() { - if (sounding == null) { - return null; - } - SoundingParams sp = new SoundingParams(sounding); - return sp; - } - - public boolean checkUserLevelValid(float level) { - boolean valid = false; - float maxPress = sounding.getMaxPressurelayer().getPressure(); - float minPress = sounding.getMinPressureLayer().getPressure(); - if (level <= maxPress && level >= minPress) { - valid = true; - } - return valid; - } - - /** - * Add skewtpoint - * - * @param pressure - * @param temp - * @param dewpoint - */ - public void addSkewtPointAction(double pressure, double temp, - double dewpoint) { - SoundingLayer sl = new SoundingLayer((float) pressure, - SoundingLayer.MISSING, (float) temp, (float) dewpoint, - SoundingLayer.MISSING, SoundingLayer.MISSING, - SoundingLayer.MISSING); - sounding.addLayer(sl); - sp.recomputeSoundingParams(sounding); - this.issueRefresh(); - } - - /** - * Add hodo point - * - * @param pressure - * @param windDirection - * @param windSpeed - */ - public void addChangePointAction(double pressure, double windSpeed, - double windDirection) { - SoundingLayer sl = new SoundingLayer((float) pressure, - SoundingLayer.MISSING, SoundingLayer.MISSING, - SoundingLayer.MISSING, (float) windSpeed, - (float) windDirection, SoundingLayer.MISSING); - sounding.addLayer(sl); - sp.recomputeSoundingParams(sounding); - this.issueRefresh(); - } - - public void resetSounding() { - dataTimes.remove(sounding.getDataTime()); - soundingMap.remove(sounding.getDataTime().getValidTime().getTime()); - soundMap.remove(sounding.getDataTime()); - try { - for (VerticalSounding vs : skwt.getResourceData().getSoundings()) { - sounding = (VerticalSounding) vs.clone(); - sounding.setStationId("Interactive"); - addSounding(vs.getDataTime(), sounding); - soundMap.put(vs.getDataTime(), sounding); - } - } catch (CloneNotSupportedException e) { - // Shouldn't happen - statusHandler.handle(Priority.PROBLEM, - "Exception resetting InteractiveSkewTResource", e); - } - this.issueRefresh(); - fireListeners(); - } - - /** - * compute the 0-3 km storm inflow and plot the lines. - */ - private void plotStormInflow(IGraphicsTarget target, WGraphics world, - double zoomLevel) { - - if (isEditable() == false || _plotStorm == false - || sp.helicity() == null) { - return; - } - - float elev = sp.getAnalysisData().get(0).getGeoHeight(); - ArrayList hodoInflow = new ArrayList(); - float uCompStorm = 0f; - float vCompStorm = 0f; - float[] _heights = sp.getHeights(); - float[] _uComp = sp.getWindUs(); - float[] _vComp = sp.getWindVs(); - float helHGT = sp.get_hgtHelLyr(); - - for (int i = 0; i < _uComp.length; i++) { - if (_heights[i] > helHGT + elev) { - break; - } - if (_uComp[i] > 999) { - continue; - } - hodoInflow.add(new Coordinate(_uComp[i], _vComp[i])); - } - Coordinate cc = WxMath.uvComp(sp.helicity().getStormMotionSpd(), sp - .helicity().getStormMotionDir()); - uCompStorm = (float) cc.x; - vCompStorm = (float) cc.y; - - // draw the Storm Motion indicator - try { - target.drawFilledCircle(world.mapX(uCompStorm), - world.mapY(vCompStorm), 0.0, SkewTConstants.endpointRadius - * zoomLevel, SkewTConstants.pointEditColor); - } catch (VizException e) { - e.printStackTrace(); - } - // Calculate the storm inflow lines and draw every third line. - // If the last entry in the sequence is a third multiple, draw - // it anyway to mark the end of the inflow pattern. - RGB color = getCapability(ColorableCapability.class).getColor(); - int index = 0; - for (int i = 0; i < hodoInflow.size(); i++) { - if ((i % 3) != 0) { - if (i != hodoInflow.size() - 1) { - continue; - } - } - try { - target.drawLine(world.mapX(hodoInflow.get(i).x), - world.mapY(hodoInflow.get(i).y), 0.0, - world.mapX(uCompStorm), world.mapY(vCompStorm), 0.0, - color, SkewTConstants.parcelLineWidth, - IGraphicsTarget.LineStyle.DOTTED); - } catch (VizException e) { - e.printStackTrace(); - } - - index++; - } - plotHelicityContours(target, world, zoomLevel); - } - - /** - * compute the 0-3 km helicity contours and plot the lines. - */ - private void plotHelicityContours(IGraphicsTarget target, WGraphics world, - double zoomLevel) { - float uMinExtent = 0f; - float uMaxExtent = 0f; - float vMinExtent = 0f; - float vMaxExtent = 0f; - String scratch = ""; - int srh = 0; - int labelInterval = 0; - float labelOffset = 0; - int startContour = 0; - int endContour = 0; - int contourInterval = 0; - float _ghx = sp.get_ghx(); - float _ghy = sp.get_ghy(); - float _helicity = sp.helicity().getHelicity(); - - // Indexer to the helicity contours and labels - RGB color = getCapability(ColorableCapability.class).getColor(); - - // Get the predefined values of umin, umax, vmin, and vmax - PixelExtent extent = new PixelExtent(getDisplay().getHodoBackground() - .getRectangle()); - Coordinate newUVupperLeft = world.unMap(extent.getMinX(), - extent.getMinY()); - Coordinate newUVlowerRight = world.unMap(extent.getMaxX(), - extent.getMaxY()); - float newUmin = (float) newUVupperLeft.x; - float newVmax = (float) newUVupperLeft.y; - float newUmax = (float) newUVlowerRight.x; - float newVmin = (float) newUVlowerRight.y; - - // Increase the contour interval size if at a higher zoom level; - // Coincides with the sounding depictable threshold for zoom contouring - if (zoomLevel < .60) { - startContour = 50; - endContour = 800; - contourInterval = 25; - labelInterval = 50; - labelOffset = 1.5f; - } else { - startContour = 50; - endContour = 800; - contourInterval = 50; - labelInterval = 100; - labelOffset = 3.5f; - } - - if (Math.abs(_ghy) > Math.abs(_ghx)) { - for (srh = startContour; srh <= endContour; srh += contourInterval) { - uMinExtent = newUmin; - uMaxExtent = newUmax; - vMinExtent = ((srh - _helicity) - (_ghx * uMinExtent)) / _ghy; - vMaxExtent = ((srh - _helicity) - (_ghx * uMaxExtent)) / _ghy; - // check to see if lines run off of top right edge, if so clip - // them - // and adjust the labels - if (vMaxExtent > newVmax) { - uMaxExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmax - vMinExtent) / (vMaxExtent - vMinExtent))); - vMaxExtent = newVmax; - } - // check to see if helicity lines go below bottom left of the - // hodo, if so clip - // them and adjust the labels - if (vMinExtent < newVmin) { - uMinExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmin - vMinExtent) / (vMaxExtent - vMinExtent))); - vMinExtent = newVmin; - } - // check to see if helicity lines go below bottom right of the - // hodo, if so clip - // them and adjust the labels - if (vMaxExtent < newVmin) { - uMaxExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmin - vMinExtent) / (vMaxExtent - vMinExtent))); - vMaxExtent = newVmin; - } - // check to see if lines run off of top left edge, if so clip - // them - // and adjust the labels - if (vMinExtent > newVmax) { - uMinExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmax - vMinExtent) / (vMaxExtent - vMinExtent))); - vMinExtent = newVmax; - } - if (vMaxExtent <= newVmax && uMaxExtent <= newUmax - && uMinExtent >= newUmin && vMaxExtent >= newVmin - && vMinExtent <= newVmax) { - try { - target.drawLine(world.mapX(uMinExtent), - world.mapY(vMinExtent), 0.0, - world.mapX(uMaxExtent), world.mapY(vMaxExtent), - 0.0, color, 1, IGraphicsTarget.LineStyle.DASHED); - // label the contours - if ((srh % labelInterval) == 0) { - scratch = String.format("%d", srh); - target.drawString(smallFont, scratch, - world.mapX(uMinExtent - labelOffset), - world.mapY(vMinExtent), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - target.drawString(smallFont, scratch, - world.mapX(uMaxExtent + labelOffset), - world.mapY(vMaxExtent), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - } - - } catch (VizException e) { - e.printStackTrace(); - } - } - } - } else { - vMinExtent = newVmin; - vMaxExtent = newVmax; - for (srh = startContour; srh <= endContour; srh += contourInterval) { - uMinExtent = ((srh - _helicity) - (_ghy * vMinExtent)) / _ghx; - uMaxExtent = ((srh - _helicity) - (_ghy * vMaxExtent)) / _ghx; - // check to see if lines run off of the bottom edge, if so clip - // them - // and adjust the labels - if (uMinExtent < newUmin) { - vMaxExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((uMinExtent - newUmin) / (newUmax - newUmin))); - uMinExtent = newUmin; - } - // check to see if helicity lines go above the hodo, if so clip - // them and adjust the labels - if (uMaxExtent > newUmax) { - vMinExtent = vMinExtent - + ((newVmax - newVmin) * ((uMaxExtent - newUmin) / (newUmax - newUmin))); - uMaxExtent = newUmax; - } - // check to see if helicity lines go left of bottom left of the - // hodo, if so clip - // them and adjust the labels - if (uMaxExtent < newUmin) { - vMaxExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((newUmin - uMinExtent) / (uMaxExtent - uMinExtent))); - uMaxExtent = newUmin; - } - // check to see if lines run off of top right edge, if so clip - // them - // and adjust the labels - if (uMinExtent > newUmax) { - vMinExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((newUmax - uMinExtent) / (uMaxExtent - uMinExtent))); - uMinExtent = newUmax; - } - - if (vMaxExtent <= newVmax && uMaxExtent <= newUmax - && uMinExtent >= newUmin && uMinExtent <= newUmax) { - try { - target.drawLine(world.mapX(uMinExtent), - world.mapY(vMinExtent), 0.0, - world.mapX(uMaxExtent), world.mapY(vMaxExtent), - 0.0, color, 1, IGraphicsTarget.LineStyle.DASHED); - // label the contours - if ((srh % labelInterval) == 0) { - scratch = String.format("%d", srh); - target.drawString(smallFont, scratch, - world.mapX(uMinExtent), - world.mapY(vMinExtent - labelOffset), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - target.drawString(smallFont, scratch, - world.mapX(uMaxExtent), - world.mapY(vMaxExtent + labelOffset), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - } - - } catch (VizException e) { - e.printStackTrace(); - } - } - } - } - } - - /** - * @param storm - * the _plotStorm to set - */ - public void set_plotStorm(boolean storm) { - _plotStorm = storm; - } - - // ===== max ================================================ - public static float max(float[] t) { - if (t.length == 0) { - return 0; - } - float maximum = t[0]; // start with the first value - for (int i = 1; i < t.length; i++) { - if (t[i] > maximum) { - maximum = t[i]; // new maximum - } - } - return maximum; - }// end method max - - // ===== min ================================================ - public static float min(float[] t) { - if (t.length == 0) { - return 0; - } - float minimum = t[0]; // start with the first value - for (int i = 1; i < t.length; i++) { - if (t[i] < minimum) { - minimum = t[i]; // new minimum - } - } - return minimum; - }// end method min - - @Override - public String inspect(ReferencedCoordinate rCoord) throws VizException { - String s = null; - - SoundingParams sp = getSoundingParameters(); - if (sp == null) { - return s; - } - - s = "NO DATA"; - VerticalSounding vs = sp.getAnalysisData(); - if (vs == null) { - return s; - } - try { - Coordinate c = rCoord.getObject(); - if (this.getDisplay().getSkewTBackground().contains(c)) { - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - } else if (getDisplay().getTempChangeBackground().contains(c)) { - c = getTempChangeWorld().unMap(c.x, c.y); - c.y = WxMath.reverseSkewTXY(c).y; - } else if (this.getDisplay().getHodoBackground().contains(c)) { - c = this.getDisplay().getHodoBackground().getWorld() - .unMap(c.x, c.y); - Coordinate cc = getWindfromSounding(c); - SoundingLayer sl = new SoundingLayer(); - if (cc != null) { - sl = windMap.get(cc); - c.y = sl.getPressure(); - } else { - return s; - } - } else { - return s; - } - - float p_mb = (float) c.y; - float p_sfc = vs.getMaxPressurelayer().getPressure(); - - if (p_mb > p_sfc) { - return s; - } - - double z_m = vs.interpolateValue(p_mb, DATA_TYPE.GEO_HEIGHT); - double z_ft = (z_m == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : metersToFeet.convert(z_m); - double t_C = (vs.interpolateValue(p_mb, DATA_TYPE.TEMPERATURE) == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : kelvinToCelsius.convert(vs.interpolateValue(p_mb, - DATA_TYPE.TEMPERATURE)); - double t_F = (t_C == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : celciusToFahrenheit.convert(t_C); - double td_C = (vs.interpolateValue(p_mb, DATA_TYPE.DEWPOINT) == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : kelvinToCelsius.convert(vs.interpolateValue(p_mb, - DATA_TYPE.DEWPOINT)); - double td_F = (td_C == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : celciusToFahrenheit.convert(td_C); - float u_ms = vs.interpolateValue(p_mb, DATA_TYPE.WIND_U); - float v_ms = vs.interpolateValue(p_mb, DATA_TYPE.WIND_V); - Coordinate sd = new Coordinate(SoundingLayer.MISSING, - SoundingLayer.MISSING); - double dir = SoundingLayer.MISSING; - double kts = SoundingLayer.MISSING; - if (u_ms != SoundingLayer.MISSING && v_ms != SoundingLayer.MISSING) { - sd = WxMath.speedDir(u_ms, v_ms); - dir = sd.y; - kts = metersPerSecondToKnots.convert(sd.x); - } - double theta = SoundingLayer.MISSING; - double thetaE = SoundingLayer.MISSING; - double w = SoundingLayer.MISSING; - if (td_C != SoundingLayer.MISSING) { - theta = celciusToKelvin.convert(WxMath.theta(p_mb, t_C, 1000)); - thetaE = celciusToKelvin - .convert(WxMath.thetae(p_mb, t_C, td_C)); - w = WxMath.mixingRatio(p_mb, t_C); - } - s = String.format("P=%.0fmb z=%.0fm/%.0fft\n", p_mb, z_m, z_ft); - s += String.format( - "T=%.0f%cC/%.0f%cF Td=%.0f%cC/%.0f%cF %03.0f@%.0fkts\n", - t_C, SkewTConstants.DEGREE_SYMBOL, t_F, - SkewTConstants.DEGREE_SYMBOL, td_C, - SkewTConstants.DEGREE_SYMBOL, td_F, - SkewTConstants.DEGREE_SYMBOL, dir, kts); - s += String.format( - "u=%.0fm/s v=%.0fm/s Theta=%.0fK Theta-e=%.0fK w=%.1f", - u_ms, v_ms, theta, thetaE, w); - - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Exception translating coordinate", e); - } - - return s; - } - - private void fireListeners() { - for (Object listener : listenerList.getListeners()) { - ((ISkewTDataChangedListener) listener).skewTResourceChanged(this); - } - } - - /** - * Save an edited sounding to a file. - * - * @param path - */ - public void saveSounding(String path) { - DataOutputStream out = null; - DataTime dtg = sounding.getDataTime(); - VerticalSounding vs = skwt.getResourceData().getSoundings()[0]; - String stnID = vs.getName(); - - try { - out = new DataOutputStream(new BufferedOutputStream( - new FileOutputStream(path))); - out.writeUTF(stnID); - out.writeDouble(vs.getLatitude()); - out.writeDouble(vs.getLongitude()); - out.writeLong(dtg.getRefTime().getTime()); - for (SoundingLayer layer : sp.getInterleavedData()) { - out.writeFloat(layer.getPressure()); - out.writeFloat(layer.getGeoHeight()); - out.writeFloat(layer.getTemperature()); - out.writeFloat(layer.getDewpoint()); - out.writeFloat(layer.getWindU()); - out.writeFloat(layer.getWindV()); - } - out.close(); - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Exception saving edited sounding", e); - } finally { - try { - if (out != null) { - out.close(); - } - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Exception closing file.", e); - } - } - } - - /** - * Read in a saved sounding file. - * - * @param path - */ - public void loadSounding(String path) { - DataInputStream in = null; - VerticalSounding vs = new VerticalSounding(); - try { - in = new DataInputStream(new BufferedInputStream( - new FileInputStream(path))); - String stnID = in.readUTF(); - vs.setName(stnID); - vs.setStationId(stnID); - vs.setLatitude(in.readDouble()); - vs.setLongitude(in.readDouble()); - vs.setDataTime(new DataTime(new Date(in.readLong()))); - - while (in.available() > 0) { - SoundingLayer layer = new SoundingLayer(); - layer.setPressure(in.readFloat()); - layer.setGeoHeight(in.readFloat()); - layer.setTemperature(in.readFloat()); - layer.setDewpoint(in.readFloat()); - layer.setWindU(in.readFloat()); - layer.setWindV(in.readFloat()); - vs.addLayer(layer); - } - addSounding(vs.getDataTime(), vs); - soundMap.put(vs.getDataTime(), vs); - fireListeners(); - - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Exception loading edited sounding", e); - } finally { - try { - if (in != null) { - in.close(); - } - } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, - "Exception closing sounding input stream.", e); - } - } - } - - /** - * @param c - * @return - */ - public boolean isPoint(Coordinate kk) { - Coordinate c = kk; - ispoint = false; - if (this.getDisplay().getSkewTBackground().contains(c)) { - - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - ep = c; - float p_mb = (float) c.y; - c.x = celciusToKelvin.convert(c.x); - SoundingLayer sle = sounding.getLayerNearest(p_mb); - p_mb = sle.getPressure(); - double t = sle.getTemperature(); - double td = sle.getDewpoint(); - - // Check if point is valid - ep.y = p_mb; - double zoomLevel = paintProp.getZoomLevel(); - double tb = t - zoomLevel; - double tt = t + zoomLevel; - double tdb = td - zoomLevel; - double tdt = td + zoomLevel; - if (c.x >= tb && c.x <= tt) { - ep.x = t; - ispoint = true; - dpt = false; - } else if (c.x >= tdb && c.x <= tdt) { - ep.x = td; - ispoint = true; - dpt = true; - } - } else if (this.getDisplay().getHodoBackground().contains(c)) { - c = this.getDisplay().getHodoBackground().getWorld() - .unMap(c.x, c.y); - ep = c; - Coordinate cc = getWindfromSounding(c); - if (cc != null) { - ispoint = true; - sl = windMap.get(cc); - ep.y = sl.getPressure(); - ep.x = sl.getTemperature(); - } - } - return ispoint; - } - - /** - * @param c - */ - public void removeLayer(Coordinate c) { - SoundingLayer so = new SoundingLayer(); - so = sounding.getLayer((float) c.y); - if (so != null) { - System.out.println("Deleting layer at: " + (int) so.getPressure() - + " mb"); - sounding.removeLayer(so); - sp.recomputeSoundingParams(sounding); - this.issueRefresh(); - } - return; - } - - /** - * @param c - */ - public void addLayer(Coordinate c) { - if (this.getDisplay().getSkewTBackground().contains(c)) { - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - c.x = celciusToKelvin.convert(c.x); - ep = c; - double t = sounding.interpolateValue((float) c.y, - DATA_TYPE.TEMPERATURE); - double td = sounding.interpolateValue((float) c.y, - DATA_TYPE.DEWPOINT); - double tb = t - 5; - double tt = t + 5; - double tdb = td - 5; - double tdt = td + 5; - if (c.x >= tb && c.x <= tt) { - ep.x = t; - dpt = false; - } else if (c.x >= tdb && c.x <= tdt) { - ep.x = td; - dpt = true; - } - } - } -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTBackgroundResource.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTBackgroundResource.java deleted file mode 100644 index bd13e11a0c..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTBackgroundResource.java +++ /dev/null @@ -1,382 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rsc; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuCreator; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; - -import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.uf.viz.core.rsc.ResourceProperties; -import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; -import com.raytheon.viz.skewt.SkewTDescriptor; -import com.raytheon.viz.skewt.rscdata.SkewTBkgResourceData; -import com.raytheon.viz.skewt.ui.HodoBackground; -import com.raytheon.viz.skewt.ui.SkewTConstants; -import com.raytheon.viz.skewt.ui.SkewtBackground; -import com.raytheon.viz.skewt.ui.TempChangeBackground; -import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; -import com.raytheon.viz.ui.cmenu.IContextMenuContributor; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 22, 2009            randerso     Initial creation
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -public class SkewTBackgroundResource extends - AbstractVizResource implements - IContextMenuContributor { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(SkewTBackgroundResource.class); - - private static final UnitConverter celciusToFahrenheit = SI.CELSIUS - .getConverterTo(NonSI.FAHRENHEIT); - - private static final UnitConverter celciusToKelvin = SI.CELSIUS - .getConverterTo(SI.KELVIN); - - private static final UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND - .getConverterTo(NonSI.KNOT); - - private SkewtBackground skewTBackground; - - /** - * @return the skewTBackground - */ - public SkewtBackground getSkewTBackground() { - return skewTBackground; - } - - /** - * @return the hodoBackground - */ - public HodoBackground getHodoBackground() { - return hodoBackground; - } - - /** - * @return the tempChangeBackground - */ - public TempChangeBackground getTempChangeBackground() { - return tempChangeBackground; - } - - private HodoBackground hodoBackground; - - private TempChangeBackground tempChangeBackground; - - public SkewTBackgroundResource(SkewTBkgResourceData rscData, - LoadProperties loadProperties) { - super(rscData, loadProperties); - double mag = getCapability(MagnificationCapability.class) - .getMagnification(); - skewTBackground = new SkewtBackground(); - skewTBackground.setMagnification(mag); - hodoBackground = new HodoBackground(); - hodoBackground.setMagnification(mag); - tempChangeBackground = new TempChangeBackground(); - tempChangeBackground.setMagnification(mag); - resourceData.addChangeListener(new IResourceDataChanged() { - @Override - public void resourceChanged(ChangeType type, Object object) { - if (type == ChangeType.CAPABILITY) { - if (object instanceof MagnificationCapability) { - double mag = ((MagnificationCapability) object) - .getMagnification(); - skewTBackground.setMagnification(mag); - hodoBackground.setMagnification(mag); - tempChangeBackground.setMagnification(mag); - } - } - - } - - }); - } - - @Override - protected void disposeInternal() { - } - - @Override - protected void initInternal(IGraphicsTarget target) throws VizException { - } - - @Override - protected void paintInternal(IGraphicsTarget target, - PaintProperties paintProps) throws VizException { - skewTBackground.paint(target, paintProps); - hodoBackground.paint(target, paintProps); - tempChangeBackground.paint(target, paintProps); - } - - @Override - public String inspect(ReferencedCoordinate rCoord) throws VizException { - String s = "NO DATA"; - - Coordinate c; - try { - c = rCoord.getObject(); - if (getSkewTBackground().contains(c)) { - c = WxMath.reverseSkewTXY(getSkewTBackground().getWorld() - .unMap(c.x, c.y)); - double p_mb = c.y; - double t_C = c.x; // Celsius - double t_F = celciusToFahrenheit.convert(c.x); - double theta = celciusToKelvin.convert(WxMath.theta(p_mb, t_C, - 1000)); - double thetaE = celciusToKelvin.convert(WxMath.thetae(p_mb, - t_C, t_C)); - double w = WxMath.mixingRatio(p_mb, t_C); - s = String - .format("P=%.0f mb T=%.0f%cC/%.0f%cF Theta=%.0fK Theta-e=%.0fK w=%.1f", - p_mb, t_C, SkewTConstants.DEGREE_SYMBOL, t_F, - SkewTConstants.DEGREE_SYMBOL, theta, thetaE, w); - } else if (getHodoBackground().contains(c)) { - c = getHodoBackground().getWorld().unMap(c.x, c.y); - c = WxMath.speedDir((float) c.x, (float) c.y); - s = String.format("%.0f%c at %.0f kts", c.y, - SkewTConstants.DEGREE_SYMBOL, - metersPerSecondToKnots.convert(c.x)); - } else if (getTempChangeBackground().contains(c)) { - c = getTempChangeBackground().getWorld().unMap(c.x, c.y); - c.y = WxMath.reverseSkewTXY(c).y; - double p_mb = c.y; - double deltaT_C = c.x; - double deltaT_F = 1.8 * deltaT_C; - s = String.format("P=%.0f mb T=%+.0f%cC/%+.0f%cF", p_mb, - deltaT_C, SkewTConstants.DEGREE_SYMBOL, deltaT_F, - SkewTConstants.DEGREE_SYMBOL); - } - - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Exception translating coordinate", e); - } - - return s; - } - - @Override - public void addContextMenuItems(IMenuManager menuManager, int x, int y) { - for (ResourcePair rp : getDescriptor().getResourceList()) { - if (rp.getResource() instanceof SkewTResource - && !(rp.getResource() instanceof InteractiveSkewTResource)) { - InteractiveSkewTMenuAction action = new InteractiveSkewTMenuAction(); - ResourcePair rscPair = new ResourcePair(); - rscPair.setLoadProperties(getLoadProperties()); - rscPair.setProperties(descriptor.getResourceList() - .getProperties(this)); - rscPair.setResource(this); - rscPair.setResourceData(resourceData); - action.setSelectedRsc(rscPair); - menuManager.add(action); - return; - } - } - return; - } - - private static class InteractiveSkewTMenuAction extends - AbstractRightClickAction implements IMenuCreator { - - private Menu menu; - - private InteractiveSkewTMenuAction() { - super("Interactive Skew-T", IAction.AS_DROP_DOWN_MENU); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#getMenuCreator() - */ - @Override - public IMenuCreator getMenuCreator() { - return this; - } - - @Override - public void dispose() { - if (menu != null) { - menu.dispose(); - } - } - - @Override - public Menu getMenu(Control parent) { - - if (menu != null) { - menu.dispose(); - } - - menu = new Menu(parent); - - fillMenu(menu); - - return menu; - } - - @Override - public Menu getMenu(Menu parent) { - - if (menu != null) { - menu.dispose(); - } - - menu = new Menu(parent); - - fillMenu(menu); - - return menu; - } - - private void fillMenu(Menu menu) { - ResourceList list = getSelectedRsc().getDescriptor() - .getResourceList(); - synchronized (list) { - InteractiveSkewTResource activeRsc = null; - String activeIcao = null; - for (ResourcePair rp : list) { - if (rp.getResource() instanceof InteractiveSkewTResource) { - activeRsc = (InteractiveSkewTResource) rp.getResource(); - activeIcao = activeRsc.getSoundingParameters() - .getInterleavedData().getName(); - break; - } - } - for (ResourcePair rp : list) { - if (rp.getResource() != activeRsc - && rp.getResource() instanceof SkewTResource) { - SkewTResource rsc = (SkewTResource) rp.getResource(); - String icao = rsc.getSoundingParameters() - .getInterleavedData().getName(); - ActionContributionItem aci = new ActionContributionItem( - new InteractiveSkewTInternalAction(rsc, - activeRsc)); - - aci.getAction().setChecked(icao.equals(activeIcao)); - aci.fill(menu, -1); - } - } - } - } - } - - private static class InteractiveSkewTInternalAction extends Action { - - private SkewTResource rsc; - - private SkewTResource activeRsc; - - public InteractiveSkewTInternalAction(SkewTResource rsc, - SkewTResource activeRsc) { - super(rsc.getSoundingParameters().getInterleavedData().getName(), - IAction.AS_RADIO_BUTTON); - this.rsc = rsc; - this.activeRsc = activeRsc; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.action.Action#run() - */ - @Override - public void run() { - if (!this.isChecked()) { - return; - } - System.out.println(this.getText() + " selected"); - - SkewTDescriptor descriptor = this.rsc.getDescriptor(); - ResourceList list = descriptor.getResourceList(); - synchronized (list) { - - // remove the currently active resource if any - if (activeRsc != null) { - list.removeRsc(activeRsc); - } - - // hide all but the selected resource - for (ResourcePair rp : list) { - AbstractVizResource r = rp.getResource(); - if (r instanceof SkewTResource && r != rsc) { - rp.getProperties().setVisible(false); - } - } - - ResourceProperties props = new ResourceProperties(); - InteractiveSkewTResource activeRsc = new InteractiveSkewTResource( - rsc); - list.add(activeRsc, props); - try { - descriptor.getTimeMatcher().redoTimeMatching(descriptor); - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName() - */ - @Override - public String getName() { - return "SkewT Background"; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTResource.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTResource.java deleted file mode 100644 index c79cb6990f..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rsc/SkewTResource.java +++ /dev/null @@ -1,1562 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rsc; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; - -import org.eclipse.core.runtime.ListenerList; -import org.eclipse.swt.graphics.RGB; - -import com.raytheon.edex.meteoLib.WindComp; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.geospatial.ReferencedCoordinate; -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.SoundingLayer.DATA_TYPE; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.WxMath; -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.IGraphicsTarget; -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.PixelExtent; -import com.raytheon.uf.viz.core.drawables.IFont; -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.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; -import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; -import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.sounding.SoundingParams; -import com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource; -import com.raytheon.uf.viz.xy.map.rsc.PointRenderable; -import com.raytheon.viz.core.ColorUtil; -import com.raytheon.viz.core.graphing.LineStroke; -import com.raytheon.viz.core.graphing.WGraphics; -import com.raytheon.viz.core.graphing.WindBarbFactory; -import com.raytheon.viz.skewt.SkewTDescriptor; -import com.raytheon.viz.skewt.SkewtDisplay; -import com.raytheon.viz.skewt.rscdata.SkewTResourceData; -import com.raytheon.viz.skewt.ui.SkewTConstants; -import com.vividsolutions.jts.geom.Coordinate; -import com.vividsolutions.jts.geom.Geometry; - -/** - * Resource to render the skewt data - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 10, 2009            randerso    Initial creation
- * Jul 05, 2013 1869       bsteffen    Fix goes sounding updates.
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -public class SkewTResource extends - AbstractVizResource implements - IInsetMapResource { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(SkewTResource.class); - protected static final int TEMP_CHANGE_WINDOW = 4; - - protected static final double BARB_LENGTH = 3.5; - - private static final UnitConverter metersToFeet = SI.METER - .getConverterTo(NonSI.FOOT); - - private static final UnitConverter celciusToFahrenheit = SI.CELSIUS - .getConverterTo(NonSI.FAHRENHEIT); - - private static final UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND - .getConverterTo(NonSI.KNOT); - - private static final UnitConverter celciusToKelvin = SI.CELSIUS - .getConverterTo(SI.KELVIN); - - private static final UnitConverter kelvinToCelsius = SI.KELVIN - .getConverterTo(SI.CELSIUS); - - private static final UnitConverter footToMeters = NonSI.FOOT - .getConverterTo(SI.METER); - - private static final char degree = '\u00B0'; - - private static final char squared = '\u00B2'; - - private float _hgtHelLyr = 3000.0f; // hgt of the layer for determining - - // helicity - - protected Map soundingMap; - - private Hashtable windMap = new Hashtable(); - - protected DataTime displayedSounding; - - protected SkewtDisplay display; - - protected boolean editable = false; - - protected IFont smallFont; - - protected IFont normalFont; - - protected ListenerList listenerList = new ListenerList(); - - private PointRenderable point; - - /** - * @param resourceData - * @param properties - */ - public SkewTResource(SkewTResourceData resourceData, - LoadProperties properties) { - super(resourceData, properties); - dataTimes = new ArrayList(); - soundingMap = new HashMap(); - - if (resourceData != null) { - for (VerticalSounding vs : resourceData.getSoundings()) { - addSounding(vs.getDataTime(), vs); - } - - resourceData.addChangeListener(new IResourceDataChanged() { - @Override - public void resourceChanged(ChangeType type, Object object) { - if (type == ChangeType.CAPABILITY) { - if (object instanceof MagnificationCapability) { - if (smallFont != null) { - smallFont.dispose(); - smallFont = null; - } - if (normalFont != null) { - normalFont.dispose(); - normalFont = null; - } - } - } - - } - - }); - } - } - - @Override - protected void disposeInternal() { - if (smallFont != null) { - smallFont.dispose(); - smallFont = null; - } - if (normalFont != null) { - normalFont.dispose(); - normalFont = null; - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractVizResource#initInternal(com.raytheon - * .uf.viz.core.IGraphicsTarget) - */ - @Override - protected void initInternal(IGraphicsTarget target) throws VizException { - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon - * .uf.viz.core.IGraphicsTarget, - * com.raytheon.uf.viz.core.drawables.PaintProperties) - */ - @Override - protected void paintInternal(IGraphicsTarget target, - PaintProperties paintProps) throws VizException { - - if (smallFont == null) { - float fontSize = (float) (10 * getCapability( - MagnificationCapability.class).getMagnification()); - smallFont = target.initializeFont(target.getDefaultFont() - .getFontName(), fontSize, null); - } - if (normalFont == null) { - float fontSize = (float) (12 * getCapability( - MagnificationCapability.class).getMagnification()); - normalFont = target.initializeFont(target.getDefaultFont() - .getFontName(), fontSize, null); - } - - setSoundingDate(paintProps.getDataTime()); - - double zoomLevel = paintProps.getZoomLevel(); - double density = getCapability(DensityCapability.class).getDensity(); - SoundingParams sp = getSoundingParameters(); - if (sp != null && sp.getInterleavedData().size() > 0) { - RGB color = getCapability(ColorableCapability.class).getColor(); - - WGraphics skewTWorld = getSkewTWorld(); - plotTempCurve(target, zoomLevel, skewTWorld, sp, color); - plotTdCurve(target, zoomLevel, skewTWorld, sp, color); - - drawHgtlabel(target, zoomLevel, skewTWorld, sp, color); - - WGraphics tempChangeWorld = getTempChangeWorld(); - draw24HrTempChange(target, tempChangeWorld, sp, color); - - WGraphics hodoWorld = getHodoWorld(); - drawHodo(target, zoomLevel, hodoWorld, sp); - drawWindPlot(target, zoomLevel, density, skewTWorld, sp, color); - if (zoomLevel <= .50) { - // draw storm inflow info and helicity lines - plotStormInflow(target, hodoWorld, zoomLevel, sp); - } - - } - } - - public void addSounding(DataTime dataTime, VerticalSounding sounding) { - - dataTimes.add(dataTime); - soundingMap.put(dataTime.getValidTime().getTime(), new SoundingParams( - sounding)); - Collections.sort(dataTimes); - } - - public void setSoundingMap(Map map) { - soundingMap = new HashMap(); - for (DataTime dt : map.keySet()) { - soundingMap.put(dt.getValidTime().getTime(), map.get(dt)); - } - dataTimes.clear(); - dataTimes.addAll(map.keySet()); - Collections.sort(dataTimes); - - if (soundingMap == null) { - soundingMap = new HashMap(); - } - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.rsc.capabilities.ITimeSeqResource#setDisplayedDate - * (java.util.Date) - */ - public DataTime getDisplayedDate() { - return displayedSounding; - } - - protected SoundingParams retrieveVerticalSounding(DataTime time) { - if (time == null) { - return null; - } - return soundingMap.get(time.getValidTime().getTime()); - } - - @Override - public String getName() { - String name = "Skewt"; - SoundingParams sp = this.getSoundingByDataTime(descriptor - .getTimeForResource(this)); - - if (sp != null) { - VerticalSounding vs = sp.getInterleavedData(); - String display = vs.getDisplayFormat(); - if (display != null) { - if (display.indexOf("{$pointId$}") > 0) { - String pt = resourceData.getPointLetter(); - if (pt != null) { - name = display.replace("{$pointId$}", " pt" + pt + " ") - + "Skewt"; - } - } else { - name = display + " Skewt"; - } - } else { - name = vs.getName() + " Skewt"; - } - } - - return name; - } - - @Override - public void setDescriptor(SkewTDescriptor descriptor) { - super.setDescriptor(descriptor); - RGB rgb = ColorUtil.getNewColor(descriptor); - getCapability(ColorableCapability.class).setColor(rgb); - } - - public void setSoundingDate(DataTime dt) { - if (dt == null && displayedSounding == null) { - return; - } - if (dt != null && dt.equals(displayedSounding)) { - return; - } - displayedSounding = dt; - fireListeners(); - } - - public SoundingParams getSoundingParameters() { - if (displayedSounding == null) { - return null; - } - SoundingParams sp = this.retrieveVerticalSounding(displayedSounding); - return sp; - } - - /** - * @param c - * @return - */ - private Coordinate getWindfromSounding(Coordinate c) { - double dist = 4; - Coordinate eo = null; - Coordinate ee = null; - Iterator iter = windMap.keySet().iterator(); - - while (iter.hasNext()) { - eo = iter.next(); - if (eo.distance(c) < dist) { - dist = eo.distance(c); - ee = eo; - } - } - return ee; - } - - protected SkewtDisplay getDisplay() { - return display; - } - - public void setDisplay(SkewtDisplay display) { - this.display = display; - } - - protected WGraphics getSkewTWorld() { - return getDisplay().getSkewTWorld(); - } - - protected WGraphics getHodoWorld() { - return getDisplay().getHodoWorld(); - } - - protected WGraphics getTempChangeWorld() { - return getDisplay().getTempChangeWorld(); - } - - /** - * Allows you to grab a sounding from a different time - * - * @param dt - * @return - */ - public SoundingParams getSoundingByDataTime(DataTime dt) { - // find a close time to 24 hours, give 4 hour lee way - SoundingParams sp = this.retrieveVerticalSounding(dt); - return sp; - } - - /** - * Allows you to grab a sounding from a similar time span back - * - * @param dt - * @return - */ - public SoundingParams getSoundingByTimeSpan(DataTime dt, int span) { - // find a time within span of dt - SoundingParams sp = null; - - try { - sp = getSoundingByDataTime(dt); - } catch (NullPointerException npe) { - for (DataTime date : dataTimes) { - if (Math.abs(date.getRefTimeAsCalendar().get(Calendar.HOUR) - - dt.getRefTimeAsCalendar().get(Calendar.HOUR)) <= span) { - sp = this.retrieveVerticalSounding(dt); - } - } - } - return sp; - } - - /** - * Returns coordinate of sounding station - * - * @return loc - */ - public Coordinate getLocation() { - Coordinate loc = null; - SoundingParams sp = getSoundingParameters(); - if (sp != null) { - loc = new Coordinate(); - loc.x = sp.getAnalysisData().getLongitude(); - loc.y = sp.getAnalysisData().getLatitude(); - } - return loc; - } - - /** - * Draw the temperature curve - * - * @throws VizException - */ - protected void plotTempCurve(IGraphicsTarget target, double zoomLevel, - WGraphics world, SoundingParams sp, RGB color) throws VizException { - - int lineWidth = getCapability(OutlineCapability.class) - .getOutlineWidth(); - LineStyle lineStyle = getCapability(OutlineCapability.class) - .getLineStyle(); - - double maxPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmax())).y; - double minPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmin())).y; - - PixelExtent extent = new PixelExtent(getDisplay().getSkewTBackground() - .getRectangle()); - target.setupClippingPlane(extent); - - Coordinate c0 = null; - for (SoundingLayer layer : sp.getInterleavedData()) { - double t = layer.getTemperature(); - double pressure = layer.getPressure(); - if (t < SoundingLayer.MISSING && pressure >= minPressure - && pressure <= maxPressure) { - - Coordinate c1 = WxMath.getSkewTXY(pressure, kelvinToCelsius - .convert(t)); - - c1.x = world.mapX(c1.x); - c1.y = world.mapY(c1.y); - - if (c0 != null) { - target.drawLine(c0.x, c0.y, 0.0, c1.x, c1.y, 0.0, color, - lineWidth, lineStyle); - } - - if (editable) { - drawEditHandle(target, world, zoomLevel, c1.x, c1.y, color); - } - - c0 = c1; - } - } - - target.clearClippingPlane(); - } - - /** - * Draw the dewpoint curve - * - * @throws VizException - */ - protected void plotTdCurve(IGraphicsTarget target, double zoomLevel, - WGraphics world, SoundingParams sp, RGB color) throws VizException { - - int lineWidth = getCapability(OutlineCapability.class) - .getOutlineWidth(); - LineStyle lineStyle = getCapability(OutlineCapability.class) - .getLineStyle(); - - double maxPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmax())).y; - double minPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmin())).y; - - PixelExtent extent = new PixelExtent(getDisplay().getSkewTBackground() - .getRectangle()); - target.setupClippingPlane(extent); - - Coordinate c0 = null; - for (SoundingLayer layer : sp.getInterleavedData()) { - double td = layer.getDewpoint(); - double pressure = layer.getPressure(); - if (td < SoundingLayer.MISSING && pressure >= minPressure - && pressure <= maxPressure) { - - // set the line style to dashed for the interpolated layers - if (layer.isDptInterpolated()) { - lineStyle = LineStyle.DASHED; - } else { - lineStyle = LineStyle.SOLID; - } - Coordinate c1 = WxMath.getSkewTXY(pressure, kelvinToCelsius - .convert(td)); - - c1.x = world.mapX(c1.x); - c1.y = world.mapY(c1.y); - - if (c0 != null) { - target.drawLine(c0.x, c0.y, 0.0, c1.x, c1.y, 0.0, color, - lineWidth, lineStyle); - } - - if (editable) { - drawEditHandle(target, world, zoomLevel, c1.x, c1.y, color); - } - - c0 = c1; - } - } - - target.clearClippingPlane(); - } - - /** - * Draws the windstaff bar. Draws to scales one on left of bar at 2K - * intervals (Meters). Draws right scale in feet (5K intervals.) - * - * @param drawColor - * Color to draw staff in. - * @throws VizException - */ - protected void drawHgtlabel(IGraphicsTarget target, double zoomLevel, - WGraphics world, SoundingParams sp, RGB drawColor) - throws VizException { - - double x = world.mapX(SkewTConstants.right + 2 * BARB_LENGTH - * zoomLevel) - + target.getStringBounds(smallFont, "99").getWidth(); - - double y; - double y0 = 0; - - double maxPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmax())).y; - double minPressure = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmin())).y; - - float[] pressures = sp.getPressures(); - float[] heights = sp.getHeights(); - int minIndex = heights.length; - for (int i = 0; i < heights.length; i++) { - if (heights[i] < SoundingLayer.MISSING - && pressures[i] < SoundingLayer.MISSING - && pressures[i] <= maxPressure) { - minIndex = i; - break; - } - } - int maxIndex = -1; - for (int i = heights.length - 1; i >= 0; i--) { - if (heights[i] < SoundingLayer.MISSING - && pressures[i] < SoundingLayer.MISSING - && pressures[i] >= minPressure) { - maxIndex = i; - break; - } - } - - if (maxIndex <= minIndex) { - return; - } - - int kft = 0; - while (footToMeters.convert(kft * 1000) <= heights[minIndex]) { - kft += 5; - } - int km = 0; - while (km * 1000 <= heights[minIndex]) { - km += 2; - } - int tickLength = 5; - int prevIndex = -1; - for (int index = minIndex; index <= maxIndex; index++) { - // skip levels with missing height - if (pressures[index] >= SoundingLayer.MISSING - || heights[index] >= SoundingLayer.MISSING) { - continue; - } - - // Special case of top and bottom of sounding - if ((index == minIndex) || (index == maxIndex)) { - y = world.mapY(WxMath.getSkewTXY(pressures[index], 0).y); - target.drawString(smallFont, String.format("%.0f", - heights[index]), x - tickLength - 1, y, 0.0, - TextStyle.NORMAL, drawColor, HorizontalAlignment.RIGHT, - VerticalAlignment.MIDDLE, null); - target - .drawLine(x - tickLength, y, 0.0, x, y, 0.0, drawColor, - 1); - - if (index == minIndex) { - y0 = y; - } else { - target.drawLine(x, y0, 0.0, x, y, 0.0, drawColor, 1); - } - } else { - - // plot the kilometers scale - double meters; - while ((meters = (km * 1000)) <= heights[index]) { - double pressure = pressures[prevIndex] - + (meters - heights[prevIndex]) - * (pressures[index] - pressures[prevIndex]) - / (heights[index] - heights[prevIndex]); - - y = world.mapY(WxMath.getSkewTXY(pressure, 0).y); - target.drawString(smallFont, Integer.toString(km), x - - tickLength - 1, y, 0.0, TextStyle.NORMAL, - drawColor, HorizontalAlignment.RIGHT, - VerticalAlignment.MIDDLE, null); - target.drawLine(x - tickLength, y, 0.0, x, y, 0.0, - drawColor, 1); - - km += 2; - } - - // plot the feet scale - while ((meters = footToMeters.convert(kft * 1000)) <= heights[index]) { - double pressure = pressures[prevIndex] - + (meters - heights[prevIndex]) - * (pressures[index] - pressures[prevIndex]) - / (heights[index] - heights[prevIndex]); - - y = world.mapY(WxMath.getSkewTXY(pressure, 0).y); - target.drawString(smallFont, Integer.toString(kft), x - + tickLength + 1, y, 0.0, TextStyle.NORMAL, - drawColor, HorizontalAlignment.LEFT, - VerticalAlignment.MIDDLE, null); - target.drawLine(x + tickLength, y, 0.0, x, y, 0.0, - drawColor, 1); - - kft += 5; - } - } - prevIndex = index; - } - } - - /** - * Draws the sounding data in the appropriate color. - * - * @param sp - * @param color - */ - protected void drawWindPlot(IGraphicsTarget target, double zoomLevel, - double density, WGraphics world, SoundingParams sp, RGB color) { - List> winds = makeWindData(sp.getInterleavedData(), - zoomLevel, density); - for (List barb : winds) { - for (LineStroke stroke : barb) { - stroke.render(target, world, color); - } - } - } - - /** - * Gets the windData for the sounding. - * - * @param sounding - * @return - */ - protected List> makeWindData(VerticalSounding sounding, - double zoomLevel, double density) { - ArrayList> windList = new ArrayList>(); - - double windX = SkewTConstants.right + BARB_LENGTH * zoomLevel; - - double prevY = 1e37; - double dVert = BARB_LENGTH * 0.3 * zoomLevel / Math.min(density, 4.0); - double windY; - for (SoundingLayer layer : sounding) { - float pressure = layer.getPressure(); - float spd = layer.getWindSpeed(); - float dir = layer.getWindDirection(); - - if (pressure >= SoundingLayer.NODATA || pressure < 100 || spd > 250 - || dir > 360) { - continue; - } - - // Get the vertical ordinate. - windY = WxMath.getSkewTXY(pressure, 0).y; - double dBarb = Math.abs(windY - prevY); - if (dBarb < dVert) { - continue; - } - prevY = windY; - - List barb = WindBarbFactory.getWindGraphics( - metersPerSecondToKnots.convert(spd), (double) dir); - if (barb != null) { - WindBarbFactory.scaleBarb(barb, zoomLevel); - WindBarbFactory.translateBarb(barb, windX, windY); - windList.add(barb); - } - } - return windList; - } - - protected void drawHodo(IGraphicsTarget target, double zoomLevel, - WGraphics world, SoundingParams sp) throws VizException { - RGB color = getCapability(ColorableCapability.class).getColor(); - int width = getCapability(OutlineCapability.class).getOutlineWidth(); - LineStyle lineStyle = getCapability(OutlineCapability.class) - .getLineStyle(); - - PixelExtent extent = new PixelExtent(getDisplay().getHodoBackground() - .getRectangle()); - target.setupClippingPlane(extent); - - windMap.clear(); - Coordinate c0 = null; - Coordinate c1; - for (SoundingLayer layer : sp.getInterleavedData()) { - double pressure = layer.getPressure(); - if (pressure < 100 || pressure >= SoundingLayer.NODATA) { - continue; - } - float u = layer.getWindU(); - float v = layer.getWindV(); - if (u > 999) { - continue; - } - - c1 = new Coordinate(u, v); - windMap.put(c1, layer); - if (c0 != null) { - target.drawLine(world.mapX(c0.x), world.mapY(c0.y), 0, world - .mapX(c1.x), world.mapY(c1.y), 0, color, width, - lineStyle); - - } - if (zoomLevel <= .50) { - String levl = String - .format("%.1f", layer.getGeoHeight() * .001); - target.drawString(normalFont, levl, world.mapX(c1.x), world - .mapY(c1.y), 0.0, IGraphicsTarget.TextStyle.NORMAL, - color, IGraphicsTarget.HorizontalAlignment.CENTER, 0.0); - } - c0 = c1; - } - - target.clearClippingPlane(); - } - - /** - * compute the 0-3 km storm inflow and plot the lines. - */ - private void plotStormInflow(IGraphicsTarget target, WGraphics world, - double zoomLevel, SoundingParams sp) { - - if (sp.helicity() == null) { - return; - } - - float elev = sp.getAnalysisData().get(0).getGeoHeight(); - ArrayList hodoInflow = new ArrayList(); - float uCompStorm = 0f; - float vCompStorm = 0f; - float[] _heights = sp.getHeights(); - float[] _uComp = sp.getWindUs(); - float[] _vComp = sp.getWindVs(); - float helHGT = sp.get_hgtHelLyr(); - - for (int i = 0; i < _uComp.length; i++) { - if (_heights[i] > helHGT + elev) { - break; - } - if (_uComp[i] > 999) { - continue; - } - hodoInflow.add(new Coordinate(_uComp[i], _vComp[i])); - } - Coordinate cc = WxMath.uvComp(sp.helicity().getStormMotionSpd(), sp - .helicity().getStormMotionDir()); - uCompStorm = (float) cc.x; - vCompStorm = (float) cc.y; - - // draw the Storm Motion indicator - try { - target.drawFilledCircle(world.mapX(uCompStorm), world - .mapY(vCompStorm), 0.0, SkewTConstants.endpointRadius - * zoomLevel, SkewTConstants.pointEditColor); - } catch (VizException e) { - e.printStackTrace(); - } - // Calculate the storm inflow lines and draw every third line. - // If the last entry in the sequence is a third multiple, draw - // it anyway to mark the end of the inflow pattern. - RGB color = getCapability(ColorableCapability.class).getColor(); - int index = 0; - for (int i = 0; i < hodoInflow.size(); i++) { - if ((i % 3) != 0) { - if (i != hodoInflow.size() - 1) { - continue; - } - } - try { - target.drawLine(world.mapX(hodoInflow.get(i).x), world - .mapY(hodoInflow.get(i).y), 0.0, - world.mapX(uCompStorm), world.mapY(vCompStorm), 0.0, - color, SkewTConstants.parcelLineWidth, - IGraphicsTarget.LineStyle.DOTTED); - } catch (VizException e) { - e.printStackTrace(); - } - - index++; - } - plotHelicityContours(target, world, zoomLevel, sp); - } - - /** - * compute the 0-3 km helicity contours and plot the lines. - */ - private void plotHelicityContours(IGraphicsTarget target, WGraphics world, - double zoomLevel, SoundingParams sp) { - float uMinExtent = 0f; - float uMaxExtent = 0f; - float vMinExtent = 0f; - float vMaxExtent = 0f; - String scratch = ""; - int srh = 0; - int labelInterval = 0; - float labelOffset = 0; - int startContour = 0; - int endContour = 0; - int contourInterval = 0; - float _ghx = sp.get_ghx(); - float _ghy = sp.get_ghy(); - float _helicity = sp.helicity().getHelicity(); - - // Indexer to the helicity contours and labels - RGB color = getCapability(ColorableCapability.class).getColor(); - - // Get the predefined values of umin, umax, vmin, and vmax - PixelExtent extent = new PixelExtent(getDisplay().getHodoBackground() - .getRectangle()); - Coordinate newUVupperLeft = world.unMap(extent.getMinX(), extent - .getMinY()); - Coordinate newUVlowerRight = world.unMap(extent.getMaxX(), extent - .getMaxY()); - float newUmin = (float) newUVupperLeft.x; - float newVmax = (float) newUVupperLeft.y; - float newUmax = (float) newUVlowerRight.x; - float newVmin = (float) newUVlowerRight.y; - - // Increase the contour interval size if at a higher zoom level; - // Coincides with the sounding depictable threshold for zoom contouring - startContour = 50; - endContour = 800; - contourInterval = 50; - labelInterval = 50; - labelOffset = 1.5f; - - if (Math.abs(_ghy) > Math.abs(_ghx)) { - for (srh = startContour; srh <= endContour; srh += contourInterval) { - uMinExtent = newUmin; - uMaxExtent = newUmax; - vMinExtent = ((srh - _helicity) - (_ghx * uMinExtent)) / _ghy; - vMaxExtent = ((srh - _helicity) - (_ghx * uMaxExtent)) / _ghy; - // check to see if lines run off of top left edge, if so clip - // them - // and adjust the labels - if (vMaxExtent > newVmax) { - uMaxExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmax - vMinExtent) / (vMaxExtent - vMinExtent))); - vMaxExtent = newVmax; - } - // check to see if helicity lines go below bottom left of the - // hodo, if so clip - // them and adjust the labels - if (vMinExtent < newVmin) { - uMinExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmin - vMinExtent) / (vMaxExtent - vMinExtent))); - vMinExtent = newVmin; - } - // check to see if helicity lines go below bottom right of the - // hodo, if so clip - // them and adjust the labels - if (vMaxExtent < newVmin) { - uMaxExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmin - vMinExtent) / (vMaxExtent - vMinExtent))); - vMaxExtent = newVmin; - } - // check to see if lines run off of top left edge, if so clip - // them - // and adjust the labels - if (vMinExtent > newVmax) { - uMinExtent = uMinExtent - + ((uMaxExtent - uMinExtent) * ((newVmax - vMinExtent) / (vMaxExtent - vMinExtent))); - vMinExtent = newVmax; - } - if (vMaxExtent <= newVmax && uMaxExtent <= newUmax - && uMinExtent >= newUmin && vMaxExtent >= newVmin - && vMinExtent <= newVmax) { - try { - target.drawLine(world.mapX(uMinExtent), world - .mapY(vMinExtent), 0.0, world.mapX(uMaxExtent), - world.mapY(vMaxExtent), 0.0, color, 1, - IGraphicsTarget.LineStyle.DASHED); - // label the contours - if ((srh % labelInterval) == 0) { - scratch = String.format("%d", srh); - target.drawString(smallFont, scratch, world - .mapX(uMinExtent - labelOffset), world - .mapY(vMinExtent), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - target.drawString(smallFont, scratch, world - .mapX(uMaxExtent + labelOffset), world - .mapY(vMaxExtent), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - } - } catch (VizException e) { - e.printStackTrace(); - } - } - } - } else { - vMinExtent = newVmin; - vMaxExtent = newVmax; - for (srh = startContour; srh <= endContour; srh += contourInterval) { - uMinExtent = ((srh - _helicity) - (_ghy * vMinExtent)) / _ghx; - uMaxExtent = ((srh - _helicity) - (_ghy * vMaxExtent)) / _ghx; - // check to see if lines run off of the bottom edge, if so clip - // them - // and adjust the labels - if (uMinExtent < newUmin) { - vMaxExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((uMinExtent - newUmin) / (newUmax - newUmin))); - uMinExtent = newUmin; - } - // check to see if helicity lines go above the hodo, if so clip - // them and adjust the labels - if (uMaxExtent > newUmax) { - vMinExtent = vMinExtent - + ((newVmax - newVmin) * ((uMaxExtent - newUmin) / (newUmax - newUmin))); - uMaxExtent = newUmax; - } - // check to see if helicity lines go left of bottom left of the - // hodo, if so clip - // them and adjust the labels - if (uMaxExtent < newUmin) { - vMaxExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((newUmin - uMinExtent) / (uMaxExtent - uMinExtent))); - uMaxExtent = newUmin; - } - // check to see if lines run off of top right edge, if so clip - // them - // and adjust the labels - if (uMinExtent > newUmax) { - vMinExtent = vMinExtent - + ((vMaxExtent - vMinExtent) * ((newUmax - uMinExtent) / (uMaxExtent - uMinExtent))); - uMinExtent = newUmax; - } - - if (vMaxExtent <= newVmax && uMaxExtent <= newUmax - && uMinExtent >= newUmin && uMinExtent <= newUmax) { - try { - target.drawLine(world.mapX(uMinExtent), world - .mapY(vMinExtent), 0.0, world.mapX(uMaxExtent), - world.mapY(vMaxExtent), 0.0, color, 1, - IGraphicsTarget.LineStyle.DASHED); - // label the contours - if ((srh % labelInterval) == 0) { - scratch = String.format("%d", srh); - target.drawString(smallFont, scratch, world - .mapX(uMinExtent), world.mapY(vMinExtent - - labelOffset), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - target.drawString(smallFont, scratch, world - .mapX(uMaxExtent), world.mapY(vMaxExtent - + labelOffset), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.CENTER, - 0.0); - } - } catch (VizException e) { - e.printStackTrace(); - } - } - } - } - if (_helicity == SoundingLayer.MISSING) { - final String sthelicity = "STORM RELATIVE HELICITY=NA"; - final String stmo = "STORM MOTION=NA"; - try { - target.drawString(normalFont, sthelicity, world.mapX(newUmax - - 3 * normalFont.getFontSize() * zoomLevel), world - .mapY(newVmax - 1 * normalFont.getFontSize() - * zoomLevel), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - - target - .drawString( - normalFont, - stmo, - world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), - world - .mapY(newVmax - - (1.5 * normalFont - .getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } else { - String stRelHelicity = getStormRelativeHelicityString(sp); - String stRelMotion = getStormRelativeMotionString(sp); - final String hgt = "HEIGHTS ARE KM AGL"; - String helTop = String.format("TOP OF HELICITY LYR= %d km AGL", - (int) (_hgtHelLyr / 1000.0)); - final String stmInd = "* "; - final String stmPlot = "IS PLOTTED STORM MOTION"; - try { - target.drawString(normalFont, hgt, world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), world - .mapY(newVmax - 1 * normalFont.getFontSize() - * zoomLevel), 0.0, - IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - - target - .drawString( - normalFont, - stRelHelicity, - world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), - world - .mapY(newVmax - - (1.5 * normalFont - .getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - target.drawString(normalFont, stRelMotion, world.mapX(newUmax - - 3 * normalFont.getFontSize() * zoomLevel), world - .mapY(newVmax - - (2 * normalFont.getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - target - .drawString( - normalFont, - helTop, - world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), - world - .mapY(newVmax - - (2.5 * normalFont - .getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - target.drawString(normalFont, stmInd, world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), world - .mapY(newVmax - - (3 * normalFont.getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, - SkewTConstants.pointEditColor, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - target.drawString(normalFont, stmPlot, world.mapX(newUmax - 3 - * normalFont.getFontSize() * zoomLevel), world - .mapY(newVmax - - (3 * normalFont.getFontSize() * zoomLevel)), - 0.0, IGraphicsTarget.TextStyle.NORMAL, color, - IGraphicsTarget.HorizontalAlignment.RIGHT, 0.0); - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - protected void draw24HrTempChange(IGraphicsTarget target, WGraphics world, - SoundingParams sp, RGB color) throws VizException { - Calendar curCal = sp.getInterleavedData().getDataTime().getValidTime(); - curCal.add(Calendar.DAY_OF_MONTH, -1); - - SoundingParams sp24 = getSoundingByTimeSpan(new DataTime(curCal), - TEMP_CHANGE_WINDOW); - - drawVerticalVelocityLine(target, world, sp.getInterleavedData(), color); - - PixelExtent extent = new PixelExtent(getDisplay() - .getTempChangeBackground().getRectangle()); - target.setupClippingPlane(extent); - - // draw something on the temp change window - drawTempChangeLine(target, world, sp.getAnalysisData(), - (sp24 == null ? null : sp24.getAnalysisData()), color); - target.clearClippingPlane(); - } - - /** - * Draw the vertical velocity line - * - * @param target - * @param world - * @param vs - * @param color - * @throws VizException - */ - protected void drawVerticalVelocityLine(IGraphicsTarget target, - WGraphics world, VerticalSounding vs, RGB color) - throws VizException { - - // create some bogus omega for testing - // Random rand = new Random(); - // float omega = 2 * rand.nextFloat() - 1; - // for (SoundingLayer layer : vs) { - // layer.setOmega(omega); - // omega += 2 * rand.nextDouble() - 1; - // if (Math.abs(omega) > 5) { - // omega = 5 * Math.signum(omega); - // } - // } - - // get the depictable range variables - double pMax = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmax())).y; - double pMin = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmin())).y; - - // First we are going to plot the vertical velocity on the temp change - // background. - LineStyle lineStyle = LineStyle.DASHED; - Coordinate c0 = null; - double opmin = pMin /*- 50 */; - boolean found = false; - for (SoundingLayer layer : vs) { - // only include data up to top of 24Hr pressure hgt (e.g., 300 mb) - if (layer.getPressure() < opmin || layer.getPressure() > pMax) { - continue; - } - if (layer.getOmega() == SoundingLayer.MISSING) { - continue; - } - double ubarps = -layer.getOmega() * 10; - double otrns = ubarps > 0 ? ubarps : -ubarps; - if (otrns > 50) { - otrns = 15; - } else if (otrns > 15) { - otrns = 10.0 + 5.0 * (otrns - 15) / 35; - } else if (otrns > 5) { - otrns = 5.0 + 5.0 * (otrns - 5) / 10; - } - if (ubarps < 0) { - otrns = -otrns; - } - - Coordinate c1 = new Coordinate(world.mapX(otrns), world.mapY(WxMath - .getSkewTXY(layer.getPressure(), 0).y)); - - if (c0 != null) { - target.drawLine(c0.x, c0.y, 0, c1.x, c1.y, 0, color, 1, - lineStyle); - } - c0 = c1; - - found = true; - } - - if (found) { - target.clearClippingPlane(); - double y = world.mapY(WxMath.getSkewTXY(opmin, 0).y); - - RGB clr = SkewTConstants.backgroundColor; - double x = world.mapX(-15); - target.drawString(smallFont, "-50", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - - x = world.mapX(-10); - target.drawString(smallFont, "-15", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - x = world.mapX(-5); - target.drawString(smallFont, "-5", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - x = world.mapX(15); - target.drawString(smallFont, "+50", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - x = world.mapX(10.0); - target.drawString(smallFont, "+15", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - x = world.mapX(5); - target.drawString(smallFont, "+5", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - x = world.mapX(0.0); - target.drawString(smallFont, "0", x, y, 0.0, TextStyle.BLANKED, - clr, HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, - 0.0); - - y -= 2 * target.getStringBounds(smallFont, "H").getHeight(); - target.drawString(smallFont, "Omega (-ubars/s)", x, y, 0.0, - TextStyle.BLANKED, clr, HorizontalAlignment.CENTER, - VerticalAlignment.BOTTOM, 0.0); - } - - } - - /** - * Draw the 24 hour temp change line - * - * @param points - * @throws VizException - */ - protected void drawTempChangeLine(IGraphicsTarget target, WGraphics world, - VerticalSounding vs, VerticalSounding vs24, RGB color) - throws VizException { - - // get the depictable range variables - double pMax = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmax())).y; - double pMin = WxMath.reverseSkewTXY(new Coordinate(0, world - .getWorldYmin())).y; - double deltaT = world.getWorldXmax(); - - // don't draw the temp profile if no data or only data is above 100 mb - if (vs.size() <= 1 || vs24 == null || vs24.size() <= 1) { - return; - } - if ((vs.getMaxPressurelayer().getPressure() < pMin) - || (vs24.getMaxPressurelayer().getPressure() < pMin)) { - return; - } - - // build the sequence of delta T's through linear interpolation of the - // temperatures between the current and previous 24-hour temp profiles - LineStyle lineStyle = LineStyle.SOLID; - Coordinate c0 = null; - double bestdz, bestdT; - for (SoundingLayer layer : vs) { - // only include data up to top of 24Hr pressure hgt (e.g., 300 mb) - if (layer.getPressure() < pMin || layer.getPressure() > pMax) { - continue; - } - - // assume +/- 20m is good enough - bestdz = 20; - bestdT = 1e37; - for (SoundingLayer oldLayer : vs24) { - if (layer.getGeoHeight() == SoundingLayer.MISSING - || oldLayer.getGeoHeight() == SoundingLayer.MISSING - || layer.getTemperature() == SoundingLayer.MISSING - || oldLayer.getTemperature() == SoundingLayer.MISSING) { - continue; - } - double dz = oldLayer.getGeoHeight() - layer.getGeoHeight(); - if (dz > bestdz) { - break; - } - if (dz < 0) { - dz = -dz; - } - if (dz > bestdz) { - continue; - } - bestdz = dz; - bestdT = layer.getTemperature() - oldLayer.getTemperature(); - } - if (bestdT > 1e36) { - continue; - } - - // case where deltaT is out of bounds, neg or pos - if (bestdT < -deltaT) { - bestdT = -deltaT; - } else if (bestdT > deltaT) { - bestdT = deltaT; - } - - Coordinate c1 = new Coordinate(world.mapX(bestdT), world - .mapY(WxMath.getSkewTXY(layer.getPressure(), 0).y)); - - if (c0 != null) { - target.drawLine(c0.x, c0.y, 0, c1.x, c1.y, 0, color, 1, - lineStyle); - } - c0 = c1; - } - - } - - private String getStormRelativeMotionString(SoundingParams sp) { - WindComp helicity = sp.helicity(); - - if (helicity == null - || helicity.getStormMotionDir() >= SoundingLayer.NODATA - || helicity.getStormMotionSpd() >= SoundingLayer.NODATA) { - return "N/A"; - } - float stormDir = helicity.getStormMotionDir(); - float stormSpd = helicity.getStormMotionSpd(); - return String.format("STORM MOTION %d%c AT %d kts", (int) stormDir, - degree, (int) stormSpd); - } - - private String getStormRelativeHelicityString(SoundingParams sp) { - WindComp helicity = sp.helicity(); - - if (helicity == null - || helicity.getStormRelativeHelicity() >= SoundingLayer.NODATA) { - return "N/A"; - } - - float _SRelHelicity = helicity.getStormRelativeHelicity(); - return String.format("STORM RELATIVE HELICITY= %d m%c/s%c", - (int) _SRelHelicity, squared, squared); - } - - @Override - public String inspect(ReferencedCoordinate rCoord) throws VizException { - String s = null; - - SoundingParams sp = getSoundingParameters(); - if (sp == null) { - return s; - } - - s = "NO DATA"; - VerticalSounding vs = sp.getAnalysisData(); - if (vs == null) { - return s; - } - try { - Coordinate c = rCoord.getObject(); - if (this.getDisplay().getSkewTBackground().contains(c)) { - c = WxMath.reverseSkewTXY(getSkewTWorld().unMap(c.x, c.y)); - } else if (getDisplay().getTempChangeBackground().contains(c)) { - c = getTempChangeWorld().unMap(c.x, c.y); - c.y = WxMath.reverseSkewTXY(c).y; - } else if (this.getDisplay().getHodoBackground().contains(c)) { - c = this.getDisplay().getHodoBackground().getWorld().unMap(c.x, - c.y); - Coordinate cc = getWindfromSounding(c); - SoundingLayer sl = new SoundingLayer(); - if (cc != null) { - sl = windMap.get(cc); - c.y = sl.getPressure(); - } else { - return s; - } - } else { - return s; - } - - float p_mb = (float) c.y; - float p_sfc = vs.getMaxPressurelayer().getPressure(); - - if (p_mb > p_sfc) { - return s; - } - - double z_m = vs.interpolateValue(p_mb, DATA_TYPE.GEO_HEIGHT); - double z_ft = (z_m == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : metersToFeet.convert(z_m); - double t_C = (vs.interpolateValue(p_mb, DATA_TYPE.TEMPERATURE) == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : kelvinToCelsius.convert(vs.interpolateValue(p_mb, - DATA_TYPE.TEMPERATURE)); - double t_F = (t_C == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : celciusToFahrenheit.convert(t_C); - double td_C = (vs.interpolateValue(p_mb, DATA_TYPE.DEWPOINT) == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : kelvinToCelsius.convert(vs.interpolateValue(p_mb, - DATA_TYPE.DEWPOINT)); - double td_F = (td_C == SoundingLayer.MISSING) ? SoundingLayer.MISSING - : celciusToFahrenheit.convert(td_C); - float u_ms = vs.interpolateValue(p_mb, DATA_TYPE.WIND_U); - float v_ms = vs.interpolateValue(p_mb, DATA_TYPE.WIND_V); - Coordinate sd = new Coordinate(SoundingLayer.MISSING, - SoundingLayer.MISSING); - double dir = SoundingLayer.MISSING; - double kts = SoundingLayer.MISSING; - if (u_ms != SoundingLayer.MISSING && v_ms != SoundingLayer.MISSING) { - sd = WxMath.speedDir(u_ms, v_ms); - dir = sd.y; - kts = metersPerSecondToKnots.convert(sd.x); - } - double theta = SoundingLayer.MISSING; - double thetaE = SoundingLayer.MISSING; - double w = SoundingLayer.MISSING; - if (td_C != SoundingLayer.MISSING) { - theta = celciusToKelvin.convert(WxMath.theta(p_mb, t_C, 1000)); - thetaE = celciusToKelvin - .convert(WxMath.thetae(p_mb, t_C, td_C)); - w = WxMath.mixingRatio(p_mb, t_C); - } - s = String.format("P=%.0fmb z=%.0fm/%.0fft\n", p_mb, z_m, z_ft); - s += String.format( - "T=%.0f%cC/%.0f%cF Td=%.0f%cC/%.0f%cF %03.0f@%.0fkts\n", - t_C, SkewTConstants.DEGREE_SYMBOL, t_F, - SkewTConstants.DEGREE_SYMBOL, td_C, - SkewTConstants.DEGREE_SYMBOL, td_F, - SkewTConstants.DEGREE_SYMBOL, dir, kts); - s += String.format( - "u=%.0fm/s v=%.0fm/s Theta=%.0fK Theta-e=%.0fK w=%.1f", - u_ms, v_ms, theta, thetaE, w); - - } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, - "Exception translating coordinate", e); - } - - return s; - } - - /** - * Draw an edit handle - * - * @param target - * @param world - * @param zoomLevel - * @param x - * @param y - * @param color - * @throws VizException - */ - public void drawEditHandle(IGraphicsTarget target, WGraphics world, - double zoomLevel, double x, double y, RGB color) - throws VizException { - double radius = SkewTConstants.endpointRadius * zoomLevel; - - target.drawShadedRect(new PixelExtent(x - radius, x + radius, y - - radius, y + radius), color, 1.0, null); - } - - public void addListener(ISkewTDataChangedListener listener) { - listenerList.add(listener); - } - - public void removeListener(ISkewTDataChangedListener listener) { - listenerList.remove(listener); - } - - private void fireListeners() { - for (Object listener : listenerList.getListeners()) { - ((ISkewTDataChangedListener) listener).skewTResourceChanged(this); - } - } - - public static interface ISkewTDataChangedListener { - public abstract void skewTResourceChanged(SkewTResource rsc); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource#getInsetMapLocation() - */ - @Override - public Geometry getInsetMapLocation() { - if (getLocation() != null) { - return IInsetMapResource.factory.createPoint(getLocation()); - } - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.xy.map.rsc.IInsetMapResource#paintInsetMap(com.raytheon - * .uf.viz.core.IGraphicsTarget, - * com.raytheon.uf.viz.core.drawables.PaintProperties, - * com.raytheon.uf.viz.core.map.MapDescriptor) - */ - @Override - public void paintInsetMap(IGraphicsTarget target, - PaintProperties paintProps, MapDescriptor insetMapDescriptor) - throws VizException { - // paint a point - if (point == null) { - Coordinate lp = getLocation(); - if (lp != null) { - point = new PointRenderable(getLocation(), getCapability( - ColorableCapability.class).getColor(), - insetMapDescriptor); - } else { - return; - } - } else { - point.setColor(getCapability(ColorableCapability.class).getColor()); - } - point.paint(target, paintProps); - } - - @Override - protected void resourceDataChanged(ChangeType type, Object updateObject) { - super.resourceDataChanged(type, updateObject); - if (type == ChangeType.DATA_UPDATE - && updateObject instanceof PluginDataObject[]) { - PluginDataObject[] objects = (PluginDataObject[]) updateObject; - try { - VerticalSounding[] soundings = resourceData - .convertToSounding(objects); - for (VerticalSounding vs : soundings) { - addSounding(vs.getDataTime(), vs); - } - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), - e); - } - } - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/AbstractSkewTResourceData.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/AbstractSkewTResourceData.java deleted file mode 100644 index 58e6deabb5..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/AbstractSkewTResourceData.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rscdata; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.viz.skewt.rsc.SkewTResource; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 20, 2009            chammack     Initial creation
- * 
- * 
- * - * @author chammack - * @version 1.0 - */ -@Deprecated -public abstract class AbstractSkewTResourceData extends - AbstractRequestableResourceData { - - protected String sourceName; - - protected void addSounding(DataTime dataTime, VerticalSounding sounding, - SkewTResource rsc) { - rsc.addSounding(dataTime, sounding); - } - - /** - * @return the sourceName - */ - public String getSourceName() { - return sourceName; - } - - /** - * @param sourceName - * the sourceName to set - */ - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - /* - * (non-Javadoc) - * - * @seecom.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# - * constructResource(com.raytheon.uf.viz.core.comm.LoadProperties, - * com.raytheon.uf.common.dataplugin.PluginDataObject[]) - */ - @Override - protected SkewTResource constructResource(LoadProperties loadProperties, - PluginDataObject[] objects) { - SkewTResource rsc = null; - // rsc = new SkewTResource(this, loadProperties); - return rsc; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result - + ((sourceName == null) ? 0 : sourceName.hashCode()); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - AbstractSkewTResourceData other = (AbstractSkewTResourceData) obj; - if (sourceName == null) { - if (other.sourceName != null) { - return false; - } - } else if (!sourceName.equals(other.sourceName)) { - return false; - } - return true; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/GribSoundingSkewTResourceData.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/GribSoundingSkewTResourceData.java deleted file mode 100644 index be723e3e91..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/GribSoundingSkewTResourceData.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rscdata; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.sounding.adapters.GridSoundingAdapter; -import com.raytheon.uf.viz.sounding.adapters.IPointSounding; -import com.raytheon.viz.skewt.rsc.SkewTResource; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * Creates soundings from Grib - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 20, 2009            chammack     Initial creation
- * 
- * 
- * - * @author chammack - * @version 1.0 - */ - -public class GribSoundingSkewTResourceData extends SkewTResourceData implements - IPointSounding { - - @XmlAttribute - private String point; - - @XmlElement - private Coordinate coordinate; - - /* - * (non-Javadoc) - * - * @seecom.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# - * constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties, - * com.raytheon.uf.common.dataplugin.PluginDataObject[]) - */ - @Override - protected SkewTResource constructResource(LoadProperties loadProperties, - PluginDataObject[] objects) throws VizException { - AbstractVerticalSoundingAdapter adapter = new GridSoundingAdapter(this); - adapter.setObjects(objects); - this.soundings = adapter.createSoundings(); - SkewTResource rsc = new SkewTResource(this, loadProperties); - return rsc; - } - - public String getPoint() { - return point; - } - - public void setPoint(String point) { - this.point = point; - } - - public Coordinate getCoordinate() { - return coordinate; - } - - public void setCoordinate(Coordinate coordinate) { - this.coordinate = coordinate; - } - - @Override - public String getPointName() { - return getPoint(); - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTBkgResourceData.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTBkgResourceData.java deleted file mode 100644 index 32a60e76df..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTBkgResourceData.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rscdata; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; - -import com.raytheon.uf.viz.core.drawables.IDescriptor; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.AbstractResourceData; -import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.viz.skewt.rsc.SkewTBackgroundResource; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Oct 7, 2009            randerso     Initial creation
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -@XmlAccessorType(XmlAccessType.NONE) -public class SkewTBkgResourceData extends AbstractResourceData { - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractResourceData#construct(com.raytheon - * .uf.viz.core.rsc.LoadProperties, - * com.raytheon.uf.viz.core.drawables.IDescriptor) - */ - @Override - public AbstractVizResource construct(LoadProperties loadProperties, - IDescriptor descriptor) throws VizException { - return new SkewTBackgroundResource(this, loadProperties); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractResourceData#equals(java.lang.Object - * ) - */ - @Override - public boolean equals(Object obj) { - return getClass() == this.getClass(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractResourceData#update(java.lang.Object - * ) - */ - @Override - public void update(Object updateData) { - - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTResourceData.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTResourceData.java deleted file mode 100644 index 0f8340ba3d..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/rscdata/SkewTResourceData.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.rscdata; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; - -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.sounding.VerticalSounding; -import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter; -import com.raytheon.uf.viz.core.Activator; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.viz.skewt.rsc.SkewTResource; - -/** - * TODO Add Description - * - *
- * 
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Sep 23, 2009            randerso    Initial creation
- * Jul 05, 2013 1869       bsteffen    Fix goes sounding updates.
- * 
- * 
- * - * @author randerso - * @version 1.0 - */ - -@XmlAccessorType(XmlAccessType.NONE) -public class SkewTResourceData extends AbstractRequestableResourceData { - private static final String VERTICAL_SOUNDING_ADAPTER_EXTENSION = "com.raytheon.uf.viz.sounding.verticalSoundingAdapter"; - - private static Map adapterMap = null; - - private String pointLetter; - - protected VerticalSounding[] soundings; - - /** - * - */ - public SkewTResourceData() { - } - - /** - * @return the soundings - */ - public VerticalSounding[] getSoundings() { - return soundings; - } - - /* - * (non-Javadoc) - * - * @seecom.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# - * constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties, - * com.raytheon.uf.common.dataplugin.PluginDataObject[]) - */ - @Override - protected SkewTResource constructResource(LoadProperties loadProperties, - PluginDataObject[] objects) throws VizException { - - soundings = convertToSounding(objects); - - return new SkewTResource(this, loadProperties); - } - - public VerticalSounding[] convertToSounding(PluginDataObject[] objects) - throws VizException { - if (objects != null && objects.length > 0) { - AbstractVerticalSoundingAdapter adapter = getAdapter(objects[0]); - adapter.setObjects(objects); - return adapter.createSoundings(); - } else { - return new VerticalSounding[0]; - } - } - - protected AbstractVerticalSoundingAdapter getAdapter(PluginDataObject object) - throws VizException { - synchronized (SkewTResourceData.class) { - if (adapterMap == null) { - adapterMap = new HashMap(); - IExtensionRegistry registry = Platform.getExtensionRegistry(); - if (registry != null) { - IExtensionPoint point = registry - .getExtensionPoint(VERTICAL_SOUNDING_ADAPTER_EXTENSION); - if (point != null) { - IExtension[] extensions = point.getExtensions(); - - for (IExtension ext : extensions) { - IConfigurationElement[] config = ext - .getConfigurationElements(); - - for (IConfigurationElement cfg : config) { - String record = cfg.getAttribute("class"); - - if (adapterMap.put(record, cfg) != null) { - Activator - .getDefault() - .getLog() - .log( - new Status( - Status.ERROR, - Activator.PLUGIN_ID, - "Duplicate VerticalSoundingAdapter for: \"" - + record - + "\" defined in " - + ext - .getNamespaceIdentifier())); - } - } - } - } - } - } - } - - String className = object.getClass().getName(); - IConfigurationElement cfg = adapterMap.get(className); - if (cfg == null) { - throw new VizException("No VerticalSoundingAdapter registered for " - + className); - } - try { - AbstractVerticalSoundingAdapter adapter = (AbstractVerticalSoundingAdapter) cfg - .createExecutableExtension("adapter"); - - return adapter; - } catch (Throwable e) { - e.printStackTrace(); - throw new VizException( - "Exception while getting VerticalSoundingAdapter for " - + className, e); - } - } - - /** - * - * @return - */ - public String getPointLetter() { - return pointLetter; - } - - /** - * - * @param pointLetter - */ - public void setPointLetter(String pointLetter) { - this.pointLetter = pointLetter; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + Arrays.hashCode(soundings); - return result; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - SkewTResourceData other = (SkewTResourceData) obj; - if (soundings != other.soundings) { - return false; - } - return true; - } -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/AbstractSkewTBackground.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/AbstractSkewTBackground.java deleted file mode 100644 index 7771b83f0e..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/AbstractSkewTBackground.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.ui; - -import org.eclipse.swt.graphics.Rectangle; - -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.drawables.IFont; -import com.raytheon.uf.viz.core.drawables.IRenderable; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.viz.core.graphing.WGraphics; -import com.vividsolutions.jts.geom.Coordinate; - -public abstract class AbstractSkewTBackground implements IRenderable { - protected Rectangle rectangle; - - private WGraphics world; - - protected IFont smallFont; - - protected double magnification; - - /** - * Determine if a point is contained in this background area - * - * @param c - * point of interest - * @return true if point is contained - */ - public boolean contains(Coordinate c) { - return this.rectangle.contains((int) c.x, (int) c.y); - } - - public Rectangle getRectangle() { - return this.rectangle; - } - - public WGraphics getWorld() { - synchronized (AbstractSkewTBackground.class) { - if (this.world == null) { - this.world = computeWorld(); - } - } - return this.world; - } - - /** - * @param magnification - * the magnification to set - */ - public void setMagnification(double magnification) { - this.magnification = magnification; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.drawables.IRenderable#paint(com.raytheon.uf. - * viz.core.IGraphicsTarget, - * com.raytheon.uf.viz.core.drawables.PaintProperties) - */ - @Override - public void paint(IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - - smallFont = target.initializeFont( - target.getDefaultFont().getFontName(), - (float) (10 * magnification), null); - - paintInternal(target, paintProps); - - smallFont.dispose(); - } - - protected abstract void paintInternal(IGraphicsTarget target, - PaintProperties paintProps) throws VizException; - - protected abstract WGraphics computeWorld(); -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/HodoBackground.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/HodoBackground.java deleted file mode 100644 index 28cebfbf6d..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/HodoBackground.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.ui; - -import org.eclipse.swt.graphics.Rectangle; - -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.PixelExtent; -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.drawables.PaintProperties; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; -import com.raytheon.viz.core.graphing.WGraphics; -import com.raytheon.viz.skewt.Activator; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * - * Draw the hodograph. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 28Sept2008  #1529       dhladky    separate and improve.
- * 
- * 
- * - * @author dhladky - * @version 1.0 - */ - -public class HodoBackground extends AbstractSkewTBackground { - - private double uMin; - - private double uMax; - - private double vMin; - - private double vMax; - - private PixelExtent pixExt; - - /** - * Public constructor - * - * @param target - * @param world - * @param paintProps - * @throws VizException - */ - public HodoBackground() { - super(); - - rectangle = new Rectangle(10, 730, 560, 480); - } - - @Override - public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - - float zoomLevel = paintProps.getZoomLevel(); - - pixExt = new PixelExtent(rectangle); - - // rings are offset to left of center of hodograph. - // in D2-D this is offset so the 50 m/s ring touches the - // left side of the display and the 90 m/s touches the right side of - // the display. We adjust our display to mimic this. - - target.setupClippingPlane(pixExt); - - // draw the spokes. - Coordinate c = new Coordinate(getWorld().mapX(0), getWorld().mapY(0)); - for (double angle = 0; angle < 2 * Math.PI; angle += Math.PI / 6) { - double x = 200 * Math.cos(angle); - double y = 200 * Math.sin(angle); - target.drawLine(c.x, c.y, 0.0, getWorld().mapX(x), getWorld().mapY( - y), 0.0, SkewTConstants.moistAdiabatColor, 1, - LineStyle.SOLID); - } - // label the spokes - - target.drawString(smallFont, "180" + SkewTConstants.DEGREE_SYMBOL, c.x, - rectangle.y, 0.0, TextStyle.BLANKED, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, VerticalAlignment.TOP, null); - - target.drawString(smallFont, "360" + SkewTConstants.DEGREE_SYMBOL, c.x, - rectangle.y + rectangle.height, 0.0, TextStyle.BLANKED, - SkewTConstants.labelColor, HorizontalAlignment.CENTER, - VerticalAlignment.BOTTOM, null); - - target.drawString(smallFont, "90" + SkewTConstants.DEGREE_SYMBOL, - rectangle.x + (2 * zoomLevel), rectangle.y + rectangle.height - / 2, 0.0, TextStyle.BLANKED, SkewTConstants.labelColor, - HorizontalAlignment.LEFT, VerticalAlignment.MIDDLE, null); - - target.drawString(smallFont, "270" + SkewTConstants.DEGREE_SYMBOL, - rectangle.x + rectangle.width - 10 * zoomLevel, rectangle.y - + rectangle.height / 2, 0.0, TextStyle.BLANKED, - SkewTConstants.labelColor, HorizontalAlignment.RIGHT, - VerticalAlignment.MIDDLE, null); - - for (int spd = 10; spd <= 100; spd += 10) { - - Coordinate c0, c1; - c0 = WxMath.uvComp(spd, 0); - for (int dir = 1; dir <= 360; dir += 1) { - c1 = WxMath.uvComp(spd, dir); - target.drawLine(getWorld().mapX(c0.x), getWorld().mapY(c0.y), - 0.0, getWorld().mapX(c1.x), getWorld().mapY(c1.y), 0.0, - SkewTConstants.backgroundColor, 1); - c0 = c1; - } - - Coordinate uv = WxMath.uvComp(spd, 240); - if (spd != 0) { - target.drawString(smallFont, "" + spd, getWorld().mapX(uv.x), - getWorld().mapY(uv.y), 0.0, TextStyle.NORMAL, - SkewTConstants.labelColor, HorizontalAlignment.CENTER, - VerticalAlignment.MIDDLE, null); - } - } - - target.drawRect(pixExt, SkewTConstants.backgroundColor, 1.0f, 1.0f); - - target.clearClippingPlane(); - String label = "HODOGRAPH SPEED IN m/s"; - target.drawString(smallFont, label, rectangle.x + rectangle.width / 2, - rectangle.y, 0.0, TextStyle.BLANKED, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, null); - - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.ui.AbstractSkewTBackground#computeWorld() - */ - @Override - protected WGraphics computeWorld() { - - HierarchicalPreferenceStore prefs = Activator.getDefault() - .getPreferenceStore(); - - double d; - uMin = ((d = prefs.getDouble("windRange.umin")) == 0.0 ? -50.0 : d); - uMax = ((d = prefs.getDouble("windRange.umax")) == 0.0 ? 50.0 : d); - vMin = ((d = prefs.getDouble("windRange.vmin")) == 0.0 ? -50.0 : d); - vMax = ((d = prefs.getDouble("windRange.vmax")) == 0.0 ? 50.0 : d); - - WGraphics world = new WGraphics(rectangle); - world.setWorldCoordinates(uMin, vMax, uMax, vMin); - return world; - } - - /** - * @return the uMin - */ - public double getUMin() { - return uMin; - } - - /** - * @return the uMax - */ - public double getUMax() { - return uMax; - } - - /** - * @return the vMin - */ - public double getVMin() { - return vMin; - } - - /** - * @return the vMax - */ - public double getVMax() { - return vMax; - } - - /** - * @return the pixExt - */ - public PixelExtent getPixExt() { - return pixExt; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewTConstants.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewTConstants.java deleted file mode 100644 index d8ac9f1de6..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewTConstants.java +++ /dev/null @@ -1,162 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt.ui; - -import java.text.DecimalFormat; -import java.util.List; - -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.graphics.Rectangle; - -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.common.sounding.util.Equations; -import com.raytheon.uf.common.sounding.util.UAPoint; - -/** - * - * Used extensive work from SkewT and associated codebase. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 28Sept2008  #1529       dhladky     initial.
- * Feb 15, 2013 1638       mschenke    Moved Equations/UAPoint from edex.common util
- *                                     to common.sounding
- * 
- * 
- * - * @author dhladky - * @version 1.0 - */ - -public class SkewTConstants { - - public static Rectangle skewTRectangle = new Rectangle(0, 0, 860, 1240); - - public static double TEMPERATURE_MIN = -115.0; - - public static double TEMPERATURE_MAX = 45.0; - - public static double WIND_SPEED_MIN = 0.0; - - public static double WIND_SPEED_MAX = 250.0; - - public static double WIND_DIR_MIN = 0.0; - - public static double WIND_DIR_MAX = 360.0; - - public static double PRESSURE_MIN = 100.0; - - public static double PRESSURE_MAX = 973.0; - - // horizontal pressure line that will be drawn. - public static final double[] MAN_LEVELS = { 1050, 1000, 950, 900, 850, 800, - 750, 700, 650, 600, 550, 500, 450, 400, 350, 300, 250, 200, 150, - 100 }; - - public static List> saturatedPoints = Equations - .getSaturatedAdiabats(1000, 100, 20, -60, 60, 5); - - public static List> dryPoints = Equations.getDryAdiabats( - 1000, 100, 20, -40, 273, 10); - - // lightGray. - public static final RGB backgroundColor = new RGB(191, 191, 191); - - /** - * Color for moist adiabat lines - */ - public static final RGB moistAdiabatColor = new RGB(0, 127, 255); - - /** - * Color for dry adiabat lines - */ - public static final RGB dryAdiabatColor = new RGB(0, 0, 255); - - /** - * Color for mixing ratio lines - */ - public static final RGB mixingRatioColor = new RGB(23, 255, 23); - - /** - * Color for temperature lines - */ - public static final RGB temperatureColor = new RGB(210, 180, 140); - - /** - * Color for pressure lines - */ - public static final RGB pressureColor = new RGB(191, 191, 191); - - /** - * Color for wetbulb lines - */ - public static final RGB wetBulbColor = new RGB(0, 255, 255); - - public static final int wetBulbLineWidth = 1; - - /** - * parameter and label color - */ - public static final RGB labelColor = new RGB(191, 191, 191); - - public static final RGB editColor = new RGB(255, 165, 0); - - public static final RGB pointEditColor = new RGB(255, 0, 0); - - public static final int editLineWidth = 2; - - public static final RGB parcelColor = new RGB(132, 112, 255); - - public static final int parcelLineWidth = 2; - - public static final int moistAdiabaticIncrement = 5; - - // lightGray. - public static final RGB pointColor = new RGB(255, 255, 0); - - public static DecimalFormat pressFormat = new DecimalFormat("####.#"); - - public static DecimalFormat tempFormat = new DecimalFormat("###.#"); - - public static DecimalFormat windFormat = new DecimalFormat("###.#"); - - public static char DEGREE_SYMBOL = '\u00B0'; - - public static double endpointRadius = 4; - - public static final int LABEL_PADDING = 5; - - public static double bottom = WxMath.getSkewTXY(1050, 0).y; - - public static double top = WxMath.getSkewTXY(100, 0).y; - - public static double height = top - bottom; - - public static double left = (-height / 2) - 1; - - public static double right = (height / 2) + 1; - - public static double center = (left + right) / 2; - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtBackground.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtBackground.java deleted file mode 100644 index b9e8fd9e25..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtBackground.java +++ /dev/null @@ -1,374 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt.ui; - -import java.awt.geom.Line2D; -import java.awt.geom.Point2D; -import java.util.Iterator; -import java.util.List; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.SI; - -import org.eclipse.swt.graphics.Rectangle; - -import com.raytheon.uf.common.sounding.util.Equations; -import com.raytheon.uf.common.sounding.util.UAPoint; -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.viz.core.IGraphicsTarget; -import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.drawables.IRenderable; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.viz.core.graphing.WGraphics; -import com.vividsolutions.jts.geom.Coordinate; - -/** - * - * Used extensive work from SkewTGraph and associated codebase. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 14Jan2007   #682        ebabin     Update for sampling bug. 
- * 28Sept2008  #1529       dhladky    separate and improve.
- * Feb 15, 2013 1638       mschenke    Moved Equations/UAPoint from edex.common util
- *                                     to common.sounding
- * 
- * 
- * - * @author dhladky - * @version 1.0 - */ - -public class SkewtBackground extends AbstractSkewTBackground implements - IRenderable { - - private static final UnitConverter kelvinToCelsius = SI.KELVIN - .getConverterTo(SI.CELSIUS); - - public SkewtBackground() { - super(); - - this.rectangle = new Rectangle(10, 10, 690, 690); - } - - /** - * Draws the adiabat lines. - * - * @throws VizException - */ - private void drawAdiabats(IGraphicsTarget target) throws VizException { - - for (Iterator> iterator = SkewTConstants.saturatedPoints - .iterator(); iterator.hasNext();) { - List points = iterator.next(); - UAPoint firstPoint = points.get(0); - Coordinate coor1 = WxMath.getSkewTXY(firstPoint.pressure, - kelvinToCelsius.convert(firstPoint.temperature)); - for (Iterator iter = points.iterator(); iter.hasNext();) { - UAPoint p = iter.next(); - Coordinate coor2 = WxMath.getSkewTXY(p.pressure, - kelvinToCelsius.convert(p.temperature)); - target.drawLine(getWorld().mapX(coor1.x), getWorld().mapY( - coor1.y), 0.0, getWorld().mapX(coor2.x), getWorld() - .mapY(coor2.y), 0.0, SkewTConstants.moistAdiabatColor, - 1, IGraphicsTarget.LineStyle.DOTTED); - coor1 = coor2; - } - } - for (Iterator> iterator = SkewTConstants.dryPoints - .iterator(); iterator.hasNext();) { - List points = iterator.next(); - UAPoint firstPoint = points.get(0); - Coordinate startCoor = WxMath.getSkewTXY(firstPoint.pressure, - kelvinToCelsius.convert(firstPoint.temperature)); - for (Iterator iter = points.iterator(); iter.hasNext();) { - UAPoint p = iter.next(); - Coordinate endCoor = WxMath.getSkewTXY(p.pressure, - kelvinToCelsius.convert(p.temperature)); - target.drawLine(getWorld().mapX(startCoor.x), getWorld().mapY( - startCoor.y), 0.0, getWorld().mapX(endCoor.x), - getWorld().mapY(endCoor.y), 0.0, - SkewTConstants.dryAdiabatColor, 1); - startCoor = endCoor; - } - } - } - - /** - * Draws the temperature lines. - * - * @throws VizException - */ - private void drawTempLines(IGraphicsTarget target) throws VizException { - - Line2D.Double rightClipLine = new Line2D.Double(getWorld() - .getViewXmax() - 20, getWorld().getViewYmin(), getWorld() - .getViewXmax() - 20, getWorld().getViewYmax()); - - Line2D.Double topClipLine = new Line2D.Double(getWorld().getViewXmin(), - getWorld().getViewYmin() + 60, getWorld().getViewXmax(), - getWorld().getViewYmin() + 60); - - for (int i = 70; i > -200; i -= 10) { - Coordinate coorStart = WxMath.getSkewTXY(1050, i); - Coordinate coorEnd = WxMath.getSkewTXY(100, i); - - target.drawLine(getWorld().mapX(coorStart.x), getWorld().mapY( - coorStart.y), 0.0, getWorld().mapX(coorEnd.x), getWorld() - .mapY(coorEnd.y), 0.0, SkewTConstants.temperatureColor, 1); - - double startX = getWorld().mapX(coorStart.x); - double startY = getWorld().mapY(coorStart.y); - - double endX = getWorld().mapX(coorEnd.x); - double endY = getWorld().mapY(coorEnd.y); - - Line2D.Double tempLine = new Line2D.Double(startX, startY, endX, - endY); - - drawLabelAtLineIntersections(target, tempLine, rightClipLine, - Integer.toString(i)); - drawLabelAtLineIntersections(target, tempLine, topClipLine, Integer - .toString(i)); - } - } - - /** - * Draws the presssure lines. - * - * @throws VizException - */ - private void drawPressureLines(IGraphicsTarget target) throws VizException { - String s = null; - - for (int i = 0; i < SkewTConstants.MAN_LEVELS.length; i++) { - Coordinate coor = WxMath.getSkewTXY(SkewTConstants.MAN_LEVELS[i], - -50); - coor.x = getWorld().unMap(getWorld().getViewXmin(), 0).x; - Coordinate coorEnd = WxMath.getSkewTXY( - SkewTConstants.MAN_LEVELS[i], 60); - coorEnd.x = getWorld().unMap(740, 0).x; - target.drawLine(getWorld().mapX(coor.x), getWorld().mapY(coor.y), - 0.0, getWorld().mapX(coorEnd.x), - getWorld().mapY(coorEnd.y), 0.0, - SkewTConstants.pressureColor, 1); - s = SkewTConstants.pressFormat.format(SkewTConstants.MAN_LEVELS[i]); - if (i != 0 && (SkewTConstants.MAN_LEVELS[i] % 100 == 0)) { - target.drawString(smallFont, s, getWorld().mapX( - SkewTConstants.center), - getWorld().mapY( - WxMath.getSkewTXY(SkewTConstants.MAN_LEVELS[i], - -35).y), 0.0, - IGraphicsTarget.TextStyle.BLANKED, - SkewTConstants.pressureColor, - IGraphicsTarget.HorizontalAlignment.CENTER, - IGraphicsTarget.VerticalAlignment.MIDDLE, null); - } - - } - } - - /** - * draw side bar lines - */ - private void drawSideLines(IGraphicsTarget target) { - - try { - target.drawLine(getWorld().mapX(SkewTConstants.left), getWorld() - .mapY(SkewTConstants.bottom), 0.0, getWorld().mapX( - SkewTConstants.left), getWorld().mapY(SkewTConstants.top), - 0.0, SkewTConstants.pressureColor, 1); - - target.drawLine(getWorld().mapX(SkewTConstants.right), getWorld() - .mapY(SkewTConstants.bottom), 0.0, getWorld().mapX( - SkewTConstants.right), getWorld().mapY(SkewTConstants.top), - 0.0, SkewTConstants.pressureColor, 1); - - } catch (VizException e) { - e.printStackTrace(); - } - } - - /** - * Draws a particular line at the intersection of two lines. - * - * @param line1 - * @param line2 - * @param s - * @throws VizException - */ - private void drawLabelAtLineIntersections(IGraphicsTarget target, - Line2D.Double line1, Line2D.Double line2, String s) - throws VizException { - Point2D.Double point = null; - if ((point = getLineIntersection(line1, line2)) != null) { - target.drawString(smallFont, s, point.x, point.y, 0.0, - IGraphicsTarget.TextStyle.BLANKED, - SkewTConstants.labelColor, - IGraphicsTarget.HorizontalAlignment.CENTER, null); - } - - } - - /** - * Returns the point that two lines instersect, or null if they do not. - * - * @param l1 - * @param l2 - * @return - */ - private Point2D.Double getLineIntersection(Line2D.Double l1, - Line2D.Double l2) { - if (!l1.intersectsLine(l2)) { - return null; - } - - Point2D.Double intersection = new Point2D.Double(); - double x1 = l1.getX1(), y1 = l1.getY1(), x2 = l1.getX2(), y2 = l1 - .getY2(), x3 = l2.getX1(), y3 = l2.getY1(), x4 = l2.getX2(), y4 = l2 - .getY2(); - - intersection.x = det(det(x1, y1, x2, y2), x1 - x2, det(x3, y3, x4, y4), - x3 - x4) - / det(x1 - x2, y1 - y2, x3 - x4, y3 - y4); - intersection.y = det(det(x1, y1, x2, y2), y1 - y2, det(x3, y3, x4, y4), - y3 - y4) - / det(x1 - x2, y1 - y2, x3 - x4, y3 - y4); - - return intersection; - } - - private double det(double a, double b, double c, double d) { - return a * d - b * c; - } - - /** - * Draws the mixing ratio lines. - * - * @throws VizException - */ - private void drawMixingRatios(IGraphicsTarget target, - PaintProperties paintProperties) throws VizException { - // get the location of the 825 pressure line... - Coordinate coorStart = WxMath.getSkewTXY(850, -50); - Coordinate coorEnd = WxMath.getSkewTXY(850, 50); - - double startX = getWorld().mapX(coorStart.x); - double startY = getWorld().mapY(coorStart.y); - - double endX = getWorld().mapX(coorEnd.x); - double endY = getWorld().mapY(coorEnd.y); - - Line2D.Double line = new Line2D.Double(startX, startY, endX, endY); - - double zoomLevel = paintProperties.getZoomLevel(); - double[] mixingRatios = getMixingRatios(zoomLevel); - for (double ratio : mixingRatios) { - UAPoint p1 = new UAPoint(); - p1.pressure = 1000; - p1.temperature = Equations - .invMixingRatio(p1.pressure, ratio / 1000); - - UAPoint p2 = new UAPoint(); - p2.pressure = 400; - p2.temperature = Equations - .invMixingRatio(p2.pressure, ratio / 1000); - Coordinate coor1 = WxMath.getSkewTXY(p1.pressure, - p1.temperature - 273.15); - Coordinate coor2 = WxMath.getSkewTXY(p2.pressure, - p2.temperature - 273.15); - target.drawLine(getWorld().mapX(coor1.x), getWorld().mapY(coor1.y), - 0.0, getWorld().mapX(coor2.x), getWorld().mapY(coor2.y), - 0.0, SkewTConstants.mixingRatioColor, 1, - IGraphicsTarget.LineStyle.DASHED); - - drawLabelAtLineIntersections(target, line, new Line2D.Double( - getWorld().mapX(coor1.x), getWorld().mapY(coor1.y), - getWorld().mapX(coor2.x), getWorld().mapY(coor2.y)), Double - .toString((ratio))); - } - } - - private double[] getMixingRatios(double zoomLevel) { - - double[][] ratios = { - { .5, 1, 2, 5, 10, 20, 50 }, - { .3, .5, 1, 2, 3, 5, 8, 12, 20, 30, 50 }, - - { 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 7, 8, 9, 10, 11, 12, 14, - 16, 18, 20, 24, 28, 32, 36, 40, 45, 50 }, - { 1.4, 1.6, 1.8, 2, 2.4, 2.8, 3.2, 3.6, 4, 4.5, 5, 5.5, 6, 7, - 8, 9, 10, 11, 12, 14, 16, 18 }, - { .1, .2, .3, .4, .5, .6, .8, .7, .8, .9, 1, 1.1, 1.2, 1.4, - 1.6, 1.8, 2, 2.4, 2.8, 3.2, 3.6, 4, 4.5, 5, 5.5, 6 }, - { .1, .2, .3, .4, .5, .6, .8, 1, 1.2, 1.6, 2, 2.5, 3, 4, 5, 6, - 8, 10, 12, 16, 20, 25, 30, 40, 50 }, - { .1, .2, .3, .5, .7, 1, 1.5, 2, 3, 5, 7, 10, 15, 20, 30, 50 }, - - { .3, 1, 3, 10, 30 }, { .1, 1, 10 } }; - - if (zoomLevel == 1) { - return ratios[0]; - } - if (zoomLevel >= .70) { - return ratios[1]; - } - return ratios[0]; - } - - @Override - public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - - PixelExtent pe = new PixelExtent(this.rectangle); - - target.setupClippingPlane(pe); - - drawAdiabats(target); - drawTempLines(target); - drawPressureLines(target); - drawMixingRatios(target, paintProps); - drawSideLines(target); - - target.clearClippingPlane(); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.ui.AbstractSkewTBackground#computeWorld() - */ - @Override - protected WGraphics computeWorld() { - - WGraphics world = new WGraphics(this.rectangle); - - world.setWorldCoordinates(SkewTConstants.left, SkewTConstants.top, - SkewTConstants.right, SkewTConstants.bottom); - - return world; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtControlsDialog.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtControlsDialog.java deleted file mode 100644 index ad2fcc84e6..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/SkewtControlsDialog.java +++ /dev/null @@ -1,933 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.skewt.ui; - -/** - * SkewTControlsDlg.java Nov 28, 2007 - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- *  Nov 28, 2007		     Lee Venable Initial Creation
- *  Nov 29, 2007          Eric Babin  Updated for D2D look and feel.
- *                        Tied in fuctions back to SkewtDisplay. 
- *  09Sept2008            dhladky     Made interactive.
- *  09Jan2009             dhladky     hardened it for release.
- * 
- * 
- * - * @author ebabin - * @version 1.0 - */ - -import java.util.Iterator; - -import javax.measure.converter.UnitConverter; -import javax.measure.unit.NonSI; -import javax.measure.unit.SI; - -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -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.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; - -import com.raytheon.uf.common.sounding.SoundingLayer; -import com.raytheon.uf.common.sounding.ParcelLift.PARCEL_TYPE; -import com.raytheon.uf.viz.core.drawables.ResourcePair; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.ResourceList; -import com.raytheon.viz.skewt.SkewTDescriptor; -import com.raytheon.viz.skewt.SkewtDisplay; -import com.raytheon.viz.skewt.rsc.InteractiveSkewTResource; -import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; -import com.raytheon.viz.ui.editor.AbstractEditor; - -public class SkewtControlsDialog extends CaveJFACEDialog { - - private static final UnitConverter celciusToFahrenheit = SI.CELSIUS - .getConverterTo(NonSI.FAHRENHEIT); - - private static final UnitConverter celciusToKelvin = SI.CELSIUS - .getConverterTo(SI.KELVIN); - - private static final UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND - .getConverterTo(NonSI.KNOT); - - protected static final UnitConverter fahrenheitToCelcius = NonSI.FAHRENHEIT - .getConverterTo(SI.CELSIUS); - - protected static final UnitConverter knotsToMetersPerSecond = NonSI.KNOT - .getConverterTo(SI.METERS_PER_SECOND); - - public String dialogTitle; - - private Composite top = null; - - private String modelName; - - private Button pmaxRdo; - - private Button surfaceRdo; - - private Button meanTempRdo; - - private Button userSelectRdo; - - private Button useFcstMaxChk; - - private Text userSelectTF; - - private Button liftParcelBtn; - - private Text pTempTF; - - private Text tTempTF; - - private Text tdTempTF; - - private Button celsiusRdo; - - private Button fahrenheitRdo; - - private Button addPntSkewtBtn; - - private Text pSpdTF; - - private Text dirSpdTF; - - private Text spdSpdTF; - - private Button ktsRdo; - - private Button msRdo; - - private Button addPntHodoBtn; - - private Button helicityStormChk; - - private Button wetBulbChk; - - private Button resetHodoSkewtBtn; - - private boolean isParcel = false; - - private String pressureError = "Pressure must be between 973 mb && 100 mb"; - - private String tempDwptError = "Temp && dewpoint must be between -115 && 45 deg C (-175 && 113 deg F)"; - - private String windDirectionError = "Wind direction must be between 0 && 360 deg"; - - private String windSpeedError = "Wind speed must be between 0 && 250 kts (0 & 129 m/s)"; - - private SkewtDisplay theDisplay = null; - - static private SkewtControlsDialog instance = null; - - private static Double PRESSURE_MAX = 973.0; - - private static Double PRESSURE_MIN = 100.0; - - private static PARCEL_TYPE ptype; - - private Shell shell = null; - - InteractiveSkewTResource rsc = null; - - AbstractEditor editor = null; - - // make it a singleton - public static SkewtControlsDialog getInstance(Shell parShell, - String modelName) { - if (instance == null) { - try { - instance = new SkewtControlsDialog(parShell, modelName); // , - // display); - } catch (VizException ve) { - ve.printStackTrace(); - } - } - - return instance; - } - - /** - * Skew-T control default constructor. - * - * @param parShell - * @param modelName - * @param SkewtDisplay - * @throws VizException - */ - private SkewtControlsDialog(Shell parShell, String modelName) - throws VizException { - super(parShell); - shell = parShell; - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); - this.modelName = modelName; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets - * .Composite) - */ - @Override - public Control createDialogArea(Composite parent) { - top = (Composite) super.createDialogArea(parent); - - // Create the main layout for the shell. - GridLayout mainLayout = new GridLayout(1, false); - mainLayout.marginHeight = 3; - mainLayout.marginWidth = 3; - top.setLayout(mainLayout); - - // Initialize all of the menus, controls, and layouts - initializeComponents(); - - return top; - } - - private void initializeComponents() { - - createMenus(); - createModelName(); - createLiftingMethod(); - createAddChangePointSkewT(); - createAddChangePointHodograph(); - createAdditionalInformation(); - createRestoreOriginalData(); - getRsc(); - ptype = rsc.getPtype(); - switch (ptype) { - case PMAX: - pmaxRdo.setSelection(true); - break; - case USERSELECT: - userSelectRdo.setSelection(true); - break; - case SURFACE: - surfaceRdo.setSelection(true); - useFcstMaxChk.setEnabled(true); - useFcstMaxChk.setSelection(rsc.getFcstMax()); - break; - case MEANTEMP: - meanTempRdo.setSelection(true); - break; - } - } - - /** - * create the Menu bar - */ - private void createMenus() { - Menu menuBar = new Menu(this.getShell(), SWT.BAR); - createFileMenu(menuBar); - this.getShell().setMenuBar(menuBar); - } - - /** - * file operations menu - */ - private void createFileMenu(Menu menuBar) { - MenuItem fileI = new MenuItem(menuBar, SWT.CASCADE); - fileI.setText("File"); - - Menu fileMenu = new Menu(menuBar); - fileI.setMenu(fileMenu); - - // Open file menu item - MenuItem openMI = new MenuItem(fileMenu, SWT.NONE); - openMI.setText("&Open\tCtrl+O"); - openMI.setAccelerator(SWT.CTRL + 'O'); - openMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - FileDialog fd = new FileDialog(shell, SWT.OPEN); - String path = fd.open(); - if (path == null) { - return; - } - rsc.loadSounding(path); - } - }); - - // Save file menu item - MenuItem saveMI = new MenuItem(fileMenu, SWT.NONE); - saveMI.setText("&Save\tCtrl+S"); - saveMI.setAccelerator(SWT.CTRL + 'S'); - saveMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - FileDialog fd = new FileDialog(shell, SWT.SAVE); - String path = fd.open(); - if (path == null) { - return; - } - rsc.saveSounding(path); - } - }); - - // Save as... file menu item - MenuItem saveasMI = new MenuItem(fileMenu, SWT.NONE); - saveasMI.setText("Save &As..."); - saveasMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - FileDialog fd = new FileDialog(shell, SWT.SAVE); - String path = fd.open(); - if (path == null) { - return; - } - rsc.saveSounding(path); - } - }); - - // Exit menu item - MenuItem exitMI = new MenuItem(fileMenu, SWT.NONE); - exitMI.setText("E&xit\tCtrl+X"); - exitMI.setAccelerator(SWT.CTRL + 'X'); - exitMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - close(); - } - }); - - } - - /** - * create model name. - */ - private void createModelName() { - Composite labelComp = new Composite(top, SWT.NONE); - GridLayout gl = new GridLayout(2, false); - labelComp.setLayout(gl); - - createCenteredLabel(labelComp, 2, modelName); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse - * .swt.widgets.Composite) - */ - @Override - protected void createButtonsForButtonBar(Composite parent) { - // do nothing - } - - /** - * Create centered Label. - * - * @param c - * @param numCols - * @param text - * @return Label - */ - private Label createCenteredLabel(Composite c, int numCols, String text) { - Label label = new Label(c, SWT.NONE | SWT.CENTER); - label.setText(text); - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - gridData.horizontalSpan = numCols; - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.FILL; - label.setLayoutData(gridData); - - return label; - } - - /** - * Create the lifting method. - */ - private void createLiftingMethod() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - Group liftingGroup = new Group(top, SWT.NONE); - - GridLayout gl = new GridLayout(2, false); - gl.horizontalSpacing = 10; - liftingGroup.setLayout(gl); - liftingGroup.setLayoutData(gd); - - createCenteredLabel(liftingGroup, 2, "Lifting Method"); - - pmaxRdo = new Button(liftingGroup, SWT.RADIO); - pmaxRdo.setText("PMAX"); - pmaxRdo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (pmaxRdo.getSelection() == true) { - ptype = PARCEL_TYPE.PMAX; - useFcstMaxChk.setSelection(false); - useFcstMaxChk.setEnabled(false); - rsc.setFcstMax(false); - } - } - }); - - // filler - new Label(liftingGroup, SWT.NONE); - - surfaceRdo = new Button(liftingGroup, SWT.RADIO); - surfaceRdo.setText("Surface"); - surfaceRdo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (surfaceRdo.getSelection() == true) { - ptype = PARCEL_TYPE.SURFACE; - useFcstMaxChk.setEnabled(true); - useFcstMaxChk.setSelection(rsc.getFcstMax()); - } - } - }); - - useFcstMaxChk = new Button(liftingGroup, SWT.CHECK); - useFcstMaxChk.setText("Use Fcst Max Temp"); - useFcstMaxChk.setEnabled(false); - useFcstMaxChk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (useFcstMaxChk.getSelection() == true) { - rsc.setFcstMax(true); - } else { - rsc.setFcstMax(false); - } - } - }); - - meanTempRdo = new Button(liftingGroup, SWT.RADIO); - meanTempRdo.setText("Mean Temp"); - meanTempRdo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (meanTempRdo.getSelection() == true) { - ptype = PARCEL_TYPE.MEANTEMP; - useFcstMaxChk.setSelection(false); - useFcstMaxChk.setEnabled(false); - rsc.setFcstMax(false); - } - } - }); - // filler - new Label(liftingGroup, SWT.NONE); - - userSelectRdo = new Button(liftingGroup, SWT.RADIO); - userSelectRdo.setText("User Select"); - userSelectRdo.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - if (userSelectRdo.getSelection() == true) { - userSelectTF.setEnabled(true); - ptype = PARCEL_TYPE.USERSELECT; - useFcstMaxChk.setSelection(false); - useFcstMaxChk.setEnabled(false); - rsc.setFcstMax(false); - } else { - userSelectTF.setEnabled(false); - } - } - }); - - gd = new GridData(80, SWT.DEFAULT); - userSelectTF = new Text(liftingGroup, SWT.BORDER); - userSelectTF.setLayoutData(gd); - userSelectTF.setEnabled(false); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 2; - gd.widthHint = 150; - liftParcelBtn = new Button(liftingGroup, SWT.PUSH); - liftParcelBtn.setText("Lift Parcel"); - liftParcelBtn.setLayoutData(gd); - - liftParcelBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - isParcel = true; - if (!ptype.equals(PARCEL_TYPE.USERSELECT)) { - rsc.changeParcel(ptype, 0); - } else { - rsc.changeParcel(ptype, Float.parseFloat(userSelectTF - .getText())); - } - } - }); - } - - private void createAddChangePointSkewT() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - Group addChangeGroup = new Group(top, SWT.NONE); - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - addChangeGroup.setLayout(gl); - addChangeGroup.setLayoutData(gd); - - int lblTextWidth = 75; - - createCenteredLabel(addChangeGroup, 3, "Add/Change Point to Skew-T"); - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label pLbl = new Label(addChangeGroup, SWT.CENTER); - pLbl.setText("P:"); - pLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label tLbl = new Label(addChangeGroup, SWT.CENTER); - tLbl.setText("T:"); - tLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label tdLbl = new Label(addChangeGroup, SWT.CENTER); - tdLbl.setText("Td:"); - tdLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - pTempTF = new Text(addChangeGroup, SWT.BORDER); - pTempTF.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - tTempTF = new Text(addChangeGroup, SWT.BORDER); - tTempTF.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - tdTempTF = new Text(addChangeGroup, SWT.BORDER); - tdTempTF.setLayoutData(gd); - - gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - Label tempsLbl = new Label(addChangeGroup, SWT.CENTER); - tempsLbl.setText("Temps Entered As:"); - tempsLbl.setLayoutData(gd); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 100; - celsiusRdo = new Button(addChangeGroup, SWT.RADIO); - celsiusRdo.setText("Celsius"); - celsiusRdo.setLayoutData(gd); - celsiusRdo.setSelection(true); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 100; - fahrenheitRdo = new Button(addChangeGroup, SWT.RADIO); - fahrenheitRdo.setText("Fahrenheit"); - fahrenheitRdo.setLayoutData(gd); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 175; - addPntSkewtBtn = new Button(addChangeGroup, SWT.PUSH); - addPntSkewtBtn.setText("Add Point to Skew-T"); - addPntSkewtBtn.setLayoutData(gd); - addPntSkewtBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - - double min = SkewTConstants.TEMPERATURE_MIN; - double max = SkewTConstants.TEMPERATURE_MAX; - - double press = SoundingLayer.MISSING; - double temp = SoundingLayer.MISSING; - double dwpt = SoundingLayer.MISSING; - - if (fahrenheitRdo.getSelection() == true) { - min = celciusToFahrenheit - .convert(SkewTConstants.TEMPERATURE_MIN); - max = celciusToFahrenheit - .convert(SkewTConstants.TEMPERATURE_MAX); - } - - press = fieldIsValid(pTempTF, PRESSURE_MIN, PRESSURE_MAX, - pressureError); - temp = fieldIsValid(tTempTF, min, max, tempDwptError); - dwpt = fieldIsValid(tdTempTF, min, max, tempDwptError); - - if ((press != SoundingLayer.MISSING - && temp != SoundingLayer.MISSING && dwpt != SoundingLayer.MISSING)) { - - if (fahrenheitRdo.getSelection() == true) { - dwpt = fahrenheitToCelcius.convert(dwpt); - temp = fahrenheitToCelcius.convert(temp); - } - // Layer values need to be in Kelvin - dwpt = celciusToKelvin.convert(dwpt); - temp = celciusToKelvin.convert(temp); - - // can't happen - if (dwpt > temp) { - MessageDialog.openError(new Shell(), "Error on field", - "Dewpoint can't exceed Temperature"); - tdTempTF.setFocus(); - } else { - rsc.addSkewtPointAction(press, temp, dwpt); - resetFields(); - } - } - } - }); - } - - /** - * Changing a point on the Hodo. - */ - private void createAddChangePointHodograph() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - Group addChangeGroup = new Group(top, SWT.NONE); - - GridLayout gl = new GridLayout(3, false); - gl.horizontalSpacing = 10; - addChangeGroup.setLayout(gl); - addChangeGroup.setLayoutData(gd); - - createCenteredLabel(addChangeGroup, 3, "Add/Change Point to Hodograph"); - - int lblTextWidth = 75; - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label pLbl = new Label(addChangeGroup, SWT.CENTER); - pLbl.setText("P:"); - pLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label dirLbl = new Label(addChangeGroup, SWT.CENTER); - dirLbl.setText("Dir:"); - dirLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - Label speedLbl = new Label(addChangeGroup, SWT.CENTER); - speedLbl.setText("Spd:"); - speedLbl.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - pSpdTF = new Text(addChangeGroup, SWT.BORDER); - pSpdTF.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - dirSpdTF = new Text(addChangeGroup, SWT.BORDER); - dirSpdTF.setLayoutData(gd); - - gd = new GridData(lblTextWidth, SWT.DEFAULT); - spdSpdTF = new Text(addChangeGroup, SWT.BORDER); - spdSpdTF.setLayoutData(gd); - - gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - Label tempsLbl = new Label(addChangeGroup, SWT.CENTER); - tempsLbl.setText("Speed Entered As:"); - tempsLbl.setLayoutData(gd); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 100; - ktsRdo = new Button(addChangeGroup, SWT.RADIO); - ktsRdo.setText("kts"); - ktsRdo.setLayoutData(gd); - ktsRdo.setSelection(true); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 100; - msRdo = new Button(addChangeGroup, SWT.RADIO); - msRdo.setText("m/s"); - msRdo.setLayoutData(gd); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 3; - gd.widthHint = 200; - addPntHodoBtn = new Button(addChangeGroup, SWT.PUSH); - addPntHodoBtn.setText("Add Point to Hodograph"); - addPntHodoBtn.setLayoutData(gd); - - addPntHodoBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - - double max = SkewTConstants.WIND_SPEED_MAX; - double min = SkewTConstants.WIND_SPEED_MIN; - - double press = SoundingLayer.MISSING; - double spd = SoundingLayer.MISSING; - double dir = SoundingLayer.MISSING; - - if (msRdo.getSelection()) { - max = knotsToMetersPerSecond - .convert(SkewTConstants.WIND_SPEED_MAX); - } - - press = fieldIsValid(pSpdTF, PRESSURE_MIN, PRESSURE_MAX, - pressureError); - dir = fieldIsValid(dirSpdTF, SkewTConstants.WIND_DIR_MIN, - SkewTConstants.WIND_DIR_MAX, windDirectionError); - spd = fieldIsValid(spdSpdTF, min, max, windSpeedError); - - if ((press != SoundingLayer.MISSING - && spd != SoundingLayer.MISSING && dir != SoundingLayer.MISSING)) { - - if (ktsRdo.getSelection()) { - // Speed must be in m/s to add new layer - spd = knotsToMetersPerSecond.convert(spd); - } - rsc.addChangePointAction(press, spd, dir); - resetFields(); - } - } - }); - - } - - /** - * Is the field valid? - * - * @param theField - * @param minimum - * @param max - * @param errorMsg - * @return double - */ - private double fieldIsValid(Text theField, double minimum, double max, - String errorMsg) { - double value = SoundingLayer.MISSING; - - try { - value = Integer.parseInt(theField.getText()); - if ((value < minimum) || value > max) { - MessageDialog - .openError(new Shell(), "Error on field", errorMsg); - theField.setFocus(); - return SoundingLayer.MISSING; - } - } catch (NumberFormatException nfe) { - MessageDialog.openError(new Shell(), "Error on field", errorMsg); - - return SoundingLayer.MISSING; - } - - return value; - } - - /** - * Create additional information - */ - private void createAdditionalInformation() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - Group addInfoGroup = new Group(top, SWT.NONE); - - GridLayout gl = new GridLayout(1, false); - addInfoGroup.setLayout(gl); - addInfoGroup.setLayoutData(gd); - - createCenteredLabel(addInfoGroup, 3, - "Additional Hodo/Skew-T Information"); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.widthHint = 180; - helicityStormChk = new Button(addInfoGroup, SWT.CHECK); - helicityStormChk.setText("Helicity/Storm Inflow"); - helicityStormChk.setLayoutData(gd); - helicityStormChk.setSelection(false); - helicityStormChk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setStormInflow(((Button) e.getSource()).getSelection()); - } - }); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.widthHint = 180; - wetBulbChk = new Button(addInfoGroup, SWT.CHECK); - wetBulbChk.setText("Wet-bulb Temp Profile"); - wetBulbChk.setLayoutData(gd); - wetBulbChk.setSelection(false); - wetBulbChk.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - setWetBulb(((Button) e.getSource()).getSelection()); - } - }); - } - - /** - * Create and restore original data. - */ - private void createRestoreOriginalData() { - GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - Group restoreGroup = new Group(top, SWT.NONE); - GridLayout gl = new GridLayout(2, true); - restoreGroup.setLayout(gl); - restoreGroup.setLayoutData(gd); - - createCenteredLabel(restoreGroup, 2, "Restore to Original Data Profile"); - - gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); - gd.horizontalSpan = 2; - gd.widthHint = 200; - resetHodoSkewtBtn = new Button(restoreGroup, SWT.PUSH); - resetHodoSkewtBtn.setText("Reset Data"); - resetHodoSkewtBtn.setLayoutData(gd); - resetHodoSkewtBtn.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - resetSkewtAction(); - } - }); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets - * .Shell) - */ - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText("Skew-T Controls"); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#getInitialSize() - */ - @Override - protected Point getInitialSize() { - return new Point(320, 835); - } - - /** - * reset - */ - private void resetSkewtAction() { - rsc.resetSounding(); - // if (this.theDisplay.getTheEditableSkewtResource().isEditable()) { - // this.theDisplay.getTheEditableSkewtResource().getSounding().reset(); - // } - } - - /** - * reset the fields - */ - private void resetFields() { - pTempTF.setText(""); - tTempTF.setText(""); - tdTempTF.setText(""); - pSpdTF.setText(""); - dirSpdTF.setText(""); - spdSpdTF.setText(""); - } - - /** - * wet bulb line draw - * - * @return - */ - public void setWetBulb(boolean wetBulb) { - rsc.setWb(wetBulb); - editor.refresh(); - } - - /** - * storm relative inflow line draw - * - * @return - */ - public void setStormInflow(boolean storm) { - rsc.set_plotStorm(storm); - editor.refresh(); - } - - /** - * override of close method - */ - @Override - public boolean close() { - if (rsc.isEditable() == true) { - rsc.setEditable(false); - isParcel = false; - } - return super.close(); - } - - /** - * A hard normal exit - */ - public void exit() { - super.close(); - } - - /** - * Gets the display you are using - * - * @return SkewTDisplay - */ - private SkewtDisplay getSkewtDisplay() { - - editor = (AbstractEditor) PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); - if (editor.getActiveDisplayPane().getDescriptor() instanceof SkewTDescriptor) { - // the ordering in the editor is paramount here!!!!! - if (editor.getActiveDisplayPane().getRenderableDisplay() instanceof SkewtDisplay) { - return ((SkewtDisplay) (editor.getActiveDisplayPane() - .getRenderableDisplay())); - } - } - return null; - } - - private InteractiveSkewTResource getRsc() { - SkewtDisplay st = getSkewtDisplay(); - if (st == null) { - return null; - } - ResourceList rl = st.getDescriptor().getResourceList(); - Iterator it = rl.iterator(); - while (it.hasNext()) { - ResourcePair rp = (ResourcePair) it.next(); - if (rp.getResource() instanceof InteractiveSkewTResource) { - rsc = (InteractiveSkewTResource) rp.getResource(); - break; - } - } - return rsc; - } - -} diff --git a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/TempChangeBackground.java b/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/TempChangeBackground.java deleted file mode 100644 index 3ffffa16f8..0000000000 --- a/cave/com.raytheon.viz.skewT/src/com/raytheon/viz/skewt/ui/TempChangeBackground.java +++ /dev/null @@ -1,180 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.skewt.ui; - -import org.eclipse.swt.graphics.Rectangle; - -import com.raytheon.uf.common.sounding.WxMath; -import com.raytheon.uf.viz.core.IGraphicsTarget; -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.drawables.IRenderable; -import com.raytheon.uf.viz.core.drawables.PaintProperties; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.localization.HierarchicalPreferenceStore; -import com.raytheon.viz.core.graphing.WGraphics; -import com.raytheon.viz.skewt.Activator; - -/** - * Used to draw the temp change background. - * - *
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 28sep2008   #1529       dhladky     redone.
- * 
- * 
- * - * @author dhladky - * @version 1.0 - */ - -public class TempChangeBackground extends AbstractSkewTBackground implements - IRenderable { - - private double pMin; - - private double pMax; - - private double deltaT; - - /** - * Public constructor - * - * @param target - * @param world - * @param paintProps - * @throws VizException - */ - public TempChangeBackground() { - super(); - - this.rectangle = new Rectangle(600, 730, 250, 480); - } - - @Override - public void paintInternal(IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - - double left = getWorld().getViewXmin(); - double right = getWorld().getViewXmax(); - double top = getWorld().getViewYmin(); - double bottom = getWorld().getViewYmax(); - - double d = Math.pow(10, Math.ceil(Math.log10(deltaT))) - 1; - String s = "- " + SkewTConstants.tempFormat.format(d); - double labelWidth = target.getStringBounds(smallFont, s).getWidth() - * paintProps.getZoomLevel(); - double dT = 1; - while ((deltaT % dT != 0) - || (labelWidth > ((right - left) / 2 / deltaT * dT))) { - dT++; - } - - for (double t = 0.0; t <= deltaT - dT; t += dT) { - double x = getWorld().mapX(t); - target.drawLine(x, bottom, 0.0, x, top, 0.0, - SkewTConstants.backgroundColor, 1, LineStyle.DOTTED); - target.drawString(smallFont, SkewTConstants.tempFormat.format(t), - x, bottom, 0.0, TextStyle.NORMAL, - SkewTConstants.labelColor, HorizontalAlignment.CENTER, - VerticalAlignment.TOP, null); - - if (t == 0) { - continue; - } - x = getWorld().mapX(-t); - target.drawLine(x, bottom, 0.0, x, top, 0.0, - SkewTConstants.backgroundColor, 1, LineStyle.DOTTED); - target.drawString(smallFont, SkewTConstants.tempFormat.format(-t), - x, bottom, 0.0, TextStyle.NORMAL, - SkewTConstants.labelColor, HorizontalAlignment.CENTER, - VerticalAlignment.TOP, null); - } - double x = getWorld().mapX(-deltaT); - target.drawLine(x, bottom, 0.0, x, top, 0.0, - SkewTConstants.backgroundColor, 1, LineStyle.SOLID); - target.drawString(smallFont, SkewTConstants.tempFormat.format(-deltaT), - x, bottom, 0.0, TextStyle.NORMAL, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, VerticalAlignment.TOP, null); - - x = getWorld().mapX(deltaT); - target.drawLine(x, bottom, 0.0, x, top, 0.0, - SkewTConstants.backgroundColor, 1, LineStyle.SOLID); - target.drawString(smallFont, SkewTConstants.tempFormat.format(deltaT), - x, bottom, 0.0, TextStyle.NORMAL, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, VerticalAlignment.TOP, null); - - // draw pressure lines. - double centerX = (left + right) / 2; - for (double pressure : SkewTConstants.MAN_LEVELS) { - if (pressure >= pMin && pressure <= pMax) { - double y = getWorld().mapY(WxMath.getSkewTXY(pressure, 0).y); - target.drawLine(left, y, 0.0, right, y, 0.0, - SkewTConstants.pressureColor, 1); - - if (pressure % 100 == 0) { - target.drawString(smallFont, SkewTConstants.pressFormat - .format(pressure), centerX, getWorld().mapY( - WxMath.getSkewTXY(pressure, 0).y), 0.0, - TextStyle.BLANKED, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, - VerticalAlignment.MIDDLE, null); - } - } - } - - String label = "24 HR TEMP CHANGE"; - - target.drawString(smallFont, label, centerX, top, 0.0, - TextStyle.NORMAL, SkewTConstants.labelColor, - HorizontalAlignment.CENTER, VerticalAlignment.BOTTOM, null); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.skewt.ui.AbstractSkewTBackground#computeWorld() - */ - @Override - protected WGraphics computeWorld() { - - HierarchicalPreferenceStore prefs = Activator.getDefault() - .getPreferenceStore(); - - double d; - pMin = ((d = prefs.getDouble("tempChange.pmin")) == 0.0 ? 300.0 : d); - pMax = ((d = prefs.getDouble("tempChange.pmax")) == 0.0 ? 1050.0 : d); - deltaT = ((d = prefs.getDouble("tempChange.deltaT")) == 0.0 ? 15.0 : d); - - WGraphics world = new WGraphics(this.rectangle); - - world.setWorldCoordinates(-deltaT, WxMath.getSkewTXY(pMin, 0).y, - deltaT, WxMath.getSkewTXY(pMax, 0).y); - - return world; - } - -} diff --git a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF index fbc2bf5fb3..4f0d682202 100644 --- a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF @@ -14,41 +14,27 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.xy.crosssection, com.raytheon.uf.viz.xy.timeheight, com.raytheon.uf.viz.xy.varheight, - com.raytheon.viz.skewt, - com.raytheon.viz.redbook, com.raytheon.viz.awipstools, com.raytheon.viz.grid, - com.raytheon.viz.satellite, - com.raytheon.viz.radar, com.raytheon.uf.viz.xy.timeseries, - com.raytheon.uf.viz.xy, com.raytheon.uf.viz.objectiveanalysis, com.raytheon.uf.common.pointdata, - com.raytheon.uf.common.serialization, net.sf.swtaddons;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.viz.points;bundle-version="1.0.0", com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0", gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0", - com.raytheon.uf.common.message;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174", - com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", com.raytheon.uf.common.comm;bundle-version="1.12.1174", com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174", com.raytheon.uf.viz.d2d.core;bundle-version="1.12.1174", - com.raytheon.uf.viz.d2d.ui;bundle-version="1.12.1174" + com.raytheon.uf.viz.d2d.ui;bundle-version="1.12.1174", + com.raytheon.uf.viz.derivparam;bundle-version="1.12.1174", + com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", + com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", + com.raytheon.uf.viz.xy;bundle-version="1.12.1174", + com.raytheon.viz.core.graphing;bundle-version="1.12.1174" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.volumebrowser, - com.raytheon.viz.volumebrowser.catalog, com.raytheon.viz.volumebrowser.datacatalog, com.raytheon.viz.volumebrowser.vbui, com.raytheon.viz.volumebrowser.xml -Import-Package: com.raytheon.uf.common.comm, - com.raytheon.uf.common.dataplugin.grid, - com.raytheon.uf.common.dataplugin.grid.dataset, - com.raytheon.uf.common.gridcoverage, - com.raytheon.uf.common.menus.xml, - com.raytheon.uf.viz.derivparam.inv, - com.raytheon.uf.viz.ui.menus.xml, - com.vividsolutions.jts.geom Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java deleted file mode 100644 index 200a5bc4c2..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/GridDataCatalog.java +++ /dev/null @@ -1,459 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.comm.CommunicationException; -import com.raytheon.uf.common.dataplugin.grid.GridConstants; -import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfo; -import com.raytheon.uf.common.dataplugin.grid.dataset.DatasetInfoLookup; -import com.raytheon.uf.common.dataplugin.level.Level; -import com.raytheon.uf.common.dataplugin.level.LevelFactory; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.viz.grid.inv.GridInventory; -import com.raytheon.viz.grid.rsc.GridResourceData; - -/** - * - * An interface to the grid datacatalog made available for the various grid - * parameters. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006   #7         brockwoo    Initial creation
- * 12/05/2006   #98        brockwoo    Fix for the grid parameter list not
- *                                     updating when only the model time
- *                                     changes
- * Aug 27, 2008 1502       dglazesk    Updated to use JAXB marshalling
- *                                     Switched to DatasetInfo from plugin-grib
- * 
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public class GridDataCatalog implements IDataCatalog { - - private ListViewer list1; - - private ListViewer list2; - - private ListViewer list3; - - private Button addDataButton; - - private String modelName; - - private GridInventory inventory; - - private String parameter; - - private String level; - - private ModelSelectionListener modelListener; - - private ParameterSelectionListener parameterListener; - - private LevelSelectionListener levelListener; - - private static final String PLUGIN = GridConstants.GRID; - - public GridDataCatalog() { - } - - private HashMap levelList; - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getDataType() - */ - public String getDataType() { - return "Grid"; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.catalog.IDataCatalog#initDataCatalog(org.eclipse - * .swt.widgets.Label, org.eclipse.swt.widgets.Label, - * org.eclipse.swt.widgets.Label, org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, org.eclipse.swt.widgets.Button) - */ - public void initDataCatalog(Label label1, Label label2, Label label3, - ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton) { - inventory = (GridInventory) DataCubeContainer - .getInventory(GridConstants.GRID); - - label1.setText("Model"); - label2.setText("Parameter"); - label3.setText("Level"); - - this.list1 = list1; - this.list2 = list2; - this.list3 = list3; - - this.list1.getList().setVisible(true); - this.list2.getList().setVisible(true); - this.list3.getList().setVisible(true); - - this.list1.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - this.list2.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - this.list3.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - - this.list1.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - return super.compare(viewer, e1, e2); - } - - }); - - this.list1.setContentProvider(new ModelContentProvider()); - this.list1.setLabelProvider(new ModelLabelProvider()); - - this.list2.setContentProvider(new ParamContentProvider()); - this.list2.setLabelProvider(new ParamLabelProvider()); - - this.list3.setContentProvider(new LevelContentProvider()); - this.list3.setLabelProvider(new LevelLabelProvider()); - - modelListener = new ModelSelectionListener(); - this.list1.addSelectionChangedListener(modelListener); - - parameterListener = new ParameterSelectionListener(); - this.list2.addSelectionChangedListener(parameterListener); - - levelListener = new LevelSelectionListener(); - this.list3.addSelectionChangedListener(levelListener); - - addDataButton = addButton; - modelName = ""; - parameter = ""; - level = ""; - - populateModelList(); - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#dispose() - */ - public void dispose() { - addDataButton.setEnabled(false); - this.list1.setInput(EMPTYLIST); - this.list2.setInput(EMPTYLIST); - this.list3.setInput(EMPTYLIST); - this.list1.refresh(); - this.list2.refresh(); - this.list3.refresh(); - this.list1.removeSelectionChangedListener(modelListener); - this.list2.removeSelectionChangedListener(parameterListener); - this.list3.removeSelectionChangedListener(levelListener); - } - - private void populateModelList() { - ArrayList modelTimes = new ArrayList(); - if (inventory == null) { - DatasetInfo[] empty = new DatasetInfo[1]; - empty[0] = new DatasetInfo(); - list1.setInput(empty); - } else { - DatasetInfoLookup modelLookup = DatasetInfoLookup.getInstance(); - - BlockingQueue returnQueue = new LinkedBlockingQueue(); - try { - inventory.checkSources(null, null, null, returnQueue); - } catch (InterruptedException e) { - e.printStackTrace(); - } - for (String modelName : returnQueue) { - DatasetInfo theGribData = modelLookup.getInfo(modelName); - - if (theGribData != null) { - modelTimes.add(theGribData); - } else { - // TODO: generate false entry - theGribData = new DatasetInfo(); - theGribData.setDatasetId(modelName); - } - } - - if (modelTimes.size() > 0) { - this.list1.setInput(modelTimes.toArray(new DatasetInfo[] {})); - } - } - } - - private void populateModelParameters() { - BlockingQueue returnQueue = new LinkedBlockingQueue(); - try { - inventory.checkParameters(Arrays.asList(modelName), null, null, - false, returnQueue); - } catch (InterruptedException e) { - e.printStackTrace(); - } - String[] parameters = returnQueue.toArray(new String[0]); - // this should be sorted by the parameter name - // tree.getParameterNode(modelName, param).getParameterName(); - Arrays.sort(parameters); - list2.setInput(parameters); - } - - private void populateModelLevel() { - this.levelList = new HashMap(); - - BlockingQueue returnQueue = new LinkedBlockingQueue(); - try { - inventory.checkLevels(Arrays.asList(modelName), - Arrays.asList(parameter), null, returnQueue); - } catch (InterruptedException e) { - e.printStackTrace(); - } - String[] levelIds = returnQueue.toArray(new String[0]); - String[] levelNames = new String[levelIds.length]; - LevelFactory lf = LevelFactory.getInstance(); - - for (int i = 0; i < levelIds.length; i++) { - try { - Level level = lf.getLevel(levelIds[i]); - levelNames[i] = level.getMasterLevel().getName() - + level.getLevelInfo(); - this.levelList.put(levelNames[i], level); - } catch (CommunicationException e) { - e.printStackTrace(); - } - } - - Arrays.sort(levelNames); - list3.getList().removeAll(); - list3.add(levelNames); - } - - class ModelContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - DatasetInfo[] models = (DatasetInfo[]) inputElement; - String[] modelNames = new String[models.length]; - for (int i = 0; i < models.length; i++) { - modelNames[i] = models[i].getTitle(); - } - return models; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class ParamContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - String[] params = (String[]) inputElement; - return params; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class LevelContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - String[] params = (String[]) inputElement; - return params; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class ModelLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - DatasetInfo model = (DatasetInfo) element; - // return (String) element; - return model.getTitle(); - } - } - - class ParamLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - String param = (String) element; - return inventory.getParameterName(modelName, param); - } - } - - class LevelLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - Level level = levelList.get((String) element); - String returnValue = level.getMasterLevel().getDescription() + " " - + level.getLevelInfo(); - return returnValue; - } - } - - class ModelSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - - StructuredSelection selectedModel = (StructuredSelection) event - .getSelection(); - DatasetInfo modelInfo = (DatasetInfo) selectedModel - .getFirstElement(); - if (modelInfo != null && modelInfo.getDatasetId() != null - && !modelInfo.getDatasetId().equals(modelName)) { - modelName = modelInfo.getDatasetId(); - addDataButton.setEnabled(false); - populateModelParameters(); - } - } - } - - class ParameterSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selParameter = (String) selectedParameter.getFirstElement(); - if (selParameter != null && !selParameter.matches(parameter)) { - parameter = selParameter; - addDataButton.setEnabled(false); - populateModelLevel(); - } - } - } - - class LevelSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedLevel = (String) selectedParameter.getFirstElement(); - if (selectedLevel != null && !selectedLevel.matches(level)) { - addDataButton.setEnabled(true); - level = (String) selectedParameter.getFirstElement(); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getProductParameters() - */ - public HashMap getProductParameters() { - HashMap parameters = new HashMap(); - parameters - .put(GridConstants.PLUGIN_NAME, new RequestConstraint(PLUGIN)); - parameters.put(GridConstants.DATASET_ID, new RequestConstraint( - modelName)); - parameters.put(GridConstants.PARAMETER_ABBREVIATION, - new RequestConstraint(parameter)); - - Level level = this.levelList.get(this.level); - parameters.put(GridConstants.MASTER_LEVEL_NAME, new RequestConstraint( - level.getMasterLevel().getName())); - parameters - .put(GridConstants.LEVEL_ONE, - new RequestConstraint(Double.toString(level - .getLevelonevalue()))); - parameters - .put(GridConstants.LEVEL_TWO, - new RequestConstraint(Double.toString(level - .getLeveltwovalue()))); - - return parameters; - } - - @Override - public AbstractRequestableResourceData getResourceData() { - GridResourceData grd = new GridResourceData(); - grd.setMetadataMap(getProductParameters()); - return grd; - } - - @Override - public Map getEditorConfig() { - Map config = new HashMap(); - - config.put("editor", VizMapEditor.EDITOR_ID); - config.put("editorInput", - "com.raytheon.uf.viz.d2d.core.map.D2DMapRenderableDisplay"); - - return config; - } -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/IDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/IDataCatalog.java deleted file mode 100644 index 05b4a520f1..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/IDataCatalog.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.util.Map; - -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; - -/** - * - * An interface to the catalog made available for the various data types. It - * defines the methods required to properly get data into the volume browser and - * on to the list of products to be displayed. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006	#7         brockwoo    Initial creation
- * 
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public interface IDataCatalog { - - /** - * An empty string to reset the list boxes to empty. - */ - public static final String EMPTYLIST = null; - - /** - * The default height for a selection list box. - */ - public static final int DEFAULTPANEHEIGHT = 180; - - /** - * The default width for a single list box. - */ - public static final int ONEPANEWIDTH = 725; - - /** - * The default width for dual list boxes. - */ - public static final int TWOPANEWIDTH = 349; - - /** - * The default width for three list boxes. - */ - public static final int THREEPANEWIDTH = 222; - - /** - * String array to notify the user that the catalog is empty. - */ - public static final String[] NODATA = { "No Data" }; - - /** - * Will return a string that identifies the data type of the catalog (i.e. - * Radar, Satellite). This is used to populate the drop down at top of the - * volume browser. - * - * @return The string of the type of catalog - */ - public abstract String getDataType(); - - /** - * Will return a map with a string that identifies the editor and a string - * for the editor input type of the catalog (i.e. Radar, Satellite). This is - * used to create the correct type of editor for a given product. - * - * @return The string of the type of editor - */ - public abstract Map getEditorConfig(); - - /** - * Initializes the catalog with the proper labels and list boxes for the - * volume browser. Will then set the controls as needed for the parameters - * that are available for that data type. - * - * @param label1 - * The label above the left most list box - * @param label2 - * The label above the center list box - * @param label3 - * The label above the right most list box - * @param list1 - * The list box at the left - * @param list2 - * The list box in the center - * @param list3 - * The list box at the right - * @param addButton - * The 'Add' button in the volume browser which can be - * enabled/disabled from the catalog - */ - public abstract void initDataCatalog(Label label1, Label label2, - Label label3, ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton); - - /** - * The parameters for the product being added to the list of products to - * display. - * - * @return A hash map containing all parameters that will allow the layer to - * retrieve that specific product - */ - public abstract Map getProductParameters(); - - public abstract AbstractRequestableResourceData getResourceData(); - - /** - * A call to dispose will clean up the controls for the present catalog and - * empty out any data contained within. - */ - public abstract void dispose(); - -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/ObservationDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/ObservationDataCatalog.java deleted file mode 100644 index 05521aeb98..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/ObservationDataCatalog.java +++ /dev/null @@ -1,218 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.time.BinOffset; -import com.raytheon.uf.viz.core.catalog.CatalogQuery; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.viz.pointdata.rsc.PlotResourceData; - -/** - * - * An interface to the surface data catalog made available for the various - * surface parameters. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006   #7         brockwoo    Initial creation
- * 05/11/2007   #273       brockwoo    Changed the plugin name from 'metar'
- *                                     to 'obs' for JavaScript support
- * 
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public class ObservationDataCatalog implements IDataCatalog { - - private ListViewer list1; - - private Button addDataButton; - - private CatalogQuery obsQuery; - - private TypeSelectionListener typeListener; - - private static final String PLUGIN = "obs"; - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getDataType() - */ - public String getDataType() { - return "Observations"; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#dispose() - */ - public void dispose() { - addDataButton.setEnabled(false); - this.list1.setInput(EMPTYLIST); - this.list1.refresh(); - this.list1.removeSelectionChangedListener(typeListener); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.catalog.IDataCatalog#initDataCatalog(org.eclipse - * .swt.widgets.Label, org.eclipse.swt.widgets.Label, - * org.eclipse.swt.widgets.Label, org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, org.eclipse.swt.widgets.Button) - */ - public void initDataCatalog(Label label1, Label label2, Label label3, - ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton) { - label1.setText("Data Type"); - label2.setText(" "); - label3.setText(" "); - obsQuery = new CatalogQuery(); - this.list1 = list1; - this.list1.getList().setLayoutData( - new GridData(ONEPANEWIDTH, DEFAULTPANEHEIGHT)); - typeListener = new TypeSelectionListener(); - this.list1.addSelectionChangedListener(typeListener); - this.list1.setContentProvider(new ObservationContentProvider()); - this.list1.setLabelProvider(new ObservationLabelProvider()); - this.list1.getList().setEnabled(true); - list2.getList().setVisible(false); - list3.getList().setVisible(false); - addDataButton = addButton; - populateTypeParameters(); - } - - private void populateTypeParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - queryList.put("reportType", new RequestConstraint("METAR")); - try { - String[] parameters = CatalogQuery.performQuery("dataTime", - queryList); - if (parameters != null && parameters.length > 0) { - String[] obsList = { "Observations (METARS)" }; - list1.setInput(obsList); - } else { - list1.setInput(NODATA); - } - } catch (VizException e) { - e.printStackTrace(); - } - } - - class ObservationContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - return (String[]) inputElement; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class ObservationLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - return (String) element; - } - } - - class TypeSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedType = (String) selectedParameter.getFirstElement(); - if (selectedType != null && !selectedType.matches(NODATA[0])) { - addDataButton.setEnabled(true); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getProductParameters() - */ - public HashMap getProductParameters() { - HashMap parameters = new HashMap(); - parameters.put("pluginName", new RequestConstraint(PLUGIN)); - parameters.put("reportType", new RequestConstraint("METAR")); - return parameters; - } - - @Override - public AbstractRequestableResourceData getResourceData() { - PlotResourceData prd = new PlotResourceData(); - prd.setRetrieveData(false); - prd.setUpdatingOnMetadataOnly(true); - prd.setRequeryNecessaryOnTimeMatch(true); - BinOffset binOffset = new BinOffset(1800, 1800); - prd.setBinOffset(binOffset); - prd.setPlotSource("METAR Plot"); - prd.setMetadataMap(getProductParameters()); - return prd; - } - - @Override - public Map getEditorConfig() { - Map config = new HashMap(); - - config.put("editor", VizMapEditor.EDITOR_ID); - config.put("editorInput", - "com.raytheon.uf.viz.d2d.core.map.D2DMapRenderableDisplay"); - - return config; - } -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RadarDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RadarDataCatalog.java deleted file mode 100644 index f9099643d2..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RadarDataCatalog.java +++ /dev/null @@ -1,406 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.io.File; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.dataplugin.radar.util.RadarInfo; -import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.viz.core.catalog.CatalogQuery; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.uf.viz.xy.VizXyEditor; -import com.raytheon.viz.radar.rsc.RadarResourceData; -import com.raytheon.viz.radar.ui.xy.RadarGraphDisplay; -import com.raytheon.viz.radar.ui.xy.RadarXYDisplay; - -/** - * - * An interface to the radar data catalog made available for the various radar - * parameters. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006   #7         brockwoo    Initial creation
- * 
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public class RadarDataCatalog implements IDataCatalog { - - private ListViewer list1; - - private ListViewer list2; - - private ListViewer list3; - - private Button addDataButton; - - private TypeSelectionListener typeListener; - - private ElevationSelectionListener elevationListener; - - private LocationSelectionListener locationListener; - - // private static HashMap radarTypes; - - private CatalogQuery radarQuery; - - private String type; - - private String elevation; - - private String location; - - private Map editorConfig = new HashMap(); - - private final RadarInfoDict infoDict; - - private static final String PLUGIN = "radar"; - - public RadarDataCatalog() { - File file = PathManagerFactory.getPathManager().getStaticFile( - "radarInfo.txt"); - infoDict = RadarInfoDict.getInstance(file.getParent()); - - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getDataType() - */ - public String getDataType() { - return "Radar"; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#dispose() - */ - public void dispose() { - addDataButton.setEnabled(false); - this.list1.setInput(EMPTYLIST); - this.list2.setInput(EMPTYLIST); - this.list3.setInput(EMPTYLIST); - this.list1.refresh(); - this.list2.refresh(); - this.list3.refresh(); - this.list1.removeSelectionChangedListener(typeListener); - this.list2.removeSelectionChangedListener(elevationListener); - this.list3.removeSelectionChangedListener(locationListener); - - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.catalog.IDataCatalog#initDataCatalog(org.eclipse - * .swt.widgets.Label, org.eclipse.swt.widgets.Label, - * org.eclipse.swt.widgets.Label, org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, org.eclipse.swt.widgets.Button) - */ - public void initDataCatalog(Label label1, Label label2, Label label3, - ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton) { - label1.setText("Data Type"); - label2.setText("Elevation"); - label3.setText("Location"); - radarQuery = new CatalogQuery(); - this.list1 = list1; - this.list2 = list2; - this.list3 = list3; - this.list1.getList().setVisible(true); - this.list2.getList().setVisible(true); - this.list3.getList().setVisible(true); - this.list1.getList().setLayoutData( - new GridData(THREEPANEWIDTH, DEFAULTPANEHEIGHT)); - this.list2.getList().setLayoutData( - new GridData(THREEPANEWIDTH, DEFAULTPANEHEIGHT)); - this.list3.getList().setLayoutData( - new GridData(THREEPANEWIDTH, DEFAULTPANEHEIGHT)); - // typeListener = new TypeSelectionListener(); - // this.list2.addSelectionChangedListener(typeListener); - this.list1.setContentProvider(new RadarContentProvider()); - this.list1.setLabelProvider(new RadarTypeLabelProvider()); - typeListener = new TypeSelectionListener(); - this.list1.addSelectionChangedListener(typeListener); - - this.list2.setContentProvider(new RadarContentProvider()); - this.list2.setLabelProvider(new RadarElevationLabelProvider()); - elevationListener = new ElevationSelectionListener(); - this.list2.addSelectionChangedListener(elevationListener); - - this.list3.setContentProvider(new RadarContentProvider()); - this.list3.setLabelProvider(new RadarLabelProvider()); - locationListener = new LocationSelectionListener(); - this.list3.addSelectionChangedListener(locationListener); - addDataButton = addButton; - type = " "; - elevation = " "; - location = " "; - populateTypeParameters(); - - } - - private void populateTypeParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - try { - String[] parameters = CatalogQuery.performQuery("productCode", - queryList); - if (parameters != null && parameters.length > 0) { - Arrays.sort(parameters); - list1.setInput(parameters); - } else { - list1.setInput(NODATA); - } - } catch (VizException e) { - // TODO Put a pop up dialog box here to notify user the query failed - e.printStackTrace(); - } - } - - private void populateElevationParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - queryList.put("productCode", new RequestConstraint(type)); - try { - String[] parameters = CatalogQuery.performQuery( - "primaryElevationAngle", queryList); - Arrays.sort(parameters); - list2.setInput(parameters); - } catch (VizException e) { - // TODO Put a pop up dialog box here to notify user the query failed - e.printStackTrace(); - } - } - - private void populateLocationParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - queryList.put("productCode", new RequestConstraint(type)); - queryList - .put("primaryElevationAngle", new RequestConstraint(elevation)); - try { - String[] parameters = CatalogQuery.performQuery("icao", queryList); - Arrays.sort(parameters); - list3.setInput(parameters); - } catch (VizException e) { - // TODO Put a pop up dialog box here to notify user the query failed - e.printStackTrace(); - } - } - - class TypeSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedModel = (StructuredSelection) event - .getSelection(); - String typeInfo = (String) selectedModel.getFirstElement(); - if (typeInfo != null && !typeInfo.matches(type) - && !typeInfo.matches(NODATA[0])) { - addDataButton.setEnabled(false); - type = typeInfo; - populateElevationParameters(); - } - } - } - - class ElevationSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedElevation = (StructuredSelection) event - .getSelection(); - String elevationInfo = (String) selectedElevation.getFirstElement(); - if (elevationInfo != null && !elevationInfo.matches(elevation)) { - addDataButton.setEnabled(false); - elevation = elevationInfo; - populateLocationParameters(); - } - } - } - - class LocationSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedLocation = (String) selectedParameter - .getFirstElement(); - if (selectedLocation != null && !selectedLocation.matches(location)) { - addDataButton.setEnabled(true); - location = selectedLocation; - } - } - } - - class RadarContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - return (String[]) inputElement; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class RadarLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - return (String) element; - } - } - - class RadarTypeLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - return getNameFromDictionary(element); - } - } - - protected String getNameFromDictionary(Object element) { - try { - int productCode = Integer.parseInt((String) element); - RadarInfo info = infoDict.getInfo(productCode); - if (info != null) { - String name = info.getDescription(); - if (name == null) { - name = "Product Code " + type; - } - return name; - } - } catch (NumberFormatException e) { - } - return (String) element; - } - - class RadarElevationLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - String type = (String) element; - return type + "°"; - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getProductParameters() - */ - public HashMap getProductParameters() { - HashMap parameters = new HashMap(); - parameters.put("pluginName", new RequestConstraint(PLUGIN)); - parameters.put("productCode", new RequestConstraint(type)); - parameters.put("primaryElevationAngle", - new RequestConstraint(elevation)); - parameters.put("icao", new RequestConstraint(location)); - return parameters; - } - - @Override - public AbstractRequestableResourceData getResourceData() { - RadarResourceData rrd = new RadarResourceData(); - rrd.setMetadataMap(getProductParameters()); - - // Need to set the type of editor - RadarInfo info = infoDict.getInfo(Integer.parseInt(type)); - String format = null; - if (info != null) { - format = info.getFormat(); - } - if ("Graph".equals(format)) { - // Handles radar products that are displayed on a nonMap display - // with a graph - - // Radar XY plot editor - setEditorConfig(VizXyEditor.class.getName(), - RadarGraphDisplay.class.getName()); - } else if ("XY".equals(format)) { - // Handles radar products that are displayed on a nonMap display - // without a graph - - // Radar XY plot editor - setEditorConfig(VizXyEditor.class.getName(), - RadarXYDisplay.class.getName()); - } else { - // Standard GL Map editor - setEditorConfig(VizMapEditor.EDITOR_ID, VizMapEditor.EDITOR_ID); - } - - // Set the product name - // rrd.setProductName(getNameFromDictionary(type)); - - return rrd; - } - - private void setEditorConfig(String editor, String editorInput) { - editorConfig.put("editor", editor); - editorConfig.put("editorInput", editorInput); - } - - @Override - public Map getEditorConfig() { - return editorConfig; - } - -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RedbookDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RedbookDataCatalog.java deleted file mode 100644 index f9b56db23c..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/RedbookDataCatalog.java +++ /dev/null @@ -1,251 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.viz.core.VizApp; -import com.raytheon.uf.viz.core.catalog.CatalogQuery; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.viz.redbook.Activator; -import com.raytheon.viz.redbook.RedbookWMOMap; -import com.raytheon.viz.redbook.rsc.RedbookResourceData; - -/** - * - * An interface to the redbook data catalog made available for the various - * redbook product ids. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 05/29/2008              brockwoo    Initial creation
- * 
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public class RedbookDataCatalog implements IDataCatalog { - - private ListViewer list1; - - private Button addDataButton; - - private TypeSelectionListener typeListener; - - private String wmoHeader; - - private static final String PLUGIN = "redbook"; - - private RedbookWMOMap mapping; - - public RedbookDataCatalog() { - try { - mapping = RedbookWMOMap.load(); - } catch (Exception e) { - VizApp.logAndAlert(Status.ERROR, e, - "Error loading redbook mapping", - "Redbook mapping could not be loaded", - Activator.getDefault(), Activator.PLUGIN_ID); - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getDataType() - */ - public String getDataType() { - return "Redbook"; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#dispose() - */ - public void dispose() { - addDataButton.setEnabled(false); - this.list1.setInput(EMPTYLIST); - this.list1.refresh(); - this.list1.removeSelectionChangedListener(typeListener); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.catalog.IDataCatalog#initDataCatalog(org.eclipse - * .swt.widgets.Label, org.eclipse.swt.widgets.Label, - * org.eclipse.swt.widgets.Label, org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, org.eclipse.swt.widgets.Button) - */ - public void initDataCatalog(Label label1, Label label2, Label label3, - ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton) { - label1.setText("Redbook Product ID"); - label2.setText(" "); - label3.setText(" "); - this.list1 = list1; - this.list1.getList().setLayoutData( - new GridData(ONEPANEWIDTH, DEFAULTPANEHEIGHT)); - typeListener = new TypeSelectionListener(); - this.list1.addSelectionChangedListener(typeListener); - this.list1.setContentProvider(new ObservationContentProvider()); - this.list1.setLabelProvider(new RedbookLabelProvider()); - this.list1.setComparator(new ViewerComparator() { - @Override - public int compare(Viewer viewer, Object e1, Object e2) { - return super.compare(viewer, descriptiveName((String) e1), - descriptiveName((String) e2)); - } - - }); - this.list1.getList().setEnabled(true); - list2.getList().setVisible(false); - list3.getList().setVisible(false); - addDataButton = addButton; - this.wmoHeader = " "; - populateTypeParameters(); - } - - private String descriptiveName(String in) { - RedbookWMOMap.Info info = mapping.mapping.get(in); - if (info != null) - return info.name + " (" + in + ")"; - - return in; - - } - - private void populateTypeParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - try { - String[] parameters = CatalogQuery.performQuery("wmoTTAAii", - queryList); - Arrays.sort(parameters); - if (parameters != null && parameters.length > 0) { - list1.setInput(parameters); - } else { - list1.setInput(NODATA); - } - } catch (VizException e) { - e.printStackTrace(); - } - } - - class ObservationContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - return (String[]) inputElement; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class RedbookLabelProvider extends LabelProvider { - @Override - public Image getImage(Object element) { - return null; - } - - @Override - public String getText(Object element) { - return descriptiveName((String) element); - } - } - - class TypeSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedType = (String) selectedParameter.getFirstElement(); - wmoHeader = selectedType; - if (selectedType != null && !selectedType.matches(NODATA[0])) { - addDataButton.setEnabled(true); - } - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getProductParameters() - */ - public HashMap getProductParameters() { - HashMap parameters = new HashMap(); - parameters.put("pluginName", new RequestConstraint(PLUGIN)); - parameters.put("wmoTTAAii", new RequestConstraint(this.wmoHeader)); - return parameters; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.volumebrowser.catalog.IDataCatalog#getResourceData() - */ - @Override - public AbstractRequestableResourceData getResourceData() { - RedbookResourceData lrd = new RedbookResourceData(); - lrd.setMetadataMap(getProductParameters()); - return lrd; - } - - @Override - public Map getEditorConfig() { - Map config = new HashMap(); - - config.put("editor", VizMapEditor.EDITOR_ID); - config.put("editorInput", - "com.raytheon.uf.viz.d2d.core.map.D2DMapRenderableDisplay"); - - return config; - } -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/SatelliteDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/SatelliteDataCatalog.java deleted file mode 100644 index 05dc8cabe6..0000000000 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/catalog/SatelliteDataCatalog.java +++ /dev/null @@ -1,314 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.volumebrowser.catalog; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.ListViewer; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Label; - -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.viz.core.catalog.CatalogQuery; -import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.maps.display.VizMapEditor; -import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.viz.satellite.rsc.SatResourceData; - -/** - * - * An interface to the satellite data catalog made available for the various - * satellite parameters. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 11/29/2006   #7         brockwoo    Initial creation
- * 12/07/2006   #111       brockwoo    Put in a filter to remove visible imagery
- * 
- * - * @author brockwoo - * @version 1.0 - */ -public class SatelliteDataCatalog implements IDataCatalog { - - private ListViewer list1; - - private ListViewer list2; - - private ListViewer list3; - - private Button addDataButton; - - private String source; - - private String region; - - private String type; - - private SourceSelectionListener sourceListener; - - private RegionSelectionListener regionListener; - - private TypeSelectionListener typeListener; - - private static final String PLUGIN = "satellite"; - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getDataType() - */ - public String getDataType() { - return "Satellite"; - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#dispose() - */ - public void dispose() { - addDataButton.setEnabled(false); - this.list1.setInput(EMPTYLIST); - this.list2.setInput(EMPTYLIST); - this.list3.setInput(EMPTYLIST); - this.list1.refresh(); - this.list2.refresh(); - this.list3.refresh(); - this.list1.removeSelectionChangedListener(sourceListener); - this.list2.removeSelectionChangedListener(regionListener); - this.list3.removeSelectionChangedListener(typeListener); - - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.catalog.IDataCatalog#initDataCatalog(org.eclipse - * .swt.widgets.Label, org.eclipse.swt.widgets.Label, - * org.eclipse.swt.widgets.Label, org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, - * org.eclipse.jface.viewers.ListViewer, org.eclipse.swt.widgets.Button) - */ - public void initDataCatalog(Label label1, Label label2, Label label3, - ListViewer list1, ListViewer list2, ListViewer list3, - Button addButton) { - label1.setText("Source"); - label2.setText("Region"); - label3.setText("Type"); - this.list1 = list1; - this.list2 = list2; - this.list3 = list3; - this.list1.getList().setVisible(true); - this.list2.getList().setVisible(true); - this.list3.getList().setVisible(true); - this.list1.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - this.list2.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - this.list3.getList().setLayoutData( - new GridData(IDataCatalog.THREEPANEWIDTH, - IDataCatalog.DEFAULTPANEHEIGHT)); - this.list1.setContentProvider(new SatelliteContentProvider()); - this.list1.setLabelProvider(new SatelliteLabelProvider()); - this.list2.setContentProvider(new SatelliteContentProvider()); - this.list2.setLabelProvider(new SatelliteLabelProvider()); - this.list3.setContentProvider(new SatelliteContentProvider()); - this.list3.setLabelProvider(new SatelliteLabelProvider()); - sourceListener = new SourceSelectionListener(); - this.list1.addSelectionChangedListener(sourceListener); - regionListener = new RegionSelectionListener(); - this.list2.addSelectionChangedListener(regionListener); - typeListener = new TypeSelectionListener(); - this.list3.addSelectionChangedListener(typeListener); - addDataButton = addButton; - source = ""; - region = ""; - type = ""; - populateSourceParameters(); - } - - private void populateSourceParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - try { - String[] parameters = CatalogQuery.performQuery("creatingEntity", - queryList); - if (parameters != null && parameters.length > 0) { - Arrays.sort(parameters); - list1.setInput(parameters); - } else { - list1.setInput(NODATA); - } - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private void populateRegionParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - queryList.put("creatingEntity", new RequestConstraint(source)); - try { - String[] parameters = CatalogQuery.performQuery("sectorID", - queryList); - Arrays.sort(parameters); - list2.setInput(parameters); - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private void populateTypeParameters() { - HashMap queryList = new HashMap(); - queryList.put("pluginName", new RequestConstraint(PLUGIN)); - queryList.put("creatingEntity", new RequestConstraint(source)); - queryList.put("sectorID", new RequestConstraint(region)); - try { - String[] parameters = CatalogQuery.performQuery("physicalElement", - queryList); - Arrays.sort(parameters); - ArrayList goodParameters = new ArrayList(); - for (int i = 0; i < parameters.length; i++) { - goodParameters.add(parameters[i]); - } - list3.setInput(goodParameters.toArray(new String[] {})); - } catch (VizException e) { - // TODO Put in a popup to alert the user that the query failed - e.printStackTrace(); - } - } - - class SatelliteContentProvider implements IStructuredContentProvider { - public Object[] getElements(Object inputElement) { - return (String[]) inputElement; - } - - public void dispose() { - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - } - } - - class SatelliteLabelProvider extends LabelProvider { - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - return (String) element; - } - } - - class SourceSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedModel = (StructuredSelection) event - .getSelection(); - String sourceInfo = (String) selectedModel.getFirstElement(); - if (sourceInfo != null && !sourceInfo.matches(source) - && !sourceInfo.matches(NODATA[0])) { - addDataButton.setEnabled(false); - source = sourceInfo; - populateRegionParameters(); - } - } - } - - class RegionSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedRegion = (String) selectedParameter - .getFirstElement(); - if (selectedRegion != null && !selectedRegion.matches(region)) { - type = ""; - addDataButton.setEnabled(false); - region = selectedRegion; - populateTypeParameters(); - } - } - } - - class TypeSelectionListener implements ISelectionChangedListener { - public void selectionChanged(SelectionChangedEvent event) { - StructuredSelection selectedParameter = (StructuredSelection) event - .getSelection(); - String selectedType = (String) selectedParameter.getFirstElement(); - if (selectedType != null && !selectedType.matches(type)) { - addDataButton.setEnabled(true); - type = selectedType; - } - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.catalog.IDataCatalog#getProductParameters() - */ - public HashMap getProductParameters() { - HashMap parameters = new HashMap(); - parameters.put("pluginName", new RequestConstraint(PLUGIN)); - parameters.put("creatingEntity", new RequestConstraint(source)); - parameters.put("sectorID", new RequestConstraint(region)); - parameters.put("physicalElement", new RequestConstraint(type)); - return parameters; - } - - @Override - public AbstractRequestableResourceData getResourceData() { - SatResourceData srd = new SatResourceData(); - srd.setMetadataMap(getProductParameters()); - return srd; - } - - @Override - public Map getEditorConfig() { - Map config = new HashMap(); - - config.put("editor", VizMapEditor.EDITOR_ID); - config.put("editorInput", - "com.raytheon.uf.viz.d2d.core.map.D2DMapRenderableDisplay"); - - return config; - } -} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java index 47c4e6994e..3b24284b95 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java @@ -58,7 +58,6 @@ import com.raytheon.uf.viz.xy.varheight.rsc.VarHeightResourceData; import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.grid.GridLevelTranslator; import com.raytheon.viz.grid.rsc.GridLoadProperties; -import com.raytheon.viz.skewt.rscdata.SkewTResourceData; import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu; import com.vividsolutions.jts.geom.Coordinate; @@ -71,13 +70,15 @@ import com.vividsolutions.jts.geom.Coordinate; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Oct 6, 2009 2987 jelkins Initial creation - * 10-21-09 #1711 bsteffen Updated Baseline and Points to use new ToolsDataManager - * 01/30/2012 DR 14308 D.Friedman Use correct style for arrow types. - * 07/31/2012 #875 rferrel Now uses points. + * Oct 06, 2009 2987 jelkins Initial creation + * Oct 21, 2009 1711 bsteffen Updated Baseline and Points to use new + * ToolsDataManager + * Jan 30, 2012 14308 D.Friedman Use correct style for arrow types. + * Jul 31, 2012 875 rferrel Now uses points. * Feb 21, 2013 1617 bsteffen fixed vb sounding point selection for * points which contain the word Point * May 03, 2013 DR14824 mgamazaychikov Added alterProductParameters method + * Aug 20, 2013 2259 bsteffen Delete old skewt plugin. * * * @@ -193,14 +194,6 @@ public abstract class AbstractDataCatalog implements IDataCatalog { thData.setSource(catalogEntry.getSelectedData().getSourcesText()); resourceData = thData; break; - case SOUNDING: - resourceData = inputResourceData; - if ((catalogEntry != null) - && (resourceData instanceof SkewTResourceData)) { - ((SkewTResourceData) resourceData) - .setPointLetter(getPointLetter(catalogEntry)); - } - break; default: // PLAN_VIEW resourceData = null; break; @@ -241,10 +234,6 @@ public abstract class AbstractDataCatalog implements IDataCatalog { resourceData = getResourceData(catalogEntry, resourceType, new TimeHeightResourceData()); break; - case SOUNDING: - resourceData = getResourceData(catalogEntry, resourceType, - new SkewTResourceData()); - break; default: // PLAN_VIEW resourceData = null; break; diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java index e2bcb1ae6c..04d236b44f 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/vbui/ProductTableComp.java @@ -87,8 +87,6 @@ import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.core.rsc.ICombinedResourceData; import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation; import com.raytheon.viz.core.slice.request.HeightScales; -import com.raytheon.viz.skewt.SkewtDisplay; -import com.raytheon.viz.skewt.rscdata.SkewTResourceData; import com.raytheon.viz.ui.BundleProductLoader; import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.UiUtil; @@ -114,12 +112,14 @@ import com.vividsolutions.jts.geom.LineString; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Jun 8, 2009 #2161 lvenable Initial creation - * Mar 27, 2012 #14506 Qinglu Lin For cross section plot along a line of - * latitude, swap xStart and xEnd. - * Jan 16, 2013 #1492 rferrel Changes for non-blocking InventoryDlg. - * Jan 25, 2013 #15529 kshresth Fixed cross section "Unhandled event loop exception" - * when loading contours and Image combo + * Jun 08, 2009 2161 lvenable Initial creation + * Mar 27, 2012 14506 Qinglu Lin For cross section plot along a line of + * latitude, swap xStart and xEnd. + * Jan 16, 2013 1492 rferrel Changes for non-blocking InventoryDlg. + * Jan 25, 2013 15529 kshresth Fixed cross section "Unhandled event loop + * exception" when loading contours and + * Image combo + * Aug 20, 2013 2259 bsteffen Delete old skewt plugin. * * * @author lvenable @@ -1022,13 +1022,10 @@ public class ProductTableComp extends Composite { // need to handle both legacy skeqwT and nsharp skewT at the same // time. List varheightSkewtResources = new ArrayList(); - List legacySkewtResources = new ArrayList(); List nsharpSkewtResources = new ArrayList(); for (ResourcePair pair : resourceList) { if (pair.getResourceData() instanceof D2DNSharpResourceData) { nsharpSkewtResources.add(pair); - } else if (pair.getResourceData() instanceof SkewTResourceData) { - legacySkewtResources.add(pair); } else if (pair.getResourceData() instanceof VarHeightResourceData) { varheightSkewtResources.add(pair); } @@ -1036,16 +1033,6 @@ public class ProductTableComp extends Composite { if (!nsharpSkewtResources.isEmpty()) { display = new NsharpSkewTPaneDisplay(); display.setDescriptor(new NsharpSkewTPaneDescriptor()); - if (!legacySkewtResources.isEmpty()) { - resourceList.removeAll(legacySkewtResources); - loadResources(difference, legacySkewtResources); - } - if (!varheightSkewtResources.isEmpty()) { - resourceList.removeAll(varheightSkewtResources); - loadResources(difference, varheightSkewtResources); - } - } else if (!legacySkewtResources.isEmpty()) { - display = new SkewtDisplay(); if (!varheightSkewtResources.isEmpty()) { resourceList.removeAll(varheightSkewtResources); loadResources(difference, varheightSkewtResources); diff --git a/deltaScripts/13.6.1/updateSkewtDisplays.py b/deltaScripts/13.6.1/updateSkewtDisplays.py index 6954a66143..3e298fa01b 100644 --- a/deltaScripts/13.6.1/updateSkewtDisplays.py +++ b/deltaScripts/13.6.1/updateSkewtDisplays.py @@ -1,3 +1,12 @@ +#!/usr/bin/python +# This script will update any saved displays which use older skewT displays to +# use Nsharp. +# +# This update only needs to be run if there are saved displays being stored +# outside of localization, for procedures saved in localization, +# updateSkewtProcedures.sh will automatically call this. + + import sys import xml.etree.ElementTree as ET @@ -29,7 +38,7 @@ def upgradeBundle(bundleFile): display.set(xsitype,'nsharpSkewTPaneDisplay') descriptor = display.find('descriptor') descriptor.set(xsitype,'nsharpSkewTPaneDescriptor') - tree.write(bundleFile.replace('.xml','-converted.xml')) + tree.write(bundleFile) def getPlugins(xmlDisplay): plugins = set() @@ -54,16 +63,64 @@ def getConstraintValue(resourceData, key): def isNsharp(plugin): return plugin == 'grib' or plugin == 'bufrua' or\ - plugin == 'goes' or plugin == 'poes' or\ - plugin == 'acarssounding' or\ - plugin == 'NAM' or plugin == 'GFS' + plugin == 'goessounding' or plugin == 'poessounding' or\ + plugin == 'acarssounding' or plugin == 'modelsounding' def isHodoVarHeight(plugin): return plugin == 'radar' or plugin == 'profiler' def convertDisplayToNsharp(xmlDisplay): - # TODO this will be written when all the nsharp types are converted. - pass + xmlDisplay.set(xsitype,'nsharpSkewTPaneDisplay') + descriptor = xmlDisplay.find('descriptor') + descriptor.set(xsitype,'nsharpSkewTPaneDescriptor') + toRemove = [] + for resource in descriptor.iterfind('resource'): + resourceData = resource.find('resourceData') + type = resourceData.get(xsitype) + if type == 'skewTBkgResourceData': + toRemove.append(resource) + elif type == 'gribSoundingSkewTResourceData': + convertResourceToNsharp(resource) + elif type == 'skewTResourceData': + convertResourceToNsharp(resource) + else: + print "Removing unrecognized resource of type: " + type + toRemove.append(resource) + for resource in toRemove: + descriptor.remove(resource) + +def convertResourceToNsharp(xmlResource): + resourceData = xmlResource.find('resourceData') + plugin = getPluginName(resourceData) + if(plugin == 'grib'): + resourceData.set(xsitype,'gribNSharpResourceData') + resourceData.set('soundingType', getConstraintValue(resourceData, 'info.datasetId')) + resourceData.set('pointName', 'Point' + resourceData.get('point')) + resourceData.attrib.pop('point') + elif(plugin == 'bufrua'): + resourceData.set(xsitype,'bufruaNSharpResourceData') + resourceData.set('soundingType', 'BUFRUA') + elif(plugin == 'modelsounding'): + reportType = getConstraintValue(resourceData, 'reportType') + if reportType == 'ETA': + reportType = 'NAM' + resourceData.set('soundingType', reportType + 'SND') + resourceData.set(xsitype,'mdlSndNSharpResourceData') + elif(plugin == 'goessounding'): + resourceData.set('soundingType', 'GOES') + resourceData.set(xsitype,'goesSndNSharpResourceData') + elif(plugin == 'poessounding'): + resourceData.set('soundingType', 'POES') + resourceData.set(xsitype,'poesSndNSharpResourceData') + elif(plugin == 'acarssounding'): + resourceData.set('soundingType', 'MDCRS') + resourceData.set(xsitype,'acarsSndNSharpResourceData') + loadProperties = xmlResource.find('loadProperties') + if loadProperties is not None: + # since nsharp doesn't use any capabilities just drop them all. + capabilities = loadProperties.find('capabilities') + if capabilities is not None: + loadProperties.remove(capabilities) def convertDisplayToHodoVarHeight(xmlDisplay): xmlDisplay.set(xsitype,'varHeightRenderableDisplay') diff --git a/edexOsgi/com.raytheon.uf.common.sounding/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.sounding/META-INF/MANIFEST.MF index 436879c9e1..b865cfffdc 100644 --- a/edexOsgi/com.raytheon.uf.common.sounding/META-INF/MANIFEST.MF +++ b/edexOsgi/com.raytheon.uf.common.sounding/META-INF/MANIFEST.MF @@ -4,14 +4,10 @@ Bundle-Name: Sounding Plug-in Bundle-SymbolicName: com.raytheon.uf.common.sounding Bundle-Version: 1.12.1174.qualifier Bundle-Vendor: RAYTHEON -Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Require-Bundle: com.raytheon.uf.common.pointdata;bundle-version="1.11.31", com.raytheon.uf.common.dataplugin;bundle-version="1.11.31", com.raytheon.uf.common.geospatial;bundle-version="1.12.1174", - com.raytheon.uf.common.serialization;bundle-version="1.12.1174", - com.raytheon.uf.common.status;bundle-version="1.12.1174", - com.raytheon.uf.common.localization;bundle-version="1.12.1174", com.raytheon.edex.meteolib;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0" Export-Package: com.raytheon.uf.common.sounding, diff --git a/edexOsgi/com.raytheon.uf.common.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject deleted file mode 100644 index 62c91c7bb2..0000000000 --- a/edexOsgi/com.raytheon.uf.common.sounding/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ /dev/null @@ -1 +0,0 @@ -com.raytheon.uf.common.sounding.util.SoundingPrefs \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/ParcelLift.java b/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/ParcelLift.java deleted file mode 100644 index 8258df023c..0000000000 --- a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/ParcelLift.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.common.sounding; - -/** - * ParcelLift.java Sept 28, 2008 - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 28 Sept 2008            dhladky     new class.
- * 
- * 
- * - * @author dhladky - * @version 1.0 - */ - -public class ParcelLift { - - private Double startPressure = null; - private boolean maxTemp = false; - private String name = null; - - public enum PARCEL_TYPE { - PMAX("PMAX"), SURFACE("Surface"), - MEANTEMP("Mean Temp"), USERSELECT("User Select"); - - private final String dataName; - - private PARCEL_TYPE(String dataName) { - this.dataName = dataName; - } - - public String getDataName() { - return dataName; - } - }; - - /** - * public constructor - * @param name - * @param startpressure - */ - public ParcelLift(PARCEL_TYPE type, Double startPressure, boolean maxTemp) { - - if (startPressure != null) { - setStartPressure(startPressure); - setMaxTemp(maxTemp); - } - - for (PARCEL_TYPE pt: PARCEL_TYPE.values()) { - if (pt.getDataName().equals(type.getDataName())) { - setName(type.getDataName()); - } - } - - } - - /** - * Set start presure when needed. - * @param startPressure - */ - private void setStartPressure(Double startPressure) { - this.startPressure = startPressure; - } - - /** - * Set use fcst mac temp - * @param startPressure - */ - private void setMaxTemp(boolean maxTemp) { - this.maxTemp = maxTemp; - } - - /** - * Gets the starting pressure when needed. - * @return double - */ - public Double getStartPressure() { - return startPressure; - } - - /** - * Gets the starting pressure when needed. - * @return double - */ - public boolean getMaxTemp() { - return maxTemp; - } - - /** - * Sets the name. - * @param name - */ - public void setName(String name) { - this.name = name; - } - - /** - * Get the name - * @return - */ - public String getName() { - return name; - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/WxMath.java b/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/WxMath.java index 691619a5dc..84ba78e510 100644 --- a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/WxMath.java +++ b/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/WxMath.java @@ -20,7 +20,6 @@ package com.raytheon.uf.common.sounding; import com.raytheon.edex.meteoLib.Controller; -import com.raytheon.uf.common.sounding.util.SoundingPrefs; import com.vividsolutions.jts.geom.Coordinate; /** @@ -34,8 +33,9 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * 06 Nov 2006 jkorman Initial Coding * 29 Sept 2008 dhladky Added more stuff to finish SkewT. - * 25 Jul 2013 2190 mschenke Moved common sounding calculation - * from PopupSkewTDialog to here + * 25 Jul 2013 2190 mschenke Moved common sounding calculation from + * PopupSkewTDialog to here + * Aug 20, 2013 2259 bsteffen Delete old skewt plugin. * * * @author jkorman @@ -205,46 +205,6 @@ public class WxMath { return new Coordinate(spd, dir); } - /** - * Convert a pressure and temperature to a skew-t x,y coordinate in - * centimeters where 0,0 occurs at 1000 hPa and 0 degrees Celsius. - * - * @param pressure - * The pressure in hectoPascals (millibars). - * @param temperature - * The temperature in degrees Celsius. - * @return The calculated coordinate in centimeters. - */ - public static final Coordinate getSkewTXY(double pressure, - double temperature) { - temperature -= SoundingPrefs.getSoundingPrefs().getTemperatureOffset(); - Coordinate point = new Coordinate(); - - point.y = 132.182 - 44.061 * Math.log10(pressure); - point.x = (0.54 * temperature) + (0.90692 * point.y); - - return point; - } - - /** - * Reverse a skewT coordinate (in centimeters) to the corresponding - * temperature and pressure. - * - * @param point - * @return The temperature and pressure. coordinate.x = temperature in - * Celsius, coordinate.y = the pressure in hectoPascals (millibars). - */ - public static final Coordinate reverseSkewTXY(Coordinate point) { - Coordinate tempPressure = new Coordinate(); - tempPressure.y = Math.pow(10, ((point.y - 132.182) / -44.061)); - tempPressure.x = (point.x - (0.90692 * point.y)) / 0.54; - - tempPressure.x += SoundingPrefs.getSoundingPrefs() - .getTemperatureOffset(); - - return tempPressure; - } - /** * Compute the final temperature of a parcel moved dry adiabatically from * its initial pressure and temperature to a final pressure. diff --git a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/util/SoundingPrefs.java b/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/util/SoundingPrefs.java deleted file mode 100644 index 3cd3493d7c..0000000000 --- a/edexOsgi/com.raytheon.uf.common.sounding/src/com/raytheon/uf/common/sounding/util/SoundingPrefs.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.uf.common.sounding.util; - -import java.io.File; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import com.raytheon.uf.common.localization.IPathManager; -import com.raytheon.uf.common.localization.LocalizationContext; -import com.raytheon.uf.common.localization.PathManagerFactory; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; -import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; -import com.raytheon.uf.common.serialization.SerializationException; -import com.raytheon.uf.common.serialization.SerializationUtil; -import com.raytheon.uf.common.status.IUFStatusHandler; -import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; - -/** - * - * TODO Add Description - * - *
- *
- * SOFTWARE HISTORY
- *
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jun 15, 2011            bsteffen     Initial creation
- *
- * 
- * - * @author bsteffen - * @version 1.0 - */ -@XmlAccessorType(XmlAccessType.NONE) -@XmlRootElement -public class SoundingPrefs { - private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(SoundingPrefs.class); - - private static final String SOUNDING_PREFS_FILE = "sounding/soundingPrefs.xml"; - - @XmlElement - private double temperatureOffset = 0.0; - - public double getTemperatureOffset() { - return temperatureOffset; - } - - public void setTemperatureOffset(double temperatureOffset) { - this.temperatureOffset = temperatureOffset; - } - - private static SoundingPrefs soundingPrefs; - - public static SoundingPrefs getSoundingPrefs() { - if(soundingPrefs == null) { - IPathManager pathMgr = PathManagerFactory.getPathManager(); - LocalizationContext lc = pathMgr.getContext( - LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); - File file = pathMgr.getFile(lc, SOUNDING_PREFS_FILE); - if(file == null || !file.exists()) { - lc = pathMgr.getContext( - LocalizationType.COMMON_STATIC, LocalizationLevel.BASE); - file = pathMgr.getFile(lc, SOUNDING_PREFS_FILE); - } - try { - soundingPrefs = (SoundingPrefs) SerializationUtil.jaxbUnmarshalFromXmlFile(file); - } catch (SerializationException e) { - statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); - soundingPrefs = new SoundingPrefs(); - } - } - return soundingPrefs; - - } - -} diff --git a/edexOsgi/com.raytheon.uf.common.sounding/utility/common_static/base/sounding/soundingPrefs.xml b/edexOsgi/com.raytheon.uf.common.sounding/utility/common_static/base/sounding/soundingPrefs.xml deleted file mode 100644 index 2719b27052..0000000000 --- a/edexOsgi/com.raytheon.uf.common.sounding/utility/common_static/base/sounding/soundingPrefs.xml +++ /dev/null @@ -1,3 +0,0 @@ - - 0 - \ No newline at end of file diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java index c0551949d9..297798db9c 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java @@ -11,6 +11,7 @@ * Date Ticket# Engineer Description * ------- ------- -------- ----------- * 04/30/2012 229 Chin Chen Initial coding + * 08/20/2013 2259 bsteffen Delete old skewt plugin. * * * @@ -40,7 +41,6 @@ import gov.noaa.nws.ncep.ui.nsharp.view.NsharpPaletteWindow; import gov.noaa.nws.ncep.ui.nsharp.view.NsharpParcelDialog; import gov.noaa.nws.ncep.ui.nsharp.view.NsharpShowTextDialog; -import java.sql.Timestamp; import java.text.DateFormatSymbols; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -56,7 +56,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.StringTokenizer; -import java.util.TimeZone; import org.eclipse.core.runtime.ListenerList; import org.eclipse.swt.graphics.GC; @@ -70,7 +69,6 @@ import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.sounding.SoundingParams; import com.raytheon.viz.core.graphing.LineStroke; import com.raytheon.viz.core.graphing.WGraphics; import com.raytheon.viz.core.graphing.WindBarbFactory; @@ -135,8 +133,6 @@ public class NsharpResourceHandler { protected static final double BARB_LENGTH = 3.5; private String soundingType= null; - protected Map soundingMap; - protected DataTime displayedSounding; private int currentGraphMode= NsharpConstants.GRAPH_SKEWT; @@ -2425,7 +2421,6 @@ public class NsharpResourceHandler { public NsharpResourceHandler(IRenderableDisplay[] displayArray, NsharpEditor editor) { //System.out.println("NsharpResourceHandler constructed"); //myNsharpEditor = editor; - this.soundingMap = new HashMap(); elementColorMap.put(NsharpConstants.ActState.CURRENT.name(),NsharpConstants.color_green); elementColorMap.put(NsharpConstants.ActState.ACTIVE.name(),NsharpConstants.color_yellow); elementColorMap.put(NsharpConstants.ActState.INACTIVE.name(),NsharpConstants.color_white); @@ -2465,7 +2460,6 @@ public class NsharpResourceHandler { } public void disposeInternal() { //System.out.println("NsharpResourceHandler disposeInternal called"); - soundingMap= null; listenerList=null; soundingLys = null; previousSoundingLys = null;