Merge branch 'master_16.2.2' into asdt_16.2.2

Former-commit-id: 02133bf406abe2ba96c7037cbb30675de2e02918
This commit is contained in:
Penghai Wang 2016-05-02 19:52:55 +00:00
commit 3464ad6b11
42 changed files with 697 additions and 914 deletions

View file

@ -150,6 +150,7 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods * Jan 11, 2016 5242 kbisanz Replaced calls to deprecated LocalizationFile methods
* Jan 15, 2016 5242 kbisanz Replaced LocalizationFile with * Jan 15, 2016 5242 kbisanz Replaced LocalizationFile with
* ILocalizationFile where possible * ILocalizationFile where possible
* Apr 14, 2016 4946 mapeters Fix duplicate files listed in delete confirmation dialog
* *
* </pre> * </pre>
* *
@ -921,9 +922,13 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
if (toDelete.size() > 0) { if (toDelete.size() > 0) {
Collections.sort(toDelete, new FileTreeFileComparator()); // Duplicates occur if both a dir and its contents are selected
mgr.add(new DeleteAction(getSite().getPage(), toDelete LocalizationFile[] toDeleteWithoutDuplicates = new HashSet<>(
.toArray(new LocalizationFile[toDelete.size()]))); toDelete).toArray(new LocalizationFile[0]);
Arrays.sort(toDeleteWithoutDuplicates,
new FileTreeFileComparator());
mgr.add(new DeleteAction(getSite().getPage(),
toDeleteWithoutDuplicates));
mgr.add(new Separator()); mgr.add(new Separator());
} }
} }

View file

@ -475,11 +475,16 @@ public class FFMPResource extends
LoadProperties loadProperties) { LoadProperties loadProperties) {
super(resourceData, loadProperties); super(resourceData, loadProperties);
getResourceData().addChangeListener(this); getResourceData().addChangeListener(this);
// The FFMPMonitor dialog was opened here previously but this led monitor = getResourceData().getMonitor();
// to an issue where if the user pressed the clear button before the monitor.addResourceListener(this);
// FFMPResource was properly initialized the dialog would not close.
// Opening the dialog is now the responsibility of the FFMPResource if (getResourceData().tableLoad) {
if (!isBasinToggle()) {
setBasinToggle(true);
}
monitor.launchFFMPDialog(this);
}
// So we are not time agnostic // So we are not time agnostic
dataTimes = new ArrayList<DataTime>(); dataTimes = new ArrayList<DataTime>();
@ -1293,16 +1298,6 @@ public class FFMPResource extends
} }
}); });
monitor = getResourceData().getMonitor();
monitor.addResourceListener(this);
if (getResourceData().tableLoad) {
if (!isBasinToggle()) {
setBasinToggle(true);
}
monitor.launchFFMPDialog(this);
}
// Set flag for HPE data // Set flag for HPE data
isHpe = resourceData.dataKey.equalsIgnoreCase(HPE) isHpe = resourceData.dataKey.equalsIgnoreCase(HPE)

View file

@ -78,7 +78,8 @@
# Sep 11, 2015 4858 dgilling Remove notification processing from publishElements. # Sep 11, 2015 4858 dgilling Remove notification processing from publishElements.
# Jan 20, 2016 4751 randerso Fix type of mask returned from getComposite() to work with numpy 1.9.2 # Jan 20, 2016 4751 randerso Fix type of mask returned from getComposite() to work with numpy 1.9.2
# Jan 28, 2016 5129 dgilling Support changes to IFPClient. # Jan 28, 2016 5129 dgilling Support changes to IFPClient.
# 02/22/2016 5374 randerso Added support for sendWFOMessage # Feb 22, 2016 5374 randerso Added support for sendWFOMessage
# Apr 05, 2016 5539 randerso Added exception when attempting create more than 256 Wx keys
# #
######################################################################## ########################################################################
import types, string, time, sys import types, string, time, sys
@ -2198,6 +2199,10 @@ class SmartScript(BaseTool.BaseTool):
for str in keys: for str in keys:
if sortedUglyStr == self.sortUglyStr(str): if sortedUglyStr == self.sortUglyStr(str):
return keys.index(str) return keys.index(str)
if len(keys) >= 256:
raise IndexError("Attempt to create more than 256 Wx keys")
keys.append(uglyStr) keys.append(uglyStr)
return len(keys) - 1 return len(keys) - 1

View file

@ -72,6 +72,7 @@ import com.vividsolutions.jts.geom.MultiPolygon;
* 02/19/2013 1637 randerso Added throws declarations to translateDataFrom * 02/19/2013 1637 randerso Added throws declarations to translateDataFrom
* 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys() * 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys()
* Apr 23, 2015 4259 njensen Removed unused INumpyable * Apr 23, 2015 4259 njensen Removed unused INumpyable
* Apr 04, 2016 5539 randerso Fix unsigned byte issues
* *
* </pre> * </pre>
* *
@ -918,7 +919,7 @@ public class DiscreteGridData extends AbstractGridData {
for (int j = 0; j < dim.y; j++) { for (int j = 0; j < dim.y; j++) {
if (points.get(i, j) == 1) { if (points.get(i, j) == 1) {
DiscreteKey combined = DiscreteKey.combine( DiscreteKey combined = DiscreteKey.combine(
key.get(values.get(i, j)), key.get(0xFF & values.get(i, j)),
doGetDiscreteValue(i, j)); doGetDiscreteValue(i, j));
grid.set(i, j, lookupKeyValue(combined)); grid.set(i, j, lookupKeyValue(combined));
} }

View file

@ -76,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys() * 10/31/2013 2508 randerso Change to use DiscreteGridSlice.getKeys()
* 09/01/2014 3572 randerso Removed ourSiteMap as it was unused and the only * 09/01/2014 3572 randerso Removed ourSiteMap as it was unused and the only
* thing that used Grid2DBoolean * thing that used Grid2DBoolean
* 04/04/2016 5539 randerso Fix unsigned byte issues
* *
* </pre> * </pre>
* *
@ -462,7 +463,7 @@ public class ISCDataAccess implements IISCDataAccess {
for (int i = 0; i < siteMask.getXdim(); i++) { for (int i = 0; i < siteMask.getXdim(); i++) {
if (siteMask.getAsBoolean(i, j)) { if (siteMask.getAsBoolean(i, j)) {
byte index = lookupKeyValue(keyIndexMap, byte index = lookupKeyValue(keyIndexMap,
iscKey[iscGrid.get(i, j)]); iscKey[0xFF & iscGrid.get(i, j)]);
slice.getWeatherGrid().set(i, j, index); slice.getWeatherGrid().set(i, j, index);
} }
} }
@ -551,7 +552,7 @@ public class ISCDataAccess implements IISCDataAccess {
for (int i = 0; i < siteMask.getXdim(); i++) { for (int i = 0; i < siteMask.getXdim(); i++) {
if (siteMask.getAsBoolean(i, j)) { if (siteMask.getAsBoolean(i, j)) {
byte index = lookupKeyValue(keyIndexMap, byte index = lookupKeyValue(keyIndexMap,
iscKey[iscGrid.get(i, j)]); iscKey[0xFF & iscGrid.get(i, j)]);
slice.getDiscreteGrid().set(i, j, index); slice.getDiscreteGrid().set(i, j, index);
} }
} }

View file

@ -191,6 +191,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Sep 10, 2015 #4782 randerso Converted inParmEdit to ReentrantLock to force * Sep 10, 2015 #4782 randerso Converted inParmEdit to ReentrantLock to force
* updates to be run consecutively. * updates to be run consecutively.
* Cleaned up TODOs, FIXMEs and deprecations. * Cleaned up TODOs, FIXMEs and deprecations.
* Apr 04, 2016 #5539 randerso Fix unsigned byte issues
* *
* </pre> * </pre>
* *
@ -2161,10 +2162,9 @@ public abstract class Parm implements Comparable<Parm> {
.getGridSlice()).getKeys(); .getGridSlice()).getKeys();
Grid2DByte grid1 = ((WeatherGridSlice) grids[k] Grid2DByte grid1 = ((WeatherGridSlice) grids[k]
.getGridSlice()).getWeatherGrid(); .getGridSlice()).getWeatherGrid();
WeatherKey tmpKey = key1[grid1.get(i, j)]; WeatherKey tmpKey = key1[0xFF & grid1.get(i, j)];
WeatherSubKey gpkeys[] = tmpKey.getSubKeys().toArray( WeatherSubKey gpkeys[] = tmpKey.getSubKeys().toArray(
new WeatherSubKey[tmpKey.getSubKeys().size()]); new WeatherSubKey[tmpKey.getSubKeys().size()]);
// key1[grid1(i, j)].subKeys();
for (int m = 0; m < gpkeys.length; m++) { for (int m = 0; m < gpkeys.length; m++) {
int index = subKeys.indexOf(gpkeys[m]); int index = subKeys.indexOf(gpkeys[m]);
if (index == -1) { if (index == -1) {
@ -2236,8 +2236,7 @@ public abstract class Parm implements Comparable<Parm> {
.getGridSlice()).getKeys(); .getGridSlice()).getKeys();
Grid2DByte grid1 = ((DiscreteGridSlice) grids[k] Grid2DByte grid1 = ((DiscreteGridSlice) grids[k]
.getGridSlice()).getDiscreteGrid(); .getGridSlice()).getDiscreteGrid();
// TextString kv = key1[grid1(i, j)].keyAsString(); DiscreteKey kv = key1[0xFF & grid1.get(i, j)];
DiscreteKey kv = key1[grid1.get(i, j)];
// add it to the dictionary // add it to the dictionary
MutableInteger cnt = values.get(kv); MutableInteger cnt = values.get(kv);
if (cnt == null) { if (cnt == null) {
@ -3706,7 +3705,7 @@ public abstract class Parm implements Comparable<Parm> {
.getGridSlice()); .getGridSlice());
WeatherKey[] key1 = slice.getKeys(); WeatherKey[] key1 = slice.getKeys();
Grid2DByte grid1 = slice.getWeatherGrid(); Grid2DByte grid1 = slice.getWeatherGrid();
WeatherKey key1ij = key1[grid1.get(i, j)]; WeatherKey key1ij = key1[0xFF & grid1.get(i, j)];
subkeys.addAll(key1ij.getSubKeys()); subkeys.addAll(key1ij.getSubKeys());
} }
@ -3760,7 +3759,7 @@ public abstract class Parm implements Comparable<Parm> {
.getGridSlice()).getKeys(); .getGridSlice()).getKeys();
Grid2DByte grid1 = ((DiscreteGridSlice) grids[k] Grid2DByte grid1 = ((DiscreteGridSlice) grids[k]
.getGridSlice()).getDiscreteGrid(); .getGridSlice()).getDiscreteGrid();
DiscreteKey dkv = key1[grid1.get(i, j)]; DiscreteKey dkv = key1[0xFF & grid1.get(i, j)];
String dks = dkv.toString(); String dks = dkv.toString();
// add it to the dictionary // add it to the dictionary
Integer count = values.get(dks); Integer count = values.get(dks);

View file

@ -35,9 +35,9 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabFolder;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
@ -47,7 +47,6 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
import com.raytheon.viz.gfe.textformatter.FormatterUtil; import com.raytheon.viz.gfe.textformatter.FormatterUtil;
import com.raytheon.viz.gfe.textformatter.TextProductFinishListener; import com.raytheon.viz.gfe.textformatter.TextProductFinishListener;
import com.raytheon.viz.gfe.textformatter.TextProductManager; import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/** /**
* Composite containing the product area and its controls. * Composite containing the product area and its controls.
@ -62,7 +61,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
* 2 SEP 2011 10654 gzhou Delete running/pending task and close tab. * 2 SEP 2011 10654 gzhou Delete running/pending task and close tab.
* 23 MAY 2012 14859 ryu Select VTEC formatting in practice mode * 23 MAY 2012 14859 ryu Select VTEC formatting in practice mode
* based on VTECMessageType setting. * based on VTECMessageType setting.
* 10 AUG 2012 15178 mli Add autoWrite and autoStore capability * 10 AUG 2012 15178 mli Add autoWrite and autoStore capability
* 26 SEP 2012 15423 ryu Fix product correction in practice mode * 26 SEP 2012 15423 ryu Fix product correction in practice mode
* 15 MAY 2013 1842 dgilling Change constructor signature to accept a * 15 MAY 2013 1842 dgilling Change constructor signature to accept a
* DataManager instance. * DataManager instance.
@ -79,7 +78,8 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
* based on the pil of the product rather than the disply name. * based on the pil of the product rather than the disply name.
* 18 FEB 2016 13033 yteng Improve error message for bad characters in text formatter * 18 FEB 2016 13033 yteng Improve error message for bad characters in text formatter
* definitions. * definitions.
* * 14 APR 2016 5578 dgilling Support changes to FormatterUtil.runFormatterScript.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -399,28 +399,29 @@ public class ProductAreaComp extends Composite implements
String pil = ""; String pil = "";
try { try {
pil = (String) textProductMgr pil = (String) textProductMgr
.getDefinitionValue(productName, "pil"); .getDefinitionValue(productName,
"pil");
} catch (ClassCastException e) { } catch (ClassCastException e) {
statusHandler.error("Invalid pil value: " statusHandler.error(
+ textProductMgr "Invalid pil value: "
.getDefinitionValue(productName, "pil"), e); + textProductMgr
.getDefinitionValue(
productName,
"pil"), e);
} }
if (pil != null) { if (pil != null) {
pil = pil.substring(0, 3); pil = pil.substring(0, 3);
vtecMode = textProductMgr.getVtecMessageType(pil); vtecMode = textProductMgr
.getVtecMessageType(pil);
} }
} }
// Get the source database // Get the source database
zoneCombiner.applyZoneCombo(); zoneCombiner.applyZoneCombo();
try { FormatterUtil.runFormatterScript(dataMgr,
FormatterUtil.runFormatterScript(dataMgr, textProductMgr, productName,
textProductMgr, productName, dbId.toString(), vtecMode,
dbId.toString(), vtecMode, ProductAreaComp.this);
ProductAreaComp.this);
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
}
} }
} }
} }
@ -663,8 +664,18 @@ public class ProductAreaComp extends Composite implements
} }
@Override @Override
public void textProductQueued(ConfigData.ProductStateEnum state) { public void textProductQueued(final ConfigData.ProductStateEnum state) {
productTabCB.setTabState(state, productName); if (isTabClosed) {
return;
}
VizApp.runSyncIfWorkbench(new Runnable() {
@Override
public void run() {
productTabCB.setTabState(state, productName);
}
});
} }
@Override @Override

View file

@ -121,10 +121,11 @@ import com.raytheon.viz.gfe.Activator;
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 2, 2008 #1161 randerso Initial creation * Jun 2, 2008 #1161 randerso Initial creation
* Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() * Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* Apr 04, 2016 #5539 randerso Fix unsigned byte issues
* *
* </pre> * </pre>
* *
@ -479,7 +480,7 @@ public class DiscreteInterp extends Interp {
// input byte index grids, but with values for the weatherKeys // input byte index grids, but with values for the weatherKeys
// in _allKeys. // in _allKeys.
byte index; int index;
DiscreteKey key; DiscreteKey key;
// For every grid point in the grids, load the new working grids // For every grid point in the grids, load the new working grids
@ -488,7 +489,7 @@ public class DiscreteInterp extends Interp {
for (i = 0; i < _xDim; i++) { for (i = 0; i < _xDim; i++) {
for (j = 0; j < _yDim; j++) { for (j = 0; j < _yDim; j++) {
// get the index value from the actual first input grid of bytes // get the index value from the actual first input grid of bytes
index = grid1.get(i, j); index = 0xFF & grid1.get(i, j);
// Can save a lot of processing here if index=0 // Can save a lot of processing here if index=0
// ALWAYS means "no weather": the workGrid1 and 2 values // ALWAYS means "no weather": the workGrid1 and 2 values
@ -508,7 +509,7 @@ public class DiscreteInterp extends Interp {
// get the index value from the actual second input grid of // get the index value from the actual second input grid of
// bytes // bytes
index = grid2.get(i, j); index = 0xFF & grid2.get(i, j);
// get its key // get its key
key = keys2[index]; key = keys2[index];
// find this key in the new list, and save the corresponding // find this key in the new list, and save the corresponding

View file

@ -23,7 +23,14 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.TimeZone; import java.util.TimeZone;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.activetable.ActiveTableMode; import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.core.mode.CAVEMode;
@ -52,6 +59,8 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
* Aug 26, 2015 4804 dgilling Add methods so SmartScript can run formatters. * Aug 26, 2015 4804 dgilling Add methods so SmartScript can run formatters.
* Sep 15, 2015 4858 dgilling Disable store/transmit in DRT mode. * Sep 15, 2015 4858 dgilling Disable store/transmit in DRT mode.
* Oct 01, 2015 4888 dgilling Fix javadoc for exceptions. * Oct 01, 2015 4888 dgilling Fix javadoc for exceptions.
* Apr 14, 2016 5578 dgilling Ensure formatters launched interactively
* ask for varDict before execution.
* *
* </pre> * </pre>
* *
@ -61,6 +70,9 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
public class FormatterUtil { public class FormatterUtil {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(FormatterUtil.class);
public static final String[] VTEC_MODES = { "Normal: NoVTEC", public static final String[] VTEC_MODES = { "Normal: NoVTEC",
"Normal: O-Vtec", "Normal: E-Vtec", "Normal: X-Vtec", "Normal: O-Vtec", "Normal: E-Vtec", "Normal: X-Vtec",
"Test: NoVTEC", "Test: T-Vtec" }; "Test: NoVTEC", "Test: T-Vtec" };
@ -85,20 +97,43 @@ public class FormatterUtil {
* VTEC mode * VTEC mode
* @param finish * @param finish
* listener to fire when formatter finishes generating product * listener to fire when formatter finishes generating product
* @throws SimulatedTimeProhibitedOperationException *
*/ */
public static void runFormatterScript(DataManager dataMgr, public static void runFormatterScript(final DataManager dataMgr,
TextProductManager productMgr, String productName, String dbId, final TextProductManager productMgr, final String productName,
String vtecMode, TextProductFinishListener finish) final String dbId, final String vtecMode,
throws SimulatedTimeProhibitedOpException { final TextProductFinishListener finish) {
String activeTable = getActiveTableName(dataMgr); /*
int testMode = getTestMode(dataMgr, vtecMode); * we wrap this inside an eclipse Job so that we aren't blocking the UI
String shortVtec = getVTECModeCode(vtecMode); * thread by waiting for the varDict result. Waiting on the varDict on
String name = productMgr.getModuleName(productName); * the UI thread would cause a deadlock because ValuesDialog requires
String time = getDRTString(); * use of VizApp.runAsync.
*/
Job runFormatterJob = new Job("Running product formatter") {
runFormatterScript(name, shortVtec, dbId, activeTable, time, testMode, @Override
finish, dataMgr); protected IStatus run(IProgressMonitor monitor) {
String activeTable = getActiveTableName(dataMgr);
int testMode = getTestMode(dataMgr, vtecMode);
String shortVtec = getVTECModeCode(vtecMode);
String name = productMgr.getModuleName(productName);
String time = getDRTString();
String varDict = dataMgr.getTextProductMgr().obtainVarDictSelections(name,
dataMgr, dbId);
try {
runFormatterScript(name, shortVtec, dbId, varDict,
activeTable, time, testMode, finish, dataMgr);
} catch (Exception e) {
statusHandler.error(String.format(
"Error running text formatter %s", productName), e);
}
return Status.OK_STATUS;
}
};
runFormatterJob.setSystem(true);
runFormatterJob.schedule();
} }
/** /**
@ -134,14 +169,6 @@ public class FormatterUtil {
testMode, listener, dataMgr); testMode, listener, dataMgr);
} }
public static void runFormatterScript(String name, String vtecMode,
String databaseID, String vtecActiveTable, String drtTime,
int testMode, TextProductFinishListener finish, DataManager dataMgr)
throws SimulatedTimeProhibitedOpException {
runFormatterScript(name, vtecMode, databaseID, null, vtecActiveTable,
drtTime, testMode, finish, dataMgr);
}
public static void runFormatterScript(String name, String vtecMode, public static void runFormatterScript(String name, String vtecMode,
String databaseID, String varDict, String vtecActiveTable, String databaseID, String varDict, String vtecActiveTable,
String drtTime, int testMode, TextProductFinishListener finish, String drtTime, int testMode, TextProductFinishListener finish,

View file

@ -25,10 +25,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import jep.JepException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.status.IPerformanceStatusHandler; import com.raytheon.uf.common.status.IPerformanceStatusHandler;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.PerformanceStatus; import com.raytheon.uf.common.status.PerformanceStatus;
@ -37,7 +33,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.ITimer; import com.raytheon.uf.common.time.util.ITimer;
import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData; import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData;
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnum; import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnum;
@ -65,6 +60,7 @@ import com.raytheon.viz.gfe.tasks.AbstractGfeTask;
* Aug 26, 2015 #4804 dgilling Support ability to run TextFormatters * Aug 26, 2015 #4804 dgilling Support ability to run TextFormatters
* from SmartScript. * from SmartScript.
* Dec 08, 2015 #5129 dgilling Pass IFPClient to getVarDict. * Dec 08, 2015 #5129 dgilling Pass IFPClient to getVarDict.
* Apr 14, 2016 #5578 dgilling Remove getVarDict.
* *
* </pre> * </pre>
* *
@ -166,9 +162,7 @@ public class TextFormatter extends AbstractGfeTask {
argMap.put(ArgDictConstants.VTEC_MODE, vtecMode); argMap.put(ArgDictConstants.VTEC_MODE, vtecMode);
argMap.put(ArgDictConstants.VTEC_ACTIVE_TABLE, vtecActiveTable); argMap.put(ArgDictConstants.VTEC_ACTIVE_TABLE, vtecActiveTable);
argMap.put("drtTime", drtTime); argMap.put("drtTime", drtTime);
if (!StringUtil.isEmptyString(varDict)) { argMap.put(ArgDictConstants.CMDLINE_VARDICT, varDict);
argMap.put(ArgDictConstants.CMDLINE_VARDICT, varDict);
}
listener = finish; listener = finish;
this.state = ConfigData.ProductStateEnum.Queued; this.state = ConfigData.ProductStateEnum.Queued;
@ -187,14 +181,6 @@ public class TextFormatter extends AbstractGfeTask {
String productName = (String) argMap String productName = (String) argMap
.get(ArgDictConstants.FORECAST_LIST); .get(ArgDictConstants.FORECAST_LIST);
String issuedBy = dataMgr.getTextProductMgr().getIssuedBy();
String dbId = (String) argMap.get(ArgDictConstants.DATABASE_ID);
if (!argMap.containsKey(ArgDictConstants.CMDLINE_VARDICT)) {
String varDict = getVarDict(productName, dataMgr, dbId,
issuedBy, script);
argMap.put(ArgDictConstants.CMDLINE_VARDICT, varDict);
}
String varDict = (String) argMap String varDict = (String) argMap
.get(ArgDictConstants.CMDLINE_VARDICT); .get(ArgDictConstants.CMDLINE_VARDICT);
@ -282,22 +268,6 @@ public class TextFormatter extends AbstractGfeTask {
return sb.toString(); return sb.toString();
} }
private String getVarDict(String productName, DataManager dataManager,
String dbId, String issuedBy, FormatterScript script)
throws JepException {
Map<String, Object> map = new HashMap<String, Object>(5, 1f);
map.put("paths", GfePyIncludeUtil.getTextProductsIncludePath());
map.put("dspName",
dataManager.getTextProductMgr().getDisplayName(productName));
map.put("dataMgr", dataManager);
map.put("ifpClient", dataManager.getClient().getPythonClient());
map.put("issuedBy", issuedBy);
map.put("dataSource", new DatabaseID(dbId).getModelName());
String varDict = (String) script.execute("getVarDict", map);
return varDict;
}
@Override @Override
public void cleanUp() { public void cleanUp() {
super.cleanUp(); super.cleanUp();

View file

@ -42,6 +42,7 @@ import com.raytheon.uf.common.python.concurrent.PythonJobCoordinator;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.IAsyncStartupObjectListener; import com.raytheon.viz.gfe.core.IAsyncStartupObjectListener;
/** /**
@ -62,6 +63,7 @@ import com.raytheon.viz.gfe.core.IAsyncStartupObjectListener;
* Jul 30, 2015 4263 dgilling Major refactor so this object can be initialized off * Jul 30, 2015 4263 dgilling Major refactor so this object can be initialized off
* UI thread. * UI thread.
* Dec 14, 2015 4816 dgilling Support refactored PythonJobCoordinator API. * Dec 14, 2015 4816 dgilling Support refactored PythonJobCoordinator API.
* Apr 14, 2016 5578 dgilling Add getVarDict.
* *
* </pre> * </pre>
* *
@ -263,6 +265,39 @@ public class TextProductManager implements ILocalizationFileObserver {
return productDef; return productDef;
} }
/**
* Returns the varDict for the given text formatter. In GFE, the varDict is
* a Map (or dict) containing the user's selections from an optional popup
* dialog that can appear before executing a formatter.
* <p>
* To retrieve the varDict this will require a call into Jep (specifically
* FormatterRunner.py's getVarDict method) to retrieve the varDict.
* Depending on whether or not the formatter script defines the global
* variable variableList, this may cause an instance of ValuesDialog to
* display.
* <p>
* Do NOT call this function from the UI thread of CAVE or it will deadlock
* the application.
*
* @param productName
* @param dataManager
* @param dbId
* @return
*/
public String obtainVarDictSelections(String productName, DataManager dataManager,
String dbId) {
String varDict = null;
try {
varDict = jobCoordinator.submitJob(
new TextProductVarDictExecutor(getDisplayName(productName),
dataManager, issuedBy, dbId)).get();
} catch (Exception e) {
statusHandler.error(String.format(
"Error retrieving varDict for product %s", productName), e);
}
return varDict;
}
public String getVtecMessageType(String productCategory) { public String getVtecMessageType(String productCategory) {
String vtec = productDefaultVtecCoding.get(productCategory); String vtec = productDefaultVtecCoding.get(productCategory);
if (vtec == null) { if (vtec == null) {

View file

@ -0,0 +1,82 @@
/**
* 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.viz.gfe.textformatter;
import java.util.HashMap;
import java.util.Map;
import jep.JepException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.python.concurrent.IPythonExecutor;
import com.raytheon.viz.gfe.core.DataManager;
/**
* Executor object to get the user's selections from the formatter's
* ValuesDialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 14, 2016 #5578 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class TextProductVarDictExecutor implements
IPythonExecutor<FormatterScript, String> {
private final String displayName;
private final DataManager dataMgr;
private final String issuedBy;
private final DatabaseID dbID;
public TextProductVarDictExecutor(String displayName, DataManager dataMgr,
String issuedBy, String dbID) {
this.displayName = displayName;
this.dataMgr = dataMgr;
this.issuedBy = issuedBy;
this.dbID = new DatabaseID(dbID);
}
@Override
public String execute(FormatterScript script) throws JepException {
Map<String, Object> map = new HashMap<String, Object>(5, 1f);
map.put("paths", GfePyIncludeUtil.getTextProductsIncludePath());
map.put("dspName", displayName);
map.put("dataMgr", dataMgr);
map.put("ifpClient", dataMgr.getClient().getPythonClient());
map.put("issuedBy", issuedBy);
map.put("dataSource", dbID.getModelName());
String varDict = (String) script.execute("getVarDict", map);
return varDict;
}
}

View file

@ -87,7 +87,7 @@ plotDelegate = ObsPlotDelegate()
<text id="pressChngText" plotMode="text" plotParam="pressChange3Hour" plotFormat="%02.0f" plotUnit="Pa" style="text-anchor: start;" x="10px" y="0">018</text> <text id="pressChngText" plotMode="text" plotParam="pressChange3Hour" plotFormat="%02.0f" plotUnit="Pa" style="text-anchor: start;" x="10px" y="0">018</text>
<text id="dewText" plotMode="text" plotParam="DpT" plotUnit="°F" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="10px">59</text> <text id="dewText" plotMode="text" plotParam="DpT" plotUnit="°F" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="10px">59</text>
<text id="tempText" plotMode="text" plotParam="T" plotUnit="°F" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text> <text id="tempText" plotMode="text" plotParam="T" plotUnit="°F" plotFormat="%3.0f" style="text-anchor: end;" x="-10px" y="-10px">75</text>
<text id="pressure" plotMode="text" plotParam="seaLevelPress" plotUnit="dPa" plotFormat="%5.0f" plotTrim="2" style="text-anchor: start;" x="10px" y="-10px">018</text> <text id="pressure" plotMode="text" plotParam="seaLevelPress" plotUnit="kPa" plotFormat="%5.0f" plotTrim="2" style="text-anchor: start;" x="10px" y="-10px">018</text>
<text id="cloudText" plotMode="table" class="special" plotFunctionTable="cloud_select.txt" plotLookupTable="cloud_chars.txt" plotParam="skyCover" style="text-anchor: start" x="0" y="0">0</text> <text id="cloudText" plotMode="table" class="special" plotFunctionTable="cloud_select.txt" plotLookupTable="cloud_chars.txt" plotParam="skyCover" style="text-anchor: start" x="0" y="0">0</text>
<text id="presentWxText" plotMode="recursive_translation" class="weather" plotLookupTable="wx_symbol_trans.txt" plotParam="presWeather" style="text-anchor: end" x="-10" y="0">0</text> <text id="presentWxText" plotMode="recursive_translation" class="weather" plotLookupTable="wx_symbol_trans.txt" plotParam="presWeather" style="text-anchor: end" x="-10" y="0">0</text>
<text id="peakWind" plotMode="text" plotParam="pkwndSpeed" plotUnit="kts" plotFormat="PK%.0f" style="text-anchor: end;" x="-10px" y="20px">59</text> <text id="peakWind" plotMode="text" plotParam="pkwndSpeed" plotUnit="kts" plotFormat="PK%.0f" style="text-anchor: end;" x="-10px" y="20px">59</text>

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -32,9 +32,9 @@
-XX:G1MixedGCLiveThresholdPercent=25 -XX:G1MixedGCLiveThresholdPercent=25
-XX:G1OldCSetRegionThresholdPercent=25 -XX:G1OldCSetRegionThresholdPercent=25
-XX:G1HeapWastePercent=5</vmArgs> -XX:G1HeapWastePercent=5</vmArgs>
<vmArgsLin>-Xmx2560M -XX:MaxDirectMemorySize=2G <vmArgsLin>-Xmx6144M -XX:MaxDirectMemorySize=2G
-XX:OnOutOfMemoryError=&quot;capture -t no -p $pid &amp;&quot;</vmArgsLin> -XX:OnOutOfMemoryError=&quot;capture -t no -p $pid &amp;&quot;</vmArgsLin>
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx2560M</vmArgsWin> <vmArgsWin>-Dfile.encoding=UTF-8 -Xmx6144M</vmArgsWin>
</launcherArgs> </launcherArgs>
<windowImages i16="/com.raytheon.viz.product.awips/icons/cave_16x16.png" i32="/com.raytheon.viz.product.awips/icons/cave_32x32.png" i48="/com.raytheon.viz.product.awips/icons/cave_48x48.png" i64="/com.raytheon.viz.product.awips/icons/cave_64x64.png" i128="/com.raytheon.viz.product.awips/icons/cave_128x128.png"/> <windowImages i16="/com.raytheon.viz.product.awips/icons/cave_16x16.png" i32="/com.raytheon.viz.product.awips/icons/cave_32x32.png" i48="/com.raytheon.viz.product.awips/icons/cave_48x48.png" i64="/com.raytheon.viz.product.awips/icons/cave_64x64.png" i128="/com.raytheon.viz.product.awips/icons/cave_128x128.png"/>

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<bundle>
<displayList>
<displays xsi:type="d2DMapRenderableDisplay"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties loadWithoutData="true">
<capabilities>
<capability xsi:type="imagingCapability"
interpolationState="false" brightness="1.0"
contrast="1.0" alpha="1.0" />
<capability xsi:type="groupNamingCapability" />
</capabilities>
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false" isHoverOn="false"
isVisible="true" />
<resourceData xsi:type="radarMosaicResourceData"
productName="${name}" isUpdatingOnMetadataOnly="false"
isRequeryNecessaryOnTimeMatch="true"
retrieveData="false">
<binOffset posOffset="360" negOffset="0"
virtualOffset="0" />
<metadataMap>
<mapping key="productCode">
<constraint constraintValue="${product}"
constraintType="IN" />
</mapping>
<mapping key="icao">
<constraint constraintValue="${mosaicIcaoList}"
constraintType="IN" />
</mapping>
<mapping key="primaryElevationAngle">
<constraint constraintValue="${elevation}"
constraintType="EQUALS" />
</mapping>
<mapping key="layer">
<constraint constraintValue="${layer}"
constraintType="EQUALS" />
</mapping>
<mapping key="pluginName">
<constraint constraintValue="radar"
constraintType="EQUALS" />
</mapping>
</metadataMap>
<resourceFactory xsi:type="radarMosaicResourceFactory"
values="${mosaicIcaoList}" key="kxxx">
<resource>
<loadProperties
loadWithoutData="true">
<capabilities>
<capability xsi:type="imagingCapability"
interpolationState="false"
brightness="1.0" contrast="1.0"
alpha="1.0" />
</capabilities>
</loadProperties>
<properties isSystemResource="false"
isBlinking="false" isMapLayer="false"
isHoverOn="false" isVisible="true" />
<resourceData xsi:type="radarResourceData"
isUpdatingOnMetadataOnly="false"
isRequeryNecessaryOnTimeMatch="true">
<metadataMap>
<mapping key="productCode">
<constraint
constraintValue="${product}"
constraintType="IN" />
</mapping>
<mapping key="icao">
<constraint
constraintValue="kxxx"
constraintType="EQUALS" />
</mapping>
<mapping key="primaryElevationAngle">
<constraint
constraintValue="${elevation}"
constraintType="EQUALS" />
</mapping>
<mapping key="layer">
<constraint
constraintValue="${layer}"
constraintType="EQUALS" />
</mapping>
<mapping key="pluginName">
<constraint
constraintValue="radar"
constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</resourceFactory>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -11,7 +11,7 @@
menuText="10km Radar Coded Msg" id="10kmRadarCodedMsg" /> menuText="10km Radar Coded Msg" id="10kmRadarCodedMsg" />
<contribute xsi:type="subinclude" fileName="menus/radar/airportRadars.xml" /> <contribute xsi:type="subinclude" fileName="menus/radar/airportRadars.xml" />
<contribute xsi:type="titleItem" titleText="------ Mosaic ------" id="RadarMosaic" /> <contribute xsi:type="titleItem" titleText="------ Mosaic ------" id="RadarMosaic" />
<contribute xsi:type="subinclude" fileName="menus/radar/otherMosaicMenus.xml" /> <contribute xsi:type="subinclude" fileName="menus/radar/regionalMosaicMenus.xml" />
<contribute xsi:type="subinclude" fileName="menus/radar/radarMosaicProductMenu.xml" /> <contribute xsi:type="subinclude" fileName="menus/radar/radarMosaicProductMenu.xml" />
<contribute xsi:type="separator" id="belowRadarMosaics" /> <contribute xsi:type="separator" id="belowRadarMosaics" />
<contribute xsi:type="subMenu" menuText="Dial Radars" id="RadarMenuDialRadarsSubMenu"> <contribute xsi:type="subMenu" menuText="Dial Radars" id="RadarMenuDialRadarsSubMenu">

View file

@ -19,7 +19,7 @@
further_licensing_information. further_licensing_information.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="toolbarSubMenu" menuText="Probablistic Forecasts"> <contribute xsi:type="toolbarSubMenu" menuText="Probabilistic Forecasts">
<contribute xsi:type="toolbarSubMenu" menuText="12hr"> <contribute xsi:type="toolbarSubMenu" menuText="12hr">
<contribute xsi:type="menuItem" menuText="12hr 5th Percentile Snow accumulation" key="TOTSN5pct12hr" indentText="false" /> <contribute xsi:type="menuItem" menuText="12hr 5th Percentile Snow accumulation" key="TOTSN5pct12hr" indentText="false" />
<contribute xsi:type="menuItem" menuText="12hr 10th Percentile Snow accumulation" key="TOTSN10pct12hr" indentText="false" /> <contribute xsi:type="menuItem" menuText="12hr 10th Percentile Snow accumulation" key="TOTSN10pct12hr" indentText="false" />

View file

@ -0,0 +1,34 @@
#!/usr/bin/env python2
# #5345
# Convert sea level pressure from hPa to Pa in an hdf5 file
# Do nothing if all values are already in Pa
import sys
import h5py
def main():
if len(sys.argv) != 2:
print "usage: {} filename.h5".format(sys.argv[0])
sys.exit(1)
didstuff = False
try:
with h5py.File(sys.argv[1], 'r+') as f:
if 'seaLevelPress' in f:
for i, data in enumerate(f['seaLevelPress']):
if data > 0 and data < 1999:
f['seaLevelPress'][i] = data * 100.0
didstuff = True
except Exception as e:
print "ERROR: " + str(sys.exc_info()[0]) + ": " + str(e)
sys.exit(1)
if didstuff:
print "INFO: {}: updated".format(sys.argv[1])
else:
print "INFO: {}: no update needed".format(sys.argv[1])
if __name__ == "__main__":
main()

View file

@ -0,0 +1,21 @@
#!/bin/bash
# #5345
# Convert sea level pressure from hPa to Pa in all h5 files
TARGET=/awips2/edex/data/hdf5/obs
THIS_LOCATION=$(dirname $0)
success=0
for item in $(find $TARGET -type f -name "*.h5"); do
$THIS_LOCATION/_update_metar_slp_values.py $item
if [[ $? -ne 0 ]]; then
success=1
fi
done
if [[ success -eq 0 ]]; then
echo INFO: No errors reported.
else
echo "ERROR: There was a problem with one or more updates; see above."
fi

View file

@ -75,12 +75,13 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 13, 2011 #8393 dgilling Initial creation * Apr 13, 2011 #8393 dgilling Initial creation
* 02/19/13 #1637 randerso Added exception handling for Discrete and Weather * 02/19/13 #1637 randerso Added exception handling for Discrete and Weather
* 10/31/2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() * 10/31/2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* 04/22/2014 #3050 randerso Allow exceptions to propagate to caller from readASCIIGridData * 04/22/2014 #3050 randerso Allow exceptions to propagate to caller from readASCIIGridData
* Jan 14, 2016 #5237 tgurney Allow outputAsciiGridData to take * 01/14/2016 #5237 tgurney Allow outputAsciiGridData to take
* OutputStream as well as File * OutputStream as well as File
* 04/04/2016 #5539 randerso Fixed unsigned byte issues
* *
* </pre> * </pre>
* *
@ -341,7 +342,7 @@ public class ASCIIGrid {
WeatherGridSlice weather = (WeatherGridSlice) gs; WeatherGridSlice weather = (WeatherGridSlice) gs;
for (int i = weather.getWeatherGrid().getYdim() - 1; i >= 0; i--) { for (int i = weather.getWeatherGrid().getYdim() - 1; i >= 0; i--) {
for (int j = 0; j < weather.getWeatherGrid().getXdim(); j++) { for (int j = 0; j < weather.getWeatherGrid().getXdim(); j++) {
String key = weather.getKeys()[weather String key = weather.getKeys()[0xFF & weather
.getWeatherGrid().get(j, i)].toString(); .getWeatherGrid().get(j, i)].toString();
printStream.println(key); printStream.println(key);
} }
@ -352,7 +353,7 @@ public class ASCIIGrid {
for (int i = discrete.getDiscreteGrid().getYdim() - 1; i >= 0; i--) { for (int i = discrete.getDiscreteGrid().getYdim() - 1; i >= 0; i--) {
for (int j = 0; j < discrete.getDiscreteGrid() for (int j = 0; j < discrete.getDiscreteGrid()
.getXdim(); j++) { .getXdim(); j++) {
String key = discrete.getKeys()[discrete String key = discrete.getKeys()[0xFF & discrete
.getDiscreteGrid().get(j, i)].toString(); .getDiscreteGrid().get(j, i)].toString();
printStream.println(key); printStream.println(key);
} }

View file

@ -35,8 +35,8 @@ import javax.measure.unit.Unit;
import com.raytheon.edex.plugin.gfe.server.IFPServer; import com.raytheon.edex.plugin.gfe.server.IFPServer;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase; import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo.GridType;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation; import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo.GridType;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainer; import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainer;
import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainers; import com.raytheon.uf.common.dataplugin.gfe.point.GFEPointDataContainers;
@ -70,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jun 13, 2013 #2044 randerso Refactored to use IFPServer * Jun 13, 2013 #2044 randerso Refactored to use IFPServer
* Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys() * Oct 31, 2013 #2508 randerso Change to use DiscreteGridSlice.getKeys()
* Apr 23, 2014 #3006 randerso Restructured code to work with multi-hour grids * Apr 23, 2014 #3006 randerso Restructured code to work with multi-hour grids
* Apr 04, 2016 #5539 randerso Fixed unsigned byte issues
* *
* </pre> * </pre>
* *
@ -209,7 +210,7 @@ public class GetPointDataHandler extends BaseGfeRequestHandler implements
byte discreteValue = discreteSlice byte discreteValue = discreteSlice
.getDiscreteGrid().get(x, y); .getDiscreteGrid().get(x, y);
String discreteKey = discreteSlice String discreteKey = discreteSlice
.getKeys()[discreteValue] .getKeys()[0xFF & discreteValue]
.toString(); .toString();
type = Type.STRING; type = Type.STRING;
view.setData(param, type, unit, discreteKey); view.setData(param, type, unit, discreteKey);
@ -218,7 +219,7 @@ public class GetPointDataHandler extends BaseGfeRequestHandler implements
WeatherGridSlice weatherSlice = (WeatherGridSlice) slice; WeatherGridSlice weatherSlice = (WeatherGridSlice) slice;
byte wxValue = weatherSlice byte wxValue = weatherSlice
.getWeatherGrid().get(x, y); .getWeatherGrid().get(x, y);
String wxKey = weatherSlice.getKeys()[wxValue] String wxKey = weatherSlice.getKeys()[0xFF & wxValue]
.toString(); .toString();
type = Type.STRING; type = Type.STRING;
view.setData(param, type, unit, wxKey); view.setData(param, type, unit, wxKey);

View file

@ -41,6 +41,8 @@
# 05/13/2015 4427 dgilling Add siteIdOverride field. # 05/13/2015 4427 dgilling Add siteIdOverride field.
# 08/06/2015 4718 dgilling Optimize casting when using where with # 08/06/2015 4718 dgilling Optimize casting when using where with
# NumPy 1.9. # NumPy 1.9.
# 04/07/2016 5539 randerso Reversed order of parameters/return value in collapseKey
# to match order of Wx/Discrete tuple
# #
## ##
@ -924,21 +926,20 @@ def storeVectorWE(we, trList, file, timeRange,
###-------------------------------------------------------------------------### ###-------------------------------------------------------------------------###
# Collapse key and bytes. (for discrete and weather) # Collapse key and bytes. (for discrete and weather)
### Returns tuple of (updated key, updated grid) ### Returns tuple of (updated grid, updated key)
def collapseKey(keys, grid): def collapseKey(grid, keys):
#make list of unique indexes in the grid #make list of unique indexes in the grid
flatGrid = grid.flat flatGrid = grid.flat
used = [] used = numpy.zeros((len(keys)), dtype=numpy.bool)
for n in range(flatGrid.__array__().shape[0]): for n in range(flatGrid.__array__().shape[0]):
if flatGrid[n] not in used: used[0xFF & flatGrid[n]] = True
used.append(flatGrid[n])
#make reverse map #make reverse map
map = [] map = []
newKeys = [] newKeys = []
j = 0 j = 0
for i in range(len(keys)): for i in range(len(keys)):
if i in used: if used[i]:
map.append(j) map.append(j)
newKeys.append(keys[i]) newKeys.append(keys[i])
j = j + 1 j = j + 1
@ -948,10 +949,10 @@ def collapseKey(keys, grid):
# modify the data # modify the data
newGrid = grid newGrid = grid
for k in range(len(map)): for k in range(len(map)):
mask = numpy.equal(k, grid) mask = numpy.equal(numpy.int8(k), grid)
newGrid = numpy.where(mask, numpy.int8(map[k]), newGrid).astype(numpy.int8) newGrid = numpy.where(mask, numpy.int8(map[k]), newGrid).astype(numpy.int8)
return (newKeys, newGrid) return (newGrid, newKeys)
###-------------------------------------------------------------------------### ###-------------------------------------------------------------------------###
# Stores the specified Weather WE in the netCDF file whose grids fall within # Stores the specified Weather WE in the netCDF file whose grids fall within
@ -987,7 +988,7 @@ def storeWeatherWE(we, trList, file, timeRange, databaseID, invMask, clipArea, s
# Process the weather keys so we store only what is necessary # Process the weather keys so we store only what is necessary
for g in range(byteCube.shape[0]): for g in range(byteCube.shape[0]):
(keyList[g], byteCube[g]) = collapseKey(keyList[g], byteCube[g]) (byteCube[g], keyList[g]) = collapseKey(byteCube[g], keyList[g])
# Mask the values # Mask the values
fillValue = -127 fillValue = -127
@ -1072,7 +1073,7 @@ def storeDiscreteWE(we, trList, file, timeRange, databaseID, invMask, clipArea,
# Process the discrete keys so we store only what is necessary # Process the discrete keys so we store only what is necessary
for g in range(byteCube.shape[0]): for g in range(byteCube.shape[0]):
(keyList[g], byteCube[g]) = collapseKey(keyList[g], byteCube[g]) (byteCube[g], keyList[g]) = collapseKey(byteCube[g], keyList[g])
# Mask the values # Mask the values
fillValue = -127 fillValue = -127

View file

@ -39,7 +39,7 @@ import LogStream, fcntl
# 11/05/13 2517 randerso Improve memory utilization # 11/05/13 2517 randerso Improve memory utilization
# 08/06/2015 4718 dgilling Optimize casting when using where with # 08/06/2015 4718 dgilling Optimize casting when using where with
# NumPy 1.9. # NumPy 1.9.
# # 04/07/2016 5539 randerso Fixed issues with Wx/Discretes with large number of keys
# #
# #
@ -79,6 +79,9 @@ class MergeGrid:
index = keyMap.index(key) index = keyMap.index(key)
return index return index
except: except:
if (len(keyMap) >= 256):
raise IndexError("Attempt to create more than 256 Wx keys")
keyMap.append(key) keyMap.append(key)
return len(keyMap) - 1 return len(keyMap) - 1
@ -186,6 +189,36 @@ class MergeGrid:
return (magGrid, dirGrid) return (magGrid, dirGrid)
###-------------------------------------------------------------------------###
# Collapse key and bytes. (for discrete and weather)
### Returns tuple of (updated grid, updated key)
def __collapseKey(self, grid, keys):
#make list of unique indexes in the grid
flatGrid = grid.flat
used = numpy.zeros((len(keys)), dtype=numpy.bool)
for n in range(flatGrid.__array__().shape[0]):
used[0xFF & flatGrid[n]] = True
#make reverse map
map = []
newKeys = []
j = 0
for i in range(len(keys)):
if used[i]:
map.append(j)
newKeys.append(keys[i])
j = j + 1
else:
map.append(-1)
# modify the data
newGrid = grid
for k in range(len(map)):
mask = numpy.equal(numpy.int8(k), grid)
newGrid = numpy.where(mask, numpy.int8(map[k]), newGrid).astype(numpy.int8)
return (newGrid, newKeys)
#--------------------------------------------------------------------- #---------------------------------------------------------------------
# merge weather grid # merge weather grid
# #
@ -208,6 +241,11 @@ class MergeGrid:
noWxGrid = numpy.empty_like(gridA[0]) noWxGrid = numpy.empty_like(gridA[0])
noWxGrid.fill(self.__findKey(noWx, noWxKeys)) noWxGrid.fill(self.__findKey(noWx, noWxKeys))
gridB = (noWxGrid, noWxKeys) gridB = (noWxGrid, noWxKeys)
else:
# clear out the masked area in gridB and collapse gridB's keys
grid, keys = gridB
grid[mask]= self.__findKey(noWx, keys)
gridB = self.__collapseKey(grid, keys)
(commonkey, remapG, dbG) = self.__commonizeKey(gridA, gridB) (commonkey, remapG, dbG) = self.__commonizeKey(gridA, gridB)
mergedGrid = numpy.where(mask, remapG, dbG) mergedGrid = numpy.where(mask, remapG, dbG)
return (mergedGrid, commonkey) return (mergedGrid, commonkey)
@ -242,6 +280,11 @@ class MergeGrid:
noGrid = numpy.empty_like(gridA[0]) noGrid = numpy.empty_like(gridA[0])
noGrid.fill(self.__findKey(noKey, noKeys)) noGrid.fill(self.__findKey(noKey, noKeys))
gridB = (noGrid, noKeys) gridB = (noGrid, noKeys)
else:
# clear out the masked area in gridB and collapse gridB's keys
grid, keys = gridB
grid[mask] = self.__findKey(noKey, keys)
gridB = self.__collapseKey(grid, keys)
(commonkey, remapG, dbG) = \ (commonkey, remapG, dbG) = \
self.__commonizeKey(gridA, gridB) self.__commonizeKey(gridA, gridB)

View file

@ -23,11 +23,14 @@ package com.raytheon.edex.plugin.grib.decoderpostprocessors;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
@ -35,7 +38,6 @@ import org.apache.camel.Headers;
import com.raytheon.edex.plugin.grib.decoderpostprocessors.DecoderPostProcessor.PostProcessorType; import com.raytheon.edex.plugin.grib.decoderpostprocessors.DecoderPostProcessor.PostProcessorType;
import com.raytheon.edex.plugin.grib.exception.GribException; import com.raytheon.edex.plugin.grib.exception.GribException;
import com.raytheon.edex.plugin.grib.util.GribModelLookup;
import com.raytheon.uf.common.dataplugin.PluginException; import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.dataplugin.grid.GridRecord;
@ -54,11 +56,11 @@ import com.raytheon.uf.common.status.UFStatus;
/** /**
* An implementation to modify a grib record after the initial grid decoding if * An implementation to modify a grib record after the initial grid decoding if
* necessary * necessary
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Aug 30, 2010 5875 bphillip Initial Creation * Aug 30, 2010 5875 bphillip Initial Creation
@ -72,9 +74,11 @@ import com.raytheon.uf.common.status.UFStatus;
* Oct 14, 2015 4627 nabowle Load post processor mappings at each * Oct 14, 2015 4627 nabowle Load post processor mappings at each
* localization level as available, appending * localization level as available, appending
* only new processors. * only new processors.
* * Apr 15, 2016 5182 tjensen Changed processorMap population to be done
* during processing instead of up front.
*
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
@ -88,13 +92,15 @@ public class GribPostProcessor {
private static GribPostProcessor instance; private static GribPostProcessor instance;
/** The map containing the currently registered grib post processors */ /** The map containing the currently registered grib post processors */
private Map<String, List<DecoderPostProcessor>> processorMap; private Map<String, List<DecoderPostProcessor>> processorMap = new ConcurrentHashMap<>();
private Map<String, String> knownProcessors = new HashMap<>(); private final Map<String, String> knownProcessors = new HashMap<>();;
private List<PostProcessedModel> postProcessedModels;
/** /**
* Gets the singleton instance of GribPostProcessor * Gets the singleton instance of GribPostProcessor
* *
* @return The singleton instance of GribPostProcessor * @return The singleton instance of GribPostProcessor
*/ */
public static synchronized GribPostProcessor getInstance() { public static synchronized GribPostProcessor getInstance() {
@ -113,7 +119,7 @@ public class GribPostProcessor {
/** /**
* Processes the GribRecords to determine if they need post processing * Processes the GribRecords to determine if they need post processing
* *
* @param records * @param records
* The records to examine * The records to examine
* @return The GribRecords including any new records created during the post * @return The GribRecords including any new records created during the post
@ -122,7 +128,7 @@ public class GribPostProcessor {
*/ */
public GridRecord[] process(GridRecord[] records) throws GribException { public GridRecord[] process(GridRecord[] records) throws GribException {
synchronized (this) { synchronized (this) {
if (this.processorMap == null) { if (this.postProcessedModels == null) {
initProcessorMap(); initProcessorMap();
} }
} }
@ -131,10 +137,22 @@ public class GribPostProcessor {
GridRecord[] results = null; GridRecord[] results = null;
List<GridRecord> additionalGrids = null; List<GridRecord> additionalGrids = null;
for (int i = 0; i < records.length; i++) { for (int i = 0; i < records.length; i++) {
// Check the map to see if this grib record is part of a model for String modelName = records[i].getDatasetId();
// which post processing is necessary
processors = processorMap.get(records[i].getDatasetId()); /*
if (processors != null) { * If we don't already have a entry in the map, check to see if we
* need to add one.
*/
if (processorMap.get(modelName) == null) {
lookupModelProcessors(modelName);
}
/*
* Check the map to see if this grib record is part of a model for
* which post processing is necessary
*/
processors = processorMap.get(modelName);
if (processors != null && !processors.isEmpty()) {
for (DecoderPostProcessor processor : processors) { for (DecoderPostProcessor processor : processors) {
// Post processing is not necessary, so we continue // Post processing is not necessary, so we continue
if (processor == null if (processor == null
@ -172,7 +190,7 @@ public class GribPostProcessor {
/** /**
* Processes the GridRecords to determine if they need post processing * Processes the GridRecords to determine if they need post processing
* *
* @param notif * @param notif
* A notification of datauri's that have been persisted. * A notification of datauri's that have been persisted.
* @return Only grid records created by the post processors. The records * @return Only grid records created by the post processors. The records
@ -244,7 +262,7 @@ public class GribPostProcessor {
/** /**
* Registers the DecoderPostProcessor classes for the supplied * Registers the DecoderPostProcessor classes for the supplied
* fully-qualified classnames. * fully-qualified classnames.
* *
* @param fqClassNames * @param fqClassNames
* The list of fully-qualified classnames to register. * The list of fully-qualified classnames to register.
*/ */
@ -288,16 +306,14 @@ public class GribPostProcessor {
} }
/** /**
* Initializes the processor map. Starting at base working to site, the * Initializes the list of postProcessedModels and the processor map.
* localization files will be unmarshalled if present and new processors * Starting at base working to site, the localization files will be
* will be appended to the list of processors for a model. If a processor * unmarshalled if present and new processors will be appended to the list
* has already been configured for a model, it will not be added again. * of processors for a model. If a processor has already been configured for
* * a model, it will not be added again.
* It's assumed that every processor will have already been registered under *
* its simple name, or is fully qualified. * The processor map is initially empty, but will be populated as records
* * are processed to prevent repeated lookup for the same model.
* Other than the first initialization, the processor map will only be
* changed if the new value is not an empty map.
*/ */
private synchronized void initProcessorMap() { private synchronized void initProcessorMap() {
IPathManager pathMgr = PathManagerFactory.getPathManager(); IPathManager pathMgr = PathManagerFactory.getPathManager();
@ -310,7 +326,7 @@ public class GribPostProcessor {
.getTieredLocalizationFile(LocalizationType.EDEX_STATIC, .getTieredLocalizationFile(LocalizationType.EDEX_STATIC,
"/grib/postProcessModels/postProcessedModels.xml"); "/grib/postProcessModels/postProcessedModels.xml");
PostProcessedModelSet ppModelSet; PostProcessedModelSet ppModelSet;
List<PostProcessedModel> postProcessedModels = new ArrayList<>(); postProcessedModels = new ArrayList<>();
Map<String, Integer> idMap = new HashMap<>(); Map<String, Integer> idMap = new HashMap<>();
for (LocalizationLevel level : levels) { for (LocalizationLevel level : levels) {
processorFile = files.get(level); processorFile = files.get(level);
@ -339,7 +355,8 @@ public class GribPostProcessor {
Integer idx = idMap.get(ppModel.getId()); Integer idx = idMap.get(ppModel.getId());
if (idx == null) { if (idx == null) {
postProcessedModels.add(ppModel); postProcessedModels.add(ppModel);
idMap.put(ppModel.getId(), postProcessedModels.size() - 1); idMap.put(ppModel.getId(),
postProcessedModels.size() - 1);
} else { } else {
postProcessedModels.remove(idx.intValue()); postProcessedModels.remove(idx.intValue());
postProcessedModels.add(idx.intValue(), ppModel); postProcessedModels.add(idx.intValue(), ppModel);
@ -355,64 +372,69 @@ public class GribPostProcessor {
} }
/* /*
* Iterate over post processed models. Determine which models apply to * Initialize processorMap to an empty map. Map will be populated as
* records are processed.
*/
this.processorMap.clear();
}
/**
* For a given model name, determine if the model applies for each post
* processor. If so, update the processor map for this model to prevent
* repeated lookup for this model.
*
* @param modelName
*/
private synchronized void lookupModelProcessors(String modelName) {
/*
* Iterate over post processed models. Determine if model applies to
* each post processor if a regex is present * each post processor if a regex is present
*/ */
String knownProc; String knownProc;
String classToLoad; String classToLoad;
List<DecoderPostProcessor> processorInstances; Matcher m;
Set<String> modelNames = GribModelLookup.getInstance().getModelNames(); List<DecoderPostProcessor> processorInstances = new ArrayList<>();
Map<String, List<DecoderPostProcessor>> newMap = new HashMap<>();
for (PostProcessedModel ppModel : postProcessedModels) { for (PostProcessedModel ppModel : postProcessedModels) {
if (ppModel.getModelName() == null) { if (ppModel.getModelName() == null) {
continue; continue;
} }
for (String modelName : modelNames) { m = ppModel.getModelNamePattern().matcher(modelName);
if (modelName.matches(ppModel.getModelName())) { if (m.matches()) {
processorInstances = newMap.get(modelName); for (String processor : ppModel.getProcessors()) {
if (processorInstances == null) { knownProc = this.knownProcessors.get(processor);
processorInstances = new ArrayList<DecoderPostProcessor>(); if (knownProc != null) {
newMap.put(modelName, processorInstances); classToLoad = knownProc;
} else {
classToLoad = processor;
} }
for (String processor : ppModel.getProcessors()) { try {
knownProc = this.knownProcessors.get(processor); boolean alreadyConfigured = false;
if (knownProc != null) { for (DecoderPostProcessor instance : processorInstances) {
classToLoad = knownProc; if (classToLoad.equals(instance.getClass()
} else { .getName())) {
classToLoad = processor; alreadyConfigured = true;
} statusHandler.debug(classToLoad
+ " is already configured for "
try { + modelName + ".");
boolean alreadyConfigured = false; break;
for (DecoderPostProcessor instance : processorInstances) {
if (classToLoad.equals(instance.getClass()
.getName())) {
alreadyConfigured = true;
statusHandler.debug(classToLoad
+ " is already configured for "
+ modelName + ".");
break;
}
} }
if (!alreadyConfigured) {
processorInstances
.add((DecoderPostProcessor) Class
.forName(classToLoad)
.newInstance());
}
} catch (Exception e) {
statusHandler.fatal(
"Error instantiating grib post processor for "
+ processor, e);
} }
if (!alreadyConfigured) {
processorInstances.add((DecoderPostProcessor) Class
.forName(classToLoad).newInstance());
}
} catch (Exception e) {
statusHandler.fatal(
"Error instantiating grib post processor for "
+ processor, e);
} }
} }
} }
} }
if (processorInstances.isEmpty()) {
if (this.processorMap == null || !newMap.isEmpty()) { processorInstances = Collections.emptyList();
this.processorMap = newMap;
} }
processorMap.put(modelName, processorInstances);
} }
} }

View file

@ -21,6 +21,7 @@ package com.raytheon.edex.plugin.grib.decoderpostprocessors;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
@ -30,20 +31,21 @@ import javax.xml.bind.annotation.XmlRootElement;
/** /**
* A container class to hold which post processors apply to a grib model * A container class to hold which post processors apply to a grib model
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jul 24, 2012 949 bphillip Initial Creation * Jul 24, 2012 949 bphillip Initial Creation
* Oct 15, 2013 2473 bsteffen Remove deprecated ISerializableObject. * Oct 15, 2013 2473 bsteffen Remove deprecated ISerializableObject.
* Oct 14, 2015 4627 nabowle Add id attribute. * Oct 14, 2015 4627 nabowle Add id attribute.
* * Apr 18, 2016 5182 tjensen Optimized to store modelNamePattern
* *
*
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
@ -70,6 +72,11 @@ public class PostProcessedModel {
@XmlElement(name = "processorName") @XmlElement(name = "processorName")
private List<String> processors; private List<String> processors;
/**
* Stores the regex pattern so it only needs to be calculated once.
*/
private Pattern modelNamePattern;
public PostProcessedModel() { public PostProcessedModel() {
} }
@ -80,6 +87,7 @@ public class PostProcessedModel {
public void setModelName(String modelName) { public void setModelName(String modelName) {
this.modelName = modelName; this.modelName = modelName;
this.modelNamePattern = Pattern.compile(modelName);
} }
/** /**
@ -122,4 +130,10 @@ public class PostProcessedModel {
return buf.toString(); return buf.toString();
} }
public Pattern getModelNamePattern() {
if (modelName != null && modelNamePattern == null) {
modelNamePattern = Pattern.compile(modelName);
}
return modelNamePattern;
}
} }

View file

@ -26,6 +26,8 @@ import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.measure.unit.SI;
import com.raytheon.edex.esb.Headers; import com.raytheon.edex.esb.Headers;
import com.raytheon.edex.exception.DecoderException; import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.obs.metar.util.VisibilityParser; import com.raytheon.edex.plugin.obs.metar.util.VisibilityParser;
@ -90,6 +92,7 @@ import com.vividsolutions.jts.geom.impl.CoordinateArraySequence;
* Jul 13, 2015 4389 skorolev Added correction of invalid (NUL) characters in the message. * Jul 13, 2015 4389 skorolev Added correction of invalid (NUL) characters in the message.
* Nov 01, 2015 DR 14741 MPorricelli Modified WIND_VAR_DIR_EXP pattern to prevent its matching * Nov 01, 2015 DR 14741 MPorricelli Modified WIND_VAR_DIR_EXP pattern to prevent its matching
* some RVR strings * some RVR strings
* Mar 08, 2016 5345 tgurney Convert sea level pressure from hPa to Pa
* *
* </pre> * </pre>
* *
@ -720,6 +723,8 @@ public class MetarDecoder {
// nothing // nothing
} }
if (slp != null) { if (slp != null) {
slp = (float) SI.HECTO(SI.PASCAL)
.getConverterTo(SI.PASCAL).convert(slp);
record.setSeaLevelPress(slp); record.setSeaLevelPress(slp);
} }
} }

View file

@ -42,6 +42,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Oct 22, 2008 1624 wdougherty Speed up translate method * Oct 22, 2008 1624 wdougherty Speed up translate method
* Sep 01, 2014 3572 randerso Changed getNumpy to use getBytes() * Sep 01, 2014 3572 randerso Changed getNumpy to use getBytes()
* Apr 23, 2015 4259 njensen Updated for new JEP API * Apr 23, 2015 4259 njensen Updated for new JEP API
* Apr 04, 2016 5539 randerso Fixed toString method to handle unsigned bytes
* *
* </pre> * </pre>
* *
@ -103,7 +104,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
*/ */
public Grid2DByte(int xDim, int yDim, byte[] data) { public Grid2DByte(int xDim, int yDim, byte[] data) {
this(xDim, yDim); this(xDim, yDim);
if (xDim * yDim != data.length) { if ((xDim * yDim) != data.length) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Dimensions do not match data length (" + xDim + "," + yDim "Dimensions do not match data length (" + xDim + "," + yDim
+ ") " + data.length); + ") " + data.length);
@ -122,7 +123,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
* ByteBuffer of initialization data * ByteBuffer of initialization data
*/ */
public Grid2DByte(int xDim, int yDim, ByteBuffer data) { public Grid2DByte(int xDim, int yDim, ByteBuffer data) {
if (xDim * yDim != data.limit()) { if ((xDim * yDim) != data.limit()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Dimensions do not match data length (" + xDim + "," + yDim "Dimensions do not match data length (" + xDim + "," + yDim
+ ") " + data.limit()); + ") " + data.limit());
@ -165,7 +166,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
if (!isValid(xDim, yDim)) { if (!isValid(xDim, yDim)) {
throw new IllegalArgumentException("Dimensions not valid"); throw new IllegalArgumentException("Dimensions not valid");
} }
return buffer.get(yDim * this.xdim + xDim); return buffer.get((yDim * this.xdim) + xDim);
} }
/** /**
@ -180,7 +181,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
if (!isValid(xDim, yDim)) { if (!isValid(xDim, yDim)) {
throw new IllegalArgumentException("Dimensions not valid"); throw new IllegalArgumentException("Dimensions not valid");
} }
buffer.put(yDim * this.xdim + xDim, aValue); buffer.put((yDim * this.xdim) + xDim, aValue);
} }
public void set(int xDim, int yDim, int aValue) { public void set(int xDim, int yDim, int aValue) {
@ -205,7 +206,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
@Override @Override
public boolean isValid(int x, int y) { public boolean isValid(int x, int y) {
return (x < xdim && y < ydim && x >= 0 && y >= 0); return ((x < xdim) && (y < ydim) && (x >= 0) && (y >= 0));
} }
/** /**
@ -224,7 +225,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
* y coordinate to clear * y coordinate to clear
*/ */
public void clear(int x, int y) { public void clear(int x, int y) {
buffer.put(y * xdim + x, (byte) 0); buffer.put((y * xdim) + x, (byte) 0);
} }
/** /**
@ -241,7 +242,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
// make another Grid2DByte // make another Grid2DByte
Grid2DByte rVal = new Grid2DByte(this.xdim, this.ydim, (byte) 0); Grid2DByte rVal = new Grid2DByte(this.xdim, this.ydim, (byte) 0);
if (Math.abs(deltaCoord.x) < xdim && Math.abs(deltaCoord.y) < ydim) { if ((Math.abs(deltaCoord.x) < xdim) && (Math.abs(deltaCoord.y) < ydim)) {
// Find iteration limits for X // Find iteration limits for X
int fromXStart; int fromXStart;
int toXStart; int toXStart;
@ -275,8 +276,8 @@ public class Grid2DByte implements IGrid2D, Cloneable {
byte[] toA = rVal.getBuffer().array(); byte[] toA = rVal.getBuffer().array();
// Calculate from/to array offsets of the first point. // Calculate from/to array offsets of the first point.
int fromOffset = fromYStart * xdim + fromXStart; int fromOffset = (fromYStart * xdim) + fromXStart;
int toOffset = toYStart * xdim + toXStart; int toOffset = (toYStart * xdim) + toXStart;
// For each row, copy cols bytes of data. // For each row, copy cols bytes of data.
// Then update offsets for next row. // Then update offsets for next row.
@ -328,9 +329,9 @@ public class Grid2DByte implements IGrid2D, Cloneable {
@Override @Override
public Grid2DByte subGrid(int minX, int minY, int maxX, int maxY) { public Grid2DByte subGrid(int minX, int minY, int maxX, int maxY) {
Grid2DByte rVal = new Grid2DByte(maxX + 1 - minX, maxY + 1 - minY); Grid2DByte rVal = new Grid2DByte((maxX + 1) - minX, (maxY + 1) - minY);
for (int y = minY; y < maxY + 1; y++) { for (int y = minY; y < (maxY + 1); y++) {
for (int x = minX; x < maxX + 1; x++) { for (int x = minX; x < (maxX + 1); x++) {
rVal.buffer.put(this.get(x, y)); rVal.buffer.put(this.get(x, y));
} }
} }
@ -345,7 +346,8 @@ public class Grid2DByte implements IGrid2D, Cloneable {
Grid2DByte rhsGrid2DByte = (Grid2DByte) rhs; Grid2DByte rhsGrid2DByte = (Grid2DByte) rhs;
if (this.xdim != rhsGrid2DByte.xdim || this.ydim != rhsGrid2DByte.ydim) { if ((this.xdim != rhsGrid2DByte.xdim)
|| (this.ydim != rhsGrid2DByte.ydim)) {
return false; return false;
} }
@ -374,9 +376,10 @@ public class Grid2DByte implements IGrid2D, Cloneable {
Grid2DByte sourceGrid2DByte = (Grid2DByte) sourceGrid; Grid2DByte sourceGrid2DByte = (Grid2DByte) sourceGrid;
if (this.xdim != sourceGrid2DByte.xdim || this.xdim != maskGrid.xdim if ((this.xdim != sourceGrid2DByte.xdim)
|| this.ydim != sourceGrid2DByte.ydim || (this.xdim != maskGrid.xdim)
|| this.ydim != maskGrid.ydim) { || (this.ydim != sourceGrid2DByte.ydim)
|| (this.ydim != maskGrid.ydim)) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"This grid, the input grid, and the input mask grid must have equal dimensions"); "This grid, the input grid, and the input mask grid must have equal dimensions");
} }
@ -407,7 +410,7 @@ public class Grid2DByte implements IGrid2D, Cloneable {
rVal += xdim + "X" + ydim + "\n[\n"; rVal += xdim + "X" + ydim + "\n[\n";
for (int y = 0; y < ydim; y++) { for (int y = 0; y < ydim; y++) {
for (int x = 0; x < xdim; x++) { for (int x = 0; x < xdim; x++) {
rVal += this.get(x, y) + (x + 1 == xdim ? "" : ","); rVal += (0xFF & this.get(x, y)) + ((x + 1) == xdim ? "" : ",");
} }
rVal += "\n"; rVal += "\n";
} }

View file

@ -53,13 +53,14 @@ import com.raytheon.uf.common.time.TimeRange;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 15, 2011 randerso Initial creation * Mar 15, 2011 randerso Initial creation
* Jan 30, 2013 15719 jdynina Allowed more than 128 char wx string * Jan 30, 2013 15719 jdynina Allowed more than 128 char wx string
* Aug 13, 2013 1571 randerso Removed toString to stop it from hanging the * Aug 13, 2013 1571 randerso Removed toString to stop it from hanging the
* debugger when trying to display the grid * debugger when trying to display the grid
* Oct 29, 2013 2476 njensen Updated getNumpy() and added getKeyList() * Oct 29, 2013 2476 njensen Updated getNumpy() and added getKeyList()
* Apr 23, 2015 4259 njensen Updated for new JEP API * Apr 23, 2015 4259 njensen Updated for new JEP API
* Nov 03, 2015 5061 randerso Fixed null pointer in equals() * Nov 03, 2015 5061 randerso Fixed null pointer in equals()
* Apr 05, 2016 5539 randerso Cleaned up collapse method
* *
* </pre> * </pre>
* *
@ -645,63 +646,81 @@ public class WeatherGridSlice extends AbstractGridSlice {
return; return;
} }
// make a histogram, indicating what is and what isn't try {
// used in the weather keys int max = 0;
boolean[] used = new boolean[keys.length]; for (byte b : weatherGrid.getBytes()) {
int[] invMapping = new int[keys.length]; int unsigned = 0xFF & b;
for (int i = 0; i < used.length; i++) { if (unsigned > max) {
invMapping[i] = i; max = unsigned;
used[i] = false;
}
// process the grid
for (int i = 0; i < weatherGrid.getXdim(); i++) {
for (int j = 0; j < weatherGrid.getYdim(); j++) {
used[0xFF & weatherGrid.get(i, j)] = true;
}
} // indicate used
// clear the invmapping if not used
for (int i = 0; i < used.length; i++) {
if (!used[i]) {
invMapping[i] = -1;
}
}
// eliminate duplicate keys
int nk = 0;
List<WeatherKey> tmpKeys = new ArrayList<WeatherKey>();
for (int i = 0; i < used.length; i++) {
if (used[i]) {
tmpKeys.add(keys[i]);
invMapping[i] = nk;
for (int j = i + 1; j < used.length; j++) {
if (keys[i].equals(keys[j])) {
invMapping[j] = nk; // key index
used[j] = false; // to prevent reprocessing
}
} }
nk++;
} }
}
WeatherKey[] newKeys = tmpKeys.toArray(new WeatherKey[tmpKeys.size()]);
// anything to do? if (max >= keys.length) {
if (Arrays.equals(newKeys, keys)) { throw new IndexOutOfBoundsException("Grid contains index ("
return; + max + ") > keys.length (" + keys.length + ")");
}
// now remap the data
for (int i = 0; i < weatherGrid.getXdim(); i++) {
for (int j = 0; j < weatherGrid.getYdim(); j++) {
weatherGrid.set(i, j,
(byte) invMapping[0xFF & weatherGrid.get(i, j)]);
} }
}
// store the grid // make a histogram, indicating what is and what isn't
setWeatherGrid(weatherGrid); // used in the weather keys
keys = newKeys; boolean[] used = new boolean[keys.length];
int[] invMapping = new int[keys.length];
for (int i = 0; i < used.length; i++) {
invMapping[i] = i;
used[i] = false;
}
// process the grid
for (int i = 0; i < weatherGrid.getXdim(); i++) {
for (int j = 0; j < weatherGrid.getYdim(); j++) {
used[0xFF & weatherGrid.get(i, j)] = true; // indicate used
}
}
// clear the invmapping if not used
for (int i = 0; i < used.length; i++) {
if (!used[i]) {
invMapping[i] = -1;
}
}
// eliminate duplicate keys
int nk = 0;
List<WeatherKey> tmpKeys = new ArrayList<WeatherKey>();
for (int i = 0; i < used.length; i++) {
if (used[i]) {
tmpKeys.add(keys[i]);
invMapping[i] = nk;
for (int j = i + 1; j < used.length; j++) {
if (keys[i].equals(keys[j])) {
invMapping[j] = nk; // key index
used[j] = false; // to prevent reprocessing
}
}
nk++;
}
}
WeatherKey[] newKeys = tmpKeys.toArray(new WeatherKey[tmpKeys
.size()]);
// anything to do?
if (Arrays.equals(newKeys, keys)) {
return;
}
// now remap the data
for (int i = 0; i < weatherGrid.getXdim(); i++) {
for (int j = 0; j < weatherGrid.getYdim(); j++) {
weatherGrid.set(i, j,
(byte) invMapping[0xFF & weatherGrid.get(i, j)]);
}
}
// store the grid
setWeatherGrid(weatherGrid);
keys = newKeys;
} catch (IndexOutOfBoundsException e) {
statusHandler.error(e.getLocalizedMessage(), e);
throw e;
}
} }
@Override @Override

View file

@ -67,6 +67,7 @@ import com.raytheon.uf.common.dataplugin.gfe.request.IscRequestQueryRequest.IscQ
import com.raytheon.uf.common.dataplugin.gfe.request.LockChangeRequest; import com.raytheon.uf.common.dataplugin.gfe.request.LockChangeRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.SaveGfeGridRequest; import com.raytheon.uf.common.dataplugin.gfe.request.SaveGfeGridRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.SendIscGridRequest; import com.raytheon.uf.common.dataplugin.gfe.request.SendIscGridRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.SendWFOMessageRequest;
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleData; import com.raytheon.uf.common.dataplugin.gfe.sample.SampleData;
import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId; import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId;
import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable; import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable;
@ -1102,6 +1103,11 @@ public class IFPClient {
return (ServerResponse<IscSendStatus>) makeRequest(request); return (ServerResponse<IscSendStatus>) makeRequest(request);
} }
public ServerResponse<?> sendWFOMessage(List<String> wfos, String message) {
SendWFOMessageRequest request = new SendWFOMessageRequest(wfos, message);
return makeRequest(request);
}
/** /**
* To get a "legacy-style" (prior to A2 release 16.2.2) IFPClient * To get a "legacy-style" (prior to A2 release 16.2.2) IFPClient
* implementation. Instead of returning ServerResponse objects, the * implementation. Instead of returning ServerResponse objects, the

View file

@ -1,6 +1,6 @@
dbhost = "dx1f" dbhost = "dx1f"
dbuser = "awips" dbuser = "awips"
dbpass = "" dbpass = ""
nrldb_host = "165.92.28.1" nrldb_host = "<set to ip address of host>"
site = "CCC" site = "CCC"
dbname = "hd_ob92ccc" dbname = "hd_ob92ccc"

View file

@ -1,56 +0,0 @@
# Great Lakes
NNEXRAD ^(SDUS[234578].|NXUS6.) (K|P|T)(APX|LOT|DTX|DLH|GRR|GRB|ARX|MQT|MKX|DVN|IWX) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Ohio River Valley
NNEXRAD ^(SDUS[234578].|NXUS6.) (K|P|T)(PAH|JKL|IND|LMK|ILX|MEG|OHX) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Northern Plains
NNEXRAD ^(SDUS[234578].|NXUS6.) (K|P|T)(ABR|BIS|DMX|FGF|GLD|GID|EAX|MPX|LBF|OAX|UNR|FSD|TOP) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Southern Plains
NNEXRAD ^(SDUS[234578].|NXUS6.) (K|P|T)(LSX|DDC|SGF|ICT|LUB|AMA|SJT|EWX|OUN|FWD|TSA|LZK|SHV) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Rockies
NNEXRAD ^(SDUS[234578].) (K|P|T)(CYS|BOU|GJT|PUB|GGW|BYZ|RIW|TFX|ABQ|MSO|PIH|SLC|FGZ) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# CA, OR, WA
NNEXRAD ^(SDUS[234578].) (K|P|T)(HNX|SGX|SEW|PQR|PDT|MFR|EKA|MTR|STO|OTX|LOX) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# OCONUS
#NNEXRAD ^(SDUS[234578].) (K|P|T)(HFO|GUM|JSJ|AJK|AFC|AFG|ACR) (..)(..)(..) /p(N0Q|N0U|NST)(...)
# FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# ID, NV, UT, AZ
NNEXRAD ^(SDUS[234578].) (K|P|T)(BOI|REV|LKN|VEF|PSR|TWC) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# New England
NNEXRAD ^(SDUS[234578].) (K|P|T)(CAR|GYX|BTV|BOX) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Mid Atlantic
NNEXRAD ^(SDUS[234578].) (K|P|T)(ALY|BGM|BUF|CTP|PHI|PBZ|OKX) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Northern South Atlantic
NNEXRAD ^(SDUS[234578].) (K|P|T)(RLX|LWX|AKQ|RNK|RAH|MHX|ILM) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# Southern South Atlantic
NNEXRAD ^(SDUS[234578].) (K|P|T)(CHS|CAE|FFC|GSP|TAE|JAX|MLB|TBW|MFL|KEY) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# East South Central
NNEXRAD ^(SDUS[234578].) (K|P|T)(MOB|JAN|BMX|HUN) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad
# West South Central
NNEXRAD ^(SDUS[234578].) (K|P|T)(LIX|LCH|HGX|CRP|BRO|EPZ|MAF) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad

View file

@ -908,3 +908,8 @@ NGRID ^(HEN[A-KXY][0-9][0-9]) (KWNH) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*
# 2.5km CONUS PWPF # 2.5km CONUS PWPF
NGRID ^(HIN[B-X][0-9][0-9]) (KWNH) (..)(..)(..) NGRID ^(HIN[B-X][0-9][0-9]) (KWNH) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/PWPF/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/PWPF/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H
# National Radar for DCS 18425 / DR 18913
NNEXRAD ^(SDUS[234578].) (K|P|T)(...) (..)(..)(..) /p(N0Q|N1Q|N0U|N1U|NST|TZL|TR1|TV1|NCR)(...)
FILE -overwrite -log -close -edex /data_store/radar/\2\8/\7/\1_\5\6_\2\8_\7_(seq).rad

View file

@ -1 +0,0 @@
After updating the edex-component spec file, run generatePatchFiles.sh from the parent folder and commit any changed patch0 files that are updated.

View file

@ -1 +0,0 @@
To update the Data Delivery installer, modify the component.spec file. Then, run generatePatchFiles.sh from the parent folder.

View file

@ -1,144 +0,0 @@
#
# AWIPS II Edex "component" spec file
#
%define __prelink_undo_cmd %{nil}
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
Name: awips2-edex-datadelivery
Summary: awips2-edex-datadelivery Installation
Version: %{_component_version}
Release: %{_component_release}
Group: AWIPSII
BuildRoot: %{_build_root}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: %{_build_site}
provides: awips2-edex-datadelivery
requires: awips2
requires: awips2-edex-base
requires: awips2-python
requires: awips2-java
requires: awips2-psql
%description
AWIPS II Edex - Installs AWIPS II Edex Plugins.
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "" ]
then
echo "ERROR: The RPM Build Root has not been specified."
exit 1
fi
if [ -d %{_build_root} ]; then
rm -rf %{_build_root}
fi
%build
%install
mkdir -p %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
# prepare the init.d directory path
mkdir -p %{_build_root}/etc/init.d
if [ $? -ne 0 ]; then
exit 1
fi
unzip %{_baseline_workspace}/build.edex/edex/dist/edex-datadelivery.zip \
-d %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
# include the init.d script
INSTALLER_RPM="%{_baseline_workspace}/rpms"
EDEX_DATADELIVERY="${INSTALLER_RPM}/awips2.edex/Installer.edex-datadelivery"
cp -v ${EDEX_DATADELIVERY}/scripts/init.d/* \
%{_build_root}/etc/init.d
if [ $? -ne 0 ]; then
exit 1
fi
# rename the script to prevent naming conflicts during installation
pushd . > /dev/null 2>&1
cd %{_build_root}/etc/init.d
mv edexServiceList edexServiceList-datadelivery
popd > /dev/null 2>&1
#add central registry script
mkdir -p %{_build_root}/awips2/edex/bin/
if [ $? -ne 0 ]; then
exit 1
fi
cp -v %{_baseline_workspace}/deploy.edex-Data_Delivery/esb/bin/centralRegistryProviderCredentials.sh %{_build_root}/awips2/edex/bin/
if [ $? -ne 0 ]; then
exit 1
fi
#create a list of all files packaged for /awips2/edex/data/utility
UTILITY=/awips2/edex/data/utility
if [ -d %{_build_root}/$UTILITY ]; then
cd %{_build_root}/$UTILITY
find . -type f > %{_build_root}/awips2/edex/util_filelist.%{name}.txt
fi
%pre
%post
# replace the service list script with the datadelivery service list script
if [ -f /etc/init.d/edexServiceList ]; then
mv /etc/init.d/edexServiceList /etc/init.d/edexServiceList.orig
if [ $? -ne 0 ]; then
exit 1
fi
fi
cp /etc/init.d/edexServiceList-datadelivery /etc/init.d/edexServiceList
if [ $? -ne 0 ]; then
exit 1
fi
#change date stamp of utility files
UTILITY=/awips2/edex/data/utility
UTIL_FILENAME=/awips2/edex/util_filelist.%{name}.txt
if [ -d $UTILITY ] && [ -f $UTIL_FILENAME ]; then
while read fileName
do
touch "$UTILITY/$fileName"
done < $UTIL_FILENAME
rm -f $UTIL_FILENAME
fi
%preun
if [ "${1}" = "1" ]; then
exit 0
fi
# restore the original service list script with the datadelivery service list script
if [ -f /etc/init.d/edexServiceList.orig ]; then
mv /etc/init.d/edexServiceList.orig /etc/init.d/edexServiceList
if [ $? -ne 0 ]; then
exit 1
fi
fi
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(644,awips,fxalpha,755)
%dir /awips2
%dir /awips2/edex
/awips2/edex/*
%dir /awips2/edex/bin
%attr(744, -, -) /awips2/edex/bin/centralRegistryProviderCredentials.sh
%attr(744,root,root) /etc/init.d/*

View file

@ -1,147 +0,0 @@
*** Installer.edex-component/component.spec 2015-12-01 15:13:59.047022621 -0600
--- Installer.edex-datadelivery/component.spec 2015-12-01 15:13:59.048022609 -0600
***************
*** 6,13 ****
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
! Name: awips2-%{_component_name}
! Summary: awips2-%{_component_name} Installation
Version: %{_component_version}
Release: %{_component_release}
Group: AWIPSII
--- 6,13 ----
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
! Name: awips2-edex-datadelivery
! Summary: awips2-edex-datadelivery Installation
Version: %{_component_version}
Release: %{_component_release}
Group: AWIPSII
***************
*** 18,24 ****
Vendor: Raytheon
Packager: %{_build_site}
! provides: awips2-%{_component_name}
requires: awips2
requires: awips2-edex-base
requires: awips2-python
--- 18,24 ----
Vendor: Raytheon
Packager: %{_build_site}
! provides: awips2-edex-datadelivery
requires: awips2
requires: awips2-edex-base
requires: awips2-python
***************
*** 47,56 ****
if [ $? -ne 0 ]; then
exit 1
fi
! unzip %{_baseline_workspace}/build.edex/edex/dist/%{_component_name}.zip \
-d %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
--- 47,85 ----
if [ $? -ne 0 ]; then
exit 1
fi
+ # prepare the init.d directory path
+ mkdir -p %{_build_root}/etc/init.d
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
! unzip %{_baseline_workspace}/build.edex/edex/dist/edex-datadelivery.zip \
-d %{_build_root}
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ # include the init.d script
+ INSTALLER_RPM="%{_baseline_workspace}/rpms"
+ EDEX_DATADELIVERY="${INSTALLER_RPM}/awips2.edex/Installer.edex-datadelivery"
+ cp -v ${EDEX_DATADELIVERY}/scripts/init.d/* \
+ %{_build_root}/etc/init.d
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ # rename the script to prevent naming conflicts during installation
+ pushd . > /dev/null 2>&1
+ cd %{_build_root}/etc/init.d
+ mv edexServiceList edexServiceList-datadelivery
+ popd > /dev/null 2>&1
+
+ #add central registry script
+ mkdir -p %{_build_root}/awips2/edex/bin/
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+ cp -v %{_baseline_workspace}/deploy.edex-Data_Delivery/esb/bin/centralRegistryProviderCredentials.sh %{_build_root}/awips2/edex/bin/
if [ $? -ne 0 ]; then
exit 1
fi
***************
*** 64,70 ****
%pre
%post
!
#change date stamp of utility files
UTILITY=/awips2/edex/data/utility
--- 93,109 ----
%pre
%post
! # replace the service list script with the datadelivery service list script
! if [ -f /etc/init.d/edexServiceList ]; then
! mv /etc/init.d/edexServiceList /etc/init.d/edexServiceList.orig
! if [ $? -ne 0 ]; then
! exit 1
! fi
! fi
! cp /etc/init.d/edexServiceList-datadelivery /etc/init.d/edexServiceList
! if [ $? -ne 0 ]; then
! exit 1
! fi
#change date stamp of utility files
UTILITY=/awips2/edex/data/utility
***************
*** 78,83 ****
--- 117,133 ----
fi
%preun
+ if [ "${1}" = "1" ]; then
+ exit 0
+ fi
+ # restore the original service list script with the datadelivery service list script
+ if [ -f /etc/init.d/edexServiceList.orig ]; then
+ mv /etc/init.d/edexServiceList.orig /etc/init.d/edexServiceList
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ fi
+
%postun
%clean
***************
*** 88,90 ****
--- 138,144 ----
%dir /awips2
%dir /awips2/edex
/awips2/edex/*
+ %dir /awips2/edex/bin
+ %attr(744, -, -) /awips2/edex/bin/centralRegistryProviderCredentials.sh
+
+ %attr(744,root,root) /etc/init.d/*

View file

@ -1,5 +0,0 @@
#!/bin/bash
# Default Services to start
export SERVICES=('registry')

View file

@ -1 +0,0 @@
To update the Hazard Services installer, modify the component.spec file. Then, run generatePatchFiles.sh from the parent folder.

View file

@ -1,141 +0,0 @@
#
# AWIPS II EDEX Hazard Services spec file
#
%define __prelink_undo_cmd %{nil}
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-java-repack-jars[[:space:]].*$!!g')
Name: awips2-%{_component_name}
Summary: awips2-%{_component_name} Installation
Version: %{_component_version}
Release: %{_component_release}
Group: AWIPSII
BuildRoot: %{_build_root}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: %{_build_site}
provides: awips2-%{_component_name}
requires: awips2
requires: awips2-edex-base
requires: awips2-python
requires: awips2-java
requires: awips2-psql
%description
AWIPS II Edex - Installs AWIPS II Edex Plugins.
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "" ]
then
echo "ERROR: The RPM Build Root has not been specified."
exit 1
fi
if [ -d %{_build_root} ]; then
rm -rf %{_build_root}
fi
%build
%install
mkdir -p %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
unzip %{_baseline_workspace}/build.edex/edex/dist/%{_component_name}.zip \
-d %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
#create the edex scripts dir
EDEX_SCRIPTS_DIR=%{_build_root}/awips2/edex/scripts/
if [ ! -d $EDEX_SCRIPTS_DIR ]; then
mkdir -p $EDEX_SCRIPTS_DIR
if [ $? -ne 0 ]; then
exit 1
fi
fi
# verify HazardServices directory exists and copy in files
HS_NAME=HazardServices
TOOLS_HS_DIR=%{_baseline_workspace}/tools/$HS_NAME
if [ -d $TOOLS_HS_DIR ]; then
cp -Rv $TOOLS_HS_DIR $EDEX_SCRIPTS_DIR
if [ $? -ne 0 ]; then
exit 1
fi
fi
# HazardServices dir may not be available, as tools/HazardServices may not exist
# if not available, create the directory for other scripts
if [ ! -d $EDEX_SCRIPTS_DIR/$HS_NAME ]; then
mkdir -p $EDEX_SCRIPTS_DIR/$HS_NAME
if [ $? -ne 0 ]; then
exit 1
fi
fi
#copy in specific files for HS
if [ -d $EDEX_SCRIPTS_DIR/$HS_NAME ]; then
cp -v %{_baseline_workspace}/tools/parseWarngenTemplate.py $EDEX_SCRIPTS_DIR/$HS_NAME
if [ $? -ne 0 ]; then
exit 1
fi
cp -v %{_baseline_workspace}/tools/ingestshapefiles.sh $EDEX_SCRIPTS_DIR/$HS_NAME
if [ $? -ne 0 ]; then
exit 1
fi
fi
#create a list of all files packaged for /awips2/edex/data/utility
UTILITY=/awips2/edex/data/utility
if [ -d %{_build_root}/$UTILITY ]; then
cd %{_build_root}/$UTILITY
find . -type f > %{_build_root}/awips2/edex/util_filelist.%{name}.txt
fi
%pre
%post
#change date stamp of utility files
UTILITY=/awips2/edex/data/utility
UTIL_FILENAME=/awips2/edex/util_filelist.%{name}.txt
if [ -d $UTILITY ] && [ -f $UTIL_FILENAME ]; then
while read fileName
do
touch "$UTILITY/$fileName"
done < $UTIL_FILENAME
rm -f $UTIL_FILENAME
fi
%preun
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(644,awips,fxalpha,755)
%dir /awips2
%dir /awips2/edex
%dir /awips2/edex/conf
/awips2/edex/*
%defattr(755,awips,fxalpha,-)
/awips2/edex/scripts/*

View file

@ -1,82 +0,0 @@
*** Installer.edex-component/component.spec 2015-12-01 15:13:59.047022621 -0600
--- Installer.edex-hazards/component.spec 2015-12-01 15:13:59.054022541 -0600
***************
*** 1,5 ****
#
! # AWIPS II Edex "component" spec file
#
%define __prelink_undo_cmd %{nil}
# Turn off the brp-python-bytecompile script
--- 1,5 ----
#
! # AWIPS II EDEX Hazard Services spec file
#
%define __prelink_undo_cmd %{nil}
# Turn off the brp-python-bytecompile script
***************
*** 55,60 ****
--- 55,108 ----
exit 1
fi
+ #create the edex scripts dir
+ EDEX_SCRIPTS_DIR=%{_build_root}/awips2/edex/scripts/
+ if [ ! -d $EDEX_SCRIPTS_DIR ]; then
+ mkdir -p $EDEX_SCRIPTS_DIR
+
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ fi
+
+
+ # verify HazardServices directory exists and copy in files
+ HS_NAME=HazardServices
+ TOOLS_HS_DIR=%{_baseline_workspace}/tools/$HS_NAME
+ if [ -d $TOOLS_HS_DIR ]; then
+
+ cp -Rv $TOOLS_HS_DIR $EDEX_SCRIPTS_DIR
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+ fi
+
+ # HazardServices dir may not be available, as tools/HazardServices may not exist
+ # if not available, create the directory for other scripts
+ if [ ! -d $EDEX_SCRIPTS_DIR/$HS_NAME ]; then
+ mkdir -p $EDEX_SCRIPTS_DIR/$HS_NAME
+
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+ fi
+
+ #copy in specific files for HS
+ if [ -d $EDEX_SCRIPTS_DIR/$HS_NAME ]; then
+
+ cp -v %{_baseline_workspace}/tools/parseWarngenTemplate.py $EDEX_SCRIPTS_DIR/$HS_NAME
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+ cp -v %{_baseline_workspace}/tools/ingestshapefiles.sh $EDEX_SCRIPTS_DIR/$HS_NAME
+ if [ $? -ne 0 ]; then
+ exit 1
+ fi
+
+ fi
+
#create a list of all files packaged for /awips2/edex/data/utility
UTILITY=/awips2/edex/data/utility
if [ -d %{_build_root}/$UTILITY ]; then
***************
*** 87,90 ****
--- 135,141 ----
%defattr(644,awips,fxalpha,755)
%dir /awips2
%dir /awips2/edex
+ %dir /awips2/edex/conf
/awips2/edex/*
+ %defattr(755,awips,fxalpha,-)
+ /awips2/edex/scripts/*

View file

@ -56,26 +56,6 @@ if [ ! "${architecture}" = "x86_64" ]; then
exit 1 exit 1
fi fi
function patchSpecification()
{
# copy the standard rpm feature specification into the
# component's project directory
cp -v Installer.edex-component/component.spec \
Installer.${COMPONENT_NAME}/component.spec
if [ $? -ne 0 ]; then
exit 1
fi
# apply the specification patch
pushd . > /dev/null 2>&1
cd Installer.${COMPONENT_NAME}
patch -p1 -i *.patch0
if [ $? -ne 0 ]; then
exit 1
fi
popd > /dev/null 2>&1
}
function buildRPM() function buildRPM()
{ {
# Arguments: # Arguments:
@ -129,36 +109,16 @@ cd ../
buildRPM "Installer.edex" buildRPM "Installer.edex"
buildRPM "Installer.edex-configuration" buildRPM "Installer.edex-configuration"
# build the edex-hazards component
export COMPONENT_NAME="edex-hazards"
# Workaround until #5466 is resolved.
if [ -f ${DIST}/${COMPONENT_NAME}.zip ]; then
patchSpecification
buildRPM "Installer.edex-hazards"
fi
unset COMPONENT_NAME
DIST="${WORKSPACE}/build.edex/edex/dist" DIST="${WORKSPACE}/build.edex/edex/dist"
for edex_zip in `cd ${DIST}; ls -1;`; for edex_zip in `cd ${DIST}; ls -1;`;
do do
edex_component=`python -c "zipFile='${edex_zip}'; componentName=zipFile.replace('.zip',''); print componentName;"` edex_component=`python -c "zipFile='${edex_zip}'; componentName=zipFile.replace('.zip',''); print componentName;"`
#Data Delivery and Hazard Services components are built separately # Check if component is in the ignore file, do not build an RPM if so.
if [ ! "${edex_component}" = "edex-datadelivery" ] && if ! grep -Fxq "${edex_component}" ${WORKSPACE}/build.edex/component.ignore.txt; then
[ ! "${edex_component}" = "common-base" ] &&
[ ! "${edex_component}" = "edex-hazards" ]; then
export COMPONENT_NAME="${edex_component}" export COMPONENT_NAME="${edex_component}"
buildRPM "Installer.edex-component" buildRPM "Installer.edex-component"
unset COMPONENT_NAME unset COMPONENT_NAME
fi fi
done done
# build the edex-datadelivery rpm
export COMPONENT_NAME="edex-datadelivery"
# Workaround until #5466 is resolved.
if [ -f ${DIST}/${COMPONENT_NAME}.zip ]; then
patchSpecification
buildRPM "Installer.edex-datadelivery"
fi
unset COMPONENT_NAME

View file

@ -1,6 +0,0 @@
#hazard services
diff -crb Installer.edex-component/component.spec Installer.edex-hazards/component.spec > Installer.edex-hazards/hazards.patch0
#data delivery
diff -crb Installer.edex-component/component.spec Installer.edex-datadelivery/component.spec > Installer.edex-datadelivery/datadelivery.patch0