Issue #2249 Changes to get simulated time from warngen ingest files.
Change-Id: Ib66d7eb678a29109ee1dd4328081e4f0d622af14 Former-commit-id: 45a70809cc891d2abb3e8587f0640669e579f351
This commit is contained in:
parent
4b6e4fcd3a
commit
46011b2b52
3 changed files with 250 additions and 258 deletions
File diff suppressed because it is too large
Load diff
|
@ -35,6 +35,7 @@
|
|||
# May 07, 2013 1973 rferrel Adjust Issue and Purge times to be relative to start time.
|
||||
# Jun 24, 2013 DR 16317 D. Friedman If no storm line, parse storm motion from event text.
|
||||
# Aug 21, 2013 DR16501 m.gamazaychikov Adjusted calculation of Purge time in NoVTECWarningDecoder.
|
||||
# Sep 12, 2013 DR2249 rferrel When incoming file from warngen adjust start time from file's timestamp.
|
||||
# </pre>
|
||||
#
|
||||
# @author rferrel
|
||||
|
@ -111,19 +112,24 @@ class StdWarningDecoder():
|
|||
self._rawMessage = text
|
||||
checkForWmo = True
|
||||
|
||||
#base time for decoder
|
||||
self._time = time.time() + self._timeOffset #present time
|
||||
|
||||
if TimeTools.allowArchive() :
|
||||
try:
|
||||
yyyymmddhh = TimeTools.getTimestamp(self._incomingFilename)
|
||||
if len(yyyymmddhh) < 10:
|
||||
timeTuple = time.strptime(yyyymmddhh, "%Y%m%d")
|
||||
else :
|
||||
timeTuple = time.strptime(yyyymmddhh, "%Y%m%d%H")
|
||||
self._time = time.mktime(timeTuple)
|
||||
except :
|
||||
LogStream.logProblem('Unable to get timestamp from filename: "%s"' % (self._incomingFilename))
|
||||
# base time for decoder
|
||||
warningTimestamp = TimeTools.getWarningTimestamp(self._incomingFilename)
|
||||
if warningTimestamp is None :
|
||||
# present time
|
||||
self._time = time.time() + self._timeOffset
|
||||
if TimeTools.allowArchive():
|
||||
try:
|
||||
yyyymmddhh = TimeTools.getTimestamp(self._incomingFilename)
|
||||
if len(yyyymmddhh) < 10:
|
||||
timeTuple = time.strptime(yyyymmddhh, "%Y%m%d")
|
||||
else :
|
||||
timeTuple = time.strptime(yyyymmddhh, "%Y%m%d%H")
|
||||
self._time = time.mktime(timeTuple)
|
||||
except :
|
||||
LogStream.logProblem('Unable to get timestamp from filename: "%s"' % (self._incomingFilename))
|
||||
else:
|
||||
# Use the epoch seconds from file generated by the text editor dialog,
|
||||
self._time = long(warningTimestamp)
|
||||
|
||||
os.umask(0) #ensure proper permissions
|
||||
|
||||
|
@ -155,9 +161,8 @@ class StdWarningDecoder():
|
|||
|
||||
def decode(self):
|
||||
#get pil and date-time group
|
||||
self._adjustIssueTime = True
|
||||
self._productPil, self._issueTime, linePos,\
|
||||
self._completeProductPil, self._issueTimeStr = self._getPilAndDTG()
|
||||
self._completeProductPil = self._getPilAndDTG()
|
||||
|
||||
# If this is a WCL - don't go any further. Run WCL procedure and exit.
|
||||
if self._productPil[0:3] == "WCL":
|
||||
|
@ -411,7 +416,7 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
|||
LogStream.logVerbose("Pil=", pil_search.group(0))
|
||||
return (self._lines[count+1][0:3],
|
||||
self._dtgFromDDHHMM(dtg_search.group(1)), count+2,
|
||||
pil_search.group(0), dtg_search.group(1))
|
||||
pil_search.group(0))
|
||||
count = count + 1
|
||||
if count >= len(self._lines)-1:
|
||||
LogStream.logProblem("Did not find either the product DTG" +\
|
||||
|
@ -830,7 +835,7 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
|||
ugcs = self._expandUGC(ugcstring)
|
||||
records = []
|
||||
for vtecS, hvtec in vtecStrings:
|
||||
search = re.search(self._vtecRE, vtecS)
|
||||
search = re.search(self._vtecRE, vtecS)
|
||||
|
||||
#construct the active table entries, without the geography
|
||||
template = {}
|
||||
|
@ -845,9 +850,6 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
|||
template['seg'] = segment
|
||||
startTime, zeros = self._calcTime(search.group(6),
|
||||
search.group(7), self._issueTime * 1000)
|
||||
if self._adjustIssueTime :
|
||||
self._issueTime = self._dtgFromDDHHMM(self._issueTimeStr, startTime/1000.0)
|
||||
self._adjustIssueTime = False
|
||||
endTime, ufn = self._calcTime(search.group(8),
|
||||
search.group(9), self._maxFutureTime * 1000)
|
||||
template['startTime'] = long(startTime)
|
||||
|
|
|
@ -49,6 +49,7 @@ import com.raytheon.uf.edex.decodertools.core.DecoderTools;
|
|||
* 20070925 391 jkorman Added copyToNearestHour method.
|
||||
* 20071019 391 jkorman Added getSystemCalendar and TimeService.
|
||||
* 20130219 1636 rferrel File timestamp can now be YYMMDD or YYMMDDHH.
|
||||
* 20130912 2249 rferrel Added getWarningTimestamp method.
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
|
@ -64,7 +65,13 @@ public class TimeTools {
|
|||
* name: .YYYYMMDD or .YYYYMMDDHH
|
||||
*/
|
||||
private static final Pattern FILE_TIMESTAMP = Pattern
|
||||
.compile("(.*\\.)(\\d{8}|\\d{10}$)");
|
||||
.compile("(.*\\.)(\\d{8}|\\d{10})$");
|
||||
|
||||
/**
|
||||
* Time stamp for a file name created by the Text Editor Dialog.
|
||||
*/
|
||||
private static final Pattern FILE_WARNING_TIMESTAMP = Pattern
|
||||
.compile(".*\\.wan(\\d{10})$");
|
||||
|
||||
public static final Pattern WMO_TIMESTAMP = Pattern
|
||||
.compile("([0-3][0-9])(\\d{2})(\\d{2})[Zz]?");
|
||||
|
@ -238,6 +245,21 @@ public class TimeTools {
|
|||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time stamp of a warning file name.
|
||||
*
|
||||
* @param fileName
|
||||
* @return timestamp if if matches FILE_WARNING_TIMESTAMP otherwise null
|
||||
*/
|
||||
public static final String getWarningTimestamp(String fileName) {
|
||||
String timestamp = null;
|
||||
Matcher matcher = FILE_WARNING_TIMESTAMP.matcher(fileName);
|
||||
if (matcher.find()) {
|
||||
timestamp = matcher.group(1);
|
||||
}
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a ddhhmm time group to a Calendar. Adjusts the calendar as
|
||||
* follows: Any time group with a day (dd) in the future is set back one
|
||||
|
|
Loading…
Add table
Reference in a new issue