Merge branch 'omaha_14.3.1' of ssh://www.awips2omaha.com:29418/AWIPS2_baseline into master_14.3.1

Former-commit-id: fc7cd63addbf7974f4f8e1607fb1d4745cb81661
This commit is contained in:
Fay.Liang 2015-02-05 15:01:17 -05:00
commit 25e5ab2c1f
10 changed files with 478 additions and 9 deletions

View file

@ -58,6 +58,7 @@ import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory;
* ------------ ---------- ----------- --------------------------
* Aug 10, 2011 randerso Initial creation
* Apr 17, 2014 #2997 randerso Moved buildBoundingGeometry up from DbMapResource
* Jan 29, 2015 #4062 randerso Added a buffer to bounding Geometry
*
* </pre>
*
@ -272,6 +273,10 @@ public abstract class AbstractDbMapResource<T extends AbstractDbMapResourceData,
.handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
}
// Add just a little buffer to get past EnvelopeIntersection limiting
// us to 179.99999 instead of going clear to 180
g = g.buffer(0.0001);
// long t1 = System.currentTimeMillis();
// System.out.println("buildBoundingGeometry took: " + (t1 - t0));
return g;

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.core.rsc.jts;
import org.eclipse.swt.graphics.RGB;
import org.geotools.referencing.operation.projection.ProjectionException;
import org.opengis.referencing.FactoryException;
import com.raytheon.uf.common.geospatial.ReferencedGeometry;
@ -54,6 +55,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Oct 24, 2006 chammack Initial Creation.
* Feb 14, 2014 2804 mschenke Rewrote to move clipping from GLWireframeShape2D to here
* Apr 21, 2014 2997 randerso Improved error handling in handle(ReferencedGeometry, JTSGeometryData)
* Jan 29, 2015 4062 randerso Don't throw errors for ProjectionExceptions
*
* </pre>
*
@ -476,6 +478,8 @@ public class JTSCompiler {
corrector.correct(geom.asLatLon()));
} catch (FactoryException e) {
throw new VizException("Error creating transform to Lat/Lon", e);
} catch (ProjectionException e) {
// ignore this exception so it doesn't cause pop ups
} catch (Exception e) {
throw new VizException(
"Error transforming geometry into Lat/Lon", e);
@ -487,6 +491,8 @@ public class JTSCompiler {
} catch (FactoryException e) {
throw new VizException(
"Error creating transform to descriptor pixel space", e);
} catch (ProjectionException e) {
// ignore this exception so it doesn't cause pop ups
} catch (Exception e) {
throw new VizException(
"Error transforming geometry into descriptor pixel space",

View file

@ -0,0 +1,71 @@
#!/bin/bash
##
# 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.
##
# NDM Menu File Ingester
if [ "$1" == "-help" ];
then
echo ""
echo "ndmMenuIngester.sh <ndmFileDirectory> <ndmMenuFileName>"
echo " ndmFileDirectory is the directory holding the ndm files"
echo " ndmMenuFileName is the name of the ndm menu file to convert"
echo ""
echo " Required files: redbookDataKeys.txt, redbookDepictKeys.txt,"
echo " redbookProductButtons.txt, and the menu file to convert"
exit;
fi
if [ ! -d "$1" ];
then
echo "Directory [$1] does not exist!"
exit
fi
if [ ! -f "$1/$2" ];
then
echo "File [$2] does not exist!"
exit
fi
SRC_DIR=$1
MENU_FILE=$2
path_to_script=`readlink -f $0`
dir=$(dirname $path_to_script)
dir=$(dirname $dir)
AWIPS_HOME=$(dirname $dir)
# Search for jars
EDEX_PLUGINS="$AWIPS_HOME/edex/lib/"
JARS=$(find $EDEX_PLUGINS -name "*.jar")
# Add jars to classpath
addSep=false
for i in $JARS
do
if [[ "$addSep" == true ]];
then
LOCAL_CLASSPATH=$LOCAL_CLASSPATH":"$i
else
LOCAL_CLASSPATH=$i
addSep=true
fi
done
JAVA_INSTALL=/awips2/java/
${JAVA_INSTALL}/bin/java -classpath $LOCAL_CLASSPATH com.raytheon.uf.edex.plugin.redbook.menu.NdmMenuConverter $SRC_DIR $MENU_FILE

View file

@ -29,6 +29,7 @@
* Dec 12, 2013 2624 rferrel Document Julian time stamp.
* May 14, 2014 2881 rferrel Change retention times and data set modifications.
* Aug 25, 2014 3537 rferrel Fixed dirPattern in Category Local.
* Feb 02, 2015 4066 rferrel Added lightning to Observation category.
*
* @author rferrel
* @version 1.0
@ -208,7 +209,7 @@
<name>Observation</name>
<extRetentionHours>168</extRetentionHours>
<dataSet>
<dirPattern>(airep|binlightning|bufrascat|bufrhdw|bufrmthdw|bufrssmi|lsr|MAROB|maritime|metar|misc_sfc_obs|pirep|sfcobs|shef|svrwx|synoptic)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern>
<dirPattern>(airep|binlightning|bufrascat|bufrhdw|bufrmthdw|bufrssmi|entlightning|lsr|MAROB|maritime|metar|misc_sfc_obs|pirep|sfcobs|shef|svrwx|synoptic)/(\d{4})(\d{2})(\d{2})/(\d{2})</dirPattern>
<displayLabel>{1}</displayLabel>
<dateGroupIndices>2,3,4,5</dateGroupIndices>
</dataSet>

View file

@ -12,7 +12,8 @@ Require-Bundle: com.raytheon.edex.common,
com.raytheon.uf.common.status;bundle-version="1.12.1174",
com.raytheon.uf.edex.ndm;bundle-version="1.14.0",
com.raytheon.uf.edex.menus;bundle-version="1.0.0",
com.raytheon.uf.common.dataplugin.redbook;bundle-version="1.14.0"
com.raytheon.uf.common.dataplugin.redbook;bundle-version="1.14.0",
org.apache.commons.lang;bundle-version="2.3.0"
Export-Package: com.raytheon.uf.edex.plugin.redbook,
com.raytheon.uf.edex.plugin.redbook.decoder
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -47,6 +47,7 @@ import com.raytheon.uf.edex.plugin.redbook.menu.RedbookUaMenuUtil;
* Mar 19, 2014 2857 mpduff Implement NCO.
* Mar 19, 2014 2859 mpduff Implement MPC.
* Mar 19, 2014 2860 mpduff Implement Upper Air.
* Jan 28, 2015 4030 mpduff Changed constants to public.
*
* </pre>
*
@ -60,22 +61,22 @@ public class RedbookMenuSubscriber implements INationalDatasetSubscriber {
.getHandler(RedbookMenuSubscriber.class);
/** Hazard menu file */
private static final String HAZARD_MENU_FILE = "RedbookHazardMenus.xml";
public static final String HAZARD_MENU_FILE = "RedbookHazardMenus.xml";
/** HPC menu file */
private static final String HPC_MENU_FILE = "RedbookHPCMenus.xml";
public static final String HPC_MENU_FILE = "RedbookHPCMenus.xml";
/** CPC menu file */
private static final String CPC_MENU_FILE = "RedbookCPCMenus.xml";
public static final String CPC_MENU_FILE = "RedbookCPCMenus.xml";
/** MPC menu file */
private static final String MPC_MENU_FILE = "RedbookMPCMenus.xml";
public static final String MPC_MENU_FILE = "RedbookMPCMenus.xml";
/** NCO menu file */
private static final String NCO_MENU_FILE = "RedbookNCOMenus.xml";
public static final String NCO_MENU_FILE = "RedbookNCOMenus.xml";
/** Upper air menu file */
private static final String UA_MENU_FILE = "RedbookUAMenus.xml";
public static final String UA_MENU_FILE = "RedbookUAMenus.xml";
/**
* {@inheritDoc}

View file

@ -39,6 +39,7 @@ import javax.xml.bind.annotation.XmlElements;
* ------------ ---------- ----------- --------------------------
* Mar 12, 2014 2855 mpduff Initial creation
* Mar 19, 2014 2860 mpduff Added DataUri.
* Jan 28, 2015 4030 mpduff Added addMenuEntry method.
*
* </pre>
*
@ -208,7 +209,7 @@ public class MenuEntry {
* @param menuEntryList
* the menuEntryList to set
*/
public void setMenuEntryyList(List<MenuEntry> menuEntryList) {
public void setMenuEntryList(List<MenuEntry> menuEntryList) {
this.menuEntryList = menuEntryList;
}
@ -227,6 +228,18 @@ public class MenuEntry {
this.dataUri = dataUri;
}
/**
* Add a {@link MenuEntry}
*
* @param entry
*/
public void addMenuEntry(MenuEntry entry) {
if (this.menuEntryList == null) {
menuEntryList = new ArrayList<MenuEntry>();
}
menuEntryList.add(entry);
}
/*
* (non-Javadoc)
*

View file

@ -39,6 +39,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* ------------ ---------- ----------- --------------------------
* Mar 07, 2014 2858 mpduff Initial creation.
* Mar 17, 2014 2855 mpduff Renamed to RedbookMenusXML.java.
* Jan 28, 2015 4030 mpduff Added addMenuEntry method.
*
* </pre>
*
@ -78,6 +79,10 @@ public class RedbookMenusXML {
this.menuEntryList = menuEntryList;
}
public void addMenuEntry(MenuEntry entry) {
menuEntryList.add(entry);
}
/*
* (non-Javadoc)
*

View file

@ -0,0 +1,360 @@
/**
* 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.uf.edex.plugin.redbook.menu;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import org.apache.commons.lang.StringUtils;
import com.raytheon.uf.edex.plugin.redbook.ingest.RedbookMenuSubscriber;
import com.raytheon.uf.edex.plugin.redbook.ingest.xml.MenuEntry;
import com.raytheon.uf.edex.plugin.redbook.ingest.xml.MenuEntryType;
import com.raytheon.uf.edex.plugin.redbook.ingest.xml.RedbookMenusXML;
/**
* This class is called from /awips2/edex/bin/ndmMenuIngester.sh.
*
* It reads in the NDM menu files and outputs an A2 version into the NDM
* endpoint on edex.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 30, 2015 4030 mpduff Initial creation
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class NdmMenuConverter {
private static final String WMO = "wmo";
private static final String OUTPUT_PATH = File.separator + "awips2"
+ File.separator + "edex" + File.separator + "data"
+ File.separator + "ndm" + File.separator;
private static final String HPC_FILE = "redbookHPCMenus.txt";
private static final String CPC_FILE = "redbookCPCMenus.txt";
private static final String NCO_FILE = "redbookNCOMenus.txt";
private static final String HAZARDS_FILE = "redbookHazardMenus.txt";
private static final String MARINE_FILE = "redbookMarineMenus.txt";
private static final String UPPER_AIR_FILE = "redbookUpperAirMenus.txt";
private String dataKeysPath;
private String depictKeysPath;
private String menuFilePath;
private String productButtonPath;
private JAXBContext jax;
private Marshaller marshaller;
private File depictFile;
public NdmMenuConverter() {
createContext();
}
public void convert() {
RedbookMenusXML menuXml = new RedbookMenusXML();
MenuEntry titleMenuEntry;
int sepCounter = 0;
List<MenuEntry> subMenuList = new ArrayList<MenuEntry>();
try {
File dataFile = new File(this.dataKeysPath);
File menuFile = new File(this.menuFilePath);
depictFile = new File(this.depictKeysPath);
File productButtonFile = new File(this.productButtonPath);
List<String> dataKeys = Files.readAllLines(dataFile.toPath(),
Charset.defaultCharset());
List<String> depictKeys = Files.readAllLines(depictFile.toPath(),
Charset.defaultCharset());
List<String> lines = Files.readAllLines(menuFile.toPath(),
Charset.defaultCharset());
List<String> productButtonKeys = Files.readAllLines(
productButtonFile.toPath(), Charset.defaultCharset());
Map<String, String> menuTextMap = getMenuTextMap(productButtonKeys);
Map<String, String> dataKeyMap = getSubstitutionMap(dataKeys);
MenuEntry subMenuEntry = null;
int subMenuCount = -1;
for (String line : lines) {
line = line.trim();
if (line.startsWith("submenu")) {
subMenuCount++;
if (line.contains("&")) {
line = line.replace("&", "&&");
}
String[] parts = line.split(":");
String text = parts[1].replace("\"", "");
subMenuEntry = new MenuEntry();
subMenuEntry.setFile(null);
subMenuEntry.setType(MenuEntryType.Submenu);
subMenuEntry.setText(text.trim());
subMenuList.add(subMenuEntry);
} else if (line.startsWith("title")) {
String[] parts = line.split(":");
String text = parts[1].replace("\"", "");
titleMenuEntry = new MenuEntry();
titleMenuEntry.setFile(null);
titleMenuEntry.setType(MenuEntryType.Title);
titleMenuEntry.setText(text);
titleMenuEntry.setId(text);
subMenuList.get(subMenuCount).addMenuEntry(titleMenuEntry);
} else if (line.startsWith("productButton")) {
String[] parts = line.split(":");
MenuEntry me = new MenuEntry();
me.setFile(null);
me.setType(MenuEntryType.ProductButton);
/*
* There are certain productButtons in the NCO menu data
* keys in the (25000 range) that have data keys that don't
* map to anything. This results in those menu items not
* being created. The site will need to fix this after
* generating the new menus.
*/
String dataKey = parts[1].trim().substring(0, 4);
StringBuilder subValue = new StringBuilder();
// Find the matching value
for (String depictKeyLine : depictKeys) {
if (depictKeyLine.trim().startsWith(dataKey)) {
String[] depictKeyParts = depictKeyLine
.split("\\|");
me.setText(menuTextMap.get(dataKey));
me.setId(depictKeyParts[6].trim());
subMenuList.get(subMenuCount).addMenuEntry(me);
String[] subParts = depictKeyParts[2].split(",");
MenuEntry subEntry = new MenuEntry();
subEntry.setFile(null);
subEntry.setType(MenuEntryType.Substitute);
subEntry.setKey(WMO);
for (String subPart : subParts) {
for (String key : dataKeyMap.keySet()) {
if (key.startsWith(subPart)) {
subValue.append(dataKeyMap.get(key))
.append(",");
break;
}
}
}
String subValueStr = subValue.toString();
subValueStr = StringUtils.removeEnd(subValueStr,
",");
subEntry.setValue(subValueStr);
me.addMenuEntry(subEntry);
break;
}
}
} else if (line.startsWith("endSubmenu")) {
// subMenuList.add(subMenuEntry);
MenuEntry closedSubMenu = subMenuList.remove(subMenuCount);
subMenuCount--;
if (subMenuCount == -1) {
menuXml.addMenuEntry(closedSubMenu);
} else {
subMenuList.get(subMenuCount).addMenuEntry(
closedSubMenu);
}
} else if (line.startsWith("separator")) {
MenuEntry sep = new MenuEntry();
sep.setFile(null);
sep.setType(MenuEntryType.Separator);
sep.setId("Separator" + sepCounter++);
subMenuList.get(subMenuCount).addMenuEntry(sep);
}
}
// Set output file name
String inputFileName = menuFile.getName();
String outputFileName = null;
if (inputFileName.equals(CPC_FILE)) {
outputFileName = RedbookMenuSubscriber.CPC_MENU_FILE;
} else if (inputFileName.equals(HPC_FILE)) {
outputFileName = RedbookMenuSubscriber.HPC_MENU_FILE;
} else if (inputFileName.equals(NCO_FILE)) {
outputFileName = RedbookMenuSubscriber.NCO_MENU_FILE;
} else if (inputFileName.equals(HAZARDS_FILE)) {
outputFileName = RedbookMenuSubscriber.HAZARD_MENU_FILE;
} else if (inputFileName.equals(MARINE_FILE)) {
outputFileName = RedbookMenuSubscriber.MPC_MENU_FILE;
} else if (inputFileName.equals(UPPER_AIR_FILE)) {
outputFileName = RedbookMenuSubscriber.UA_MENU_FILE;
} else {
throw new IOException("Error processing file");
}
marshaller.marshal(menuXml, new File(OUTPUT_PATH + outputFileName));
} catch (Exception e) {
System.err.println("Error occurred processing file: "
+ menuFilePath);
e.printStackTrace();
}
}
/**
* Get a map of menu keys to menu text.
*
* @param productButtonKeys
* List of strings from redbookProductButtons.txt
*
* @return Map for key -> menu text
*/
private Map<String, String> getMenuTextMap(List<String> productButtonKeys) {
Map<String, String> menuTextMap = new HashMap<String, String>();
for (String line : productButtonKeys) {
line = line.trim();
// Skip comment lines
if (line.startsWith("#") || line.trim().length() == 0) {
continue;
}
String[] parts = line.split("\\|");
menuTextMap.put(parts[0].trim(), parts[2].trim());
}
return menuTextMap;
}
/**
* Get a map of key to substitution values.
*
* @param dataKeys
* List of strings from the redbookDataKeys.txt file
* @returnMap for key -> substitution string
*/
private Map<String, String> getSubstitutionMap(List<String> dataKeys) {
Map<String, String> dataKeyMap = new HashMap<String, String>();
for (String line : dataKeys) {
line = line.trim();
// Skip comment lines
if (line.startsWith("#") || line.trim().length() == 0) {
continue;
}
String[] parts = line.split("\\|");
dataKeyMap.put(parts[0].trim(), parts[10].substring(0, 6));
}
return dataKeyMap;
}
public String getDataKeysPath() {
return dataKeysPath;
}
public void setDataKeysPath(String dataKeysPath) {
this.dataKeysPath = dataKeysPath;
}
public String getDepictKeysPath() {
return depictKeysPath;
}
public void setDepictKeysPath(String depictKeysPath) {
this.depictKeysPath = depictKeysPath;
}
public String getMenuFilePath() {
return menuFilePath;
}
public void setMenuFilePath(String menuFilePath) {
this.menuFilePath = menuFilePath;
}
public void setProductButtonPath(String productButtonPath) {
this.productButtonPath = productButtonPath;
}
public String getProductButtonPath() {
return this.productButtonPath;
}
private void createContext() {
Class[] classes = new Class[] { MenuEntry.class, MenuEntryType.class,
RedbookMenusXML.class };
try {
jax = JAXBContext.newInstance(classes);
this.marshaller = jax.createMarshaller();
this.marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Unexpected Arguments");
System.err
.println("Expecting local NDM directory and NDM File Menu Name");
return;
}
String dirPath = args[0];
if (!dirPath.endsWith(File.separator)) {
dirPath = dirPath.concat(File.separator);
}
String menuFile = dirPath + args[1];
String dataKeysFile = dirPath + "redbookDataKeys.txt";
String depictKeysFile = dirPath + "redbookDepictKeys.txt";
String productButtonFile = dirPath + "redbookProductButtons.txt";
NdmMenuConverter converter = new NdmMenuConverter();
converter.setDataKeysPath(dataKeysFile);
converter.setMenuFilePath(menuFile);
converter.setDepictKeysPath(depictKeysFile);
converter.setProductButtonPath(productButtonFile);
converter.convert();
}
}

View file

@ -36,6 +36,7 @@
#20130624 1966 rferrel The acars pattern changed to place files in the proper subdirectories.
# Name changes to reflect plugin names for modelsounding, goessounding, poessounding.
#20140424 3068 dgilling Add pattern for MetOp-B ASCAT T winds.
#20150202 4066 rferrel Add pattern form Earth Networks Total Lightning: SFPA42
#***************************************************************
# AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw
# PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001
@ -384,6 +385,11 @@ HDS ^(IUS(Z[0-9]|Y4)[0-9]) ([A-Z]{4}) (..)(..)(..)
HDS ^(SF(US|PA)41) ([A-Z]{4}) (..)(..)(..)
FILE -overwrite -log -edex -close /data_store/binlightning/(\4:yyyy)(\4:mm)\4/\5/\1_\3_\4\5\6_(seq).nldn.%Y%m%d%H
# WMO Heading for Earth Networks Total Lightning
HDS ^(SF(US|PA)42) ([A-Z]{4}) (..)(..)(..)
FILE -overwrite -log -edex -close /data_store/entlightning/(\4:yyyy)(\4:mm)\4/\5/\1_\3_\4\5\6_(seq).nldn.%Y%m%d%H
# AWIPS1: TEXT ^[ABCFMNRSUVW]......[KPTMC] /text/NO_STORE
# TEXT ^[ABCFMNRSUVW].....[KPTMC] /text/NO_STORE
# TEXT ^DF.* /text/NO_STORE