Issue #1869 Modified D2D time series of point data to work without dataURI.

Change-Id: I80f39877903e50338add58700f6ffeb39e848a32

Former-commit-id: 3f246d2d473050ae89a4db65bc01d7729dc0aa01
This commit is contained in:
Ben Steffensmeier 2013-05-09 17:03:41 -05:00
parent baa6b26c34
commit baf051a27e
29 changed files with 194 additions and 81 deletions

View file

@ -20,12 +20,14 @@
package com.raytheon.uf.viz.d2d.xy.adapters.timeseries; package com.raytheon.uf.viz.d2d.xy.adapters.timeseries;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.measure.unit.SI;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GeneralGridEnvelope; import org.geotools.coverage.grid.GeneralGridEnvelope;
@ -40,10 +42,13 @@ import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory;
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.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.pointdata.PointDataConstants;
import com.raytheon.uf.common.pointdata.PointDataContainer; 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.time.DataTime; 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.common.time.TimeRange;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; 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.level.LevelUtilities; import com.raytheon.uf.viz.core.level.LevelUtilities;
@ -58,14 +63,17 @@ import com.raytheon.viz.core.graphing.xy.XYWindImageData;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
* TODO Add Description * Adapter for converting pdos that are compatible with the point data api into
* XYDataLists that can be used for time series.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation * May 07, 2010 bsteffen Initial creation
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -107,32 +115,48 @@ public class PointDataTimeSeriesAdapter extends
private XYDataList loadDataInternal(PluginDataObject[] recordsToLoad) private XYDataList loadDataInternal(PluginDataObject[] recordsToLoad)
throws VizException { throws VizException {
RequestConstraint uriConstraint = new RequestConstraint(); boolean refTimeOnly = true;
uriConstraint.setConstraintType(RequestConstraint.ConstraintType.IN); RequestConstraint dataTimeConstraint = new RequestConstraint();
RequestConstraint refTimeConstraint = new RequestConstraint();
// Perhaps this should just be done using the resource metadatamap // Perhaps this should just be done using the resource metadatamap
for (PluginDataObject pdo : recordsToLoad) { for (PluginDataObject pdo : recordsToLoad) {
uriConstraint.addToConstraintValueList(pdo.getDataURI()); DataTime dt = pdo.getDataTime();
dataTimeConstraint.addToConstraintValueList(dt
.toString());
refTimeOnly &= !dt.getUtilityFlags().contains(FLAG.FCST_USED);
if(refTimeOnly){
refTimeConstraint.addToConstraintValueList(TimeUtil
.formatToSqlTimestamp(dt.getRefTime()));
}
} }
String parameter = resourceData.getYParameter().code; String parameter = resourceData.getYParameter().code;
boolean isIcon = displayType == DisplayType.ICON; boolean isIcon = displayType == DisplayType.ICON;
Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(); Map<String, RequestConstraint> constraints = new HashMap<String, RequestConstraint>(
constraints.put("dataURI", uriConstraint); resourceData.getMetadataMap());
String[] parameters = null;
if(refTimeOnly){
refTimeConstraint.setConstraintType(RequestConstraint.ConstraintType.IN);
constraints.put("dataTime.refTime", refTimeConstraint);
parameters = new String[] {
PointDataConstants.DATASET_REFTIME, parameter };
}else{
dataTimeConstraint.setConstraintType(RequestConstraint.ConstraintType.IN);
constraints.put("dataTime", dataTimeConstraint);
parameters = new String[] {
PointDataConstants.DATASET_REFTIME,
PointDataConstants.DATASET_FORECASTHR, parameter };
}
PointDataContainer pdc = DataCubeContainer.getPointData( PointDataContainer pdc = DataCubeContainer.getPointData(
recordsToLoad[0].getPluginName(), new String[] { "dataURI", recordsToLoad[0].getPluginName(), parameters,
parameter }, resourceData.getLevelKey(), constraints); resourceData.getLevelKey(),
constraints);
ArrayList<XYData> data = new ArrayList<XYData>(); ArrayList<XYData> data = new ArrayList<XYData>();
for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) { for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
PointDataView pdv = pdc.readRandom(uriCounter); PointDataView pdv = pdc.readRandom(uriCounter);
String dataURI = pdv.getString("dataURI"); DataTime x = getDataTime(pdv, refTimeOnly);
DataTime x = null;
for (PluginDataObject pdo : recordsToLoad) {
if (dataURI.equals(pdo.getDataURI())) {
x = pdo.getDataTime();
}
}
Number y = pdv.getNumber(parameter); Number y = pdv.getNumber(parameter);
if (x == null) { if (x == null) {
@ -167,6 +191,32 @@ public class PointDataTimeSeriesAdapter extends
return list; return list;
} }
private DataTime getDataTime(PointDataView pdv, boolean refTimeOnly) {
long refTime = pdv.getNumber(PointDataConstants.DATASET_REFTIME)
.longValue();
Unit<?> refUnit = pdv.getUnit(PointDataConstants.DATASET_REFTIME);
if (refUnit != null && !refUnit.equals(SI.MILLI(SI.SECOND))
&& refUnit.isCompatible(SI.SECOND)) {
refTime = (long) refUnit.getConverterTo(SI.MILLI(SI.SECOND))
.convert(refTime);
}
if (refTimeOnly) {
return new DataTime(new Date(refTime));
}
int forecastTime = pdv.getNumber(PointDataConstants.DATASET_FORECASTHR)
.intValue();
Unit<?> forecastUnit = pdv
.getUnit(PointDataConstants.DATASET_FORECASTHR);
if (forecastUnit != null && !forecastUnit.equals(SI.SECOND)
&& forecastUnit.isCompatible(SI.SECOND)) {
forecastTime = (int) forecastUnit.getConverterTo(SI.SECOND)
.convert(forecastTime);
}
return new DataTime(new Date(refTime), forecastTime);
}
private XYDataList loadDataOAInternal(PluginDataObject[] recordsToLoad) private XYDataList loadDataOAInternal(PluginDataObject[] recordsToLoad)
throws VizException { throws VizException {
Set<DataTime> times = new HashSet<DataTime>(); Set<DataTime> times = new HashSet<DataTime>();

View file

@ -69,7 +69,9 @@ import com.vividsolutions.jts.geom.LineString;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 1, 2009 bsteffen Initial creation * Dec 01, 2009 bsteffen Initial creation
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -146,8 +148,6 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
query.addColumn("location.latitude"); query.addColumn("location.latitude");
query.addColumn("location.longitude"); query.addColumn("location.longitude");
query.addOrderBy("location.latitude"); query.addOrderBy("location.latitude");
query.addOrderBy("location.longitude");
query.addOrderBy("location.stationId");
if (type != null && !type.isEmpty()) { if (type != null && !type.isEmpty()) {
query.addConstraint(getTypeKey(sourceKey), query.addConstraint(getTypeKey(sourceKey),
new RequestConstraint(type)); new RequestConstraint(type));
@ -304,6 +304,9 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
&& closestStation.getStationId() != null) { && closestStation.getStationId() != null) {
productParameters.put(constraintKey, new RequestConstraint( productParameters.put(constraintKey, new RequestConstraint(
closestStation.getStationId())); closestStation.getStationId()));
} else {
productParameters.put(constraintKey, new RequestConstraint(
null, ConstraintType.ISNULL));
} }
} }
} }

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="invTime" numDims="1" type="INT" /> <parameter name="invTime" numDims="1" type="INT" />
<parameter name="QPF6hr_cat3" numDims="1" type="INT" /> <parameter name="QPF6hr_cat3" numDims="1" type="INT" />
<parameter name="QPF6hr_cat2" numDims="1" type="INT" /> <parameter name="QPF6hr_cat2" numDims="1" type="INT" />

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="csevere6hr" numDims="1" type="INT" /> <parameter name="csevere6hr" numDims="1" type="INT" />
<parameter name="QPF6hr_cat3" numDims="1" type="INT" /> <parameter name="QPF6hr_cat3" numDims="1" type="INT" />
<parameter name="QPF6hr_cat2" numDims="1" type="INT" /> <parameter name="QPF6hr_cat2" numDims="1" type="INT" />

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="csevere6hr" numDims="1" type="INT" /> <parameter name="csevere6hr" numDims="1" type="INT" />
<parameter name="QPF6hr_cat3" numDims="1" type="INT" /> <parameter name="QPF6hr_cat3" numDims="1" type="INT" />
<parameter name="QPF6hr_cat2" numDims="1" type="INT" /> <parameter name="QPF6hr_cat2" numDims="1" type="INT" />

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="minTempClim" numDims="1" type="FLOAT" /> <parameter name="minTempClim" numDims="1" type="FLOAT" />
<parameter name="relFreqPrecip" numDims="1" type="INT" /> <parameter name="relFreqPrecip" numDims="1" type="INT" />
<parameter name="proj_hour" numDims="1" type="INT" /> <parameter name="proj_hour" numDims="1" type="INT" />

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="QPF24hr_cat2" numDims="1" type="INT" /> <parameter name="QPF24hr_cat2" numDims="1" type="INT" />
<parameter name="QPF24hr_cat3" numDims="1" type="INT" /> <parameter name="QPF24hr_cat3" numDims="1" type="INT" />
<parameter name="QPF24hr_cat1" numDims="1" type="INT" /> <parameter name="QPF24hr_cat1" numDims="1" type="INT" />

View file

@ -19,8 +19,6 @@
further_licensing_information. further_licensing_information.
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="refTime" numDims="1" type="LONG" />
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="snow12hr_cat2" numDims="1" type="INT" /> <parameter name="snow12hr_cat2" numDims="1" type="INT" />
<parameter name="precipType" numDims="1" type="INT" /> <parameter name="precipType" numDims="1" type="INT" />
<parameter name="ceiling_cat1" numDims="1" type="INT" /> <parameter name="ceiling_cat1" numDims="1" type="INT" />

View file

@ -23,4 +23,6 @@
<parameter name="longitude" queryName="location.longitude" type="FLOAT" unit="°" /> <parameter name="longitude" queryName="location.longitude" type="FLOAT" unit="°" />
<parameter name="stationId" queryName="location.stationId" type="STRING" /> <parameter name="stationId" queryName="location.stationId" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -35,7 +35,6 @@ import com.raytheon.edex.plugin.bufrmos.common.BufrMosHpcData;
import com.raytheon.edex.plugin.bufrmos.common.BufrMosLampData; import com.raytheon.edex.plugin.bufrmos.common.BufrMosLampData;
import com.raytheon.edex.plugin.bufrmos.common.BufrMosMrfData; import com.raytheon.edex.plugin.bufrmos.common.BufrMosMrfData;
import com.raytheon.edex.plugin.bufrmos.common.BufrMosNgmData; import com.raytheon.edex.plugin.bufrmos.common.BufrMosNgmData;
import com.raytheon.uf.common.pointdata.PointDataConstants;
import com.raytheon.uf.common.pointdata.PointDataContainer; 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.time.DataTime; import com.raytheon.uf.common.time.DataTime;
@ -58,7 +57,9 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080221 862 jkorman Initial Coding. * Feb 21, 2008 862 jkorman Initial Coding.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* </pre> * </pre>
* *
* @author jkorman * @author jkorman
@ -224,11 +225,6 @@ public class BufrMOSDataAdapter {
populateMOSElement(packet, element, pdv); populateMOSElement(packet, element, pdv);
} }
// set the common metadata
pdv.setLong(PointDataConstants.DATASET_FORECASTHR, fcstHour);
pdv.setLong(PointDataConstants.DATASET_REFTIME,
baseTime.getTimeInMillis());
fcstData.setPointDataView(pdv); fcstData.setPointDataView(pdv);
} }
dataSection += (System.currentTimeMillis() - startTime); dataSection += (System.currentTimeMillis() - startTime);

View file

@ -28,8 +28,6 @@
<parameter name="wmoStaNum" numDims="1" type="INT" /> <parameter name="wmoStaNum" numDims="1" type="INT" />
<parameter name="staName" numDims="1" type="STRING" size="10" /> <parameter name="staName" numDims="1" type="STRING" size="10" />
<parameter name="validTime" numDims="1" type="LONG" />
<parameter name="relTime" numDims="1" type="LONG" />
<parameter name="sfcPressure" numDims="1" type="FLOAT" unit="Pa" /> <parameter name="sfcPressure" numDims="1" type="FLOAT" unit="Pa" />
<!-- Mandatory level data --> <!-- Mandatory level data -->

View file

@ -24,4 +24,8 @@
<parameter name="staElev" queryName="location.elevation" type="FLOAT" unit="m" /> <parameter name="staElev" queryName="location.elevation" type="FLOAT" unit="m" />
<parameter name="rptType" queryName="reportType" type="INT" /> <parameter name="rptType" queryName="reportType" type="INT" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="validTime" queryName="validTime" numDims="1" type="LONG" unit="ms" />
<parameter name="relTime" queryName="validTime" numDims="1" type="LONG" unit="ms" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s" />
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -48,7 +48,9 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080303 969 jkorman Initial implementation. * Mar 03, 2008 969 jkorman Initial implementation.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -113,8 +115,6 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
Calendar validTime = obsData.getValidTime(); Calendar validTime = obsData.getValidTime();
Calendar relTime = TimeTools.copy(validTime);
// Now offset the "record" validTime using the hour mapping. // Now offset the "record" validTime using the hour mapping.
int hour = validTime.get(Calendar.HOUR_OF_DAY); int hour = validTime.get(Calendar.HOUR_OF_DAY);
validTime.add(Calendar.HOUR_OF_DAY, HOUR_MAP[hour]); validTime.add(Calendar.HOUR_OF_DAY, HOUR_MAP[hour]);
@ -139,9 +139,6 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
PointDataView view = container.append(); PointDataView view = container.append();
view.setLong("relTime", relTime.getTimeInMillis());
view.setLong("validTime", validTime.getTimeInMillis());
SurfaceObsLocation location = new SurfaceObsLocation(); SurfaceObsLocation location = new SurfaceObsLocation();
location.setStationId(String.format("%05d", wmoStaId)); location.setStationId(String.format("%05d", wmoStaId));
view.setInt("wmoStaNum", wmoStaId); view.setInt("wmoStaNum", wmoStaId);

