Issue #1782 Merge branch 'master_13.3.1' (13.3.1-9) into omaha_13.3.1

Conflicts:
	edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/FFMPGenerator.java

Change-Id: I86cba73da17ae0e057240abcfc2ba84b36a054bb

Former-commit-id: dc7b231bf0 [formerly 90f7f2110b] [formerly dc7b231bf0 [formerly 90f7f2110b] [formerly 3cdbfa3f25 [formerly 410c1d3ca42abf207615fb6ab3e8135c6f661461]]]
Former-commit-id: 3cdbfa3f25
Former-commit-id: 01c6ff12a0 [formerly bd17b99bd1]
Former-commit-id: 8299b2872a
This commit is contained in:
Dave Hladky 2013-03-20 12:41:33 -05:00
commit 1aef08f449
14 changed files with 174 additions and 76 deletions

View file

@ -60,6 +60,9 @@
# Status: TEST
# Title: AvnFPS: tpo indicator not monitoring properly
#
# Date Ticket# Engineer Description
# ------------- ---------- ----------- --------------------------
# Feb. 21, 2013 15834 zhao Modified for CCFP 8hr data
#
import logging, time
import Avn, AvnLib, Globals, MonitorP
@ -68,10 +71,10 @@ import CCFPData
_Logger = logging.getLogger(__name__)
_Code = { \
'tops': {1: '370+ ', 2: '310-370', 3: '250-310'}, \
'gwth': {1: '++', 2: '+ ', 3: 'NC', 4: '- '}, \
'tops': {1: '400+ ', 2: '350-390', 3: '300-340', 4: '250-290'}, \
'gwth': {1: '+ ', 2: 'NC', 3: '- '}, \
'conf': {1: 'HIGH', 3: 'LOW'}, \
'cvrg': {1: '75-100%', 2: ' 50-74%', 3: ' 25-49%'}, \
'cvrg': {1: '75-100%', 2: ' 40-74%', 3: ' 25-39%'}, \
}
##############################################################################
@ -82,7 +85,7 @@ class Monitor(MonitorP.Monitor):
def __makeData(self, data):
# 6 hour forecast
tstart = (time.time()//3600.0 + 1) * 3600.0
tend = tstart + 7*3600.0 - 10.0
tend = tstart + 9*3600.0 - 10.0
seq = [{'time': t} for t in Avn.frange(tstart, tend, 3600.0)]
fcst, text = {}, []
try:

View file

@ -25,7 +25,9 @@
menuText="Convective SIGMET" id="ConvSigmet">
<dataURI>/convsigmet/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/BufrNcwf.xml" menuText="NCWF" id="NCWF">
<dataURI>/bufrncwf/%</dataURI>
</contribute>
<contribute xsi:type="separator" id="separator1"/>
<contribute xsi:type="titleItem" titleText="------ Icing Products ------" />

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,10 +53,8 @@ public class FollowUpLockingBehavior extends AbstractLockingBehavior {
*/
@Override
public void body() {
if (action != WarningAction.COR)
headlines();
else
super.body();
headlines();
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

@ -346,7 +346,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>();
@ -222,13 +233,21 @@ public class FollowUpUtil {
areasNotation = "COUNTIES";
}
}
if (ugc.length() < 3)
continue; // TODO: log?
fips = ugc.substring(ugc.length() - 3);
if (i < names.length) {
name = names[i].substring(0, names[i].length() - 3);
stateAbbreviation = names[i].substring(names[i].length() - 2);
}
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 **!

View file

@ -70,6 +70,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
* ------------ ---------- ----------- --------------------------
* Dec 3, 2010 rjpeter Initial creation
* Mar 07, 2013 1587 bsteffen rewrite static data generation.
* Mar 14, 2013 1587 bsteffen Fix persisting to datastore.
*
* </pre>
*
@ -267,7 +268,7 @@ public class StaticDataGenerator {
for (GridRecord staticRecord : datastoreRecords) {
populateMessageData(staticRecord);
}
dao.persistToHDF5(databaseRecords.toArray(new PluginDataObject[0]));
dao.persistToHDF5(datastoreRecords.toArray(new PluginDataObject[0]));
}
if (!databaseRecords.isEmpty()) {
dao.persistToDatabase(databaseRecords
@ -423,7 +424,8 @@ public class StaticDataGenerator {
datasets = Collections.emptyList();
}
}
if (datasets.contains(missing)) {
if (!datasets.contains(staticRecord.getParameter()
.getAbbreviation())) {
missing.add(staticRecord);
}
}

View file

@ -8,8 +8,8 @@
<bean id="ffmpThreadPool"
class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="2" />
<property name="maxPoolSize" value="4" />
<property name="corePoolSize" value="1" />
<property name="maxPoolSize" value="1" />
<property name="keepAliveSeconds" value="60000" />
</bean>

View file

@ -119,6 +119,7 @@ import com.raytheon.uf.edex.plugin.ffmp.common.FFTIRatioDiff;
* 02/01/13 1569 D. Hladky Added constants, switched to using aggregate records written through pypies
* 02/20/13 1635 D. Hladky Added some finally methods to increase dead lock safety. Reduced wait times for threads.
* 02/25/13 1660 D. Hladky Redesigned data flow for FFTI in order to have only one mosaic piece in memory at a time.
* 03/13/13 1478 D. Hladky non-FFTI mosaic containers weren't getting ejected. Made it so that they are ejected after processing as well.
* </pre>
*
* @author dhladky
@ -701,40 +702,51 @@ public class FFMPGenerator extends CompositeProductGenerator implements
fftiSources.add(ffmp.getFFTISource());
ffti.processFFTI();
}
// Do the accumulation now, more memory efficient.
// Only one piece in memory at a time
for (String attribute : ffmp.getAttributes()) {
if (attribute.equals(ATTRIBUTE.ACCUM
.getAttribute())) {
FFTIAccum accum = getAccumulationForSite(
ffmpProduct.getDisplayName(),
siteKey, dataKey,
fftiSource.getDurationHour(),
ffmpProduct.getUnit(siteKey));
if (statusHandler
.isPriorityEnabled(Priority.DEBUG)) {
statusHandler
.debug("Accumulating FFTI for source: "
+ ffmpProduct
.getDisplayName()
+ " site: "
+ siteKey
+ " data: "
+ dataKey
+ " duration: "
+ fftiSource
.getDurationHour()
+ " accumulation: "
+ accum.getAccumulation());
}
}
}
// Do the accumulation now, more memory efficient.
// Only one piece in memory at a time
for (String attribute : ffmp.getAttributes()) {
if (attribute.equals(ATTRIBUTE.ACCUM
.getAttribute())) {
FFTIAccum accum = getAccumulationForSite(
ffmpProduct.getDisplayName(),
siteKey, dataKey,
fftiSource.getDurationHour(),
ffmpProduct.getUnit(siteKey));
if (statusHandler
.isPriorityEnabled(Priority.DEBUG)) {
statusHandler
.debug("Accumulating FFTI for source: "
+ ffmpProduct
.getDisplayName()
+ " site: "
+ siteKey
+ " data: "
+ dataKey
+ " duration: "
+ fftiSource
.getDurationHour()
+ " accumulation: "
+ accum.getAccumulation());
}
}
}
}
} // record not null
} // end sitekey for loop
} // end datakey loop
} // end process
SourceXML source = getSourceConfig().getSource(
ffmpRec.getSourceName());
if (!source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
String sourceSiteDataKey = getSourceSiteDataKey(source,
dataKey, ffmpRec);
ffmpData.remove(sourceSiteDataKey);
statusHandler.info("Removing from memory: "+sourceSiteDataKey);
}
}
}
}
}
}
/**
@ -1816,6 +1828,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
ffmpData.remove(siteDataKey);
statusHandler.info("Removing from memory: "+siteDataKey);
accumulator.setReset(false);
writeFFTIData(siteDataKey, accumulator);
}
@ -1966,6 +1979,7 @@ public class FFMPGenerator extends CompositeProductGenerator implements
// replace or insert it
ffmpData.remove(qpeSiteSourceDataKey);
statusHandler.info("Removing from memory: "+qpeSiteSourceDataKey);
values.setReset(false);
writeFFTIData(siteDataKey, values);
}
@ -2001,5 +2015,34 @@ public class FFMPGenerator extends CompositeProductGenerator implements
}
}
}
/**
* Find siteSourceDataKey
*
* @param source
* @param dataKey
* @param ffmpRec
* @return
*/
private String getSourceSiteDataKey(SourceXML source, String dataKey, FFMPRecord ffmpRec) {
String sourceName = source.getSourceName();
String sourceSiteDataKey = null;
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
sourceName = source.getDisplayName();
sourceSiteDataKey = sourceName;
} else {
sourceName = ffmpRec.getSourceName();
sourceSiteDataKey = sourceName + "-" + ffmpRec.getSiteKey()
+ "-" + dataKey;
}
return sourceSiteDataKey;
}
}

View file

@ -66,6 +66,7 @@ import com.raytheon.uf.edex.database.plugin.PluginDao;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 4/7/09 1994 bphillip Initial Creation
* Mar 14, 2013 1587 bsteffen Fix static data persisting to datastore.
*
* </pre>
*
@ -99,10 +100,13 @@ public class GridDao extends PluginDao {
long[] sizes = new long[] { location.getNx(), location.getNy() };
String abbrev = gridRec.getParameter().getAbbreviation();
String group = gridRec.getDataURI();
String datasetName = "Data";
if (GridPathProvider.STATIC_PARAMETERS.contains(abbrev)) {
group = "/" + location.getId();
datasetName = abbrev;
}
AbstractStorageRecord storageRecord = new FloatDataRecord("Data",
AbstractStorageRecord storageRecord = new FloatDataRecord(
datasetName,
group, (float[]) messageData, 2, sizes);
storageRecord.setCorrelationObject(gridRec);