Merge branch 'master_14.2.4' (14.2.4-12) into omaha_14.2.4

Former-commit-id: b1931ae7dc [formerly 9bc599dd5481360d7a00b9c8455805893922127d]
Former-commit-id: 38daf108e6
This commit is contained in:
Steve Harris 2014-09-22 22:06:05 -05:00
commit 7aa6719ca2
6 changed files with 123 additions and 67 deletions

View file

@ -1223,6 +1223,8 @@
levelTwoValue="0" />
<DatabaseLevel levelName="BL" levelOneValue="180"
levelTwoValue="0" />
<DatabaseLevel levelName="BL" levelOneValue="255"
levelTwoValue="0" />
<DatabaseLevel levelName="FHAG" levelOneValue="0"
levelTwoValue="30" />
</Level>

View file

@ -78,6 +78,8 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 28, 2014 ASM #15658 D. Friedman Add marine zones.
* Aug 29, 2014 ASM #15551 Qinglu Lin Sort watches by ETN and filter out ActiveTableRecord
* with act of CAN and EXP in processRecords().
* Sep 12, 2014 ASM #15551 Qinglu Lin Prevent a county's WOU from being used while its
* corresponding WCN is canceled or expired.
*
* </pre>
*
@ -307,6 +309,8 @@ public class WatchUtil {
InstantiationException {
List<ActiveTableRecord> records = new ArrayList<ActiveTableRecord>(
response.getNumResults());
Map<Pair<String, String>, Set<String>> removedUgczones = new HashMap<Pair<String, String>, Set<String>>();
Set<String> ugczones = null;
for (Map<String, Object> result : response.getResults()) {
WarningAction action = WarningAction.valueOf(String.valueOf(result
.get(ACTION)));
@ -316,7 +320,7 @@ public class WatchUtil {
* fixed the underlying system. request.addConstraint("act", new
* RequestConstraint("CAN", ConstraintType.NOT_EQUALS));
*/
if (action != WarningAction.CAN || action != WarningAction.EXP) {
if (action != WarningAction.CAN && action != WarningAction.EXP) {
ActiveTableRecord record = entityClass.newInstance();
record.setIssueTime((Calendar) result.get(ISSUE_TIME_FIELD));
record.setStartTime((Calendar) result.get(START_TIME_FIELD));
@ -327,6 +331,37 @@ public class WatchUtil {
record.setEtn(String.valueOf(result.get(ETN)));
record.setAct(String.valueOf(result.get(ACTION)));
records.add(record);
} else {
Pair<String, String> key = new Pair<String, String>(null, null);
key.setFirst(String.valueOf(result.get(ETN)));
key.setSecond(String.valueOf(result.get(PHEN_SIG_FIELD)));
ugczones = removedUgczones.get(key);
if (ugczones == null) {
ugczones = new HashSet<String>();
}
ugczones.add(String.valueOf(result.get(UGC_ZONE_FIELD)));
removedUgczones.put(key, ugczones);
}
}
// remove ActiveTableRecord from records whose etn, ugcZone, and phensig is same as
// canceled or expired.
String etn, ugczone, phensig;
for (Pair<String, String> etnPhensig: removedUgczones.keySet()) {
ugczones = removedUgczones.get(etnPhensig);
etn = etnPhensig.getFirst();
phensig = etnPhensig.getSecond();
Iterator<String> iter = ugczones.iterator();
while (iter.hasNext()) {
ugczone = iter.next();
Iterator<ActiveTableRecord> iterator = records.iterator();
while (iterator.hasNext()) {
ActiveTableRecord atr = iterator.next();
if (atr.getEtn().equals(etn) && atr.getUgcZone().equals(ugczone) &&
atr.getPhensig().equals(phensig)) {
iterator.remove();
}
}
}
}
@ -361,9 +396,6 @@ public class WatchUtil {
Map<Watch, List<String>> map = new HashMap<Watch, List<String>>();
// For each watch event, get the end time and list of active zones
for (ActiveTableRecord ar : activeTableRecords) {
if (ar.getAct().equals("CAN") || ar.getAct().equals("EXP")) {
continue;
}
/*
* Currently reports all zones in the watch even if a given zone is
* not in the warning polygon. If the logic is changed to only show

View file

@ -213,6 +213,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 07/28/2014 DR 17475 Qinglu Lin Updated populateStrings() and findLargestQuadrant(), removed findLargestGeometry(),
* added createAreaAndCentroidMaps() and movePopulatePt(), updated paintText() to center W.
* 08/20/2014 ASM #16703 D. Friedman Make geo feature types for watches explicit
* 09/10/2014 ASM #16730 D. Friedman Fix NPE.
* </pre>
*
* @author mschenke
@ -340,10 +341,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
private Set<String> getAllFipsInArea(Geometry warningArea) {
Set<String> fipsIds = new HashSet<String>();
if (warningArea != null) {
for (int n = 0; n < warningArea.getNumGeometries(); ++n) {
Geometry area = warningArea.getGeometryN(n);
fipsIds.add(getFips(area));
}
}
return fipsIds;
}

View file

@ -141,8 +141,6 @@ import com.vividsolutions.jts.io.WKTReader;
* added determineAffectedMarinePortions().
* Jul 21, 2014 3419 jsanchez Refactored WatchUtil.
* Aug 15, 2014 DR15701 mgamazaychikov Removed static field watchUtil.
* Aug 28, 2014 ASM #15551 Qinglu Lin Replaced 1200 PM/1200 AM by NOON/MIDNIGHT, removed days in
* included tornado/severe thunderstorm watch message.
* </pre>
*
* @author njensen
@ -874,37 +872,7 @@ public class TemplateRunner {
System.out.println("velocity time: "
+ (System.currentTimeMillis() - tz0));
String watches[] = {"TORNADO WATCH", "SEVERE THUNDERSTORM WATCH"};
int index1 = -1, index2 = -1, index1ToUse = -1;
String doubleDollar = "$$";
boolean firstTime = true;
for (String s: watches) {
index1 = script.indexOf(s, 0);
if (index1 > 0) {
index2 = script.indexOf(doubleDollar, index1);
}
if (firstTime && index1 > -1) {
index1ToUse = index1;
firstTime = false;
}
}
String days[] = {"SUNDAY", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY"};
String substring = "", text;
if (index1ToUse > -1 && index2 > -1) {
substring = script.substring(index1ToUse, index2).toUpperCase();
// remove day
for (String day: days) {
substring = substring.replaceAll(day + " ", "");
}
// replace 1200 PM/1200 AM with NOON/MIDNIGHT
substring = substring.replaceAll("1200 PM", "NOON");
substring = substring.replaceAll("1200 AM", "MIDNIGHT");
// concatenate strings
text = script.substring(0, index1ToUse - 1);
text = text + " " + substring + script.substring(index2, script.length());
} else {
text = script.toString();
}
String text = script.toString();
WarningTextHandler handler = WarningTextHandlerFactory.getHandler(
selectedAction, text, config.getAutoLockText());
String handledText = handler.handle(text, areas, cancelareas,

View file

@ -37,6 +37,7 @@ import com.raytheon.viz.texteditor.TextWarningConstants;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06182008 bwoodle additional format method overloads, javadocs.
* Sep 12, 2014 ASM RM#15551 Qinglu Lin Added formatUseNoonMidnight().
*
* </pre>
*
@ -45,6 +46,8 @@ import com.raytheon.viz.texteditor.TextWarningConstants;
*/
public class DateUtil {
Pattern timePtrn = Pattern.compile("(1200\\s(AM|PM))");
/**
* Format a date for the severe weather warnings templates
*
@ -107,6 +110,28 @@ public class DateUtil {
return str;
}
public String formatUseNoonMidnight(Date date, DateFormat format, int interval, String tz) {
return formatUseNoonMidnight(date, format, interval, getTimeZoneFromString(tz));
}
public String formatUseNoonMidnight(Date date, DateFormat format, int interval, TimeZone tz) {
String str;
Date workingDate = date;
if (interval > 0) {
workingDate = roundDate(date, interval);
}
synchronized (format) {
format.setTimeZone(tz);
str = format.format(workingDate);
}
Matcher m = timePtrn.matcher(str);
if(m.find()) {
str = str.replace("1200 AM", "MIDNIGHT");
str = str.replace("1200 PM", "NOON");
}
return str;
}
/**
* Format a date for the severe weather warnings templates
*

View file

@ -13,7 +13,7 @@
##### Qinglu Lin 03-17-2014 DR 16309. Updated inserttorwatches and insertsvrwatches.
##### Qinglu Lin 05-21-2014 DR 16309. Updated inserttorwatches and insertsvrwatches by changing 'FOR##' to 'FOR ##'.
##### D. Friedman 08-28-2014 ASM #15658. Add marine watch wording.
##### Qinglu Lin 08-29-2014 ASM #15551. Overhauled inserttorwatches and insertsvrwatches.
##### Qinglu Lin 09-15-2014 ASM #15551. Overhauled inserttorwatches and insertsvrwatches, added until.
####################################################################################################
#*
Mile Marker Test Code
@ -200,25 +200,35 @@ ${drainage.name}##
#end
#end
#set($etns = [])
#set($lastTime = "")
#set($currTime = "")
#set($lastEtn = "")
#set($lastEndTime = "")
#set($count = 0)
#foreach(${watch} in ${tornadoWatches})
#if($lastEtn != "" && ${watch.etn} != ${lastEtn})
#set($success = $etns.add(${watch.etn}))
#end
#foreach(${watch} in ${tornadoWatches})
#set($count = $count + 1)
#if(${lastEtn} != "" && ${watch.etn} != ${lastEtn})
. ##
#end
#set($endTime = ${watch.endTime})
#if(${watch.etn} == ${lastEtn})
#if(${endTime} == ${lastEndTime})
...##
#else
...UNTIL ${dateUtil.format(${endTime}, ${timeFormat.plain}, 15, ${localtimezone})} FOR ##
#end
#else
A TORNADO WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${endTime}, ${timeFormat.plain}, 15, ${localtimezone})} FOR ##
#if(${watch.etn} != ${lastEtn})
#set($lastTime = "#until(${endTime}, ${timeFormat}, ${secondtimezone}, ${watch})")
A TORNADO WATCH${ALSO} REMAINS IN EFFECT ${lastTime}##
#set($ALSO = " ALSO")
#else
#if(!$foreach.hasNext() || ${watch.etn} != $etns.get(${count}))
AND ##
#else
...##
#end
#set($currTime = "#until(${endTime}, ${timeFormat}, ${secondtimezone}, ${watch})")
#if(${currTime} != ${lastTime})
${currTime}##
#set($lastTime = ${currTime})
#end
#if(${secondtimezone})
/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end
#if(!${watch.marineAreas})
#areaFormat(${watch.partOfState} true false true)${watch.state}##
@ -226,7 +236,6 @@ A TORNADO WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${endTime}, ${t
#formatMarineAreas(${watch.marineAreas})
#end
#set($lastEtn = ${watch.etn})
#set($lastEndTime = ${watch.endTime})
#end
#if(${lastEtn} != "")
.
@ -234,6 +243,14 @@ A TORNADO WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${endTime}, ${t
#end
########END MACRO
#macro(until $endTime $timeFormat $secondtimezone $watch)
UNTIL ${dateUtil.formatUseNoonMidnight(${endTime}, ${timeFormat.clock}, 15, ${localtimezone})}##
#if(${secondtimezone})
/${dateUtil.formatUseNoonMidnight(${watch.getEndTime()}, ${timeFormat.clock}, 15, ${secondtimezone})}/##
#end
FOR ##
#end
#macro(insertsvrwatches $watches $list $secondtimezone $dateUtil $timeFormat)
#set($svrWatches = [])
#set($ALSO = "")
@ -244,25 +261,35 @@ A TORNADO WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${endTime}, ${t
#end
#end
#set($etns = [])
#set($lastTime = "")
#set($currTime = "")
#set($lastEtn = "")
#set($lastEndTime = "")
#set($count = 0)
#foreach(${watch} in ${svrWatches})
#if($lastEtn != "" && ${watch.etn} != ${lastEtn})
#set($success = $etns.add(${watch.etn}))
#end
#foreach(${watch} in ${svrWatches})
#set($count = $count + 1)
#if(${lastEtn} != "" && ${watch.etn} != ${lastEtn})
. ##
#end
#set($endTime = ${watch.endTime})
#if(${watch.etn} == ${lastEtn})
#if(${endTime} == ${lastEndTime})
...##
#else
...UNTIL ${dateUtil.format(${endTime}, ${timeFormat.plain}, 15, ${localtimezone})} FOR ##
#end
#else
A SEVERE THUNDERSTORM WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${endTime}, ${timeFormat.plain}, 15, ${localtimezone})} FOR ##
#if(${watch.etn} != ${lastEtn})
#set($lastTime = "#until(${endTime}, ${timeFormat}, ${secondtimezone}, ${watch})")
A SEVERE THUNDERSTORM WATCH${ALSO} REMAINS IN EFFECT ${lastTime}##
#set($ALSO = " ALSO")
#else
#if(!$foreach.hasNext() || ${watch.etn} != $etns.get(${count}))
AND ##
#else
...##
#end
#set($currTime = "#until(${endTime}, ${timeFormat}, ${secondtimezone}, ${watch})")
#if(${currTime} != ${lastTime})
${currTime}##
#set($lastTime = ${currTime})
#end
#if(${secondtimezone})
/${dateUtil.format(${watch.getEndTime()}, ${timeFormat.plain}, 15, ${secondtimezone})}/##
#end
#if(!${watch.marineAreas})
#areaFormat(${watch.partOfState} true false true)${watch.state}##
@ -270,7 +297,6 @@ A SEVERE THUNDERSTORM WATCH${ALSO} REMAINS IN EFFECT UNTIL ${dateUtil.format(${e
#formatMarineAreas(${watch.marineAreas})
#end
#set($lastEtn = ${watch.etn})
#set($lastEndTime = ${watch.endTime})
#end
#if(${lastEtn} != "")
.