13.2.1-14 baseline

Former-commit-id: 00ce32ea21 [formerly 00ce32ea21 [formerly 101c9de4e57be6c25dab4f1e6d9158a33ca89005]]
Former-commit-id: af22cfad98
Former-commit-id: d8775866a6
This commit is contained in:
Steve Harris 2013-03-18 12:46:46 -04:00
parent caf1606e62
commit 7d7fe21803
8 changed files with 76 additions and 32 deletions

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.warngen.gis.AffectedAreas;
* moved the following methods from InitialLockingBehavior to this class:
* bulletIndices(), header(), firstBullet(), secondBullet(), getImmediateCausesPtrn();
* updated body(), header(), and secondBullet();
* Mar 13, 2013 DR 15892 D. Friedman Fix bullet parsing.
*
* </pre>
*
@ -141,10 +142,13 @@ abstract public class AbstractLockingBehavior implements ICommonPatterns {
private Integer[] bulletIndices() {
List<Integer> bulletIndices = new ArrayList<Integer>();
int index = text.indexOf("* ");
/* Assumes first line cannot be a bullet and that the '*' is
* at the start of a line.
*/
int index = text.indexOf("\n* ");
while (index >= 0) {
bulletIndices.add(index);
index = text.indexOf("* ", index + 2);
bulletIndices.add(index + 1);
index = text.indexOf("\n* ", index + 3);
}
return bulletIndices.toArray(new Integer[bulletIndices.size()]);

View file

@ -39,6 +39,8 @@ import com.raytheon.viz.warngen.gis.AffectedAreas;
* ------------ ---------- ----------- --------------------------
* Sep 24, 2012 15322 jsanchez Initial creation
* Jan 8, 2013 15664 Qinglu Lin Updated body().
* Mar 13, 2013 15892 D. Friedman Fix headline locking. Do not
* lock "AND" or "FOR".
*
* </pre>
*
@ -51,9 +53,7 @@ public class FollowUpLockingBehavior extends AbstractLockingBehavior {
*/
@Override
public void body() {
if (action != WarningAction.COR)
headlines();
else
super.body();
}
@ -66,7 +66,7 @@ public class FollowUpLockingBehavior extends AbstractLockingBehavior {
// should be blank.
Pattern headlinePtrn = Pattern
.compile(
"^\\.\\.\\.(A|THE) (.*) (WARNING|ADVISORY) .*(REMAINS|EXPIRE|CANCELLED).*(\\.\\.\\.)$",
"^\\.\\.\\.(AN?|THE) (.*) (WARNING|ADVISORY) .*(REMAINS|EXPIRE|CANCELLED).*(\\.\\.\\.)$",
Pattern.MULTILINE);
Matcher m = headlinePtrn.matcher(text);
@ -187,16 +187,8 @@ public class FollowUpLockingBehavior extends AbstractLockingBehavior {
+ LOCK_START + "..." + LOCK_END;
}
// Locks warning type (i.e. SEVERE THUNDERSTORM)
headline = headline.replaceAll("(A|THE) (" + warningType + ")",
LOCK_START + "$0" + LOCK_END);
// Locks the 'FOR' in the headline
headline = headline.replaceFirst(" FOR ", " " + LOCK_START + "FOR"
+ LOCK_END + " ");
// Locks the 'AND' in the headline
headline = headline.replaceFirst(" AND ", " " + LOCK_START + "AND"
+ LOCK_END + " ");
headline = headline.replaceAll("(AN?|THE)( [\\w\\s]*?)(" + warningType + ")",
LOCK_START + "$1" + LOCK_END + "$2" + LOCK_START + "$3" + LOCK_END);
return headline;
}

View file

@ -32,6 +32,7 @@ import java.util.regex.Pattern;
* ------------ ---------- ----------- --------------------------
* Sep 24, 2012 15332 jsanchez Initial creation
* Oct 18, 2012 15332 jsanchez Replaced listOfAreaNamesPtrn with String pattern.
* Mar 13, 2013 DR 15892 D. Friedman Allow some punctuation in area names.
*
* </pre>
*
@ -55,7 +56,7 @@ public interface ICommonPatterns {
// LOCK_END can be added at the start of the line if a previous line has
// been locked.
public static final String listOfAreaName = "^((" + LOCK_END
+ "){0,1}(((\\w+\\s{1})+\\w{2}-)*((\\w+\\s{1})+\\w{2}-)))";
+ "){0,1}((([\\w\\./'-]+\\s{1})+\\w{2}-)*(([\\w\\./'-]+\\s{1})+\\w{2}-)))";
// LOCK_END should not be found at the beginning of a first bullet since the
// previous line should be blank.

View file

@ -340,7 +340,7 @@ public class FipsUtil {
* @param fips
* @return
*/
private static ArrayList<String> getListCounties(String fips) {
public static ArrayList<String> getListCounties(String fips) {
ArrayList<String> rval = new ArrayList<String>();
String matchStr = "";

View file

@ -28,6 +28,7 @@ import com.raytheon.viz.warngen.text.ICommonPatterns;
* ------------ ---------- ----------- --------------------------
* Jul 22, 2008 #1284 bwoodle Initial creation
* Oct 18, 2012 15332 jsanchez Fixed refactor bugs.
* Mar 13, 2013 DR 15892 D. Friedman Handle SMW format in canceledAreasFromText
*
* </pre>
*
@ -43,6 +44,8 @@ public class FollowUpUtil {
public static final Pattern vtecPtrn = Pattern
.compile("/[OTEX]\\.([A-Z]{3})\\.[A-Za-z0-9]{4}\\.[A-Z]{2}\\.[WAYSFON]\\.\\d{4}\\.\\d{6}T\\d{4}Z-\\d{6}T\\d{4}Z/");
private static final String SMW_CANCELED_AREAS_HEADER = "THE AFFECTED AREAS WERE...";
/**
* This method checks whether a particular followup should be available
* given a Warning Record, a vtec Action, and a template configuration
@ -173,7 +176,8 @@ public class FollowUpUtil {
String headline = "";
Pattern listOfAreaNamePtrn = Pattern
.compile(ICommonPatterns.listOfAreaName);
for (String line : originalText.trim().split("\n")) {
String[] splitLines = originalText.trim().split("\n");
for (String line : splitLines) {
if (line.contains("TEST") || line.trim().length() == 0) {
continue;
}
@ -198,8 +202,15 @@ public class FollowUpUtil {
headline += line;
}
}
String[] ugcs = ugcLine.split("-");
String[] names = namesLine.split("-");
String[] ugcs = FipsUtil.getListCounties(ugcLine).toArray(new String[0]);
String[] names;
boolean smwAreas = false;
if (namesLine.length() > 0)
names = namesLine.split("-");
else {
names = parseSMWCanceledAreas(splitLines);
smwAreas = true;
}
String[] areas = headline.split("\\.\\.\\.");
ArrayList<AffectedAreas> al = new ArrayList<AffectedAreas>();
@ -223,12 +234,20 @@ public class FollowUpUtil {
}
}
if (ugc.length() < 3)
continue; // TODO: log?
fips = ugc.substring(ugc.length() - 3);
if (i < names.length) {
if (!smwAreas && names[i].length() >= 3) {
name = names[i].substring(0, names[i].length() - 3);
stateAbbreviation = names[i].substring(names[i].length() - 2);
} else {
name = names[i];
}
} else
break;
if (name != null) {
for (String area : areas) {
@ -334,4 +353,32 @@ public class FollowUpUtil {
return rval;
}
/** Parses the canceled areas of an SMW, which have a different format
* from other products.
*/
private static String[] parseSMWCanceledAreas(String[] splitLines) {
StringBuilder text = new StringBuilder(64);
boolean inAreas = false;
for (String line : splitLines) {
String trimmedLine = line.trim();
if (SMW_CANCELED_AREAS_HEADER.equals(trimmedLine))
inAreas = true;
else if (inAreas) {
if (trimmedLine.length() > 0) {
text.append(trimmedLine);
text.append('\n');
} else
break;
}
}
int len = text.length();
if (len >= 4 && "...\n".equals(text.substring(len - 4)))
text.delete(len - 4, len);
String[] areas = text.toString().split("\\.\\.\\.\\n");
// Unwrap lines.
for (int i = 0; i < areas.length; ++i)
areas[i] = areas[i].replace("\n", " ");
return areas;
}
}

View file

@ -5,6 +5,7 @@
##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime.
##### D. Friedman 11-09-2012 DR 15430. Rework included watches.
##### QINGLU LIN 12-27-2012 DR 15594. Added $lock to headlineLocList.
##### D. Friedman 03-13-2013 DR 15892. Do not lock portion of state in firstBullet.
####################################################################################################
Mile Marker Test Code
macro "mmarkers" use (called out of VM_global_library.vm):
@ -750,7 +751,7 @@ THE ${area.name}##
#if(${intFIPS.parseInt($FIPS)} < 500 || ${area.stateabbr} == "TX")
<L>${area.name} ${area.areaNotation}</L> IN #areaFormat(${area.partOfParentRegion} true false) <L>${area.parentRegion}...</L>
#else
<L>${area.name}</L> IN <L>#areaFormat(${area.partOfParentRegion} true false) ${area.parentRegion}...</L>
<L>${area.name}</L> IN #areaFormat(${area.partOfParentRegion} true false) <L>${area.parentRegion}...</L>
#end
#end
## COMMENTED OUT 5 LINES BELOW THIS IS GENERALLY NOT UTILIZED - you can unREMARK if desired

View file

@ -4,6 +4,7 @@
## Evan Bookbinder 4-25-2012 for OB 12.3.1 (corText)
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad
## Qinglu Lin 12-27-2012 DR 15594. Appended true to headlineLocList's parameter list.
## D. Friedman 03-13-2013 DR 15892. Use printcoords.
################################################
##
### CREATE PHRASING DEPENDING ON WHETHER WE ISSUE EXP PRIOR TO EXPIRATION TIME OR NOT
@ -482,10 +483,7 @@ THIS IS A TEST MESSAGE.##
THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#end
LAT...LON ##
#foreach(${coord} in ${areaPoly})
#llFormat(${coord.y}) #llFormat(${coord.x}) ##
#end
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##

View file

@ -8,6 +8,7 @@
## Evan Bookbinder 4-25-2012 for OB 12.3.1 (MND)
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## Qinglu Lin 12-27-2012 DR 15594. Appended true to headlineLocList's parameter list.
## D. Friemdan 13-03-2013 DR 15892. Do not lock locations in headline.
######################################################
##
##SET SOME INITIAL VARIABLES
@ -120,7 +121,7 @@ THIS IS A TEST MESSAGE. ##
#end
#if(${windSpeed} >= 40 || ${hailSize} >= 0.70)
...SIGNIFICANT WEATHER ADVISORY FOR ##
#headlineLocList(${areas} true false true false true) #secondBullet(${dateUtil},${expire},${timeFormat},${localtimezone},${secondtimezone})
#headlineLocList(${areas} true false true false false) #secondBullet(${dateUtil},${expire},${timeFormat},${localtimezone},${secondtimezone})
...##
#elseif(${windSpeed} == 0 && ${hailSize} == 0)
!** YOU DID NOT SELECT ANY WIND OR HAIL THREATS. PLEASE RE-GENERATE THIS ADVISORY **!