Issue #2260 Switch goessounding to NSharp.

Change-Id: Ie78c4456758dcbce845cfb85da3e2e69ec74323b

Former-commit-id: 2f0c0c9cf2 [formerly 7e0b4473c5ebe30794014b43ffc2788eb98fc47f]
Former-commit-id: 54310cd87e
This commit is contained in:
Ben Steffensmeier 2013-08-15 17:56:32 -05:00
parent 932568191b
commit d2237d9e44
4 changed files with 181 additions and 22 deletions

View file

@ -2,5 +2,6 @@ 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

View file

@ -186,7 +186,8 @@ public class SoundingLayerBuilder {
if (relativeHumidity != null) {
layer.setRelativeHumidity(relativeHumidity
.floatValue(NC_RELATIVE_HUMIDITY_UNIT));
} else {
} else if (specificHumidity != null && temperature != null
&& pressure != null) {
Measure<?, Dimensionless> relativeHumidity = RelativeHumidity
.calculate(pressure, temperature, specificHumidity);
layer.setRelativeHumidity(relativeHumidity

View file

@ -0,0 +1,162 @@
/**
* 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.rsc;
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 java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.measure.quantity.Length;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.Temperature;
import javax.measure.unit.Unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
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.viz.pointdata.PointDataRequest;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Provides sounding data to nsharp from goes sounding satellite data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 14, 2013 2259 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class GoesSndNSharpResourceData extends D2DNSharpResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GoesSndNSharpResourceData.class);
private static final String NUM_LEVELS = "numLevels";
private static final String PRESSURE = "pressure";
private static final String HEIGHT = "height";
private static final String TEMPERATURE = "temperature";
private static final String DEWPOINT = "dewPoint";
private static final String LONGITUDE = "location.longitude";
private static final String LATITUDE = "location.latitude";
private static final String[] PARAMETERS = { NUM_LEVELS, PRESSURE, HEIGHT,
TEMPERATURE, DEWPOINT };
public GoesSndNSharpResourceData() {
super("GOES");
}
@Override
protected void preparePointInfo() throws VizException {
if (coordinate == null || pointName == 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) {
DataTime time = new DataTime(stnInfo.getReftime());
try {
PointDataContainer pdc = PointDataRequest
.requestPointDataAllLevels(time, "goes", PARAMETERS, null,
getMetadataMap());
PointDataView pdv = pdc.readRandom(0);
int numLevels = pdv.getInt(NUM_LEVELS);
Number[] pressure = pdv.getNumberAllLevels(PRESSURE);
Unit<Pressure> pressureUnit = pdv.getUnit(PRESSURE).asType(
Pressure.class);
Number[] height = pdv.getNumberAllLevels(HEIGHT);
Unit<Length> heightUnit = pdv.getUnit(HEIGHT)
.asType(Length.class);
Number[] temperature = pdv.getNumberAllLevels(TEMPERATURE);
Unit<Temperature> temperatureUnit = pdv.getUnit(TEMPERATURE)
.asType(Temperature.class);
Number[] dewpoint = pdv.getNumberAllLevels(DEWPOINT);
Unit<Temperature> dewpointUnit = pdv.getUnit(DEWPOINT).asType(
Temperature.class);
List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>(
numLevels);
for (int i = 0; i < numLevels; i += 1) {
SoundingLayerBuilder builder = new SoundingLayerBuilder();
builder.addPressure(pressure[i].doubleValue(), pressureUnit);
builder.addHeight(height[i].doubleValue(), heightUnit);
builder.addTemperature(temperature[i].doubleValue(),
temperatureUnit);
builder.addDewpoint(dewpoint[i].doubleValue(), dewpointUnit);
layers.add(builder.toNcSoundingLayer());
}
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

@ -47,6 +47,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.d2d.nsharp.rsc.BufruaNSharpResourceData;
import com.raytheon.uf.viz.d2d.nsharp.rsc.GoesSndNSharpResourceData;
import com.raytheon.uf.viz.d2d.nsharp.rsc.MdlSndNSharpResourceData;
import com.raytheon.uf.viz.d2d.nsharp.rsc.PoesSndNSharpResourceData;
import com.raytheon.uf.viz.objectiveanalysis.rsc.OAResourceData;
@ -412,24 +413,24 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
@Override
protected AbstractRequestableResourceData getResourceData(
IDataCatalogEntry catalogEntry, ResourceType resourceType) {
String sourceKey = catalogEntry.getSelectedData().getSourcesKey();
String sourceText = catalogEntry.getSelectedData().getSourcesText();
switch (resourceType) {
case PLAN_VIEW:
OAResourceData rscData = new OAResourceData();
// TODO this should be configurable
if (catalogEntry.getSelectedData().getSourcesText()
.equals("RaobOA")) {
if (sourceText.equals("RaobOA")) {
BinOffset binOffset = new BinOffset(3600, 3600);
rscData.setBinOffset(binOffset);
} else if (catalogEntry.getSelectedData().getSourcesText()
.equals("MetarOA")) {
} else if (sourceText.equals("MetarOA")) {
BinOffset binOffset = new BinOffset(1800, 1800);
rscData.setBinOffset(binOffset);
}
rscData.setParameter(catalogEntry.getSelectedData().getFieldsKey());
rscData.setParameterName(catalogEntry.getSelectedData()
.getFieldsText());
rscData.setSource(catalogEntry.getSelectedData().getSourcesText());
rscData.setSource(sourceText);
String levelKey = catalogEntry.getSelectedData().getPlanesKey();
rscData.setLevelKey(levelKey);
rscData.setRetrieveData(false);
@ -439,11 +440,11 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
AbstractRequestableResourceData resourceData = super
.getResourceData(catalogEntry, resourceType);
// TODO this should be configurable, and shared with PLAN_VIEW
if (catalogEntry.getSelectedData().getSourcesText()
if (sourceText
.equals("RaobOA")) {
BinOffset binOffset = new BinOffset(3600, 3600);
resourceData.setBinOffset(binOffset);
} else if (catalogEntry.getSelectedData().getSourcesText()
} else if (sourceText
.equals("MetarOA")) {
BinOffset binOffset = new BinOffset(1800, 1800);
resourceData.setBinOffset(binOffset);
@ -453,7 +454,6 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
resourceData = getResourceData(catalogEntry, resourceType,
new TimeHeightResourceData());
String sourceKey = catalogEntry.getSelectedData().getSourcesKey();
Coordinate coordinate = getPointCoordinate(catalogEntry);
SurfaceObsLocation closestLoc = getClosestStation(coordinate,
sourceKey);
@ -474,7 +474,6 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
LineString line = ToolsDataManager.getInstance()
.getBaseline(letter);
Coordinate[] newLine = new Coordinate[line.getNumPoints()];
sourceKey = catalogEntry.getSelectedData().getSourcesKey();
for (int i = 0; i < line.getNumPoints(); i++) {
SurfaceObsLocation loc = getClosestStation(
line.getCoordinateN(i), sourceKey, closest);
@ -490,27 +489,23 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
((CrossSectionResourceData) resourceData).setStationIDs(closest);
return resourceData;
case SOUNDING:
if (getPlugin(catalogEntry.getSelectedData().getSourcesKey())
.equals("bufrua")) {
if (getPlugin(sourceKey).equals("bufrua")) {
return new BufruaNSharpResourceData();
} else if (catalogEntry.getSelectedData().getSourcesKey()
.equals("modelsoundingETA")) {
} else if (sourceKey.equals("modelsoundingETA")) {
return new MdlSndNSharpResourceData("NAMSND");
} else if (catalogEntry.getSelectedData().getSourcesKey()
.equals("modelsoundingGFS")) {
} else if (sourceKey.equals("modelsoundingGFS")) {
return new MdlSndNSharpResourceData("GFSSND");
} else if (catalogEntry.getSelectedData().getSourcesKey()
.equals("poessounding")) {
} else if (sourceKey.equals("poessounding")) {
return new PoesSndNSharpResourceData();
} else if (catalogEntry.getSelectedData().getSourcesKey()
.equals("profiler")) {
} else if (sourceKey.equals("goessounding")) {
return new GoesSndNSharpResourceData();
} else if (sourceKey.equals("profiler")) {
VarHeightResourceData vhData = new VarHeightResourceData();
vhData.setPoint(getPointCoordinate(catalogEntry));
vhData.setParameter("Wind");
vhData.setParameterName("Wind");
vhData.setPointLetter(getPointLetter(catalogEntry));
vhData.setSource(catalogEntry.getSelectedData()
.getSourcesText());
vhData.setSource(sourceText);
return vhData;
}
default: