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 d14aef0182..a7d91e0739 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,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 \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/SoundingLayerBuilder.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/SoundingLayerBuilder.java index f172336b6a..d7cee16807 100644 --- a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/SoundingLayerBuilder.java +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/SoundingLayerBuilder.java @@ -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 relativeHumidity = RelativeHumidity .calculate(pressure, temperature, specificHumidity); layer.setRelativeHumidity(relativeHumidity diff --git a/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/GoesSndNSharpResourceData.java b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/GoesSndNSharpResourceData.java new file mode 100644 index 0000000000..e4a049fac3 --- /dev/null +++ b/cave/com.raytheon.uf.viz.d2d.nsharp/src/com/raytheon/uf/viz/d2d/nsharp/rsc/GoesSndNSharpResourceData.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Aug 14, 2013 2259       bsteffen    Initial creation
+ * 
+ * 
+ * + * @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 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 pressureUnit = pdv.getUnit(PRESSURE).asType( + Pressure.class); + Number[] height = pdv.getNumberAllLevels(HEIGHT); + Unit heightUnit = pdv.getUnit(HEIGHT) + .asType(Length.class); + Number[] temperature = pdv.getNumberAllLevels(TEMPERATURE); + Unit temperatureUnit = pdv.getUnit(TEMPERATURE) + .asType(Temperature.class); + Number[] dewpoint = pdv.getNumberAllLevels(DEWPOINT); + Unit dewpointUnit = pdv.getUnit(DEWPOINT).asType( + Temperature.class); + + List layers = new ArrayList( + 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; + } + +} diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java index 9eb16b256a..ae03124785 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/PointDataCatalog.java @@ -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: