Issue #1847 Merged NPP NUCAPS changes from omaha_13.2.1-NPP into development.

Change-Id: I37c3135794c991e2405d556823a22768dd491f00

Former-commit-id: b32fbad9c8 [formerly b32fbad9c8 [formerly 7b37bda291882ff345d466f4338b6707ed84d4d5]]
Former-commit-id: 547190329b
Former-commit-id: 635388a7ad
This commit is contained in:
Max Schenkelberg 2013-04-01 12:39:45 -05:00
parent e66a72fbed
commit 80b0f7c159
89 changed files with 2304 additions and 820 deletions

View file

@ -5,50 +5,26 @@ Bundle-SymbolicName: com.raytheon.uf.viz.npp.crimss;singleton:=true
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.crimss.Activator Bundle-Activator: com.raytheon.uf.viz.npp.crimss.Activator
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.6.1", org.eclipse.ui;bundle-version="3.6.1",
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.crimss;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.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0",
com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0",
com.raytheon.uf.viz.points;bundle-version="1.0.0", com.raytheon.uf.viz.points;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0" com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
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.viz.productbrowser;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.dataplugin, Export-Package: com.raytheon.uf.viz.npp.crimss
com.raytheon.uf.common.dataplugin.npp.crimss, Import-Package: gov.noaa.nws.ncep.edex.common.sounding
com.raytheon.uf.common.dataquery.requests,
com.raytheon.uf.common.dataquery.responses,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.comm,
com.raytheon.uf.common.status,
com.raytheon.uf.common.time,
com.raytheon.uf.viz.core,
com.raytheon.uf.viz.core.drawables,
com.raytheon.uf.viz.core.exception,
com.raytheon.uf.viz.core.map,
com.raytheon.uf.viz.core.maps.display,
com.raytheon.uf.viz.core.procedures,
com.raytheon.uf.viz.core.requests,
com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.core.rsc.capabilities,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.viz.d2d.core.map,
com.raytheon.uf.viz.d2d.nsharp.display,
com.raytheon.uf.viz.d2d.nsharp.rsc,
com.raytheon.uf.viz.productbrowser,
com.raytheon.viz.core.graphing,
com.raytheon.viz.pointdata,
com.raytheon.viz.ui,
com.raytheon.viz.ui.editor,
com.raytheon.viz.ui.input,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.edex.common.sounding,
gov.noaa.nws.ncep.ui.nsharp,
gov.noaa.nws.ncep.ui.nsharp.natives,
javax.measure.converter,
javax.measure.unit,
org.eclipse.swt.graphics,
org.eclipse.swt.widgets
Export-Package: com.raytheon.uf.viz.npp.crimss,
com.raytheon.uf.viz.npp.crimss.map

View file

@ -1,2 +1 @@
com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData
com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData

View file

@ -19,10 +19,10 @@
further_licensing_information. further_licensing_information.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="separator" id="beforeCRIMSS" visible="false"/> <contribute xsi:type="bundleItem" file="bundles/npp/soundingAvailability.xml"
<contribute xsi:type="titleItem" titleText="------ CrIMSS ------" id="SoundingLine"/> menuText="CrIMSS Sounding Availability" id="CrIMSSAvailability">
<contribute xsi:type="bundleItem" file="bundles/crimssAvailability.xml" <substitute key="name" value="CrIMSS"/>
menuText="Sounding Availability" id="CrIMSSAvailability"> <substitute key="pluginName" value="crimss"/>
<substitute key="soundingResourceData" value="com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData"/>
</contribute> </contribute>
<contribute xsi:type="separator" id="afterCRIMSS" visible="false"/>
</menuTemplate> </menuTemplate>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Soundings" fileName="menus/npp/crimss/crimssMenuItems.xml"/>
</menuContributionFile>

View file

@ -44,7 +44,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDescriptor; import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDescriptor;
import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDisplay; import com.raytheon.uf.viz.d2d.nsharp.display.D2DNSharpDisplay;
import com.raytheon.uf.viz.npp.crimss.map.CrimssMapResourceData; import com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData;
import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition; import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel; import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
@ -229,7 +229,10 @@ public class CrimssDataDefinition
for (int i = 0; i < selection.length; i++) { for (int i = 0; i < selection.length; i++) {
if (order[i].equals(POINT)) { if (order[i].equals(POINT)) {
if (selection[i].equals(MAP_RESOURCE)) { if (selection[i].equals(MAP_RESOURCE)) {
resourceData = new CrimssMapResourceData(); NPPSoundingMapResourceData nsmrd = new NPPSoundingMapResourceData();
nsmrd.setNsharpResourceData(CrimssNSharpResourceData.class);
nsmrd.setResourceName("CrIMSS");
resourceData = nsmrd;
} }
} }
} }

View file

@ -19,15 +19,10 @@
**/ **/
package com.raytheon.uf.viz.npp.crimss; package com.raytheon.uf.viz.npp.crimss;
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.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 gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -39,19 +34,12 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView; 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.exception.VizException;
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData; import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData;
import com.raytheon.viz.pointdata.PointDataRequest;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* TODO Add Description * NSharp resource data capable of loading CrIMSS data
* *
* <pre> * <pre>
* *
@ -68,9 +56,7 @@ import com.vividsolutions.jts.geom.Coordinate;
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class CrimssNSharpResourceData extends D2DNSharpResourceData { public class CrimssNSharpResourceData extends AbstractNPPNSharpResourceData {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CrimssNSharpResourceData.class);
private static final String PLUGIN = "crimss"; private static final String PLUGIN = "crimss";
@ -80,57 +66,19 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
CrimssRecord.PDV_H2O, CrimssRecord.PDV_P_H2O, CrimssRecord.PDV_H2O, CrimssRecord.PDV_P_H2O,
CrimssRecord.PDV_TEMPERATURE, CrimssRecord.PDV_P_TEMPERATURE }; CrimssRecord.PDV_TEMPERATURE, CrimssRecord.PDV_P_TEMPERATURE };
private static final Unit<?> PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
private static final Unit<?> HEIGHT_UNIT = SI.METER;
private static final Unit<?> TEMPERATURE_UNIT = SI.CELSIUS;
private static final Unit<?> H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM);
private static final Unit<?> DEWPOINT_UNIT = SI.CELSIUS;
public CrimssNSharpResourceData() { public CrimssNSharpResourceData() {
super("CRiMSS"); super("CrIMSS", PLUGIN, PARAMETERS);
}
@Override
protected void preparePointInfo() throws VizException {
// everything should already be set
return;
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData#
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube * getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView)
* (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo)
*/ */
@Override @Override
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) { protected List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
DataTime time = new DataTime(stnInfo.getReftime()); throws VizException {
try {
PointDataContainer pdc = PointDataRequest
.requestPointDataAllLevels(time, PLUGIN, PARAMETERS, null,
getMetadataMap());
PointDataView pdv = null;
Coordinate closest = null;
for (int i = 0; i < pdc.getCurrentSz(); i++) {
PointDataView testPdv = pdc.readRandom(i);
Coordinate p = new Coordinate(
testPdv.getFloat(CrimssRecord.LONGITUDE),
testPdv.getFloat(CrimssRecord.LATITUDE));
if (closest == null
|| coordinate.distance(p) < coordinate
.distance(closest)) {
pdv = testPdv;
closest = p;
}
}
if (pdv == null) {
return null;
}
List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>(); List<NcSoundingLayer> layers = new ArrayList<NcSoundingLayer>();
layers.add(getSurfacePressureLayer(pdv)); layers.add(getSurfacePressureLayer(pdv));
layers.addAll(getHeightLayers(pdv)); layers.addAll(getHeightLayers(pdv));
@ -139,36 +87,7 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
Collections.sort(layers, Collections.sort(layers,
NsharpDataHandling.reversePressureHeightWindComparator()); NsharpDataHandling.reversePressureHeightWindComparator());
mergeDuplicates(layers); mergeDuplicates(layers);
// We have to interpolate everything so that height,temperature, and return layers;
// dewpoint are available on all levels.
interpolateHeight(layers);
interpolateTemperature(layers);
interpolateDewpoint(layers);
Iterator<NcSoundingLayer> iter = layers.iterator();
while (iter.hasNext()) {
NcSoundingLayer layer = iter.next();
if (layer.getPressure() < 0) {
iter.remove();
} else if (layer.getGeoHeight() < 0) {
iter.remove();
} else if (layer.getTemperature() < -300) {
iter.remove();
} else if (layer.getDewpoint() < -300) {
iter.remove();
}
}
NcSoundingProfile profile = new NcSoundingProfile();
profile.setSoundingLyLst(layers);
// TODO populate other fields in profile
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;
} }
private static NcSoundingLayer getSurfacePressureLayer(PointDataView pdv) { private static NcSoundingLayer getSurfacePressureLayer(PointDataView pdv) {
@ -278,7 +197,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
float pressure = pressureArray[j].floatValue(); float pressure = pressureArray[j].floatValue();
pressure = (float) pressureConverter.convert(pressure); pressure = (float) pressureConverter.convert(pressure);
float h2o = h2oArray[j].floatValue(); float h2o = h2oArray[j].floatValue();
h2o = (float) h2oConverter.convert(h2o);
float dpt = convertH2OtoDewpoint(h2o, pressure); float dpt = convertH2OtoDewpoint(h2o, pressure);
dpt = (float) dewpointConverter.convert(dpt); dpt = (float) dewpointConverter.convert(dpt);
NcSoundingLayer layer = new NcSoundingLayer(pressure, NcSoundingLayer layer = new NcSoundingLayer(pressure,
@ -292,13 +210,6 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
return layers; return layers;
} }
// convert h2o in g/kg and pressure in hPa to dewpoint in kelvin.
private static float convertH2OtoDewpoint(float h2o, float pressure) {
double eee = pressure * h2o / (622.0 + 0.378 * h2o);
double b = 26.66082 - Math.log(eee);
return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048);
}
private static void mergeDuplicates(List<NcSoundingLayer> layers) { private static void mergeDuplicates(List<NcSoundingLayer> layers) {
// Merge any soundings at same pressure. // Merge any soundings at same pressure.
Iterator<NcSoundingLayer> iter = layers.iterator(); Iterator<NcSoundingLayer> iter = layers.iterator();
@ -322,80 +233,4 @@ public class CrimssNSharpResourceData extends D2DNSharpResourceData {
} }
} }
private static void interpolateHeight(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getGeoHeight() < 0) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateTemperature(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getTemperature() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getTemperature()
- layerBelow.getTemperature();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateDewpoint(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getDewpoint() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
} }

View file

@ -1,65 +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.npp.crimss.map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 7, 2011 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class CrimssMapResourceData extends AbstractRequestableResourceData {
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
CrimssMapResource resource = new CrimssMapResource(this, loadProperties);
for (PluginDataObject pdo : objects) {
if (pdo instanceof CrimssRecord) {
resource.addRecord((CrimssRecord) pdo);
}
}
return resource;
}
}