View file

@ -21,7 +21,6 @@
<pointDataDescription> <pointDataDescription>
<dimension name="maxLevels" length="50"/> <dimension name="maxLevels" length="50"/>
<parameter name="validTime" numDims="1" type="LONG" unit="s" />
<parameter name="wmoHeader" numDims="1" type="STRING" /> <parameter name="wmoHeader" numDims="1" type="STRING" />
<parameter name="cloudAmt" numDims="1" type="FLOAT" unit="percent" /> <parameter name="cloudAmt" numDims="1" type="FLOAT" unit="percent" />

View file

@ -24,4 +24,7 @@
<parameter name="elevation" queryName="location.elevation" type="FLOAT" unit="m" /> <parameter name="elevation" queryName="location.elevation" type="FLOAT" unit="m" />
<parameter name="stationId" queryName="location.stationId" type="STRING" /> <parameter name="stationId" queryName="location.stationId" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="validTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -58,7 +58,9 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080414 1077 jkorman Initial implementation. * Apr 14, 2008 1077 jkorman Initial implementation.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -271,8 +273,6 @@ public class GOESSoundingDataAdapter {
// TODO: need cloudAmt, cloudTopPressure, precipWater and // TODO: need cloudAmt, cloudTopPressure, precipWater and
// skinTemp // skinTemp
view.setLong("validTime", obsData.getDataTime().getValidTime()
.getTimeInMillis());
view.setString("wmoHeader", obsData.getWmoHeader()); view.setString("wmoHeader", obsData.getWmoHeader());
// get the replication sublist for the sounding data // get the replication sublist for the sounding data

View file

@ -21,10 +21,8 @@
<pointDataDescription> <pointDataDescription>
<dimension name="maxLevels" length="64"/> <dimension name="maxLevels" length="64"/>
<parameter name="forecastHr" numDims="1" type="INT" />
<parameter name="wmoStaNum" numDims="1" type="INT" /> <parameter name="wmoStaNum" numDims="1" type="INT" />
<parameter name="refTime" numDims="1" type="LONG" unit="s" />
<parameter name="validTime" numDims="1" type="LONG" unit="s" /> <parameter name="validTime" numDims="1" type="LONG" unit="s" />
<parameter name="landSea" numDims="1" type="INT" /> <parameter name="landSea" numDims="1" type="INT" />

