Merge "Issue #1992 Remove redundant time columns from bufrua. Change-Id: If0799726ff9fa3d90026d0115cc03bd55347ce90" into development

Former-commit-id: c7e9cd592e [formerly 57a6241f16973a6e793d0917ca4242a51bfd55f6]
Former-commit-id: 857426cc44
This commit is contained in:
Richard Peter 2013-07-21 21:57:38 -05:00 committed by Gerrit Code Review
commit 4dc5e4ac27
7 changed files with 44 additions and 76 deletions

View file

@ -0,0 +1,7 @@
#!/bin/bash
# DR #1992 - this update script will drop the refHour and validTime columns
# from the bufrua column, refTime has the exact same value.
PSQL="/awips2/psql/bin/psql"
${PSQL} -U awips -d metadata -c "ALTER TABLE bufrua DROP COLUMN IF EXISTS validtime, DROP COLUMN IF EXISTS refhour;"

View file

@ -24,8 +24,11 @@
<parameter name="staElev" queryName="location.elevation" type="FLOAT" unit="m" />
<parameter name="rptType" queryName="reportType" type="INT" />
<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="stationId" queryName="location.stationId" type="STRING" />
<!-- Do not use validTime, only use refTime -->
<parameter name="validTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
<!-- Do not use relTime, only use refTime -->
<parameter name="relTime" 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>

View file

@ -51,6 +51,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* Mar 03, 2008 969 jkorman Initial implementation.
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
* work without dataURI.
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
* bufrua.
*
* </pre>
*
@ -113,13 +115,13 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
obsData.setPluginName(getPluginName());
obsData.setWmoHeader(wmoHeader.getWmoHeader());
Calendar validTime = obsData.getValidTime();
Calendar validTime = obsData.getDataTime()
.getRefTimeAsCalendar();
// Now offset the "record" validTime using the hour mapping.
int hour = validTime.get(Calendar.HOUR_OF_DAY);
validTime.add(Calendar.HOUR_OF_DAY, HOUR_MAP[hour]);
// Set the new validTime back into the UAObs record.
obsData.setValidTime(validTime);
Calendar maxFutureTime = Calendar.getInstance();
maxFutureTime.add(Calendar.HOUR, 12);
@ -128,7 +130,6 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
return null;
}
obsData.setRefHour(TimeTools.copy(validTime));
obsData.setDataTime(new DataTime(TimeTools.copy(validTime)));
// We have times now, so ok to get container.
@ -184,7 +185,7 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
Calendar obsTime = getTimeInfo(dataList);
if (obsTime != null) {
obsData = new UAObs();
obsData.setValidTime(obsTime);
obsData.setDataTime(new DataTime(obsTime));
}
if (isValidTime(obsData)) {

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.common.dataplugin.bufrua;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@ -93,6 +92,8 @@ import com.vividsolutions.jts.geom.Geometry;
* May 07, 2013 1869 bsteffen Remove dataURI column from
* PluginDataObject.
* Jun 20, 2013 2128 bsteffen Ensure setDataURI sets the dataURI.
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
* bufrua.
*
* </pre>
*
@ -174,18 +175,6 @@ public class UAObs extends PersistablePluginDataObject implements
@Transient
private Integer levelId;
// Time of the observation.
@Column
@XmlElement
@DynamicSerializeElement
private Calendar validTime;
// Time of the observation to the nearest hour.
@Column
@XmlElement
@DynamicSerializeElement
private Calendar refHour;
// The observation report type.
@DataURI(position = 1)
@Column
@ -450,40 +439,6 @@ public class UAObs extends PersistablePluginDataObject implements
this.reportType = reportType;
}
/**
* @return the validTime
*/
public Calendar getValidTime() {
return validTime;
}
/**
* @param validTime
* the validTime to set
*/
public void setValidTime(Calendar validTime) {
this.validTime = validTime;
}
/**
* Get the reference hour
*
* @return the refHour
*/
public Calendar getRefHour() {
return refHour;
}
/**
* Set the reference hour
*
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;
}
/**
* Get the station pressure at the observation site.
*

View file

@ -36,12 +36,14 @@ import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
/**
* TODO Add Description
* Adapter for convertung UAObs data into Vertical Soundings.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
* bufrua.
*
*
* </pre>
@ -181,7 +183,7 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
sounding.setDisplayFormat(icao);
sounding.setName(icao);
sounding.setObsTime(obsData.getValidTime());
sounding.setObsTime(obsData.getDataTime().getRefTimeAsCalendar());
sounding.setDataTime(obsData.getDataTime());
List<SoundingLayer> layers = interleave(obsData);
@ -654,7 +656,7 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
// if compare(mapped,obs) < 0 then mapped has newer data
int c = UAObs.getCorComparator().compare(mapped, obs);
if(c < 0) {
if (c < 0) {
obsMap.put(key, obs);
}
} else {
@ -668,18 +670,19 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
}
/**
* Create a key for a UAObs by concatenating the station identifier,
* report type code and the valid time in milliseconds.
* @param data A UAObs instance to key.
* Create a key for a UAObs by concatenating the station identifier, report
* type code and the valid time in milliseconds.
*
* @param data
* A UAObs instance to key.
* @return The generated key, returns null if the UAObs reference is null.
*/
private static String getKey(UAObs data) {
String key = null;
if (data != null) {
key = String
.format("%s:%4d:%d", data.getStationId(), data
.getReportType(), data.getValidTime()
.getTimeInMillis());
key = String.format("%s:%4d:%d", data.getStationId(),
data.getReportType(), data.getDataTime().getRefTime()
.getTime());
}
return key;
}
@ -803,14 +806,12 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
SurfaceObsLocation loc = new SurfaceObsLocation("72558");
UAObs[] obs = new UAObs[2];
obs[0] = new UAObs();
obs[0].setValidTime(TimeTools.copy(c));
obs[0].setLocation(loc);
obs[0].setReportType(2020);
obs[0].setCorIndicator(null);
loc = new SurfaceObsLocation("72558");
obs[1] = new UAObs();
obs[1].setValidTime(TimeTools.copy(c));
obs[1].setLocation(loc);
obs[1].setReportType(2020);
obs[1].setCorIndicator("CCA");

