Merge tag 'OB_16.2.1-23' into asm_16.2.1

16.2.1-23


Former-commit-id: 58689e4265e780a75c5e4c8e584afa27ea30e3f1
This commit is contained in:
Shawn.Hooper 2016-04-14 14:15:39 -04:00
commit e7d7a5df40
5 changed files with 126 additions and 86 deletions

View file

@ -19,6 +19,7 @@
# Last Modified: 10/30/15 by Joe Maloney, added -q flags to scp/ssh at end.
# Last Modified: 11/25/15 by Tom LeFebvre, added switch to run tool from a cron or interactively.
# Last Modified: 11/29/15 by P. Santos, completed adding code to enable running Run_NWPS interactively or from a cron.
# Last modified: 03/18/16 by Joe Maloney, a minor tweak to runManualNWPS_OutsideAWIPS call.
# ----------------------------------------------------------------------------
# The MenuItems list defines the GFE menu item(s) under which the
@ -216,5 +217,5 @@ class Procedure (SmartScript.SmartScript):
if cron:
os.system('ssh -q px2f /awips2/GFESuite/nwps/bin/runManualNWPS_OutsideAWIPS.sh '+GFEDomainname)
else:
os.system('xterm -e ssh -q px2f /awips2/GFESuite/nwps/bin/runManualNWPS_OutsideAWIPS.sh '+GFEDomainname)
os.system('nohup xterm -iconic -e ssh -q px2f /awips2/GFESuite/nwps/bin/runManualNWPS_OutsideAWIPS.sh '+GFEDomainname+' &')
shutil.rmtree('/tmp/nwps/'+GFEDomainname)

View file

@ -93,6 +93,7 @@ import com.vividsolutions.jts.io.WKBReader;
* 07/15/13 2184 dhladky Remove all HUC's for storage except ALL
* Nov 18, 2014 3831 dhladky StatusHandler logging. Proper list sizing. Geometry chunk sizing.
* Aug 08, 2015 4722 dhladky Improved Grid support.
* Apr 07, 2016 5491 tjensen Fix NullPointerException from getRawGeometries
* </pre>
*
* @author dhladky
@ -366,7 +367,8 @@ public class FFMPTemplates {
HashMap<String, FFMPVirtualGageBasinMetaData> protoMap = readVGBDomainMap(
dataKey, cwa);
String[] list = readVGBDomainList(dataKey, cwa);
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> map = new LinkedHashMap<String, FFMPVirtualGageBasinMetaData>(list.length, 1.0f);
LinkedHashMap<String, FFMPVirtualGageBasinMetaData> map = new LinkedHashMap<>(
list.length, 1.0f);
// construct ordered map
for (String lid : list) {
@ -416,13 +418,17 @@ public class FFMPTemplates {
list = null;
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: Write VGB: cwa: "+cwa+" dataKey: "+dataKey, se);
statusHandler.error("Serialization Exception: Write VGB: cwa: "
+ cwa + " dataKey: " + dataKey, se);
} catch (FileNotFoundException fnfe) {
statusHandler.error("File Not found Exception: Write VGB: cwa: "+cwa+" dataKey: "+dataKey, fnfe);
statusHandler.error("File Not found Exception: Write VGB: cwa: "
+ cwa + " dataKey: " + dataKey, fnfe);
} catch (IOException ioe) {
statusHandler.error("IO Exception: Write VGB: cwa: "+cwa+" dataKey: "+dataKey, ioe);
statusHandler.error("IO Exception: Write VGB: cwa: " + cwa
+ " dataKey: " + dataKey, ioe);
} catch (LocalizationOpFailedException e) {
statusHandler.error("Localization Exception: Write VGB: cwa: "+cwa+" dataKey: "+dataKey, e);
statusHandler.error("Localization Exception: Write VGB: cwa: "
+ cwa + " dataKey: " + dataKey, e);
}
}
@ -489,13 +495,19 @@ public class FFMPTemplates {
list = null;
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: Write Template: cwa: "+cwa+" dataKey:"+dataKey+" huc: "+huc, se);
statusHandler.error(
"Serialization Exception: Write Template: cwa: " + cwa
+ " dataKey:" + dataKey + " huc: " + huc, se);
} catch (FileNotFoundException fnfe) {
statusHandler.error("File Not found Exception: Write Template: cwa: "+cwa+" dataKey:"+dataKey+" huc: "+huc, fnfe);
statusHandler.error(
"File Not found Exception: Write Template: cwa: " + cwa
+ " dataKey:" + dataKey + " huc: " + huc, fnfe);
} catch (IOException ioe) {
statusHandler.error("IO Exception: Write Template: cwa: "+cwa+" dataKey:"+dataKey+" huc: "+huc, ioe);
statusHandler.error("IO Exception: Write Template: cwa: " + cwa
+ " dataKey:" + dataKey + " huc: " + huc, ioe);
} catch (LocalizationOpFailedException e) {
statusHandler.error("Localization Exception: Write Template: cwa: "+cwa+" dataKey:"+dataKey+" huc: "+huc, e);
statusHandler.error("Localization Exception: Write Template: cwa: "
+ cwa + " dataKey:" + dataKey + " huc: " + huc, e);
}
}
@ -846,7 +858,8 @@ public class FFMPTemplates {
}
}
} catch (Exception e) {
statusHandler.error("Find Basin by lon lat failed: dataKey: "+dataKey+ " coor:"+coor.toString(), e);
statusHandler.error("Find Basin by lon lat failed: dataKey: "
+ dataKey + " coor:" + coor.toString(), e);
}
return null;
@ -1010,7 +1023,8 @@ public class FFMPTemplates {
}
} catch (Exception e) {
statusHandler.error("Failed to lookup County: dataKey: "+dataKey, e);
statusHandler.error("Failed to lookup County: dataKey: " + dataKey,
e);
}
FFMPCounties counties = new FFMPCounties(countyList);
@ -1087,8 +1101,8 @@ public class FFMPTemplates {
rect = HRAPCoordinates.getHRAPCoordinates();
rect.setBounds(rect.x * primeSource.getHrapGridFactor(), rect.y
* primeSource.getHrapGridFactor(), rect.width
* primeSource.getHrapGridFactor(), rect.height
* primeSource.getHrapGridFactor(),
rect.width * primeSource.getHrapGridFactor(), rect.height
* primeSource.getHrapGridFactor());
HRAPSubGrid hrapgrid = new HRAPSubGrid(rect,
@ -1108,7 +1122,8 @@ public class FFMPTemplates {
} else if (primeSource.getDataType().equals(
FFMPSourceConfigurationManager.DATA_TYPE.GRID.getDataType())) {
// extract the Grid Coverage for use in site extents creation
GridCoverage coverage = FFMPUtils.getGridCoverageRecord(primeSource.getDataPath());
GridCoverage coverage = FFMPUtils.getGridCoverageRecord(primeSource
.getDataPath());
siteExtents = FFMPUtils.getGeometryText(coverage.getGeometry());
} else if (primeSource.getDataType().equals(
FFMPSourceConfigurationManager.DATA_TYPE.PDO.getDataType())) {
@ -1170,7 +1185,9 @@ public class FFMPTemplates {
getMaxExtent(), getSiteExtents(dataKey),
mode.getMode()));
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to create FFMP Template for this dataKey: "+dataKey, e);
statusHandler.handle(Priority.PROBLEM,
"Unable to create FFMP Template for this dataKey: "
+ dataKey, e);
}
} else if (huc.equals(FFMPRecord.COUNTY)) {
list = getCountyFips(cwa, dataKey);
@ -1243,7 +1260,8 @@ public class FFMPTemplates {
primary = true;
}
if (rawGeometries == null) {
if (rawGeometries == null
|| rawGeometries.isEmpty()) {
rawGeometries = getRawGeometries(dataKey, cwa);
}
@ -1753,7 +1771,7 @@ public class FFMPTemplates {
if (results != null && results.length > 0) {
if (pfafGeometries == null) {
pfafGeometries = new HashMap<Long, Geometry>(results.length, 1.0f);
pfafGeometries = new HashMap<>(results.length, 1.0f);
cwaRawGeometries.put(compositeKey,
new SoftReference<Map<Long, Geometry>>(pfafGeometries));
}
@ -1772,12 +1790,14 @@ public class FFMPTemplates {
if ((row.length >= (upstreamDepth + 9))
&& (row[upstreamDepth + 9] != null)) {
try {
pfafGeometries.put(basin.getPfaf(), reader
.read((byte[]) row[upstreamDepth + 9])
pfafGeometries.put(basin.getPfaf(),
reader.read((byte[]) row[upstreamDepth + 9])
.buffer(0));
} catch (Exception e) {
statusHandler.error("Failure to add rawGeometry in loadBasins: "+siteKey, e);
statusHandler.error(
"Failure to add rawGeometry in loadBasins: "
+ siteKey, e);
}
}
}
@ -1995,9 +2015,11 @@ public class FFMPTemplates {
list = SerializationUtil.transformFromThrift(long[].class,
FileUtil.file2bytes(f.getFile(), true));
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: Read Domain: cwa: "+cwa+" dataKey: "+dataKey+" huc: "+huc, se);
statusHandler.error("Serialization Exception: Read Domain: cwa: "
+ cwa + " dataKey: " + dataKey + " huc: " + huc, se);
} catch (IOException e) {
statusHandler.error("IO Exception: Read Domain: cwa: "+cwa+" dataKey: "+dataKey+" huc: "+huc, e);
statusHandler.error("IO Exception: Read Domain: cwa: " + cwa
+ " dataKey: " + dataKey + " huc: " + huc, e);
}
return list;
@ -2032,9 +2054,11 @@ public class FFMPTemplates {
FileUtil.file2bytes(f.getFile(), true));
}
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: Domain Map: "+dataKey+" cwa:"+cwa+" huc: "+huc, se);
statusHandler.error("Serialization Exception: Domain Map: "
+ dataKey + " cwa:" + cwa + " huc: " + huc, se);
} catch (IOException e) {
statusHandler.error("IO Exception: Domain Map: "+dataKey+" cwa:"+cwa+" huc: "+huc, e);
statusHandler.error("IO Exception: Domain Map: " + dataKey
+ " cwa:" + cwa + " huc: " + huc, e);
}
return map;
@ -2063,9 +2087,11 @@ public class FFMPTemplates {
.transformFromThrift(HashMap.class,
FileUtil.file2bytes(f.getFile(), true));
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: Virtual Basins: "+dataKey+" cwa: "+cwa, se);
statusHandler.error("Serialization Exception: Virtual Basins: "
+ dataKey + " cwa: " + cwa, se);
} catch (IOException e) {
statusHandler.error("IO Exception: Virtual Basins: "+dataKey+" cwa: "+cwa, e);
statusHandler.error("IO Exception: Virtual Basins: " + dataKey
+ " cwa: " + cwa, e);
}
return map;
@ -2091,9 +2117,12 @@ public class FFMPTemplates {
list = SerializationUtil.transformFromThrift(String[].class,
FileUtil.file2bytes(f.getFile(), true));
} catch (SerializationException se) {
statusHandler.error("Serialization Exception: : Read Virtual Domain: cwa: "+cwa+" dataKey: "+dataKey, se);
statusHandler.error(
"Serialization Exception: : Read Virtual Domain: cwa: "
+ cwa + " dataKey: " + dataKey, se);
} catch (IOException e) {
statusHandler.error("IO Exception: : Read Virtual Domain: cwa: "+cwa+" dataKey: "+dataKey, e);
statusHandler.error("IO Exception: : Read Virtual Domain: cwa: "
+ cwa + " dataKey: " + dataKey, e);
}
return list;
@ -2151,14 +2180,15 @@ public class FFMPTemplates {
if (rawGeomRef != null) {
pfafGeometries = rawGeomRef.get();
}
if (pfafGeometries == null) {
if (pfafGeometries == null || pfafGeometries.isEmpty()) {
// TODO: add sync locking per cwa
long t0 = System.currentTimeMillis();
pfafGeometries = FFMPUtils.getRawGeometries(getMap(siteKey, cwa,
FFMPRecord.ALL).keySet());
long t1 = System.currentTimeMillis();
System.out.println("Retrieval of raw geometries for site "
+ siteKey + " cwa " + cwa + " took " + (t1 - t0) + " ms.");
statusHandler.handle(Priority.INFO,
"Retrieval of raw geometries for site " + siteKey + " cwa "
+ cwa + " took " + (t1 - t0) + " ms.");
cwaRawGeometries.put(compositeKey,
new SoftReference<Map<Long, Geometry>>(pfafGeometries));
}
@ -2362,10 +2392,14 @@ public class FFMPTemplates {
if (res >= 0.004) {
try {
list = FFMPUtils.getUniqueCountyFips(cwa, getMaxExtent(),
getSiteExtents(dataKey), mode.getMode(), resolution);
list = FFMPUtils
.getUniqueCountyFips(cwa, getMaxExtent(),
getSiteExtents(dataKey), mode.getMode(),
resolution);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to create FFMP Template for this dataKey: "+dataKey, e);
statusHandler.handle(Priority.PROBLEM,
"Unable to create FFMP Template for this dataKey: "
+ dataKey, e);
}
if (list.size() > 0) {

View file

@ -100,6 +100,7 @@ import com.vividsolutions.jts.io.WKTWriter;
* Aug 08, 2015 4722 dhladky Added Grid coverage and parsing methods.
* Sep 17, 2015 4756 dhladky Multiple guidance source bugs.
* Feb 12, 2016 5370 dhladky Camel case for insertTime.
* Apr 07, 2016 5491 tjensen Fix NullPointerException from getRawGeometries
* </pre>
*
* @author dhladky
@ -371,8 +372,8 @@ public class FFMPUtils {
* @param extents
* @return
*/
public static Object[] getBasins(String cwa, double buffer,
String extents, String mode) {
public static Object[] getBasins(String cwa, double buffer, String extents,
String mode) {
String lowestSimplificationLevel = ScanUtils
.getHighResolutionLevel("ffmp_basins");
String highestSimplificationLevel = ScanUtils
@ -424,7 +425,8 @@ public class FFMPUtils {
* @return
*/
public static Map<Long, Geometry> getRawGeometries(Collection<Long> pfafs) {
HashMap<Long, Geometry> rval = null;
// Initialize rval to an empty Map to use as the default return value.
HashMap<Long, Geometry> rval = new HashMap<>();
if (pfafs.size() > 0) {
StringBuilder builder = new StringBuilder();
builder.append("SELECT pfaf_id, AsBinary("
@ -448,7 +450,7 @@ public class FFMPUtils {
try {
sq = SpatialQueryFactory.create();
results = sq.dbRequest(builder.toString(), MAPS_DB);
rval = new HashMap<Long, Geometry>(results.length, 1.0f);
rval = new HashMap<>(results.length, 1.0f);
} catch (SpatialException e) {
statusHandler.error("Error querying Raw Geometries: +sql: "
+ builder.toString(), e);
@ -971,19 +973,19 @@ public class FFMPUtils {
* @param id
* @return
*/
public static String getFFGDataURI(GUIDANCE_TYPE type, String datasetid, String parameter,
String plugin) {
public static String getFFGDataURI(GUIDANCE_TYPE type, String datasetid,
String parameter, String plugin) {
DbQueryRequest request = new DbQueryRequest();
request.setEntityClass(GridRecord.class.getName());
request.addConstraint(GridConstants.PARAMETER_ABBREVIATION,
new RequestConstraint(parameter));
if (type == GUIDANCE_TYPE.RFC) {
request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
"FFG-" + datasetid.substring(1)));
request.addConstraint(GridConstants.DATASET_ID,
new RequestConstraint("FFG-" + datasetid.substring(1)));
} else {
request.addConstraint(GridConstants.DATASET_ID, new RequestConstraint(
datasetid));
request.addConstraint(GridConstants.DATASET_ID,
new RequestConstraint(datasetid));
}
request.setOrderByField("dataTime.refTime", OrderMode.DESC);
@ -994,8 +996,8 @@ public class FFMPUtils {
if (grids != null && grids.length > 0) {
return grids[0].getDataURI();
} else {
statusHandler.warn(
"No data available for this FFG Request: " + request.toString());
statusHandler.warn("No data available for this FFG Request: "
+ request.toString());
}
} catch (Exception e) {
statusHandler.error(
@ -1471,7 +1473,8 @@ public class FFMPUtils {
coverage = record.getLocation();
}
} else {
statusHandler.error("Query for Grid Coverage returned no results: DataSetID = "
statusHandler
.error("Query for Grid Coverage returned no results: DataSetID = "
+ datasetID);
}

View file

@ -30,7 +30,6 @@ import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFTIDataManager;
import com.raytheon.uf.common.monitor.processing.IMonitorProcessing;
@ -63,6 +62,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Sep.09, 2015 4756 dhladky Further simplified configuration.
* Mar 04, 2016 5429 dhladky Special case for RFCFFG multi-RFC mosaics.
* Mar 29, 2016 5491 tjensen Special case for QPFSCAN
* Apr 02, 2016 5491 tjensen Fixed special case for QPFSCAN to be strict
* </pre>
*
* @author dhladky
@ -482,7 +482,7 @@ public class FFMPConfig {
* RFC mosaic piece. Use existing sourceKey that designates that
* mosaic piece.
*/
} else if (source.getSourceType().equals(SOURCE_TYPE.QPF.name())) {
} else if (source.getSourceName().equals("QPFSCAN")) {
/*
* The special case of QPFSCAN. Use existing sourceKey that
* designates that mosaic piece.

View file

@ -109,6 +109,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Aug 26, 2015 4777 dhladky Fixed bug in DPR accumulations.
* Sep 28, 2015 4756 dhladky Multiple Guidance upgrades.
* Feb 04, 2016 5311 dhladky Bug in creation of source bins fixed.
* Apr 07, 2016 5491 tjensen Fix NullPointerException from getRawGeometries
* </pre>
*
* @author dhladky
@ -377,7 +378,8 @@ public class FFMPProcessor {
} else {
if (checkLockStatus()) {
lock();
if (cwaGeometries == null) {
if (cwaGeometries == null
|| cwaGeometries.isEmpty()) {
cwaGeometries = template
.getRawGeometries(dataKey,
domain.getCwa());
@ -902,7 +904,7 @@ public class FFMPProcessor {
}
} else {
if (cwaGeometries == null) {
if (cwaGeometries == null || cwaGeometries.isEmpty()) {
cwaGeometries = template.getRawGeometries(dataKey, cwa);
}
@ -1007,7 +1009,7 @@ public class FFMPProcessor {
}
} else {
if (cwaGeometries == null) {
if (cwaGeometries == null || cwaGeometries.isEmpty()) {
cwaGeometries = template.getRawGeometries(dataKey, cwa);
}
@ -1222,7 +1224,7 @@ public class FFMPProcessor {
}
} else {
if (cwaGeometries == null) {
if (cwaGeometries == null || cwaGeometries.isEmpty()) {
cwaGeometries = template.getRawGeometries(siteKey, cwa);
}