View file

@ -25,4 +25,6 @@
<parameter name="stationId" queryName="location.stationId" type="STRING" /> <parameter name="stationId" queryName="location.stationId" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="wmoHeader" queryName="wmoHeader" type="STRING" /> <parameter name="wmoHeader" queryName="wmoHeader" type="STRING" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="s" dbunit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -38,7 +38,6 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManager; import com.raytheon.uf.common.localization.PathManager;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.pointdata.PointDataConstants;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription.Type; import com.raytheon.uf.common.pointdata.PointDataDescription.Type;
import com.raytheon.uf.common.pointdata.PointDataView; import com.raytheon.uf.common.pointdata.PointDataView;
@ -59,7 +58,9 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080317 1026 jkorman Initial implementation. * Mar 17, 2008 1026 jkorman Initial implementation.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -169,16 +170,11 @@ public class ModelSoundingDataAdapter {
.getFcstSeconds().intValue()); .getFcstSeconds().intValue());
obsData.setDataTime(dt); obsData.setDataTime(dt);
Calendar baseTime = dt.getRefTimeAsCalendar();
view.setLong(PointDataConstants.DATASET_REFTIME,
baseTime.getTimeInMillis() / 1000L);
Calendar validTime = dt.getValidTime(); Calendar validTime = dt.getValidTime();
view.setLong("validTime", view.setLong("validTime",
validTime.getTimeInMillis() / 1000L); validTime.getTimeInMillis() / 1000L);
int fcstHour = (int) (obsData.getFcstSeconds() / 3600);
view.setInt("forecastHr", fcstHour);
} }
obsData.setPointDataView(view); obsData.setPointDataView(view);

View file

@ -22,8 +22,6 @@
<dimension name="maxSkyCover" length="6"/> <dimension name="maxSkyCover" length="6"/>
<dimension name="maxWeather" length="5"/> <dimension name="maxWeather" length="5"/>
<parameter name="timeNominal" numDims="1" type="DOUBLE" unit="seconds since 1-1-1970" />
<parameter name="timeObs" numDims="1" type="LONG" unit="seconds since 1-1-1970" />
<parameter name="autoStationType" numDims="1" type="STRING" size="3"/> <parameter name="autoStationType" numDims="1" type="STRING" size="3"/>
<parameter name="wmoId" numDims="1" type="INT" /> <parameter name="wmoId" numDims="1" type="INT" />
<parameter name="correction" numDims="1" type="INT" /> <parameter name="correction" numDims="1" type="INT" />

View file

@ -26,4 +26,7 @@
<parameter name="stationName" queryName="location.stationId" type="STRING" /> <parameter name="stationName" queryName="location.stationId" type="STRING" />
<parameter name="reportType" queryName="reportType" type="STRING" /> <parameter name="reportType" queryName="reportType" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="timeObs" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -52,10 +52,13 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 3, 2009 chammack Initial creation * Jun 03, 2009 chammack Initial creation
* Jun 23, 2009 njensen Combined present weather * Jun 23, 2009 njensen Combined present weather
* Jun 29, 2009 2538 jsanchez Sorted the sky cover. * Jun 29, 2009 2538 jsanchez Sorted the sky cover.
* May 17, 2012 460 jkorman Modified to limit stored data to dimensioned size. * May 17, 2012 460 jkorman Modified to limit stored data to
* dimensioned size.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -258,7 +261,6 @@ public class MetarPointDataTransform {
pdv.setInt(CORRECTION, 0); pdv.setInt(CORRECTION, 0);
} }
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
pdv.setString(AUTO_STATION_TYPE, record.getAutoStationType()); pdv.setString(AUTO_STATION_TYPE, record.getAutoStationType());
// TODO: Temporary? // TODO: Temporary?
pdv.setString(RAW_METAR, record.getReport()); pdv.setString(RAW_METAR, record.getReport());

