Issue #1992 Remove redundant time columns from bufrua.
Change-Id: If0799726ff9fa3d90026d0115cc03bd55347ce90 Former-commit-id: 3e916aad7d281ba53cd1634a15d7ac521943bc75
This commit is contained in:
parent
8e78f80ddd
commit
ad0cefc7fa
7 changed files with 44 additions and 76 deletions
7
deltaScripts/13.6.1/bufruaTimeColumns.sh
Normal file
7
deltaScripts/13.6.1/bufruaTimeColumns.sh
Normal 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;"
|
|
@ -24,8 +24,11 @@
|
||||||
<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="stationId" queryName="location.stationId" type="STRING" />
|
||||||
<parameter name="relTime" queryName="validTime" numDims="1" type="LONG" unit="ms" />
|
<!-- 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="refTime" queryName="dataTime.refTime" numDims="1" type="LONG" unit="ms" />
|
||||||
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s" />
|
<parameter name="forecastHr" queryName="dataTime.fcstTime" numDims="1" type="INT" unit="h" dbunit="s" />
|
||||||
</pointDataDbDescription>
|
</pointDataDbDescription>
|
|
@ -51,6 +51,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
|
||||||
* Mar 03, 2008 969 jkorman Initial implementation.
|
* Mar 03, 2008 969 jkorman Initial implementation.
|
||||||
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
|
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
|
||||||
* work without dataURI.
|
* work without dataURI.
|
||||||
|
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
|
||||||
|
* bufrua.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -113,13 +115,13 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
|
||||||
obsData.setPluginName(getPluginName());
|
obsData.setPluginName(getPluginName());
|
||||||
obsData.setWmoHeader(wmoHeader.getWmoHeader());
|
obsData.setWmoHeader(wmoHeader.getWmoHeader());
|
||||||
|
|
||||||
Calendar validTime = obsData.getValidTime();
|
Calendar validTime = obsData.getDataTime()
|
||||||
|
.getRefTimeAsCalendar();
|
||||||
|
|
||||||
// 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]);
|
||||||
// Set the new validTime back into the UAObs record.
|
// Set the new validTime back into the UAObs record.
|
||||||
obsData.setValidTime(validTime);
|
|
||||||
|
|
||||||
Calendar maxFutureTime = Calendar.getInstance();
|
Calendar maxFutureTime = Calendar.getInstance();
|
||||||
maxFutureTime.add(Calendar.HOUR, 12);
|
maxFutureTime.add(Calendar.HOUR, 12);
|
||||||
|
@ -128,7 +130,6 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
obsData.setRefHour(TimeTools.copy(validTime));
|
|
||||||
obsData.setDataTime(new DataTime(TimeTools.copy(validTime)));
|
obsData.setDataTime(new DataTime(TimeTools.copy(validTime)));
|
||||||
|
|
||||||
// We have times now, so ok to get container.
|
// We have times now, so ok to get container.
|
||||||
|
@ -184,7 +185,7 @@ public abstract class AbstractBUFRUAAdapter extends BUFRPointDataAdapter<UAObs>
|
||||||
Calendar obsTime = getTimeInfo(dataList);
|
Calendar obsTime = getTimeInfo(dataList);
|
||||||
if (obsTime != null) {
|
if (obsTime != null) {
|
||||||
obsData = new UAObs();
|
obsData = new UAObs();
|
||||||
obsData.setValidTime(obsTime);
|
obsData.setDataTime(new DataTime(obsTime));
|
||||||
}
|
}
|
||||||
if (isValidTime(obsData)) {
|
if (isValidTime(obsData)) {
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package com.raytheon.uf.common.dataplugin.bufrua;
|
package com.raytheon.uf.common.dataplugin.bufrua;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -93,6 +92,8 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||||
* PluginDataObject.
|
* PluginDataObject.
|
||||||
* Jun 20, 2013 2128 bsteffen Ensure setDataURI sets the dataURI.
|
* Jun 20, 2013 2128 bsteffen Ensure setDataURI sets the dataURI.
|
||||||
|
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
|
||||||
|
* bufrua.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -174,18 +175,6 @@ public class UAObs extends PersistablePluginDataObject implements
|
||||||
@Transient
|
@Transient
|
||||||
private Integer levelId;
|
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.
|
// The observation report type.
|
||||||
@DataURI(position = 1)
|
@DataURI(position = 1)
|
||||||
@Column
|
@Column
|
||||||
|
@ -450,40 +439,6 @@ public class UAObs extends PersistablePluginDataObject implements
|
||||||
this.reportType = reportType;
|
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.
|
* Get the station pressure at the observation site.
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,12 +36,14 @@ import com.raytheon.uf.common.sounding.adapter.AbstractVerticalSoundingAdapter;
|
||||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Adapter for convertung UAObs data into Vertical Soundings.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
|
||||||
|
* bufrua.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
|
@ -181,7 +183,7 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
|
||||||
sounding.setDisplayFormat(icao);
|
sounding.setDisplayFormat(icao);
|
||||||
sounding.setName(icao);
|
sounding.setName(icao);
|
||||||
|
|
||||||
sounding.setObsTime(obsData.getValidTime());
|
sounding.setObsTime(obsData.getDataTime().getRefTimeAsCalendar());
|
||||||
sounding.setDataTime(obsData.getDataTime());
|
sounding.setDataTime(obsData.getDataTime());
|
||||||
|
|
||||||
List<SoundingLayer> layers = interleave(obsData);
|
List<SoundingLayer> layers = interleave(obsData);
|
||||||
|
@ -651,10 +653,10 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
|
||||||
String key = getKey(obs);
|
String key = getKey(obs);
|
||||||
if (obsMap.containsKey(key)) {
|
if (obsMap.containsKey(key)) {
|
||||||
UAObs mapped = obsMap.get(key);
|
UAObs mapped = obsMap.get(key);
|
||||||
|
|
||||||
// if compare(mapped,obs) < 0 then mapped has newer data
|
// if compare(mapped,obs) < 0 then mapped has newer data
|
||||||
int c = UAObs.getCorComparator().compare(mapped, obs);
|
int c = UAObs.getCorComparator().compare(mapped, obs);
|
||||||
if(c < 0) {
|
if (c < 0) {
|
||||||
obsMap.put(key, obs);
|
obsMap.put(key, obs);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -668,18 +670,19 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a key for a UAObs by concatenating the station identifier,
|
* Create a key for a UAObs by concatenating the station identifier, report
|
||||||
* report type code and the valid time in milliseconds.
|
* type code and the valid time in milliseconds.
|
||||||
* @param data A UAObs instance to key.
|
*
|
||||||
|
* @param data
|
||||||
|
* A UAObs instance to key.
|
||||||
* @return The generated key, returns null if the UAObs reference is null.
|
* @return The generated key, returns null if the UAObs reference is null.
|
||||||
*/
|
*/
|
||||||
private static String getKey(UAObs data) {
|
private static String getKey(UAObs data) {
|
||||||
String key = null;
|
String key = null;
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
key = String
|
key = String.format("%s:%4d:%d", data.getStationId(),
|
||||||
.format("%s:%4d:%d", data.getStationId(), data
|
data.getReportType(), data.getDataTime().getRefTime()
|
||||||
.getReportType(), data.getValidTime()
|
.getTime());
|
||||||
.getTimeInMillis());
|
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -803,14 +806,12 @@ public class UAObsAdapter extends AbstractVerticalSoundingAdapter {
|
||||||
SurfaceObsLocation loc = new SurfaceObsLocation("72558");
|
SurfaceObsLocation loc = new SurfaceObsLocation("72558");
|
||||||
UAObs[] obs = new UAObs[2];
|
UAObs[] obs = new UAObs[2];
|
||||||
obs[0] = new UAObs();
|
obs[0] = new UAObs();
|
||||||
obs[0].setValidTime(TimeTools.copy(c));
|
|
||||||
obs[0].setLocation(loc);
|
obs[0].setLocation(loc);
|
||||||
obs[0].setReportType(2020);
|
obs[0].setReportType(2020);
|
||||||
obs[0].setCorIndicator(null);
|
obs[0].setCorIndicator(null);
|
||||||
|
|
||||||
loc = new SurfaceObsLocation("72558");
|
loc = new SurfaceObsLocation("72558");
|
||||||
obs[1] = new UAObs();
|
obs[1] = new UAObs();
|
||||||
obs[1].setValidTime(TimeTools.copy(c));
|
|
||||||
obs[1].setLocation(loc);
|
obs[1].setLocation(loc);
|
||||||
obs[1].setReportType(2020);
|
obs[1].setReportType(2020);
|
||||||
obs[1].setCorIndicator("CCA");
|
obs[1].setCorIndicator("CCA");
|
||||||
|
|
|
@ -35,20 +35,22 @@ import com.raytheon.uf.common.time.DataTime;
|
||||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* Converts a PointDataContainer into a UAObs record.
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Aug 19, 2009 jkorman Initial creation
|
* Aug 19, 2009 jkorman Initial creation
|
||||||
*
|
* Jul 19, 2013 1992 bsteffen Remove redundant time columns from
|
||||||
|
* bufrua.
|
||||||
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author jkorman
|
* @author jkorman
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class BufrUAPointDataTransform {
|
public class BufrUAPointDataTransform {
|
||||||
|
@ -121,9 +123,7 @@ public class BufrUAPointDataTransform {
|
||||||
obs = new UAObs(uri);
|
obs = new UAObs(uri);
|
||||||
|
|
||||||
long vt = pdv.getNumber("validTime").longValue();
|
long vt = pdv.getNumber("validTime").longValue();
|
||||||
obs.setValidTime(TimeTools.newCalendar(vt));
|
|
||||||
|
|
||||||
obs.setRefHour(TimeTools.newCalendar(vt));
|
|
||||||
obs.setDataTime(new DataTime(TimeTools.newCalendar(vt)));
|
obs.setDataTime(new DataTime(TimeTools.newCalendar(vt)));
|
||||||
|
|
||||||
SurfaceObsLocation location = new SurfaceObsLocation();
|
SurfaceObsLocation location = new SurfaceObsLocation();
|
||||||
|
|
|
@ -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
|
* Nov 2011 Chin Chen changed Ncuair table query algorithm for performance improvement
|
||||||
* 01/05/2012 S. Gurung Removed references to UAIR (performed cleanup)
|
* 01/05/2012 S. Gurung Removed references to UAIR (performed cleanup)
|
||||||
* 02/28/2012 Chin Chen modify several sounding query algorithms for better performance
|
* 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>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Chin Chen
|
* @author Chin Chen
|
||||||
|
@ -151,8 +152,8 @@ public class ObservedSoundingQuery {
|
||||||
else {
|
else {
|
||||||
return pf;
|
return pf;
|
||||||
}
|
}
|
||||||
fields.add("validTime");// the synoptic time field name defined in UAObs
|
fields.add("dataTime.refTime");// the synoptic time field name defined in UAObs
|
||||||
values.add(refTimeCal);
|
values.add(refTimeCal.getTime());
|
||||||
dao = new CoreDao(DaoConfig.forClass(UAObs.class));
|
dao = new CoreDao(DaoConfig.forClass(UAObs.class));
|
||||||
try {
|
try {
|
||||||
lUairRecords = (List<UAObs>) dao.queryByCriteria(fields, values);
|
lUairRecords = (List<UAObs>) dao.queryByCriteria(fields, values);
|
||||||
|
|
Loading…
Add table
Reference in a new issue