Issue #2269 Fix MDCRS data and switch acars to use nsharp.

Former-commit-id: fcf969bcc5 [formerly d4b2bf52fb] [formerly 5fd84f4516] [formerly f778b53310 [formerly 5fd84f4516 [formerly 30b4923ee25dcba22e79f03ae5a3e8cec8f9683e]]]
Former-commit-id: f778b53310
Former-commit-id: cee01004c8b155fef2d5b6504e9033362ddacfbc [formerly 2d54492d7f]
Former-commit-id: d7d0a42633
This commit is contained in:
Ben Steffensmeier 2013-08-19 12:04:15 -05:00 committed by Gerrit Code Review
parent bc4a26bfd6
commit 074c2c56f2
8 changed files with 305 additions and 35 deletions

View file

@ -7,7 +7,7 @@ Bundle-Activator: com.raytheon.uf.viz.acarssounding.Activator
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.sounding
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization, com.raytheon.uf.viz.sounding, com.raytheon.uf.viz.core
Export-Package: com.raytheon.uf.viz.acarssounding
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
@ -23,4 +23,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0",
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",
com.raytheon.uf.common.wxmath
com.raytheon.uf.common.wxmath,
gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
org.geotools;bundle-version="2.6.4",
javax.measure;bundle-version="1.0.0",
com.raytheon.viz.volumebrowser;bundle-version="1.12.1174"

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.acarssounding.AcarsSndNSharpResourceData

View file

@ -0,0 +1,160 @@
/**
* 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 gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingCube.QueryStatus;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingProfile;
import gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo;
import gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingLayer;
import com.raytheon.uf.common.dataplugin.acarssounding.ACARSSoundingRecord;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.d2d.nsharp.SoundingLayerBuilder;
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Provides sounding data to nsharp from aircraft reports.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 15, 2013 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class AcarsSndNSharpResourceData extends D2DNSharpResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AcarsSndNSharpResourceData.class);
private static final String LONGITUDE = "location.longitude";
private static final String LATITUDE = "location.latitude";
public AcarsSndNSharpResourceData() {
super("MDCRS");
}
@Override
protected void preparePointInfo() throws VizException {
if (coordinate == null) {
DbQueryRequest request = new DbQueryRequest();
request.setConstraints(getMetadataMap());
request.addFields(new String[] { LONGITUDE, LATITUDE });
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
for (Map<String, Object> result : response.getResults()) {
if (coordinate == null) {
coordinate = new Coordinate();
coordinate.x = (Double) result.get(LONGITUDE);
coordinate.y = (Double) result.get(LATITUDE);
}
}
}
}
@Override
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(ACARSSoundingRecord.class);
request.setLimit(1);
request.setConstraints(new HashMap<String, RequestConstraint>(
getMetadataMap()));
request.addConstraint("dataTime", new RequestConstraint(new DataTime(
stnInfo.getReftime()).toString()));
try {
DbQueryResponse response = (DbQueryResponse) ThriftClient.sendRequest(request);
ACARSSoundingRecord[] records = response
.getEntityObjects(ACARSSoundingRecord.class);
if (records.length > 0) {
ACARSSoundingRecord record = records[0];
List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>(
record.getLevels().size());
for (ACARSSoundingLayer layer : record.getLevels()) {
SoundingLayerBuilder builder = new SoundingLayerBuilder();
if (layer.getDwpt() != null) {
builder.addDewpoint(layer.getDwpt(), SI.KELVIN);
}
if (layer.getTemp() != null) {
builder.addTemperature(layer.getTemp(), SI.KELVIN);
}
if (layer.getWindDirection() != null) {
builder.addWindDirection(layer.getWindDirection(), NonSI.DEGREE_ANGLE);
}
if (layer.getWindSpeed() != null) {
builder.addWindSpeed(layer.getWindSpeed(),
SI.METERS_PER_SECOND);
}
if (layer.getPressure() != null) {
builder.addPressure(layer.getPressure(), SI.PASCAL);
}
if (layer.getFlightLevel() != null) {
builder.addHeight(layer.getFlightLevel(), SI.METER);
}
layers.add(builder.toNcSoundingLayer());
}
Collections.sort(layers, NsharpDataHandling
.reversePressureHeightWindComparator());
NcSoundingProfile profile = new NcSoundingProfile();
profile.setSoundingLyLst(layers);
NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile));
cube.setRtnStatus(QueryStatus.OK);
return cube;
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
return null;
}
}

View file

@ -0,0 +1,64 @@
/**
* 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 com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.viz.volumebrowser.datacatalog.IDataCatalogEntry;
import com.raytheon.viz.volumebrowser.datacatalog.PointDataCatalog;
import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu;
/**
* Volume browser catalog which enables acars sounding data to work.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 19, 2013 2269 bsteffen Initial javadoc
* Aug 19, 2013 2269 bsteffen Fix MDCRS data and switch acars to use
* nsharp.
*
* </pre>
*
* @author unknown
* @version 1.0
*/
public class AcarsSoundingVbDataCatalog extends PointDataCatalog {
@Override
protected String[] getPlugins(ViewMenu setting) {
return new String[] { "acarssounding" };
}
@Override
protected AbstractRequestableResourceData getResourceData(
IDataCatalogEntry catalogEntry, ResourceType resourceType) {
if (resourceType == ResourceType.SOUNDING
&& catalogEntry.getSelectedData().getSourcesKey()
.equals("acarssounding")) {
return new AcarsSndNSharpResourceData();
}
return super.getResourceData(catalogEntry, resourceType);
}
}