View file

@ -1,11 +1,9 @@
<pointDataDescription> <pointDataDescription>
<dimension name="maxLevels" length="50"/> <dimension name="maxLevels" length="50"/>
<parameter name="validTime" numDims="1" type="LONG" />
<parameter name="satelliteID" numDims="1" type="INT" /> <parameter name="satelliteID" numDims="1" type="INT" />
<parameter name="satProc" numDims="1" type="INT" /> <parameter name="satProc" numDims="1" type="INT" />
<parameter name="invTime" numDims="1" type="INT" />
<parameter name="terrain" numDims="1" type="INT" /> <parameter name="terrain" numDims="1" type="INT" />
<parameter name="dayNight" numDims="1" type="INT" /> <parameter name="dayNight" numDims="1" type="INT" />
<parameter name="landSea" numDims="1" type="INT" /> <parameter name="landSea" numDims="1" type="INT" />

View file

@ -25,4 +25,6 @@
<parameter name="stationId" queryName="location.stationId" type="STRING" /> <parameter name="stationId" queryName="location.stationId" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="wmoHeader" queryName="wmoHeader" type="STRING" /> <parameter name="wmoHeader" queryName="wmoHeader" type="STRING" />
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -20,7 +20,6 @@
--> -->
<pointDataDescription> <pointDataDescription>
<parameter name="profilerName" numDims="1" type="STRING" /> <parameter name="profilerName" numDims="1" type="STRING" />
<parameter name="validTime" numDims="1" type="LONG" />
<parameter name="windSpeedSfc" numDims="1" type="FLOAT" unit="m/s" /> <parameter name="windSpeedSfc" numDims="1" type="FLOAT" unit="m/s" />
<parameter name="windDirSfc" numDims="1" type="FLOAT" unit="degree" /> <parameter name="windDirSfc" numDims="1" type="FLOAT" unit="degree" />

View file

@ -25,4 +25,7 @@
<parameter name="stationId" queryName="location.stationId" type="STRING" /> <parameter name="stationId" queryName="location.stationId" type="STRING" />
<parameter name="dataURI" queryName="dataURI" type="STRING" /> <parameter name="dataURI" queryName="dataURI" type="STRING" />
<parameter name="profilerId" queryName="profilerId" type="STRING" /> <parameter name="profilerId" queryName="profilerId" type="STRING" />
<parameter name="validTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms"/>
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s"/>
</pointDataDbDescription> </pointDataDbDescription>

View file

