Issue #1973 Changes to properly determine Issue and Purge time when ingesting a warngen.
Change-Id: If8045d03084b9085b573cc11c42b6a2f93ffacc8 Former-commit-id:7636a7fcad
[formerly3b27e54b31
] [formerlyd1a3e3dc2f
] [formerly7636a7fcad
[formerly3b27e54b31
] [formerlyd1a3e3dc2f
] [formerly938cd275cc
[formerlyd1a3e3dc2f
[formerly b794f0b882d88cec6f552bf10f7f58096dfd5a69]]]] Former-commit-id:938cd275cc
Former-commit-id:2370bb2932
[formerly6523560a48
] [formerly 68d47f06839ee2e4b2e5e7f584b42183fbf5fe7d [formerly2be6266c9b
]] Former-commit-id: 01117c6218e4b709fa605225abd1a65f1cc7bab5 [formerly3aa2986115
] Former-commit-id:a0ff160f7c
This commit is contained in:
parent
152426b0b8
commit
539439976b
3 changed files with 89 additions and 42 deletions
|
@ -1,3 +1,22 @@
|
||||||
|
/**
|
||||||
|
* This software was developed and / or modified by Raytheon Company,
|
||||||
|
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||||
|
*
|
||||||
|
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||||
|
* This software product contains export-restricted data whose
|
||||||
|
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||||
|
* to non-U.S. persons whether in the United States or abroad requires
|
||||||
|
* an export license or other authorization.
|
||||||
|
*
|
||||||
|
* Contractor Name: Raytheon Company
|
||||||
|
* Contractor Address: 6825 Pine Street, Suite 340
|
||||||
|
* Mail Stop B8
|
||||||
|
* Omaha, NE 68106
|
||||||
|
* 402.291.0100
|
||||||
|
*
|
||||||
|
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||||
|
* further licensing information.
|
||||||
|
**/
|
||||||
package com.raytheon.viz.warngen.gui;
|
package com.raytheon.viz.warngen.gui;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -5,17 +24,37 @@ import java.util.Calendar;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
|
||||||
import com.raytheon.uf.common.dataplugin.warning.WarningRecord;
|
import com.raytheon.uf.common.dataplugin.warning.WarningRecord;
|
||||||
import com.raytheon.uf.common.time.SimulatedTime;
|
import com.raytheon.uf.common.time.SimulatedTime;
|
||||||
|
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A subclass of Warning Record to create the display strings needed by the GUI.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Initial creation
|
||||||
|
* May 7, 2013 1973 rferrel Changes to properly display Issue Time.
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author rferrel
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
public class FollowupData extends WarningRecord {
|
public class FollowupData extends WarningRecord {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** String displayed in the drop down update list */
|
/**
|
||||||
|
* String displayed in the drop down update list.
|
||||||
|
*/
|
||||||
public String displayString;
|
public String displayString;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String used to test if this object is equivalent to one of the updated
|
* String used to test if this object is equivalent to one of the updated
|
||||||
* items in the drop down
|
* items in the drop down.
|
||||||
*/
|
*/
|
||||||
public String equvialentString;
|
public String equvialentString;
|
||||||
|
|
||||||
|
@ -39,21 +78,21 @@ public class FollowupData extends WarningRecord {
|
||||||
*/
|
*/
|
||||||
private String getDisplayString(WarningAction status,
|
private String getDisplayString(WarningAction status,
|
||||||
AbstractWarningRecord record) {
|
AbstractWarningRecord record) {
|
||||||
StringBuffer rval = new StringBuffer();
|
StringBuilder rval = new StringBuilder();
|
||||||
if (record.getProductClass().equals("T")) {
|
if (record.getProductClass().equals("T")) {
|
||||||
rval.append("T.");
|
rval.append("T.");
|
||||||
}
|
}
|
||||||
rval.append(status.toString() + "-");
|
rval.append(status.toString()).append("-");
|
||||||
rval.append(record.getOfficeid() + ".");
|
rval.append(record.getOfficeid()).append(".");
|
||||||
rval.append(record.getPhen() + ".");
|
rval.append(record.getPhen()).append(".");
|
||||||
rval.append(record.getSig() + ".");
|
rval.append(record.getSig()).append(".");
|
||||||
rval.append(record.getEtn());
|
rval.append(record.getEtn());
|
||||||
|
|
||||||
if (status != WarningAction.CAN) {
|
if (status != WarningAction.CAN) {
|
||||||
rval.append(buildExpStr(status, record));
|
rval.append(buildExpStr(status, record));
|
||||||
}
|
}
|
||||||
|
|
||||||
equvialentString = rval.toString().substring(0,
|
equvialentString = rval.substring(0,
|
||||||
record.getProductClass().equals("T") ? 20 : 18);
|
record.getProductClass().equals("T") ? 20 : 18);
|
||||||
|
|
||||||
return rval.toString();
|
return rval.toString();
|
||||||
|
@ -70,29 +109,27 @@ public class FollowupData extends WarningRecord {
|
||||||
*/
|
*/
|
||||||
private String buildExpStr(WarningAction status,
|
private String buildExpStr(WarningAction status,
|
||||||
AbstractWarningRecord record) {
|
AbstractWarningRecord record) {
|
||||||
StringBuffer rval = new StringBuffer();
|
StringBuilder rval = new StringBuilder();
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTime(SimulatedTime.getSystemTime().getTime());
|
cal.setTime(SimulatedTime.getSystemTime().getTime());
|
||||||
// Positive means not yet expired
|
if (status != WarningAction.COR) {
|
||||||
long diffMins = (record.getEndTime().getTimeInMillis() - cal
|
// Positive means not yet expired
|
||||||
.getTimeInMillis()) / (60 * 1000);
|
long diffMins = (record.getEndTime().getTimeInMillis() - cal
|
||||||
if (diffMins == 0) {
|
.getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE;
|
||||||
rval.append(" Expired");
|
if (diffMins == 0) {
|
||||||
} else if (diffMins > 0) {
|
rval.append(" Expired");
|
||||||
rval.append(" Exp in " + diffMins + " min");
|
} else if (diffMins > 0) {
|
||||||
|
rval.append(" Exp in ").append(diffMins).append(" min");
|
||||||
|
} else {
|
||||||
|
rval.append(" Exp ").append(-diffMins).append(" min ago");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rval.append(" Exp " + -diffMins + " min ago");
|
long diffMins = (cal.getTimeInMillis() - record.getIssueTime()
|
||||||
}
|
.getTimeInMillis()) / TimeUtil.MILLIS_PER_MINUTE;
|
||||||
if (status == WarningAction.COR) {
|
|
||||||
rval.delete(0, rval.length());
|
|
||||||
diffMins = (cal.getTimeInMillis() - record.getIssueTime()
|
|
||||||
.getTimeInMillis()) / (60 * 1000);
|
|
||||||
if (diffMins == 0) {
|
if (diffMins == 0) {
|
||||||
rval.append(" Just Issued");
|
rval.append(" Just Issued");
|
||||||
} else if (diffMins > 0) {
|
} else {
|
||||||
rval.append(" Issued " + diffMins + " min ago");
|
rval.append(" Issued ").append(diffMins).append(" min ago");
|
||||||
} else if (diffMins < 0) {
|
|
||||||
rval.append(" Issued " + diffMins + " min ago");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rval.toString();
|
return rval.toString();
|
||||||
|
|
|
@ -69,6 +69,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
||||||
* Feb 12, 2013 1500 mschenke Refactored to not request full records and only request full
|
* Feb 12, 2013 1500 mschenke Refactored to not request full records and only request full
|
||||||
* record when actually retrieving for use
|
* record when actually retrieving for use
|
||||||
* Apr 22, 2013 jsanchez Set the issue time for follow up warnings.
|
* Apr 22, 2013 jsanchez Set the issue time for follow up warnings.
|
||||||
|
* May 07, 2013 1973 rferrel Corrections when getting Issue time.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -304,7 +305,7 @@ public class CurrentWarnings {
|
||||||
if (getAction(warning.getAct()) == WarningAction.EXT) {
|
if (getAction(warning.getAct()) == WarningAction.EXT) {
|
||||||
if (rval != null) {
|
if (rval != null) {
|
||||||
rval.setEndTime(warning.getEndTime());
|
rval.setEndTime(warning.getEndTime());
|
||||||
rval.setIssueTime(warning.getInsertTime());
|
rval.setIssueTime(warning.getIssueTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,7 @@ public class CurrentWarnings {
|
||||||
rval.setUgczones(warning.getUgczones());
|
rval.setUgczones(warning.getUgczones());
|
||||||
rval.setLoc(warning.getLoc());
|
rval.setLoc(warning.getLoc());
|
||||||
rval.setRawmessage(warning.getRawmessage());
|
rval.setRawmessage(warning.getRawmessage());
|
||||||
rval.setIssueTime(warning.getInsertTime());
|
rval.setIssueTime(warning.getIssueTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
# ------------ ---------- ----------- --------------------------
|
# ------------ ---------- ----------- --------------------------
|
||||||
# Initial creation
|
# Initial creation
|
||||||
# Feb 19, 2013 1636 rferrel Use TimeTools to get file timestamp.
|
# Feb 19, 2013 1636 rferrel Use TimeTools to get file timestamp.
|
||||||
|
# May 07, 2013 1973 rferrel Adjust Issue and Purge times to be relative to start time.
|
||||||
# </pre>
|
# </pre>
|
||||||
#
|
#
|
||||||
# @author rferrel
|
# @author rferrel
|
||||||
|
@ -142,9 +143,10 @@ class StdWarningDecoder():
|
||||||
|
|
||||||
def decode(self):
|
def decode(self):
|
||||||
#get pil and date-time group
|
#get pil and date-time group
|
||||||
|
self._adjustIssueTime = True
|
||||||
self._productPil, self._issueTime, linePos,\
|
self._productPil, self._issueTime, linePos,\
|
||||||
self._completeProductPil = self._getPilAndDTG()
|
self._completeProductPil, self._issueTimeStr = self._getPilAndDTG()
|
||||||
|
|
||||||
# If this is a WCL - don't go any further. Run WCL procedure and exit.
|
# If this is a WCL - don't go any further. Run WCL procedure and exit.
|
||||||
if self._productPil[0:3] == "WCL":
|
if self._productPil[0:3] == "WCL":
|
||||||
endpoint = "WCLWatch"
|
endpoint = "WCLWatch"
|
||||||
|
@ -182,9 +184,9 @@ class StdWarningDecoder():
|
||||||
purgeTime = None
|
purgeTime = None
|
||||||
self._checkForDTG(ugcString)
|
self._checkForDTG(ugcString)
|
||||||
if self._hasDTG:
|
if self._hasDTG:
|
||||||
purgeTime = self._dtgFromDDHHMM(ugcString[-7:-1])
|
purgeTime = ugcString[-7:-1]
|
||||||
else:
|
else:
|
||||||
purgeTime = self._getPurgeTimeFromVTEC(vtecStrings)
|
purgeTime = self._getPurgeTimeStrFromVTEC(vtecStrings)
|
||||||
vtecList = self._expandVTEC(ugcString, vtecStrings, segCount,
|
vtecList = self._expandVTEC(ugcString, vtecStrings, segCount,
|
||||||
segText, cities, purgeTime)
|
segText, cities, purgeTime)
|
||||||
segCount = segCount + 1
|
segCount = segCount + 1
|
||||||
|
@ -202,13 +204,13 @@ class StdWarningDecoder():
|
||||||
else:
|
else:
|
||||||
self._hasDTG = False
|
self._hasDTG = False
|
||||||
|
|
||||||
def _getPurgeTimeFromVTEC(self, vtecStrings):
|
def _getPurgeTimeStrFromVTEC(self, vtecStrings):
|
||||||
for vtecS, hvtec in vtecStrings:
|
for vtecS, hvtec in vtecStrings:
|
||||||
search = re.search(self._vtecRE, vtecS)
|
search = re.search(self._vtecRE, vtecS)
|
||||||
#print "getting time from ", search.group(8)[-2:] + search.group(9)
|
#print "getting time from ", search.group(8)[-2:] + search.group(9)
|
||||||
endTime = self._dtgFromDDHHMM(str(search.group(8)[-2:]) + str(search.group(9)))
|
timeStr = str(search.group(8)[-2:]) + str(search.group(9))
|
||||||
return endTime
|
return timeStr
|
||||||
return 0
|
return None
|
||||||
|
|
||||||
def _usage(self):
|
def _usage(self):
|
||||||
#Prints out usage information if started without sufficient command
|
#Prints out usage information if started without sufficient command
|
||||||
|
@ -397,7 +399,7 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
||||||
LogStream.logVerbose("Pil=", pil_search.group(0))
|
LogStream.logVerbose("Pil=", pil_search.group(0))
|
||||||
return (self._lines[count+1][0:3],
|
return (self._lines[count+1][0:3],
|
||||||
self._dtgFromDDHHMM(dtg_search.group(1)), count+2,
|
self._dtgFromDDHHMM(dtg_search.group(1)), count+2,
|
||||||
pil_search.group(0))
|
pil_search.group(0), dtg_search.group(1))
|
||||||
count = count + 1
|
count = count + 1
|
||||||
if count >= len(self._lines)-1:
|
if count >= len(self._lines)-1:
|
||||||
LogStream.logProblem("Did not find either the product DTG" +\
|
LogStream.logProblem("Did not find either the product DTG" +\
|
||||||
|
@ -405,7 +407,11 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
||||||
LogStream.exc())
|
LogStream.exc())
|
||||||
raise Exception, "Product DTG or Pil missing"
|
raise Exception, "Product DTG or Pil missing"
|
||||||
|
|
||||||
def _dtgFromDDHHMM(self, dtgString):
|
def _dtgFromDDHHMM(self, dtgString, baseTime=None):
|
||||||
|
if dtgString is None:
|
||||||
|
return 0.0
|
||||||
|
if baseTime is None :
|
||||||
|
baseTime = self._time
|
||||||
#utility function taking a ddhhmm string
|
#utility function taking a ddhhmm string
|
||||||
#group1=day, group2=hour, group3=minute
|
#group1=day, group2=hour, group3=minute
|
||||||
#returns a time object
|
#returns a time object
|
||||||
|
@ -413,9 +419,9 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
||||||
wmo_hour = int(dtgString[2:4])
|
wmo_hour = int(dtgString[2:4])
|
||||||
wmo_min = int(dtgString[4:6])
|
wmo_min = int(dtgString[4:6])
|
||||||
|
|
||||||
gmtuple = time.gmtime(self._time)
|
gmtuple = time.gmtime(baseTime)
|
||||||
wmo_year = gmtuple[0] #based on current time
|
wmo_year = gmtuple[0]
|
||||||
wmo_month = gmtuple[1] #based on current time
|
wmo_month = gmtuple[1]
|
||||||
current_day = gmtuple[2]
|
current_day = gmtuple[2]
|
||||||
if current_day - wmo_day > 15:
|
if current_day - wmo_day > 15:
|
||||||
# next month
|
# next month
|
||||||
|
@ -773,6 +779,9 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
||||||
template['seg'] = segment
|
template['seg'] = segment
|
||||||
startTime, zeros = self._calcTime(search.group(6),
|
startTime, zeros = self._calcTime(search.group(6),
|
||||||
search.group(7), self._issueTime * 1000)
|
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),
|
endTime, ufn = self._calcTime(search.group(8),
|
||||||
search.group(9), self._maxFutureTime * 1000)
|
search.group(9), self._maxFutureTime * 1000)
|
||||||
template['startTime'] = long(startTime)
|
template['startTime'] = long(startTime)
|
||||||
|
@ -782,7 +791,7 @@ usage: VTECDecoder -f productfilename -d -a activeTableName
|
||||||
else:
|
else:
|
||||||
template['ufn'] = False
|
template['ufn'] = False
|
||||||
template['officeid'] = search.group(2)
|
template['officeid'] = search.group(2)
|
||||||
template['purgeTime'] = long(purgeTime * 1000)
|
template['purgeTime'] = long(self._dtgFromDDHHMM(purgeTime, self._issueTime)*1000)
|
||||||
template['issueTime'] = long(self._issueTime * 1000)
|
template['issueTime'] = long(self._issueTime * 1000)
|
||||||
template['state'] = "Decoded"
|
template['state'] = "Decoded"
|
||||||
template['xxxid'] = self._completeProductPil[3:]
|
template['xxxid'] = self._completeProductPil[3:]
|
||||||
|
|
Loading…
Add table
Reference in a new issue