View file

@ -38,14 +38,33 @@
version="0.0.0"/> version="0.0.0"/>
<plugin <plugin
id="com.raytheon.uf.common.dataplugin.npp.crimss" id="com.raytheon.uf.common.dataplugin.npp.sounding"
download-size="0" download-size="0"
install-size="0" install-size="0"
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.viz.npp.crimss" id="com.raytheon.uf.viz.npp"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.viz.npp.sounding"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.nucaps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.npp.nucaps"
download-size="0" download-size="0"
install-size="0" install-size="0"
version="0.0.0"/> version="0.0.0"/>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.npp.nucaps</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Thu Jan 17 15:46:54 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NUCAPS Viz Plugin
Bundle-SymbolicName: com.raytheon.uf.viz.npp.nucaps
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.nucaps.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.nucaps;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.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0",
com.raytheon.uf.viz.npp.sounding;bundle-version="1.0.0",
com.raytheon.viz.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
javax.measure;bundle-version="1.0.0",
meteolib.jni;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: gov.noaa.nws.ncep.edex.common.sounding

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.npp.nucaps.NucapsNSharpResourceData

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Soundings" fileName="menus/npp/nucaps/nucapsMenuItems.xml"/>
</menuContributionFile>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/npp/soundingAvailability.xml"
menuText="NUCAPS Sounding Availability" id="NUCAPSAvailability">
<substitute key="name" value="NUCAPS"/>
<substitute key="pluginName" value="nucaps"/>
<substitute key="soundingResourceData" value="com.raytheon.uf.viz.npp.nucaps.NucapsNSharpResourceData"/>
</contribute>
</menuTemplate>

View file

@ -0,0 +1,30 @@
package com.raytheon.uf.viz.npp.nucaps;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,141 @@
/**
* 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.npp.nucaps;
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
import java.util.ArrayList;
import java.util.List;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.edex.meteolibrary.Meteolibrary;
import com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData;
/**
* NSharp resource data capable of loading NUCAPS data
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 15, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class NucapsNSharpResourceData extends AbstractNPPNSharpResourceData {
private static final String PLUGIN = "nucaps";
private static final String[] PARAMETERS = { NucapsRecord.LONGITUDE,
NucapsRecord.LATITUDE, NucapsRecord.PDV_SURFACE_PRESSURE,
NucapsRecord.PDV_PRESSURE, NucapsRecord.PDV_TEMPERATURE,
NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO };
public NucapsNSharpResourceData() {
super("NUCAPS", PLUGIN, PARAMETERS);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.npp.sounding.rsc.AbstractNPPNSharpResourceData#
* getSoundingLayers(com.raytheon.uf.common.pointdata.PointDataView)
*/
@Override
protected List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
throws VizException {
Number[] pressures = pdv.getNumberAllLevels(NucapsRecord.PDV_PRESSURE);
UnitConverter pressureConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_PRESSURE), PRESSURE_UNIT);
Number[] temperatures = pdv
.getNumberAllLevels(NucapsRecord.PDV_TEMPERATURE);
UnitConverter temperatureConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_TEMPERATURE), TEMPERATURE_UNIT);
UnitConverter temperatureCalcConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_TEMPERATURE),
TEMPERATURE_CALC_UNIT);
Number[] wvMixingRatios = pdv
.getNumberAllLevels(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO);
UnitConverter wvMixingRatioConverter = getConverter(
pdv.getUnit(NucapsRecord.PDV_WATER_VAPOR_MIXING_RATIO),
H2O_UNIT);
UnitConverter dewPointConverter = getConverter(SI.KELVIN, SI.CELSIUS);
if (pressures.length != temperatures.length
|| pressures.length != wvMixingRatios.length) {
throw new VizException("NUCAPS PointData sizes incorrect");
}
int length = pressures.length;
List<NcSoundingLayer> soundingLayers = new ArrayList<NcSoundingLayer>(
length);
float surfacePressure = pdv.getFloat(NucapsRecord.PDV_SURFACE_PRESSURE);
for (int i = 0; i < length; ++i) {
int idx = i;
float pressure = (float) pressureConverter.convert(pressures[idx]
.doubleValue());
if (pressure <= surfacePressure) {
// Don't add entries where pressure indicates below ground
float gh = Meteolibrary.ptozsa(new float[] { pressure }, 0);
Number temperature = temperatures[idx];
float h20 = (float) wvMixingRatioConverter
.convert(wvMixingRatios[idx].doubleValue());
float dewpoint = convertH2OtoDewpoint(h20, pressure);
float rh = convertH20ToRelativeHumidity(h20,
(float) temperatureCalcConverter.convert(temperature
.doubleValue()), pressure);
soundingLayers.add(new NcSoundingLayer(pressure, gh,
(float) temperatureConverter.convert(temperature
.doubleValue()), (float) dewPointConverter
.convert(dewpoint), NcSoundingLayer.MISSING,
NcSoundingLayer.MISSING, NcSoundingLayer.MISSING,
NcSoundingLayer.MISSING, NcSoundingLayer.MISSING, h20,
rh));
}
}
return soundingLayers;
}
private UnitConverter getConverter(Unit<?> fromUnit, Unit<?> toUnit)
throws VizException {
if (fromUnit.isCompatible(toUnit)) {
return fromUnit.getConverterTo(toUnit);
}
throw new VizException("Unable to convert " + fromUnit + " to "
+ toUnit);
}
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.npp.sounding</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Mon Jan 14 13:20:29 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,28 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Viz Sounding
Bundle-SymbolicName: com.raytheon.uf.viz.npp.sounding;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.sounding.Activator
Bundle-Vendor: RAYTHEON
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.6.1",
com.raytheon.uf.common.dataplugin.npp.sounding;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.npp;bundle-version="1.0.0",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.viz.d2d.nsharp;bundle-version="1.0.0",
gov.noaa.nws.ncep.ui.nsharp;bundle-version="1.0.0",
com.raytheon.viz.ui;bundle-version="1.12.1174",
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.pointdata;bundle-version="1.12.1174",
com.raytheon.viz.core.graphing;bundle-version="1.12.1174",
javax.measure;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: gov.noaa.nws.ncep.edex.common.sounding
Export-Package: com.raytheon.uf.viz.npp.sounding.rsc

View file

@ -0,0 +1 @@
com.raytheon.uf.viz.npp.sounding.rsc.NPPSoundingMapResourceData

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -24,11 +24,12 @@
<descriptor xsi:type="mapDescriptor"> <descriptor xsi:type="mapDescriptor">
<resource> <resource>
<loadProperties/> <loadProperties/>
<properties isSystemResource="false" isBlinking="false" isMapLayer="false" isHoverOn="false" isVisible="true"/> <resourceData xsi:type="nppSoundingMapResourceData">
<resourceData xsi:type="crimssMapResourceData" retrieveData="true" isUpdatingOnMetadataOnly="false" isRequeryNecessaryOnTimeMatch="true"> <nsharpResourceData>${soundingResourceData}</nsharpResourceData>
<resourceName>${name;Unknown}</resourceName>
<metadataMap> <metadataMap>
<mapping key="pluginName"> <mapping key="pluginName">
<constraint constraintValue="crimss" constraintType="EQUALS"/> <constraint constraintValue="${pluginName}" constraintType="EQUALS"/>
</mapping> </mapping>
</metadataMap> </metadataMap>
</resourceData> </resourceData>

View file

@ -0,0 +1,41 @@
package com.raytheon.uf.viz.npp.sounding;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
public class Activator implements BundleActivator {
public static final IUFStatusHandler statusHandler = UFStatus
.getHandler(Activator.class);
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
*
* @see
* org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -0,0 +1,339 @@
/**
* 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.npp.sounding.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 gov.noaa.nws.ncep.ui.nsharp.natives.NsharpDataHandling;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.DataTime.FLAG;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData;
import com.raytheon.uf.viz.npp.sounding.Activator;
import com.raytheon.viz.pointdata.PointDataRequest;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Abstract NPP Sounding resource data
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractNPPNSharpResourceData extends
D2DNSharpResourceData {
public static class NPPNsharpStationInfo extends NsharpStationInfo {
private TimeRange timeRange;
public NPPNsharpStationInfo(NsharpStationInfo info, DataTime time) {
this.latitude = info.getLatitude();
this.longitude = info.getLongitude();
this.reftime = new Timestamp(info.getReftime().getTime());
if (info.getRangestarttime() != null) {
this.rangestarttime = new Timestamp(info.getRangestarttime()
.getTime());
}
this.sndType = info.getSndType();
this.stnDisplayInfo = info.getStnDisplayInfo();
this.timeLineSpList = new ArrayList<NsharpStationInfo.timeLineSpecific>(
info.getTimeLineSpList());
setDataTime(time);
}
public void setDataTime(DataTime time) {
this.reftime = new Timestamp(time.getMatchRef());
if (time.getUtilityFlags().contains(FLAG.PERIOD_USED)) {
this.timeRange = time.getValidPeriod();
}
}
public DataTime getDataTime() {
if (timeRange != null) {
return new DataTime(getReftime().getTime(), timeRange);
} else {
return new DataTime(new Date(getReftime().getTime()));
}
}
}
protected static final Unit<?> PRESSURE_UNIT = SI.HECTO(SI.PASCAL);
protected static final Unit<?> HEIGHT_UNIT = SI.METER;
protected static final Unit<?> TEMPERATURE_UNIT = SI.CELSIUS;
protected static final Unit<?> TEMPERATURE_CALC_UNIT = SI.KELVIN;
protected static final Unit<?> H2O_UNIT = SI.GRAM.divide(SI.KILOGRAM);
protected static final Unit<?> DEWPOINT_UNIT = SI.CELSIUS;
private final String plugin;
private final String[] parameters;
public AbstractNPPNSharpResourceData() {
// This constructor only exists so JAXB won't complain
throw new UnsupportedOperationException();
}
protected AbstractNPPNSharpResourceData(String name, String plugin,
String[] parameters) {
super(name);
this.plugin = plugin;
this.parameters = parameters;
}
@Override
protected void preparePointInfo() throws VizException {
// everything should already be set
return;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#createStationInfo
* (com.raytheon.uf.common.time.DataTime)
*/
@Override
protected NsharpStationInfo createStationInfo(DataTime time) {
return new NPPNsharpStationInfo(super.createStationInfo(time), time);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.d2d.nsharp.rsc.D2DNSharpResourceData#getSoundingCube
* (gov.noaa.nws.ncep.ui.nsharp.NsharpStationInfo)
*/
@Override
protected NcSoundingCube getSoundingCube(NsharpStationInfo stnInfo) {
DataTime time = new DataTime(stnInfo.getReftime());
if (stnInfo instanceof NPPNsharpStationInfo) {
time = ((NPPNsharpStationInfo) stnInfo).getDataTime();
}
try {
PointDataContainer pdc = PointDataRequest
.requestPointDataAllLevels(time, plugin, parameters, null,
getMetadataMap());
PointDataView pdv = null;
Coordinate closest = null;
for (int i = 0; i < pdc.getCurrentSz(); i++) {
PointDataView testPdv = pdc.readRandom(i);
Coordinate p = new Coordinate(
testPdv.getFloat(NPPSoundingRecord.LONGITUDE),
testPdv.getFloat(NPPSoundingRecord.LATITUDE));
if (closest == null
|| coordinate.distance(p) < coordinate
.distance(closest)) {
pdv = testPdv;
closest = p;
}
}
if (pdv == null) {
return null;
}
List<NcSoundingLayer> layers = getSoundingLayers(pdv);
Collections.sort(layers,
NsharpDataHandling.reversePressureHeightWindComparator());
// We have to interpolate everything so that height,temperature, and
// dewpoint are available on all levels.
interpolateHeight(layers);
interpolateTemperature(layers);
interpolateDewpoint(layers);
Iterator<NcSoundingLayer> iter = layers.iterator();
while (iter.hasNext()) {
NcSoundingLayer layer = iter.next();
if (layer.getPressure() < 0) {
iter.remove();
} else if (layer.getGeoHeight() < 0) {
// TODO: Needed?
// iter.remove();
} else if (layer.getTemperature() < -300) {
iter.remove();
} else if (layer.getDewpoint() < -300) {
iter.remove();
}
}
NcSoundingProfile profile = new NcSoundingProfile();
profile.setSoundingLyLst(layers);
// TODO populate other fields in profile
NcSoundingCube cube = new NcSoundingCube(Arrays.asList(profile));
cube.setRtnStatus(QueryStatus.OK);
return cube;
} catch (VizException e) {
Activator.statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
}
return null;
}
/**
* @param pdv
* @return
*/
protected abstract List<NcSoundingLayer> getSoundingLayers(PointDataView pdv)
throws VizException;
private static void interpolateHeight(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getGeoHeight() < 0) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getGeoHeight() - layerBelow.getGeoHeight();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setGeoHeight((float) (layerBelow.getGeoHeight() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateTemperature(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getTemperature() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getTemperature()
- layerBelow.getTemperature();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setTemperature((float) (layerBelow.getTemperature() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
private static void interpolateDewpoint(List<NcSoundingLayer> layers) {
int belowIndex = -1;
for (int i = 0; i < layers.size(); i++) {
NcSoundingLayer layerAbove = layers.get(i);
if (layerAbove.getDewpoint() < -300) {
continue;
}
if (belowIndex == -1) {
belowIndex = i;
continue;
}
NcSoundingLayer layerBelow = layers.get(belowIndex);
double diff = layerAbove.getDewpoint() - layerBelow.getDewpoint();
double pchg1 = Math.log(layerBelow.getPressure()
/ layerAbove.getPressure());
for (int j = belowIndex + 1; j < i; j += 1) {
NcSoundingLayer layer = layers.get(j);
double pchg2 = Math.log(layerBelow.getPressure()
/ layer.getPressure());
layer.setDewpoint((float) (layerBelow.getDewpoint() + ((pchg2 / pchg1) * diff)));
}
belowIndex = i;
}
}
// convert h2o in g/kg and pressure in hPa to dewpoint in kelvin.
protected static float convertH2OtoDewpoint(float h2o, float pressure) {
double eee = pressure * h2o / (622.0 + 0.378 * h2o);
double b = 26.66082 - Math.log(eee);
return (float) ((b - Math.sqrt(b * b - 223.1986)) / 0.0182758048);
}
// convert h2o in g/kg and pressure in hPa to relative humidity.
protected static float convertH20ToRelativeHumidity(float h20,
float temperature, float pressure) {
double a = 22.05565;
double b = 0.0091379024;
double c = 6106.396;
double epsilonx1k = 622.0;
double shxDenom = h20 * 0.378;
shxDenom += epsilonx1k;
double tDenom = -b * temperature;
tDenom += a;
tDenom -= c / temperature;
double RH = pressure * h20;
RH /= shxDenom;
RH /= Math.exp(tDenom);
return (float) RH;
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.npp.crimss.map; package com.raytheon.uf.viz.npp.sounding.rsc;
import java.util.Collection; import java.util.Collection;
@ -28,14 +28,14 @@ import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.VizWorkbenchManager;
import com.raytheon.viz.ui.input.InputAdapter; import com.raytheon.viz.ui.input.InputAdapter;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
* Input manager for the CrimssMapResource * Input handler for npp sounding availability resource
* *
* <pre> * <pre>
* *
@ -43,7 +43,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 9, 2012 mschenke Initial creation * Jan 14, 2013 mschenke Initial creation
* *
* </pre> * </pre>
* *
@ -51,28 +51,24 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0 * @version 1.0
*/ */
public class CrimssMapInputManager extends InputAdapter { public class NPPSoundingMapInputHandler extends InputAdapter {
private NPPSoundingMapResource resource;
private Cursor handCursor; private Cursor handCursor;
private Cursor arrowCursor; private NPPSoundingRecord closestRecord;
private CrimssMapResource resource;
private CrimssRecord closestRecord;
private int downX, downY; private int downX, downY;
public CrimssMapInputManager(CrimssMapResource resource) { public NPPSoundingMapInputHandler(NPPSoundingMapResource resource) {
this.resource = resource; this.resource = resource;
Display display = Display.getCurrent(); Display display = Display.getCurrent();
handCursor = new Cursor(display, SWT.CURSOR_HAND); handCursor = new Cursor(display, SWT.CURSOR_HAND);
arrowCursor = new Cursor(display, SWT.CURSOR_ARROW);
} }
public void dispose() { public void dispose() {
handCursor.dispose(); handCursor.dispose();
arrowCursor.dispose();
} }
/* /*
@ -86,12 +82,13 @@ public class CrimssMapInputManager extends InputAdapter {
closestRecord = null; closestRecord = null;
if (resource.isEditable()) { if (resource.isEditable()) {
Collection<CrimssRecord> records = resource.getCurrentRecords(); Collection<NPPSoundingRecord> records = resource
.getCurrentRecords();
if (records != null) { if (records != null) {
double radius = resource.getRadius(); double radius = resource.getRadius();
Coordinate c = new Coordinate(x, y); Coordinate c = new Coordinate(x, y);
double bestDist = Double.MAX_VALUE; double bestDist = Double.MAX_VALUE;
for (CrimssRecord record : records) { for (NPPSoundingRecord record : records) {
double lat = record.getLatitude(); double lat = record.getLatitude();
double lon = record.getLongitude(); double lon = record.getLongitude();
double[] pixel = resource.getResourceContainer() double[] pixel = resource.getResourceContainer()
@ -107,7 +104,7 @@ public class CrimssMapInputManager extends InputAdapter {
} }
if (wasClosest && closestRecord == null) { if (wasClosest && closestRecord == null) {
getShell().setCursor(arrowCursor); getShell().setCursor(null);
} else if (!wasClosest && closestRecord != null) { } else if (!wasClosest && closestRecord != null) {
getShell().setCursor(handCursor); getShell().setCursor(handCursor);
} }
@ -159,7 +156,7 @@ public class CrimssMapInputManager extends InputAdapter {
@Override @Override
public boolean handleMouseExit(Event event) { public boolean handleMouseExit(Event event) {
closestRecord = null; closestRecord = null;
getShell().setCursor(arrowCursor); getShell().setCursor(null);
return super.handleMouseExit(event); return super.handleMouseExit(event);
} }

View file

@ -17,26 +17,25 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.viz.npp.crimss.map; package com.raytheon.uf.viz.npp.sounding.rsc;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDescriptor;
import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay; import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.jobs.Job; import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.BinOffset;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DescriptorMap; import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.DrawableCircle; import com.raytheon.uf.viz.core.DrawableCircle;
@ -53,7 +52,6 @@ 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.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.npp.crimss.CrimssNSharpResourceData;
import com.raytheon.viz.ui.BundleProductLoader; import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor; import com.raytheon.viz.ui.editor.AbstractEditor;
@ -61,7 +59,7 @@ import com.raytheon.viz.ui.input.EditableManager;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
* TODO Add Description * Sounding available resource. Draws points on map where data is available
* *
* <pre> * <pre>
* *
@ -69,66 +67,72 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 7, 2011 bsteffen Initial creation * Jan 14, 2013 mschenke Initial creation
* *
* </pre> * </pre>
* *
* @author bsteffen * @author mschenke
* @version 1.0 * @version 1.0
*/ */
public class CrimssMapResource extends public class NPPSoundingMapResource extends
AbstractVizResource<CrimssMapResourceData, IMapDescriptor> { AbstractVizResource<NPPSoundingMapResourceData, IMapDescriptor> {
private CrimssMapInputManager inputManager; private NPPSoundingMapInputHandler inputManager;
private Map<DataTime, Set<CrimssRecord>> records = new HashMap<DataTime, Set<CrimssRecord>>(); private Collection<NPPSoundingRecord> allRecords = new ArrayList<NPPSoundingRecord>();
protected CrimssMapResource(CrimssMapResourceData resourceData, private Map<DataTime, Collection<NPPSoundingRecord>> groupedRecords = new HashMap<DataTime, Collection<NPPSoundingRecord>>();
/**
* @param resourceData
* @param loadProperties
*/
protected NPPSoundingMapResource(NPPSoundingMapResourceData resourceData,
LoadProperties loadProperties) { LoadProperties loadProperties) {
super(resourceData, loadProperties); super(resourceData, loadProperties);
this.inputManager = new CrimssMapInputManager(this); this.inputManager = new NPPSoundingMapInputHandler(this);
this.dataTimes = new ArrayList<DataTime>(); this.dataTimes = new ArrayList<DataTime>();
getCapability(EditableCapability.class).setEditable(true); getCapability(EditableCapability.class).setEditable(true);
resourceData.addChangeListener(new IResourceDataChanged() { resourceData.addChangeListener(new IResourceDataChanged() {
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void resourceChanged(ChangeType type, Object object) {
if (type == ChangeType.DATA_UPDATE) { if (type == ChangeType.DATA_UPDATE) {
if (object instanceof PluginDataObject[]) { if (object instanceof PluginDataObject[]) {
for (PluginDataObject pdo : (PluginDataObject[]) object) { addRecords((PluginDataObject[]) object);
addRecord((CrimssRecord) pdo);
}
} }
} }
} }
}); });
} }
Collection<CrimssRecord> getCurrentRecords() { Collection<NPPSoundingRecord> getCurrentRecords() {
return records.get(descriptor.getTimeForResource(this)); return groupedRecords.get(descriptor.getTimeForResource(this));
} }
public void addRecord(CrimssRecord record) { public synchronized void addRecords(PluginDataObject... records) {
DataTime time = record.getDataTime(); for (PluginDataObject record : records) {
BinOffset binOffset = resourceData.getBinOffset(); if (record instanceof NPPSoundingRecord) {
if (binOffset != null) { if (allRecords.contains(record) == false) {
time = binOffset.getNormalizedTime(time); allRecords.add((NPPSoundingRecord) record);
} }
Set<CrimssRecord> pdos = this.records.get(time);
if (pdos == null) {
pdos = new HashSet<CrimssRecord>();
this.records.put(time, pdos);
} }
if (!this.dataTimes.contains(time)) {
this.dataTimes.add(time);
} }
pdos.add(record); Map<DataTime, Collection<NPPSoundingRecord>> groupedRecords = resourceData
.groupRecordTimes(allRecords);
List<DataTime> dataTimes = new ArrayList<DataTime>(
groupedRecords.keySet());
Collections.sort(dataTimes);
this.dataTimes = dataTimes;
this.groupedRecords = groupedRecords;
} }
@Override @Override
public void remove(DataTime dataTime) { public synchronized void remove(DataTime dataTime) {
records.remove(dataTime); Collection<NPPSoundingRecord> records = groupedRecords.remove(dataTime);
if (records != null) {
allRecords.removeAll(records);
}
super.remove(dataTime); super.remove(dataTime);
} }
@ -145,20 +149,21 @@ public class CrimssMapResource extends
if (time == null) { if (time == null) {
return; return;
} }
Set<CrimssRecord> records = this.records.get(time); Collection<NPPSoundingRecord> records = this.groupedRecords.get(time);
if (records == null) { if (records == null) {
return; return;
} }
RGB color = getCapability(ColorableCapability.class).getColor(); RGB color = getCapability(ColorableCapability.class).getColor();
List<DrawableCircle> circles = new ArrayList<DrawableCircle>( List<DrawableCircle> circles = new ArrayList<DrawableCircle>(
records.size()); records.size());
for (CrimssRecord record : records) { for (NPPSoundingRecord record : records) {
double lat = record.getLatitude(); double lat = record.getLatitude();
double lon = record.getLongitude(); double lon = record.getLongitude();
double[] pixel = descriptor.worldToPixel(new double[] { lon, lat }); double[] pixel = descriptor.worldToPixel(new double[] { lon, lat });
DrawableCircle circle = new DrawableCircle(); DrawableCircle circle = new DrawableCircle();
circle.setCoordinates(pixel[0], pixel[1]); circle.setCoordinates(pixel[0], pixel[1]);
circle.screenRadius = getRadius() - 1; circle.screenRadius = getRadius();
circle.numberOfPoints = (int) (circle.screenRadius * 4);
circle.basics.color = color; circle.basics.color = color;
circle.filled = true; circle.filled = true;
circles.add(circle); circles.add(circle);
@ -183,11 +188,20 @@ public class CrimssMapResource extends
} }
double getRadius() { double getRadius() {
return 8 * getCapability(MagnificationCapability.class) return 5 * getCapability(MagnificationCapability.class)
.getMagnification(); .getMagnification();
} }
void loadSoundingResource(CrimssRecord record) { @Override
public String getName() {
return resourceData.getResourceName() + " Availability";
}
/**
* @param closestRecord
*/
void loadSoundingResource(NPPSoundingRecord record) {
// Build metadata map for sounding resource
HashMap<String, RequestConstraint> metadataMap = new HashMap<String, RequestConstraint>( HashMap<String, RequestConstraint> metadataMap = new HashMap<String, RequestConstraint>(
resourceData.getMetadataMap()); resourceData.getMetadataMap());
RequestConstraint rc = new RequestConstraint(null, RequestConstraint rc = new RequestConstraint(null,
@ -195,22 +209,24 @@ public class CrimssMapResource extends
rc.setBetweenValueList(new String[] { rc.setBetweenValueList(new String[] {
String.valueOf(record.getLongitude() - 0.01), String.valueOf(record.getLongitude() - 0.01),
String.valueOf(record.getLongitude() + 0.01) }); String.valueOf(record.getLongitude() + 0.01) });
metadataMap.put(CrimssRecord.LONGITUDE, rc); metadataMap.put(NPPSoundingRecord.LONGITUDE, rc);
rc = new RequestConstraint(null, ConstraintType.BETWEEN); rc = new RequestConstraint(null, ConstraintType.BETWEEN);
rc.setBetweenValueList(new String[] { rc.setBetweenValueList(new String[] {
String.valueOf(record.getLatitude() - 0.01), String.valueOf(record.getLatitude() - 0.01),
String.valueOf(record.getLatitude() + 0.01) }); String.valueOf(record.getLatitude() + 0.01) });
metadataMap.put(CrimssRecord.LATITUDE, rc); metadataMap.put(NPPSoundingRecord.LATITUDE, rc);
CrimssNSharpResourceData resourceData = new CrimssNSharpResourceData();
resourceData.setCoordinate(new Coordinate(record.getLongitude(), record // Construct nsharp resource data for loading
.getLatitude())); AbstractNPPNSharpResourceData nsResourceData = resourceData
resourceData.setPointName(String.format("CrIMSS-%.2f,%.2f", .newNsharpResourceData();
record.getLongitude(), record.getLatitude())); nsResourceData.setCoordinate(new Coordinate(record.getLongitude(),
resourceData.setMetadataMap(metadataMap); record.getLatitude()));
nsResourceData.setMetadataMap(metadataMap);
ResourcePair pair = new ResourcePair(); ResourcePair pair = new ResourcePair();
pair.setResourceData(resourceData); pair.setResourceData(nsResourceData);
pair.setLoadProperties(new LoadProperties()); pair.setLoadProperties(new LoadProperties());
NsharpSkewTPaneDisplay display = new NsharpSkewTPaneDisplay(); NsharpSkewTPaneDisplay display = new NsharpSkewTPaneDisplay();
display.setDescriptor(new NsharpSkewTPaneDescriptor());
display.getDescriptor().getResourceList().add(pair); display.getDescriptor().getResourceList().add(pair);
String editorId = DescriptorMap.getEditorId(display.getDescriptor() String editorId = DescriptorMap.getEditorId(display.getDescriptor()
.getClass().getName()); .getClass().getName());
@ -221,10 +237,4 @@ public class CrimssMapResource extends
Job j = new BundleProductLoader(editor, b); Job j = new BundleProductLoader(editor, b);
j.schedule(); j.schedule();
} }
@Override
public String getName() {
return "CrIMSS Availability";
}
} }

View file

@ -0,0 +1,161 @@
/**
* 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.npp.sounding.rsc;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.npp.AbstractNppResourceData;
/**
* Resource data for availability map of npp soundings
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 14, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public class NPPSoundingMapResourceData extends AbstractNppResourceData {
@XmlElement
private Class<? extends AbstractNPPNSharpResourceData> nsharpResourceData;
@XmlElement
private String resourceName;
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* constructResource(com.raytheon.uf.viz.core.rsc.LoadProperties,
* com.raytheon.uf.viz.core.rsc.PluginDataObject[])
*/
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
NPPSoundingMapResource resource = new NPPSoundingMapResource(this,
loadProperties);
if (objects instanceof PluginDataObject[]) {
resource.addRecords((PluginDataObject[]) objects);
}
return resource;
}
/**
* @return the nsharpResourceData
*/
public Class<? extends AbstractNPPNSharpResourceData> getNsharpResourceData() {
return nsharpResourceData;
}
/**
* @param nsharpResourceData
* the nsharpResourceData to set
*/
public void setNsharpResourceData(
Class<? extends AbstractNPPNSharpResourceData> nsharpResourceData) {
this.nsharpResourceData = nsharpResourceData;
}
/**
* @return the resourceName
*/
public String getResourceName() {
return resourceName;
}
/**
* @param resourceName
* the resourceName to set
*/
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
}
public AbstractNPPNSharpResourceData newNsharpResourceData() {
try {
return getNsharpResourceData().newInstance();
} catch (Exception e) {
throw new RuntimeException("Unable to create new instance of: "
+ getNsharpResourceData());
}
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime
* result
+ ((nsharpResourceData == null) ? 0 : nsharpResourceData
.hashCode());
result = prime * result
+ ((resourceName == null) ? 0 : resourceName.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;
NPPSoundingMapResourceData other = (NPPSoundingMapResourceData) obj;
if (nsharpResourceData == null) {
if (other.nsharpResourceData != null)
return false;
} else if (!nsharpResourceData.equals(other.nsharpResourceData))
return false;
if (resourceName == null) {
if (other.resourceName != null)
return false;
} else if (!resourceName.equals(other.resourceName))
return false;
return true;
}
}

View file

@ -24,6 +24,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.derivparam;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.dataplugin.level;bundle-version="1.12.1174",
com.raytheon.uf.common.comm;bundle-version="1.12.1174", com.raytheon.uf.common.comm;bundle-version="1.12.1174",
com.raytheon.viz.alerts;bundle-version="1.12.1174" com.raytheon.viz.alerts;bundle-version="1.12.1174",
com.raytheon.uf.viz.npp;bundle-version="1.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<menuContributionFile>
<include installTo="menu:NPPProducts?after=Imagery" fileName="menus/npp/viirs/viirsMenuItems.xml"/>
</menuContributionFile>

View file

@ -19,7 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="separator" id="beforeVIIRS" visible="false"/>
<contribute xsi:type="titleItem" titleText="------ VIIRS ------" id="ImageryLine"/> <contribute xsi:type="titleItem" titleText="------ VIIRS ------" id="ImageryLine"/>
<contribute xsi:type="subMenu" menuText="CONUS Imagery" id="CONUSid"> <contribute xsi:type="subMenu" menuText="CONUS Imagery" id="CONUSid">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml"> <contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsBundleItems.xml">
@ -36,5 +35,4 @@
<substitute key="region" value="Pacific"/> <substitute key="region" value="Pacific"/>
</contribute> </contribute>
</contribute> </contribute>
<contribute xsi:type="separator" id="afterVIIRS" visible="false"/>
</menuTemplate> </menuTemplate>

View file

@ -25,6 +25,7 @@ import java.nio.FloatBuffer;
import java.nio.ShortBuffer; import java.nio.ShortBuffer;
import com.raytheon.uf.common.colormap.image.ColorMapData; import com.raytheon.uf.common.colormap.image.ColorMapData;
import com.raytheon.uf.common.colormap.image.ColorMapData.ColorMapDataType;
import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord; import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord;
import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
@ -88,13 +89,13 @@ public class VIIRSDataCallback implements IColorMapDataRetrievalCallback {
return new ColorMapData(shortData, new int[] { return new ColorMapData(shortData, new int[] {
(int) rawData.getSizes()[0], (int) rawData.getSizes()[0],
(int) rawData.getSizes()[1] }, (int) rawData.getSizes()[1] },
ColorMapData.ColorMapDataType.UNSIGNED_SHORT); ColorMapDataType.UNSIGNED_SHORT);
} else if (rawData instanceof FloatDataRecord) { } else if (rawData instanceof FloatDataRecord) {
Buffer floatData = FloatBuffer.wrap(((FloatDataRecord) rawData) Buffer floatData = FloatBuffer.wrap(((FloatDataRecord) rawData)
.getFloatData()); .getFloatData());
return new ColorMapData(floatData, new int[] { return new ColorMapData(floatData, new int[] {
(int) rawData.getSizes()[0], (int) rawData.getSizes()[0],
(int) rawData.getSizes()[1] }, ColorMapData.ColorMapDataType.FLOAT); (int) rawData.getSizes()[1] }, ColorMapDataType.FLOAT);
} else { } else {
throw new VizException("Could not handle IDataRecord: " throw new VizException("Could not handle IDataRecord: "
+ rawData); + rawData);

View file

@ -19,33 +19,18 @@
**/ **/
package com.raytheon.uf.viz.npp.viirs.rsc; package com.raytheon.uf.viz.npp.viirs.rsc;
import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Queue;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord; import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.npp.AbstractNppResourceData;
/** /**
* VIIRS Resource data * VIIRS Resource data
@ -66,38 +51,7 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class VIIRSResourceData extends AbstractRequestableResourceData { public class VIIRSResourceData extends AbstractNppResourceData {
private static class DataTimeIterator<T extends PluginDataObject>
implements Iterator<DataTime> {
private Iterator<T> pdoIter;
private T lastAccesed;
private DataTimeIterator(Iterator<T> pdoIter) {
this.pdoIter = pdoIter;
}
@Override
public boolean hasNext() {
return pdoIter.hasNext();
}
@Override
public DataTime next() {
lastAccesed = pdoIter.next();
return lastAccesed.getDataTime();
}
@Override
public void remove() {
pdoIter.remove();
}
}
@XmlElement
private int groupTimeRangeMinutes = 3;
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -119,176 +73,4 @@ public class VIIRSResourceData extends AbstractRequestableResourceData {
return new VIIRSResource(this, loadProperties, viirsRecords); return new VIIRSResource(this, loadProperties, viirsRecords);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* requestPluginDataObjects(java.util.Collection)
*/
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {
List<DataTime> timesToLoad = new ArrayList<DataTime>(loadSet);
Collections.sort(timesToLoad);
DataTime first = timesToLoad.get(0);
DataTime last = timesToLoad.get(timesToLoad.size() - 1);
Map<String, RequestConstraint> requestMap = new HashMap<String, RequestConstraint>(
getMetadataMap());
RequestConstraint timeConst = new RequestConstraint();
timeConst.setConstraintType(ConstraintType.BETWEEN);
timeConst.setBetweenValueList(new String[] {
new DataTime(first.getValidPeriod().getStart()).toString(),
new DataTime(last.getValidPeriod().getEnd()).toString() });
requestMap.put("dataTime.refTime", timeConst);
LayerProperty property = new LayerProperty();
property.setEntryQueryParameters(requestMap, false);
property.setNumberOfImages(9999);
List<Object> pdos = DataCubeContainer.getData(property, 60000);
List<PluginDataObject> finalList = new ArrayList<PluginDataObject>(
pdos != null ? pdos.size() : 0);
if (pdos != null) {
for (Object obj : pdos) {
PluginDataObject pdo = (PluginDataObject) obj;
for (DataTime dt : loadSet) {
if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) {
finalList.add(pdo);
break;
}
}
}
Collections.sort(finalList, layerComparator);
}
return finalList.toArray(new PluginDataObject[finalList.size()]);
}
public static boolean withinRange(TimeRange range, DataTime time) {
long refTime = time.getMatchRef();
return range.getStart().getTime() <= refTime
&& range.getEnd().getTime() >= refTime;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* getAvailableTimes()
*/
@Override
public DataTime[] getAvailableTimes() throws VizException {
Collection<DataTime> dts = groupTimes(Arrays.asList(super
.getAvailableTimes()));
return dts.toArray(new DataTime[dts.size()]);
}
/**
* Group times for a {@link PluginDataObject} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param records
* @return
*/
public <T extends PluginDataObject> Map<DataTime, Collection<T>> groupRecordTimes(
Collection<T> records) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
Map<DataTime, Collection<T>> grouped = new HashMap<DataTime, Collection<T>>();
Queue<T> objects = new ArrayDeque<T>(records);
while (objects.size() > 0) {
T record = objects.remove();
DataTime current = record.getDataTime();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
List<T> group = new ArrayList<T>();
while (curr != null) {
prev = curr;
DataTimeIterator<T> iter = new DataTimeIterator<T>(
objects.iterator());
curr = match(iter, current.getValidPeriod(), groupTimeInMillis);
if (curr != null) {
group.add(iter.lastAccesed);
}
}
grouped.put(new DataTime(prev.getStart().getTime(), prev), group);
}
return grouped;
}
/**
* Group the {@link DataTime} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param dataTimes
* @return
*/
public Collection<DataTime> groupTimes(Collection<DataTime> dataTimes) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
List<DataTime> grouped = new ArrayList<DataTime>(dataTimes.size());
Queue<DataTime> objects = new ArrayDeque<DataTime>(dataTimes);
while (objects.size() > 0) {
DataTime current = objects.remove();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
while (curr != null) {
prev = curr;
curr = match(objects.iterator(), current.getValidPeriod(),
groupTimeInMillis);
}
grouped.add(new DataTime(prev.getStart().getTime(), prev));
}
return grouped;
}
private TimeRange match(Iterator<DataTime> iter, TimeRange time,
long groupTimeInMillis) {
long startT = time.getStart().getTime();
long endT = time.getEnd().getTime();
while (iter.hasNext()) {
DataTime dt = iter.next();
TimeRange dtRange = dt.getValidPeriod();
long s = dtRange.getStart().getTime();
long e = dtRange.getEnd().getTime();
long startCheck = s - groupTimeInMillis;
long endCheck = e + groupTimeInMillis;
if ((startT <= startCheck && endT >= startCheck)
|| (startCheck <= startT && endCheck >= startT)) {
iter.remove();
return new TimeRange(Math.min(s, startT), Math.max(e, endT));
}
}
return null;
}
/**
* @return the groupTimeRangeMinutes
*/
public int getGroupTimeRangeMinutes() {
return groupTimeRangeMinutes;
}
/**
* @param groupTimeRangeMinutes
* the groupTimeRangeMinutes to set
*/
public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) {
this.groupTimeRangeMinutes = groupTimeRangeMinutes;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java
* .lang.Object)
*/
@Override
public void update(Object updateData) {
super.update(updateData);
invalidateAvailableTimesCache();
}
} }

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.npp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Tue Jan 08 13:23:52 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Viz
Bundle-SymbolicName: com.raytheon.uf.viz.npp
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.raytheon.uf.viz.npp.Activator
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.npp

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
localization/

View file

@ -20,7 +20,8 @@
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" id="NPPProducts" menuText="NPP Products"> <contribute xsi:type="subMenu" id="NPPProducts" menuText="NPP Products">
<contribute xsi:type="subinclude" fileName="menus/npp/viirs/viirsMenuItems.xml"/> <contribute xsi:type="separator" id="Imagery" visible="false"/>
<contribute xsi:type="subinclude" fileName="menus/npp/crimss/crimssMenuItems.xml"/> <contribute xsi:type="titleItem" id="SoundingsTitle" titleText="------ Soundings ------"/>
<contribute xsi:type="separator" id="Soundings" visible="false"/>
</contribute> </contribute>
</menuTemplate> </menuTemplate>

View file

@ -0,0 +1,269 @@
/**
* 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.npp;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
/**
* Abstract resource data for all NPP data. Groups frame times close together
* (within {@link #groupTimeRangeMinutes} minutes).
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 8, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class AbstractNppResourceData extends
AbstractRequestableResourceData {
private static class DataTimeIterator<T extends PluginDataObject>
implements Iterator<DataTime> {
private Iterator<T> pdoIter;
private T lastAccesed;
private DataTimeIterator(Iterator<T> pdoIter) {
this.pdoIter = pdoIter;
}
@Override
public boolean hasNext() {
return pdoIter.hasNext();
}
@Override
public DataTime next() {
lastAccesed = pdoIter.next();
return lastAccesed.getDataTime();
}
@Override
public void remove() {
pdoIter.remove();
}
}
@XmlElement
private int groupTimeRangeMinutes = 15;
/**
* @return the groupTimeRangeMinutes
*/
public int getGroupTimeRangeMinutes() {
return groupTimeRangeMinutes;
}
/**
* @param groupTimeRangeMinutes
* the groupTimeRangeMinutes to set
*/
public void setGroupTimeRangeMinutes(int groupTimeRangeMinutes) {
this.groupTimeRangeMinutes = groupTimeRangeMinutes;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* requestPluginDataObjects(java.util.Collection)
*/
@Override
protected PluginDataObject[] requestPluginDataObjects(
Collection<DataTime> loadSet) throws VizException {
List<DataTime> timesToLoad = new ArrayList<DataTime>(loadSet);
Collections.sort(timesToLoad);
DataTime first = timesToLoad.get(0);
DataTime last = timesToLoad.get(timesToLoad.size() - 1);
Map<String, RequestConstraint> requestMap = new HashMap<String, RequestConstraint>(
getMetadataMap());
RequestConstraint timeConst = new RequestConstraint();
timeConst.setConstraintType(ConstraintType.BETWEEN);
timeConst.setBetweenValueList(new String[] {
new DataTime(first.getValidPeriod().getStart()).toString(),
new DataTime(last.getValidPeriod().getEnd()).toString() });
requestMap.put("dataTime.refTime", timeConst);
LayerProperty property = new LayerProperty();
property.setEntryQueryParameters(requestMap, false);
property.setNumberOfImages(9999);
List<Object> pdos = DataCubeContainer.getData(property, 60000);
List<PluginDataObject> finalList = new ArrayList<PluginDataObject>(
pdos != null ? pdos.size() : 0);
if (pdos != null) {
for (Object obj : pdos) {
PluginDataObject pdo = (PluginDataObject) obj;
for (DataTime dt : loadSet) {
if (withinRange(dt.getValidPeriod(), pdo.getDataTime())) {
finalList.add(pdo);
break;
}
}
}
Collections.sort(finalList, layerComparator);
}
return finalList.toArray(new PluginDataObject[finalList.size()]);
}
public static boolean withinRange(TimeRange range, DataTime time) {
long refTime = time.getMatchRef();
return range.getStart().getTime() <= refTime
&& range.getEnd().getTime() >= refTime;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#
* getAvailableTimes()
*/
@Override
public DataTime[] getAvailableTimes() throws VizException {
Collection<DataTime> dts = groupTimes(Arrays.asList(super
.getAvailableTimes()));
return dts.toArray(new DataTime[dts.size()]);
}
/**
* Group times for a {@link PluginDataObject} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param records
* @return
*/
public <T extends PluginDataObject> Map<DataTime, Collection<T>> groupRecordTimes(
Collection<T> records) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
Map<DataTime, Collection<T>> grouped = new HashMap<DataTime, Collection<T>>();
Queue<T> objects = new ArrayDeque<T>(records);
while (objects.size() > 0) {
T record = objects.remove();
DataTime current = record.getDataTime();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
List<T> group = new ArrayList<T>();
while (curr != null) {
prev = curr;
DataTimeIterator<T> iter = new DataTimeIterator<T>(
objects.iterator());
curr = match(iter, prev, groupTimeInMillis);
if (curr != null) {
group.add(iter.lastAccesed);
}
}
grouped.put(new DataTime(prev.getStart().getTime(), prev), group);
}
return grouped;
}
/**
* Group the {@link DataTime} collection based on
* {@link #groupTimeRangeMinutes}
*
* @param dataTimes
* @return
*/
public Collection<DataTime> groupTimes(Collection<DataTime> dataTimes) {
long groupTimeInMillis = groupTimeRangeMinutes * 60 * 1000;
List<DataTime> grouped = new ArrayList<DataTime>(dataTimes.size());
Queue<DataTime> objects = new ArrayDeque<DataTime>(dataTimes);
while (objects.size() > 0) {
DataTime current = objects.remove();
TimeRange prev, curr;
prev = curr = current.getValidPeriod();
while (curr != null) {
prev = curr;
curr = match(objects.iterator(), prev, groupTimeInMillis);
}
grouped.add(new DataTime(prev.getStart().getTime(), prev));
}
return grouped;
}
private TimeRange match(Iterator<DataTime> iter, TimeRange time,
long groupTimeInMillis) {
long startT = time.getStart().getTime();
long endT = time.getEnd().getTime();
while (iter.hasNext()) {
DataTime dt = iter.next();
TimeRange dtRange = dt.getValidPeriod();
long s = dtRange.getStart().getTime();
long e = dtRange.getEnd().getTime();
long startCheck = s - groupTimeInMillis;
long endCheck = e + groupTimeInMillis;
if ((startT <= startCheck && endT >= startCheck)
|| (startCheck <= startT && endCheck >= startT)) {
iter.remove();
return new TimeRange(Math.min(s, startT), Math.max(e, endT));
}
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java
* .lang.Object)
*/
@Override
public void update(Object updateData) {
super.update(updateData);
invalidateAvailableTimesCache();
}
}

View file

@ -0,0 +1,30 @@
package com.raytheon.uf.viz.npp;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
public class Activator implements BundleActivator {
private static BundleContext context;
static BundleContext getContext() {
return context;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}
}

View file

@ -7,10 +7,10 @@ Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.serialization.annotations,
javax.persistence
Export-Package: com.raytheon.uf.common.dataplugin.npp.crimss Export-Package: com.raytheon.uf.common.dataplugin.npp.crimss
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0"

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.common.dataplugin.npp.crimss">
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -19,30 +19,18 @@
**/ **/
package com.raytheon.uf.common.dataplugin.npp.crimss; package com.raytheon.uf.common.dataplugin.npp.crimss;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.UniqueConstraint; import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable; import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/** /**
* TODO Add Description * PluginDataObject record for NPP CrIMSS data
* *
* <pre> * <pre>
* *
@ -62,8 +50,9 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize @DynamicSerialize
@XmlRootElement @XmlRootElement
@XmlAccessorType(XmlAccessType.NONE) @XmlAccessorType(XmlAccessType.NONE)
public class CrimssRecord extends PersistablePluginDataObject implements public class CrimssRecord extends NPPSoundingRecord {
IPointData {
private static final long serialVersionUID = 1L;
public static final String PDV_SURFACE_PRESSURE = "SurfacePressure"; public static final String PDV_SURFACE_PRESSURE = "SurfacePressure";
@ -79,77 +68,4 @@ public class CrimssRecord extends PersistablePluginDataObject implements
public static final String PDV_P_H2O = "PressureLevels_H2O"; public static final String PDV_P_H2O = "PressureLevels_H2O";
public static final String LATITUDE = "latitude";
public static final String LONGITUDE = "longitude";
@Embedded
private PointDataView pdv;
@DataURI(position = 1)
@Column
@XmlAttribute
@DynamicSerializeElement
private Double latitude;
@DataURI(position = 2)
@Column
@XmlAttribute
@DynamicSerializeElement
private Double longitude;
public CrimssRecord() {
super();
}
public CrimssRecord(String uri) {
super(uri);
}
@Override
public Date getPersistenceTime() {
Calendar c = getInsertTime();
if (c == null)
return null;
return c.getTime();
}
public void setPersistenceTime(Date persistTime) {
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
c.setTime(persistTime);
setInsertTime(c);
}
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
@Override
public PointDataView getPointDataView() {
return pdv;
}
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
} }

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.dataplugin.npp.nucaps</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Tue Jan 15 10:15:18 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NUCAPS Common Plugin
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.npp.nucaps
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
com.raytheon.uf.common.time;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.common.dataplugin.npp.nucaps

View file

@ -0,0 +1 @@
com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -0,0 +1,79 @@
/**
* 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.dataplugin.npp.nucaps;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
/**
* PDO for NPP NUCAPS data
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 15, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@Entity
@Table(name = "nucaps", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@DynamicSerialize
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class NucapsRecord extends NPPSoundingRecord {
private static final long serialVersionUID = 1L;
public static final String PDV_SURFACE_PRESSURE = "Surface_Pressure";
public static final String PDV_PRESSURE = "Pressure";
public static final String PDV_SKIN_TEMPERATURE = "Skin_Temperature";
public static final String PDV_TEMPERATURE = "Temperature";
public static final String PDV_TOPOGRAPHY = "Topography";
public static final String PDV_EFFECTIVE_PRESSURE = "Effective_Pressure";
public static final String PDV_WATER_VAPOR_MIXING_RATIO = "H2O_MR";
public static final String PDV_LIQUID_WATER_MIXING_RATIO = "Liquid_H2O_MR";
public static final String PDV_OZONE_MIXING_RATIO = "O3_MR";
public static final String PDV_SULFER_DIOXIDE_MIXING_RATIO = "SO2_MR";
public static final String PDV_QUALITY_FLAG = "Quality_Flag";
}

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.common.dataplugin.npp.sounding</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Thu Jan 03 14:58:27 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Sounding DataPlugin
Bundle-SymbolicName: com.raytheon.uf.common.dataplugin.npp.sounding
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
javax.persistence;bundle-version="1.0.0",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.common.dataplugin.npp.sounding

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -0,0 +1,137 @@
/**
* 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.dataplugin.npp.sounding;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.PersistablePluginDataObject;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Abstract NPP sounding record class
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 3, 2013 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
@Entity
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public abstract class NPPSoundingRecord extends PersistablePluginDataObject
implements IPointData {
private static final long serialVersionUID = 1L;
public static final String LATITUDE = "latitude";
public static final String LONGITUDE = "longitude";
@Embedded
private PointDataView pointDataView;
@DataURI(position = 1)
@Column
@XmlAttribute
@DynamicSerializeElement
private Double latitude;
@DataURI(position = 2)
@Column
@XmlAttribute
@DynamicSerializeElement
private Double longitude;
@Override
public IDecoderGettable getDecoderGettable() {
return null;
}
/**
* @return the latitude
*/
public Double getLatitude() {
return latitude;
}
/**
* @param latitude
* the latitude to set
*/
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
/**
* @return the longitude
*/
public Double getLongitude() {
return longitude;
}
/**
* @param longitude
* the longitude to set
*/
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView()
*/
@Override
public PointDataView getPointDataView() {
return pointDataView;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon
* .uf.common.pointdata.PointDataView)
*/
@Override
public void setPointDataView(PointDataView pointDataView) {
this.pointDataView = pointDataView;
}
}

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.common.dataplugin.npp.viirs">
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.common.dataplugin.npp.viirs.projection; package com.raytheon.uf.common.dataplugin.npp.viirs.projection;
import org.geotools.referencing.crs.DefaultProjectedCRS;
import org.geotools.referencing.operation.DefaultMathTransformFactory; import org.geotools.referencing.operation.DefaultMathTransformFactory;
import org.opengis.parameter.ParameterValueGroup; import org.opengis.parameter.ParameterValueGroup;
import org.opengis.referencing.FactoryException; import org.opengis.referencing.FactoryException;
@ -49,8 +50,7 @@ public class VIIRSMapProjectionFactory {
/** Using single factory is faster due to internal caching */ /** Using single factory is faster due to internal caching */
private static DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory(); private static DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
public static synchronized ProjectedCRS construct( public static ProjectedCRS construct(VIIRSSpatialCoverage record)
VIIRSSpatialCoverage record)
throws FactoryException { throws FactoryException {
try { try {
ParameterValueGroup group = dmtFactory ParameterValueGroup group = dmtFactory

View file

@ -23,13 +23,6 @@
<import feature="com.raytheon.uf.edex.core.feature" version="1.0.0.qualifier"/> <import feature="com.raytheon.uf.edex.core.feature" version="1.0.0.qualifier"/>
</requires> </requires>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.crimss"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.common.dataplugin.npp.viirs" id="com.raytheon.uf.common.dataplugin.npp.viirs"
download-size="0" download-size="0"
@ -44,13 +37,6 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.edex.plugin.npp.crimss"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin <plugin
id="com.raytheon.uf.edex.plugin.npp.viirs" id="com.raytheon.uf.edex.plugin.npp.viirs"
download-size="0" download-size="0"
@ -58,4 +44,32 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.sounding"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.plugin.npp.sounding"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.common.dataplugin.npp.nucaps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.edex.plugin.npp.nucaps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature> </feature>

View file

@ -5,15 +5,8 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.crimss
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0",
org.geotools;bundle-version="2.6.4", com.raytheon.uf.edex.plugin.npp.sounding;bundle-version="1.0.0",
javax.measure;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0";visibility:=reexport,
javax.persistence;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.npp.crimss;bundle-version="1.0.0",
org.apache.commons.logging;bundle-version="1.1.1",
ucar.nc2;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174", com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174" com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174"

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.edex.plugin.npp.crimss">
<available file="../build.edex" property="build.dir.location" value="../build.edex" />
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex" />
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -9,7 +9,7 @@
<bean id="crimssProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties"> <bean id="crimssProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="crimssPluginName" /> <property name="pluginName" ref="crimssPluginName" />
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.npp.crimss" /> <property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.npp.crimss" />
<property name="dao" value="com.raytheon.uf.edex.plugin.npp.crimss.dao.CrimssDao" /> <property name="dao" value="com.raytheon.uf.edex.plugin.npp.sounding.NPPSoundingDao" />
<property name="record" value="com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord" /> <property name="record" value="com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord" />
</bean> </bean>

View file

@ -2,7 +2,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="crimssDecoder" class=" com.raytheon.uf.edex.plugin.npp.crimss.CrimssDecoder"> <bean id="crimssDecoder" class="com.raytheon.uf.edex.plugin.npp.sounding.NPPSoundingDecoder">
<constructor-arg ref="crimssPluginName" /> <constructor-arg ref="crimssPluginName" />
</bean> </bean>

View file

@ -0,0 +1,21 @@
/**
* 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.edex.plugin.npp.crimss;

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.plugin.npp.nucaps</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Tue Jan 15 10:22:03 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NUCAPS EDEX Plugin
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.nucaps
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0",
com.raytheon.uf.edex.plugin.npp.sounding;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.npp.nucaps;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174"

View file

@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
res/

View file

@ -0,0 +1,52 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
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.
-->
<pointDataDescription>
<!-- Need to check if this is really the max number of levels -->
<dimension name="maxLevels" length="100"/>
<!-- Surface weather parameters, 1 per point -->
<parameter name="Skin_Temperature" numDims="1" unit="K" type="FLOAT" />
<parameter name="Surface_Pressure" numDims="1" unit="hPa" type="FLOAT" />
<parameter name="Topography" numDims="1" unit="m" type="FLOAT" />
<!-- Pressure parameters -->
<parameter name="Pressure" numDims="2" unit="hPa" type="FLOAT" dimension="maxLevels" />
<parameter name="Effective_Pressure" numDims="2" unit="hPa" type="FLOAT" dimension="maxLevels" />
<!-- Temperature parameter -->
<parameter name="Temperature" numDims="2" unit="K" type="FLOAT" dimension="maxLevels" />
<!-- Water vapor mixing ratio -->
<parameter name="H2O_MR" numDims="2" unit="g/g" type="FLOAT" dimension="maxLevels" />
<!-- Liquid water mixing ratio -->
<parameter name="Liquid_H2O_MR" numDims="2" unit="g/g" type="FLOAT" dimension="maxLevels" />
<!-- Ozone mixing ratio -->
<parameter name="O3_MR" numDims="2" unit="ppb" type="FLOAT" dimension="maxLevels" />
<!-- Quality flags -->
<parameter name="Quality_Flag" numDims="1" type="INT" />
<!-- Sulfer dioxide mixing ratio -->
<parameter name="SO2_MR" numDims="2" unit="ppb" type="FLOAT" dimension="maxLevels" />
</pointDataDescription>

View file

@ -0,0 +1,25 @@
<?xml version='1.0' encoding='UTF-8'?>
<!--
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.
-->
<pointDataDbDescription>
<parameter name="latitude" queryName="latitude" type="FLOAT" unit="°" />
<parameter name="longitude" queryName="longitude" type="FLOAT" unit="°" />
<parameter name="dataURI" queryName="dataURI" type="STRING" />
</pointDataDbDescription>

View file

@ -0,0 +1,21 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="nucapsPluginName" class="java.lang.String">
<constructor-arg type="java.lang.String" value="nucaps" />
</bean>
<bean id="nucapsProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
<property name="pluginName" ref="nucapsPluginName" />
<property name="pluginFQN" value="com.raytheon.uf.common.dataplugin.npp.nucaps" />
<property name="dao" value="com.raytheon.uf.edex.plugin.npp.sounding.NPPSoundingDao" />
<property name="record" value="com.raytheon.uf.common.dataplugin.npp.nucaps.NucapsRecord" />
</bean>
<bean factory-bean="pluginRegistry" factory-method="register">
<constructor-arg ref="nucapsPluginName"/>
<constructor-arg ref="nucapsProperties"/>
</bean>
</beans>

View file

@ -0,0 +1,45 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="nucapsDecoder" class="com.raytheon.uf.edex.plugin.npp.sounding.NPPSoundingDecoder">
<constructor-arg ref="nucapsPluginName" />
</bean>
<bean id="nucapsDistRegistry" factory-bean="distributionSrv"
factory-method="register">
<constructor-arg ref="nucapsPluginName" />
<constructor-arg value="jms-dist:queue:Ingest.nucaps" />
</bean>
<bean id="nucapsCamelRegistered" factory-bean="contextManager"
factory-method="register" depends-on="persistCamelRegistered">
<constructor-arg ref="nucaps-camel"/>
</bean>
<camelContext id="nucaps-camel"
xmlns="http://camel.apache.org/schema/spring"
errorHandlerRef="errorHandler"
autoStartup="false">
<!-- Begin nucaps routes -->
<route id="nucapsIngestRoute">
<from uri="jms-generic:queue:Ingest.nucaps?destinationResolver=#qpidDurableResolver" />
<setHeader headerName="pluginName">
<constant>nucaps</constant>
</setHeader>
<doTry>
<pipeline>
<bean ref="stringToFile" />
<bean ref="extractWMOHeader" method="remove"/>
<bean ref="nucapsDecoder" method="decode" />
<to uri="directvm:persistIndexAlert" />
</pipeline>
<doCatch>
<exception>java.lang.Throwable</exception>
<to uri="log:nucaps?level=ERROR&amp;showBody=false&amp;showCaughtException=true&amp;showStackTrace=true"/>
</doCatch>
</doTry>
</route>
</camelContext>
</beans>

View file

@ -0,0 +1,21 @@
/**
* 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.edex.plugin.npp.nucaps;

View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
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.
-->
<requestPatterns xmlns:ns2="group">
<regex>^IUTN0[0-9] KNES*</regex>
</requestPatterns>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.edex.plugin.npp.sounding</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,8 @@
#Thu Jan 03 14:37:22 CST 2013
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
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

View file

@ -0,0 +1,14 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: NPP Sounding
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp.sounding
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.uf.edex.plugin.npp;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.npp.sounding;bundle-version="1.0.0";visibility:=reexport,
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.common.status;bundle-version="1.12.1174"
Export-Package: com.raytheon.uf.edex.plugin.npp.sounding

View file

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View file

@ -17,14 +17,15 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.edex.plugin.npp.crimss.dao; package com.raytheon.uf.edex.plugin.npp.sounding;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; import com.raytheon.uf.edex.database.plugin.PluginFactory;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao; import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
/** /**
* TODO Add Description * Dao for all NPP Soundings
* *
* <pre> * <pre>
* *
@ -32,27 +33,46 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2011 bsteffen Initial creation * Jan 4, 2013 mschenke Initial creation
* *
* </pre> * </pre>
* *
* @author bsteffen * @author mschenke
* @version 1.0 * @version 1.0
*/ */
public class CrimssDao extends PointDataPluginDao<CrimssRecord> { public class NPPSoundingDao extends PointDataPluginDao<PluginDataObject> {
private String[] fileNameKeys = new String[] { "dataTime.refTime" };
private Class<? extends PluginDataObject> recordClass;
/** /**
* @param pluginName * @param pluginName
* @throws PluginException * @throws PluginException
*/ */
public CrimssDao(String pluginName) throws PluginException { public NPPSoundingDao(String pluginName) throws PluginException {
super(pluginName); super(pluginName);
} }
/**
* @param fileNameKeys
* the fileNameKeys to set
*/
public void setFileNameKeys(String[] fileNameKeys) {
this.fileNameKeys = fileNameKeys;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.edex.pointdata.PointDataPluginDao#getKeysRequiredForFileName
* ()
*/
@Override @Override
public String[] getKeysRequiredForFileName() { public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime" }; return fileNameKeys;
} }
/* /*
@ -61,8 +81,21 @@ public class CrimssDao extends PointDataPluginDao<CrimssRecord> {
* @see com.raytheon.uf.edex.pointdata.PointDataPluginDao#newObject() * @see com.raytheon.uf.edex.pointdata.PointDataPluginDao#newObject()
*/ */
@Override @Override
public CrimssRecord newObject() { public PluginDataObject newObject() {
return new CrimssRecord(); if (recordClass == null) {
try {
recordClass = PluginFactory.getInstance().getPluginRecordClass(
pluginName);
} catch (PluginException e) {
throw new RuntimeException(
"Error getting record class for plugin: " + pluginName);
}
}
try {
return recordClass.newInstance();
} catch (Exception e) {
throw new RuntimeException(e.getLocalizedMessage());
}
} }
/* /*
@ -73,8 +106,8 @@ public class CrimssDao extends PointDataPluginDao<CrimssRecord> {
* (com.raytheon.uf.common.dataplugin.PluginDataObject) * (com.raytheon.uf.common.dataplugin.PluginDataObject)
*/ */
@Override @Override
public String getPointDataFileName(CrimssRecord p) { public String getPointDataFileName(PluginDataObject p) {
return pluginName + ".h5"; return pluginName;
} }
} }

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.uf.edex.plugin.npp.crimss; package com.raytheon.uf.edex.plugin.npp.sounding;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -35,7 +35,7 @@ import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.npp.crimss.CrimssRecord; import com.raytheon.uf.common.dataplugin.npp.sounding.NPPSoundingRecord;
import com.raytheon.uf.common.pointdata.ParameterDescription; import com.raytheon.uf.common.pointdata.ParameterDescription;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription; import com.raytheon.uf.common.pointdata.PointDataDescription;
@ -44,11 +44,12 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
import com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder; import com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder;
import com.raytheon.uf.edex.plugin.npp.crimss.dao.CrimssDao;
/** /**
* TODO Add Description * Common decoder for all NPP Soundings. Uses point data definition to find data
* records in netcdf file for persisting
* *
* <pre> * <pre>
* *
@ -56,32 +57,36 @@ import com.raytheon.uf.edex.plugin.npp.crimss.dao.CrimssDao;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2011 bsteffen Initial creation * Jan 4, 2013 mschenke Initial creation
* *
* </pre> * </pre>
* *
* @author bsteffen * @author mschenke
* @version 1.0 * @version 1.0
*/ */
public class CrimssDecoder extends AbstractNPPDecoder { public class NPPSoundingDecoder extends AbstractNPPDecoder {
private static final IUFStatusHandler statusHandler = UFStatus private IUFStatusHandler statusHandler = UFStatus
.getHandler(CrimssDecoder.class); .getHandler(NPPSoundingDecoder.class);
private final String pluginName; private static final String LATITUDE_DATASET_ID = "Latitude@";
private final CrimssDao dao; private static final String LONGITUDE_DATASET_ID = "Longitude@";
public CrimssDecoder(String pluginName) { private String pluginName;
private NPPSoundingDao pluginDao;
public NPPSoundingDecoder(String pluginName) {
this.pluginName = pluginName; this.pluginName = pluginName;
CrimssDao dao = null;
try { try {
dao = new CrimssDao(pluginName); this.pluginDao = (NPPSoundingDao) PluginFactory.getInstance()
.getPluginDao(pluginName);
} catch (PluginException e) { } catch (PluginException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); throw new RuntimeException("Could not get DAO from pluginName: "
+ pluginName, e);
} }
this.dao = dao;
} }
/* /*
@ -90,65 +95,79 @@ public class CrimssDecoder extends AbstractNPPDecoder {
* @see * @see
* com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder#decodeNetcdf(ucar. * com.raytheon.uf.edex.plugin.npp.AbstractNPPDecoder#decodeNetcdf(ucar.
* nc2.NetcdfFile, com.raytheon.uf.common.time.DataTime, * nc2.NetcdfFile, com.raytheon.uf.common.time.DataTime,
* com.raytheon.edex.esb.Headers) * com.raytheon.uf.edex.plugin.npp.Headers)
*/ */
@Override @Override
protected Object decodeNetcdf(NetcdfFile dataFile, DataTime dataTime, protected Object decodeNetcdf(NetcdfFile dataFile, DataTime dataTime,
Headers headers) { Headers headers) {
PluginDataObject[] pdos = new PluginDataObject[0];
try { try {
Group root = dataFile.getRootGroup(); Group root = dataFile.getRootGroup();
CrimssRecord[] records = decodeMetadata(root, dataTime); NPPSoundingRecord[] metadata = decodeMetadata(root, dataTime);
decodeData(records, root); decodePointData(root, metadata);
return records; pdos = metadata;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Error decoding CrIMSS", e); statusHandler.handle(
} Priority.WARN,
return new PluginDataObject[0]; "Could not decode sounding file: "
+ e.getLocalizedMessage(), e);
} }
private CrimssRecord[] decodeMetadata(Group root, DataTime time) return pdos;
}
protected NPPSoundingRecord[] decodeMetadata(Group root, DataTime dataTime)
throws DecoderException, PluginException, IOException { throws DecoderException, PluginException, IOException {
NPPSoundingRecord[] pdos = new NPPSoundingRecord[0];
Variable latitude = null; Variable latitude = null;
Variable longitude = null; Variable longitude = null;
for (Variable var : root.getVariables()) { for (Variable var : root.getVariables()) {
if (var.getFullName().startsWith("Latitude@")) { if (var.getFullName().startsWith(LATITUDE_DATASET_ID)) {
latitude = var; latitude = var;
} else if (var.getFullName().startsWith("Longitude@")) { } else if (var.getFullName().startsWith(LONGITUDE_DATASET_ID)) {
longitude = var; longitude = var;
} }
} }
if (latitude == null || longitude == null) { if (latitude == null || longitude == null) {
throw new DecoderException("Unable to find lat/lon information"); throw new DecoderException("Unable to find lat/lon information");
} }
Map<File, PointDataContainer> containerMap = new HashMap<File, PointDataContainer>();
Map<File, PointDataContainer> containerMap = new HashMap<File, PointDataContainer>();
Array latArray = latitude.read(); Array latArray = latitude.read();
Array lonArray = longitude.read(); Array lonArray = longitude.read();
int numRecs = latitude.getDimension(0).getLength(); int numRecs = latitude.getDimension(0).getLength();
CrimssRecord[] records = new CrimssRecord[numRecs]; NPPSoundingRecord[] records = new NPPSoundingRecord[numRecs];
for (int i = 0; i < numRecs; i++) { for (int i = 0; i < numRecs; i++) {
records[i] = new CrimssRecord(); // Create PDO for lat/lon entry
records[i].setPluginName(pluginName); NPPSoundingRecord record = (NPPSoundingRecord) pluginDao
records[i].setDataTime(time); .newObject();
records[i].setLatitude((double) latArray.getFloat(i)); record.setPluginName(pluginName);
records[i].setLongitude((double) lonArray.getFloat(i)); record.setDataTime(dataTime);
records[i].constructDataURI(); record.setLatitude((double) latArray.getFloat(i));
File storageFile = dao.getFullFilePath(records[i]); record.setLongitude((double) lonArray.getFloat(i));
record.constructDataURI();
File storageFile = pluginDao.getFullFilePath(record);
PointDataContainer pdc = containerMap.get(storageFile); PointDataContainer pdc = containerMap.get(storageFile);
if (pdc == null) { if (pdc == null) {
pdc = PointDataContainer.build(dao pdc = PointDataContainer.build(pluginDao
.getPointDataDescription(null)); .getPointDataDescription(null));
containerMap.put(storageFile, pdc); containerMap.put(storageFile, pdc);
} }
PointDataView pdv = pdc.append(); PointDataView pdv = pdc.append();
records[i].setPointDataView(pdv); record.setPointDataView(pdv);
records[i] = record;
} }
return records; pdos = records;
return pdos;
} }
private void decodeData(CrimssRecord[] records, Group root) private void decodePointData(Group root, NPPSoundingRecord[] records)
throws IOException { throws IOException {
PointDataDescription desc = dao.getPointDataDescription(null); PointDataDescription desc = pluginDao.getPointDataDescription(null);
for (Variable var : root.getVariables()) { for (Variable var : root.getVariables()) {
String name = var.getFullName().split("@")[0]; String name = var.getFullName().split("@")[0];
for (ParameterDescription param : desc.parameters) { for (ParameterDescription param : desc.parameters) {
@ -171,7 +190,7 @@ public class CrimssDecoder extends AbstractNPPDecoder {
} }
} }
private static void read1D(CrimssRecord[] records, Variable var, private static void read1D(NPPSoundingRecord[] records, Variable var,
String parameter) throws IOException { String parameter) throws IOException {
Array data = var.read(); Array data = var.read();
for (int i = 0; i < records.length; i++) { for (int i = 0; i < records.length; i++) {
@ -186,7 +205,7 @@ public class CrimssDecoder extends AbstractNPPDecoder {
* stored in one dimensional data. We need this pressure information stored * stored in one dimensional data. We need this pressure information stored
* for each location so it becomes two dimensional in our storage. * for each location so it becomes two dimensional in our storage.
*/ */
private static void read1Dto2D(CrimssRecord[] records, Variable var, private static void read1Dto2D(NPPSoundingRecord[] records, Variable var,
String parameter) throws IOException { String parameter) throws IOException {
int numLevels = var.getDimension(0).getLength(); int numLevels = var.getDimension(0).getLength();
Array data = var.read(); Array data = var.read();
@ -199,7 +218,7 @@ public class CrimssDecoder extends AbstractNPPDecoder {
} }
} }
private static void read2D(CrimssRecord[] records, Variable var, private static void read2D(NPPSoundingRecord[] records, Variable var,
String parameter) throws IOException { String parameter) throws IOException {
int numLevels = var.getDimension(1).getLength(); int numLevels = var.getDimension(1).getLength();
Array data = var.read(); Array data = var.read();

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.edex.plugin.npp.viirs">
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -5,11 +5,9 @@ Bundle-SymbolicName: com.raytheon.uf.edex.plugin.npp
Bundle-Version: 1.0.0.qualifier Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174", Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174";visibility:=reexport,
ucar.nc2;bundle-version="1.0.0";visibility:=reexport,
org.geotools;bundle-version="2.6.4", org.geotools;bundle-version="2.6.4",
javax.measure;bundle-version="1.0.0",
javax.persistence;bundle-version="1.0.0",
org.apache.commons.logging;bundle-version="1.1.1", org.apache.commons.logging;bundle-version="1.1.1",
ucar.nc2;bundle-version="1.0.0",
org.apache.commons.lang;bundle-version="2.3.0" org.apache.commons.lang;bundle-version="2.3.0"
Export-Package: com.raytheon.uf.edex.plugin.npp Export-Package: com.raytheon.uf.edex.plugin.npp

View file

@ -1,7 +0,0 @@
<project basedir="." default="deploy" name="com.raytheon.uf.edex.plugin.npp">
<available file="../build.edex" property="build.dir.location" value="../build.edex" />
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex" />
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>