View file

@ -22,8 +22,25 @@ package com.raytheon.uf.viz.acarssounding;
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager;
/**
* The activator class controls the plug-in life cycle
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 19, 2013 2269 bsteffen Initial javadoc
* Aug 19, 2013 2269 bsteffen Fix MDCRS data and switch acars to use
* nsharp.
*
* </pre>
*
* @author unknown
* @version 1.0
*/
public class Activator extends Plugin {
@ -46,6 +63,8 @@ public class Activator extends Plugin {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
DataCatalogManager.getDataCatalogManager().addDataCatalog(
new AcarsSoundingVbDataCatalog());
}
/*

View file

@ -22,10 +22,12 @@ package com.raytheon.uf.viz.d2d.nsharp;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import javax.measure.Measure;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Dimensionless;
import javax.measure.quantity.Length;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
@ -63,6 +65,10 @@ public class SoundingLayerBuilder {
private static final Unit<Temperature> DEWPOINT_UNIT = SI.CELSIUS;
private static final Unit<Angle> WIND_DIRECTION_UNIT = NonSI.DEGREE_ANGLE;
private static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
private static final Unit<Pressure> NC_PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
private static final Unit<Length> NC_HEIGHT_UNIT = SI.METER;
@ -71,6 +77,10 @@ public class SoundingLayerBuilder {
private static final Unit<Temperature> NC_DEWPOINT_UNIT = SI.CELSIUS;
private static final Unit<Angle> NC_WIND_DIRECTION_UNIT = NonSI.DEGREE_ANGLE;
private static final Unit<Velocity> NC_WIND_SPEED_UNIT = NonSI.KNOT;
private static final Unit<Dimensionless> NC_RELATIVE_HUMIDITY_UNIT = NonSI.PERCENT;
private static final Unit<Dimensionless> NC_SPECIFIC_HUMIDITY_UNIT = SI.KILOGRAM
@ -84,6 +94,10 @@ public class SoundingLayerBuilder {
private Measure<?, Temperature> dewpoint;
private Measure<?, Angle> windDirection;
private Measure<?, Velocity> windSpeed;
private Measure<?, Dimensionless> relativeHumidity;
private Measure<?, Dimensionless> specificHumidity;
@ -136,6 +150,28 @@ public class SoundingLayerBuilder {
return this;
}
public SoundingLayerBuilder addWindDirection(Measure<?, Angle> windDirection) {
this.windDirection = windDirection;
return this;
}
public SoundingLayerBuilder addWindDirection(double windDirection,
Unit<Angle> unit) {
this.windDirection = Measure.valueOf(windDirection, unit);
return this;
}
public SoundingLayerBuilder addWindSpeed(Measure<?, Velocity> windSpeed) {
this.windSpeed = windSpeed;
return this;
}
public SoundingLayerBuilder addWindSpeed(double windSpeed,
Unit<Velocity> unit) {
this.windSpeed = Measure.valueOf(windSpeed, unit);
return this;
}
public SoundingLayerBuilder addSpecificHumidity(
Measure<?, Dimensionless> specificHumidity) {
this.specificHumidity = specificHumidity;
@ -183,6 +219,13 @@ public class SoundingLayerBuilder {
specificHumidity);
layer.setDewpoint(dewpoint.floatValue(NC_DEWPOINT_UNIT));
}
if (windDirection != null) {
layer.setWindDirection(windDirection
.floatValue(NC_WIND_DIRECTION_UNIT));
}
if (windSpeed != null) {
layer.setWindSpeed(windSpeed.floatValue(NC_WIND_SPEED_UNIT));
}
if (relativeHumidity != null) {
layer.setRelativeHumidity(relativeHumidity
.floatValue(NC_RELATIVE_HUMIDITY_UNIT));
@ -223,6 +266,13 @@ public class SoundingLayerBuilder {
specificHumidity);
layer.setDewpoint(dewpoint.floatValue(DEWPOINT_UNIT));
}
if (windDirection != null) {
layer.setWindDirection(windDirection
.floatValue(WIND_DIRECTION_UNIT));
}
if (windSpeed != null) {
layer.setWindSpeed(windSpeed.floatValue(WIND_SPEED_UNIT));
}
return layer;
}

View file

@ -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.viz.volumebrowser.datacatalog;
import com.raytheon.viz.volumebrowser.vbui.VBMenuBarItemsMgr.ViewMenu;
public class AcarsSoundingDataCatalog extends PointDataCatalog {
@Override
protected String[] getPlugins(ViewMenu setting) {
return new String[] { "acarssounding" };
}
}

View file

@ -44,7 +44,9 @@ import com.raytheon.viz.volumebrowser.vbui.VbUtil;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2009 #2161 lvenable Initial creation
* May 27, 2009 2161 lvenable Initial creation
* Aug 19, 2013 2269 bsteffen Fix MDCRS data and switch acars to use
* nsharp.
*
* </pre>
*
@ -169,7 +171,6 @@ public class DataCatalogManager {
// TODO these should be read from an extension point.
catalogs = new ArrayList<IDataCatalog>();
catalogs.add(new GridDataCatalog());
catalogs.add(new AcarsSoundingDataCatalog());
catalogs.add(new DmdDataCatalog());
catalogs.add(new PointDataCatalog());
catalogs.add(new ModelSoundingCatalog());