View file

@ -35,7 +35,7 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
/**
* TODO Add Description
* Converts a PointDataContainer into a UAObs record.
*
* <pre>
*
@ -44,6 +44,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 19, 2009 jkorman Initial creation
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
* bufrua.
*
* </pre>
*
@ -121,9 +123,7 @@ public class BufrUAPointDataTransform {
obs = new UAObs(uri);
long vt = pdv.getNumber("validTime").longValue();
obs.setValidTime(TimeTools.newCalendar(vt));
obs.setRefHour(TimeTools.newCalendar(vt));
obs.setDataTime(new DataTime(TimeTools.newCalendar(vt)));
SurfaceObsLocation location = new SurfaceObsLocation();

View file

@ -20,6 +20,7 @@ package gov.noaa.nws.ncep.edex.uengine.tasks.profile;
* Nov 2011 Chin Chen changed Ncuair table query algorithm for performance improvement
* 01/05/2012 S. Gurung Removed references to UAIR (performed cleanup)
* 02/28/2012 Chin Chen modify several sounding query algorithms for better performance
* 07/19/2013 1992 bsteffen Remove redundant time columns from bufrua.
* </pre>
*
* @author Chin Chen
@ -151,8 +152,8 @@ public class ObservedSoundingQuery {
else {
return pf;
}
fields.add("validTime");// the synoptic time field name defined in UAObs
values.add(refTimeCal);
fields.add("dataTime.refTime");// the synoptic time field name defined in UAObs
values.add(refTimeCal.getTime());
dao = new CoreDao(DaoConfig.forClass(UAObs.class));
try {
lUairRecords = (List<UAObs>) dao.queryByCriteria(fields, values);