@ -57,7 +57,9 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 20080303 969 jkorman Initial implementation. * Mar 03, 2008 969 jkorman Initial implementation.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -224,7 +226,6 @@ public class ProfilerDataAdapter {
obsData.setTimeObs(TimeTools.copy(baseTime)); obsData.setTimeObs(TimeTools.copy(baseTime));
DataTime dt = new DataTime(TimeTools.copy(baseTime)); DataTime dt = new DataTime(TimeTools.copy(baseTime));
obsData.setDataTime(dt); obsData.setDataTime(dt);
view.setLong("validTime", baseTime.getTimeInMillis());
} else { } else {
logger.error(traceId logger.error(traceId
+ "-Time information missing or incorrect"); + "-Time information missing or incorrect");

View file

@ -19,6 +19,12 @@
**/ **/
package com.raytheon.uf.edex.pointdata; package com.raytheon.uf.edex.pointdata;
import java.text.ParseException;
import java.text.ParsePosition;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
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.XmlAttribute;
@ -28,7 +34,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
/** /**
* *
* TODO Add Description * Describes what parameters should be availbale to the point data api that can
* be queried from the database rather than loaded from HDF5.
* *
* <pre> * <pre>
* *
@ -36,7 +43,9 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 27, 2011 bsteffen Initial creation * Jan 27, 2011 bsteffen Initial creation
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -58,9 +67,19 @@ public class DbParameterDescription implements ISerializableObject {
@XmlAttribute(name = "unit", required = false) @XmlAttribute(name = "unit", required = false)
private String unit; private String unit;
/**
* If the units in the db are different from the units that we want the
* point data container then set dbunit to what is in the database and unit
* to what we want and conversion will occur.
*/
@XmlAttribute(name = "dbunit", required = false)
private String dbunit;
@XmlAttribute(name = "fillValue", required = false) @XmlAttribute(name = "fillValue", required = false)
private String fillValue; private String fillValue;
private transient UnitConverter fromDbConverter;
/** /**
* @return the parameterName * @return the parameterName
*/ */
@ -121,6 +140,14 @@ public class DbParameterDescription implements ISerializableObject {
this.unit = unit; this.unit = unit;
} }
public String getDbunit() {
return dbunit;
}
public void setDbunit(String dbunit) {
this.dbunit = dbunit;
}
/** /**
* @return the fillValue * @return the fillValue
*/ */
@ -136,4 +163,30 @@ public class DbParameterDescription implements ISerializableObject {
this.fillValue = fillValue; this.fillValue = fillValue;
} }
/**
* Get a converter for converting data from the units in the db to the units
* we want in the point data container.
*
* @return
*/
public UnitConverter getUnitConverter() {
if (fromDbConverter == null) {
if (unit == null || dbunit == null || unit.equals(dbunit)) {
fromDbConverter = UnitConverter.IDENTITY;
} else {
try {
Unit<?> dbunit = UnitFormat
.getUCUMInstance()
.parseProductUnit(this.dbunit, new ParsePosition(0));
Unit<?> unit = UnitFormat.getUCUMInstance()
.parseProductUnit(this.unit, new ParsePosition(0));
fromDbConverter = dbunit.getConverterTo(unit);
} catch (ParseException e) {
fromDbConverter = UnitConverter.IDENTITY;
}
}
}
return fromDbConverter;
}
} }

View file

@ -22,12 +22,16 @@ package com.raytheon.uf.edex.pointdata;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; 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 java.util.Set;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord;
@ -53,7 +57,9 @@ import com.raytheon.uf.edex.pointdata.PointDataPluginDao.LevelRequest;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 15, 2009 chammack Initial creation * Apr 15, 2009 chammack Initial creation
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* *
* </pre> * </pre>
* *
@ -254,6 +260,8 @@ public class PointDataQuery {
int id = (Integer) workingMap.get("id"); int id = (Integer) workingMap.get("id");
int idx = (Integer) workingMap.get("pointDataView.curIdx"); int idx = (Integer) workingMap.get("pointDataView.curIdx");
dbResultMap.put(id, workingMap); dbResultMap.put(id, workingMap);
// Clone is needed because getPointDataFileName alters the map
workingMap = new HashMap<String, Object>(workingMap);
String fileName = dao.getPointDataFileName(workingMap); String fileName = dao.getPointDataFileName(workingMap);
int listIndex = files.indexOf(fileName); int listIndex = files.indexOf(fileName);
if (listIndex == -1) { if (listIndex == -1) {
@ -337,19 +345,29 @@ public class PointDataQuery {
continue; continue;
} }
} }
if (obj instanceof Date) {
obj = ((Date) obj).getTime();
} else if (obj instanceof Calendar) {
obj = ((Calendar) obj).getTimeInMillis();
}
Number num = null;
if (obj instanceof Number) {
num = (Number) obj;
UnitConverter conv = desc.getUnitConverter();
if (conv != null && conv != UnitConverter.IDENTITY) {
num = conv.convert(num.doubleValue());
}
}
switch (desc.getType()) { switch (desc.getType()) {
case FLOAT: case FLOAT:
pdv.setFloat(desc.getParameterName(), pdv.setFloat(desc.getParameterName(), num.floatValue());
((Number) obj).floatValue());
break; break;
case INT: case INT:
pdv.setInt(desc.getParameterName(), num.intValue());
pdv.setInt(desc.getParameterName(),
((Number) obj).intValue());
break; break;
case LONG: case LONG:
pdv.setLong(desc.getParameterName(), pdv.setLong(desc.getParameterName(), num.longValue());
((Number) obj).longValue());
break; break;
case STRING: case STRING:
pdv.setString(desc.getParameterName(), obj.toString()); pdv.setString(desc.getParameterName(), obj.toString());