Issue #947 remove milliseconds from obs, change avnfps to use dbqueryrequest to get Dates instead of CatalogQuery to get Strings.
Former-commit-id: 06c2c85159598ca803c663de97caed4b6841c135
This commit is contained in:
parent
525c0b21a9
commit
c6a121962f
3 changed files with 226 additions and 222 deletions
|
@ -41,8 +41,7 @@ class HoursRefTimePointDataRetrieve(RefTimePointDataRetrieve.RefTimePointDataRet
|
|||
super(HoursRefTimePointDataRetrieve, self).__init__(pluginName, site, parameters, keyId, refTime, constraint, maxSize)
|
||||
|
||||
def _createJarray(self, availableTimes, numHours):
|
||||
from java.util import Date, TimeZone
|
||||
from java.sql import Timestamp
|
||||
from java.util import Date
|
||||
from com.raytheon.uf.common.time import DataTime
|
||||
import jep, time
|
||||
#Get a DataTime numHours from current time
|
||||
|
@ -52,15 +51,7 @@ class HoursRefTimePointDataRetrieve(RefTimePointDataRetrieve.RefTimePointDataRet
|
|||
length = len(availableTimes)
|
||||
xdts = []
|
||||
for i in range(length) :
|
||||
# Timestamp must be used to parse the time because it correctly handles
|
||||
# the fractional part of seconds instead of interpreting them as
|
||||
# milliseconds directly. for example 11.62 is
|
||||
# interpreted as 11 seconds and 620 milliseconds instead of
|
||||
# 11 seconds and 62 milliseconds.
|
||||
milliTime = Timestamp.valueOf(availableTimes[length-1-i]).getTime()
|
||||
# Timestamp parses into the default timezone so we must offset it to get GMT.
|
||||
milliTime += TimeZone.getDefault().getOffset(milliTime)
|
||||
d = DataTime(Date(milliTime))
|
||||
d = DataTime(availableTimes[length-1-i])
|
||||
if d.greaterThan(stDateTime) :
|
||||
xdts.append(d)
|
||||
else :
|
||||
|
|
|
@ -47,8 +47,18 @@ class RefTimePointDataRetrieve(PointDataRetrieve.PointDataRetrieve):
|
|||
self.pdc = PointDataContainer.PointDataContainer(pdvDict, self.__javaPdc, self.refTime)
|
||||
|
||||
def __queryRefTimes(self):
|
||||
from com.raytheon.uf.viz.core.catalog import CatalogQuery
|
||||
return CatalogQuery.performQuery('dataTime.refTime', self._buildConstraints(None))
|
||||
from com.raytheon.uf.common.dataquery.requests import DbQueryRequest
|
||||
from com.raytheon.uf.viz.core.requests import ThriftClient
|
||||
request = DbQueryRequest()
|
||||
request.setConstraints(self._buildConstraints(None))
|
||||
request.addRequestField('dataTime.refTime')
|
||||
request.setOrderByField('dataTime.refTime')
|
||||
request.setDistinct(True)
|
||||
response = ThriftClient.sendRequest(request).getResults()
|
||||
timeList = []
|
||||
for i in range(0,response.size()):
|
||||
timeList.append(response.get(i).get('dataTime.refTime'))
|
||||
return timeList
|
||||
|
||||
def __requestData(self, availableTimes, parameters, maxSize):
|
||||
from com.raytheon.viz.pointdata import PointDataRequest
|
||||
|
|
|
@ -31,7 +31,6 @@ import com.raytheon.edex.esb.Headers;
|
|||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.edex.plugin.AbstractDecoder;
|
||||
import com.raytheon.edex.plugin.obs.metar.util.VisibilityParser;
|
||||
import com.raytheon.edex.util.Util;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.obs.metar.MetarRecord;
|
||||
import com.raytheon.uf.common.dataplugin.obs.metar.util.SkyCover;
|
||||
|
@ -174,13 +173,17 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
public static final Pattern PK_WIND_EXP = Pattern
|
||||
.compile("\\b(PK WND|PKWND) (\\d{3})(\\d{2,3})/(\\d{2}|\\d{4})\\b");
|
||||
|
||||
public static final Pattern SNOW_FALL_6HR = Pattern.compile("(\\b)931(\\d{3}|///)");
|
||||
public static final Pattern SNOW_FALL_6HR = Pattern
|
||||
.compile("(\\b)931(\\d{3}|///)");
|
||||
|
||||
public static final Pattern SNOW_WATER = Pattern.compile("(\\b)933(\\d{3}|///)");
|
||||
public static final Pattern SNOW_WATER = Pattern
|
||||
.compile("(\\b)933(\\d{3}|///)");
|
||||
|
||||
public static final Pattern SNOW_DEPTH = Pattern.compile("(\\b)4/(\\d{3}|///)");
|
||||
public static final Pattern SNOW_DEPTH = Pattern
|
||||
.compile("(\\b)4/(\\d{3}|///)");
|
||||
|
||||
public static final Pattern SUNSHINE = Pattern.compile("(\\b)98(\\d{3}|///)");
|
||||
public static final Pattern SUNSHINE = Pattern
|
||||
.compile("(\\b)98(\\d{3}|///)");
|
||||
|
||||
private final String PLUGIN_NAME;
|
||||
|
||||
|
@ -220,7 +223,8 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
if ((wmoHdr != null) && (wmoHdr.isValid())) {
|
||||
baseTime = TimeTools.findDataTime(wmoHdr.getYYGGgg(), headers);
|
||||
} else {
|
||||
logger.error("ARCHIVE MODE-No WMO Header found in file" + headers.get(WMOHeader.INGEST_FILE_NAME));
|
||||
logger.error("ARCHIVE MODE-No WMO Header found in file"
|
||||
+ headers.get(WMOHeader.INGEST_FILE_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -291,7 +295,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
continue;
|
||||
}
|
||||
|
||||
|
||||
Calendar obsTime = null;
|
||||
Integer da = DecoderTools.getInt(timeGroup, 0, 2);
|
||||
Integer hr = DecoderTools.getInt(timeGroup, 2, 4);
|
||||
|
@ -301,6 +304,8 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
obsTime.set(Calendar.DAY_OF_MONTH, da);
|
||||
obsTime.set(Calendar.HOUR_OF_DAY, hr);
|
||||
obsTime.set(Calendar.MINUTE, mi);
|
||||
obsTime.set(Calendar.SECOND, 0);
|
||||
obsTime.set(Calendar.MILLISECOND, 0);
|
||||
}
|
||||
if (obsTime != null) {
|
||||
record.setTimeObs(obsTime);
|
||||
|
@ -324,11 +329,13 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
if (obsTime != null) {
|
||||
Calendar currTime = TimeTools.copy(baseTime);
|
||||
|
||||
// Do this only for archive mode!!! Otherwise valid data will not pass if the WMO header
|
||||
// Do this only for archive mode!!! Otherwise valid data
|
||||
// will not pass if the WMO header
|
||||
// date/time is much less than the obstime. For instance
|
||||
// WMO Header time = dd1200
|
||||
// Observed time = dd1235
|
||||
// To solve this will require greater precision in the file timestamp.
|
||||
// To solve this will require greater precision in the file
|
||||
// timestamp.
|
||||
if (TimeTools.allowArchive()) {
|
||||
currTime.add(Calendar.HOUR, 1);
|
||||
}
|
||||
|
@ -797,8 +804,7 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
if ((obsHr % 3) == 0) {
|
||||
Float precip = null;
|
||||
try {
|
||||
precip = Float.parseFloat(matcher
|
||||
.group(1));
|
||||
precip = Float.parseFloat(matcher.group(1));
|
||||
precip /= 100.0f;
|
||||
} catch (NumberFormatException nfe) {
|
||||
precip = null;
|
||||
|
@ -819,7 +825,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
matcher = PRECIP_24HR_EXP.matcher(trailingData);
|
||||
if (matcher.find()) {
|
||||
String s = matcher.group(1).trim();
|
||||
|
@ -833,7 +838,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
matcher = MAXMIN_TEMP_6_HR_EXP.matcher(trailingData);
|
||||
while (matcher.find()) {
|
||||
String op = matcher.group(1);
|
||||
|
@ -858,7 +862,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Gets the pressure change over the last 3 hours
|
||||
matcher = PRESS_CHANGE_EXP.matcher(trailingData);
|
||||
|
||||
|
@ -1014,7 +1017,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
return (sb != null) ? sb.toString().trim() : "";
|
||||
}
|
||||
|
||||
|
||||
public static final int getInt(String val, int defaultVal) {
|
||||
int retVal = defaultVal;
|
||||
try {
|
||||
|
@ -1173,7 +1175,8 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
// + "\r CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
|
||||
// + "\r 53003 $=",
|
||||
// "KLWT 281154Z AUTO 27005KT 10SM -RA OVC020 04/04 A2997 RMK AO2"
|
||||
// + "\r RAB1057 SLP145 P0003 60011 70013 T00440039 10072 20044 53004"
|
||||
// +
|
||||
// "\r RAB1057 SLP145 P0003 60011 70013 T00440039 10072 20044 53004"
|
||||
// + "\r $=",
|
||||
// "KSIY 281153Z AUTO 19003KT 10SM BKN014 OVC023 07/06 A3006 RMK AO2"
|
||||
// + "\r RAE10B36E48 SLP187 P0001 60003 70014 T00670056 10072 20067"
|
||||
|
@ -1186,7 +1189,8 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
// "PABR 281153Z COR 02003KT 10SM OVC003 M01/M02 A3009 RMK AO2 CIG"
|
||||
// + "\r 001V005 SLP189 FZRAB12FZRAE50 P0002 60002 70002 4/012"
|
||||
// + "\r T10111017 11011 21011 56009=",
|
||||
// "SAUS70 KWBC 281220 METAR KLUM 281216Z AUTO 00000KT 10SM CLR 13/08 A3014 RMK AO2", };
|
||||
// "SAUS70 KWBC 281220 METAR KLUM 281216Z AUTO 00000KT 10SM CLR 13/08 A3014 RMK AO2",
|
||||
// };
|
||||
//
|
||||
// for (String s : data) {
|
||||
// System.out.println(formatMetar(s));
|
||||
|
@ -1199,14 +1203,18 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
// String obs = "\001023\r\r\nSAUS42 KOAX 191510\r\r\n"
|
||||
// + ""
|
||||
// // +
|
||||
// // "KOMA 281156Z AUTO 26005KT 7SM -FZDZSN FG OVC009 04/03 A2999 RMK AO2 RAB37"
|
||||
// //
|
||||
// "KOMA 281156Z AUTO 26005KT 7SM -FZDZSN FG OVC009 04/03 A2999 RMK AO2 RAB37"
|
||||
// // +
|
||||
// // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
|
||||
// //
|
||||
// "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
|
||||
// // + "\r\r\n 53003 $=\r\r\b\003"
|
||||
// // +
|
||||
// // "KFET 281156Z AUTO 26005KT 7SM -SNBR OVC009 04/03 A2999 RMK AO2 RAB37"
|
||||
// //
|
||||
// "KFET 281156Z AUTO 26005KT 7SM -SNBR OVC009 04/03 A2999 RMK AO2 RAB37"
|
||||
// // +
|
||||
// // "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
|
||||
// //
|
||||
// "\r\r\n CIG 007V011 SLP200 P0001 60002 70074 T00390033 10044 20033"
|
||||
// // + "\r\r\n 53003 $=\r\r\b\003"
|
||||
// + "VVNB 261830Z 04003KT 3700 TSRA SCT005 SCT030CB BKN040 26/25"
|
||||
// + "\r\r\n Q1005 RMK PKWND 14527/1135 NOSIG";
|
||||
|
@ -1264,11 +1272,6 @@ public class MetarDecoder extends AbstractDecoder {
|
|||
System.out.println("[" + s + "]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue