Merge branch 'development' into development_on_RHEL6
Former-commit-id:1b3d4c8f67
[formerly b0aa5782ea932919ad3e67d460c4809a664b1e08] Former-commit-id:108a4d908d
This commit is contained in:
commit
2a8e926976
217 changed files with 885 additions and 26395 deletions
|
@ -25,7 +25,6 @@ import org.eclipse.swt.SWT;
|
|||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.graphics.Region;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
|
@ -58,6 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jun 21, 2013 2132 mpduff Convert coordinates to East/West before drawing.
|
||||
* Oct 10, 2013 2428 skorolev Fixed memory leak for Regions
|
||||
* Oct 24, 2013 2486 skorolev Fixed an error of editing subset box.
|
||||
* Nov 06, 2013 2486 skorolev Corrected the regions and zoom handling defects.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -165,6 +165,7 @@ public class DrawBoxResource extends
|
|||
double[] lr = descriptor.worldToPixel(new double[] { c2.x, c2.y });
|
||||
PixelExtent pe = new PixelExtent(ul[0], lr[0], ul[1], lr[1]);
|
||||
target.drawRect(pe, boxColor, 3, 1);
|
||||
getMapRectangle();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,17 +192,6 @@ public class DrawBoxResource extends
|
|||
|
||||
getMapRectangle();
|
||||
|
||||
// Create initial regions
|
||||
if ((c1 != null) && (c2 != null)) {
|
||||
double[] luBox = getResourceContainer().translateInverseClick(c1);
|
||||
x1 = (int) luBox[0];
|
||||
y1 = (int) luBox[1];
|
||||
double[] rbBox = getResourceContainer().translateInverseClick(c2);
|
||||
x2 = (int) rbBox[0];
|
||||
y2 = (int) rbBox[1];
|
||||
createRegions();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -274,8 +264,10 @@ public class DrawBoxResource extends
|
|||
if (c != null) {
|
||||
if (boxSide == 0) {
|
||||
c1.y = c.y;
|
||||
y1 = y;
|
||||
} else if (boxSide == 1) {
|
||||
c1.x = c.x;
|
||||
x1 = x;
|
||||
c1.x = spatialUtils.convertToEasting(c1.x);
|
||||
if (spatialUtils.getLongitudinalShift() > 0
|
||||
&& x >= x360) {
|
||||
|
@ -283,8 +275,10 @@ public class DrawBoxResource extends
|
|||
}
|
||||
} else if (boxSide == 2) {
|
||||
c2.y = c.y;
|
||||
y2 = y;
|
||||
} else if (boxSide == 3) {
|
||||
c2.x = c.x;
|
||||
x2 = x;
|
||||
c2.x = spatialUtils.convertToEasting(c2.x);
|
||||
if (spatialUtils.getLongitudinalShift() > 0
|
||||
&& x >= x360) {
|
||||
|
@ -310,9 +304,7 @@ public class DrawBoxResource extends
|
|||
}
|
||||
} else if (mouseButton == 2) {
|
||||
super.handleMouseDownMove(x, y, 1);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -407,20 +399,6 @@ public class DrawBoxResource extends
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn off mouse wheel.
|
||||
*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.input.PanHandler#handleMouseWheel(org.eclipse
|
||||
* .swt.widgets.Event, int, int)
|
||||
*/
|
||||
@Override
|
||||
public boolean handleMouseWheel(Event event, int x, int y) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -574,7 +552,7 @@ public class DrawBoxResource extends
|
|||
}
|
||||
|
||||
/**
|
||||
* Map's rectangle in pixels
|
||||
* Get map's rectangle in pixels after changing.
|
||||
*/
|
||||
private void getMapRectangle() {
|
||||
Coordinate top = new Coordinate();
|
||||
|
@ -592,5 +570,16 @@ public class DrawBoxResource extends
|
|||
int yBottom = (int) Math.round(pointBot[1]);
|
||||
|
||||
mapRctgl = new Rectangle(xTop, yTop, (xBottom - xTop), (yBottom - yTop));
|
||||
|
||||
// Re-calculate regions
|
||||
if ((c1 != null) && (c2 != null)) {
|
||||
double[] luBox = getResourceContainer().translateInverseClick(c1);
|
||||
x1 = (int) luBox[0];
|
||||
y1 = (int) luBox[1];
|
||||
double[] rbBox = getResourceContainer().translateInverseClick(c2);
|
||||
x2 = (int) rbBox[0];
|
||||
y2 = (int) rbBox[1];
|
||||
createRegions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@ package com.raytheon.uf.viz.datadelivery.subscription;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
@ -38,6 +36,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -61,7 +60,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.SubColumnNames;
|
|||
* Jun 07, 2012 687 lvenable Table data refactor.
|
||||
* Jan 03, 2013 1437 bgonzale Put default configuration file code here.
|
||||
* Jun 21, 2013 2130 mpduff Fix ordering of columns.
|
||||
*
|
||||
* Nov 06, 2013 2358 mpduff Remove default configuration code.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -106,6 +105,9 @@ public class SubscriptionConfigurationManager {
|
|||
/** File name */
|
||||
String fileName;
|
||||
|
||||
/** Current Configuration File */
|
||||
private LocalizationFile currentConfigFile = null;
|
||||
|
||||
/**
|
||||
* Private Constructor
|
||||
*/
|
||||
|
@ -181,10 +183,8 @@ public class SubscriptionConfigurationManager {
|
|||
}
|
||||
|
||||
try {
|
||||
|
||||
marshaller.marshal(xml, file);
|
||||
locFile.save();
|
||||
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
} catch (Exception e) {
|
||||
|
@ -274,53 +274,27 @@ public class SubscriptionConfigurationManager {
|
|||
/**
|
||||
* Set the current configuration file.
|
||||
*
|
||||
* @param currentConfigFile
|
||||
* @param configFile
|
||||
*/
|
||||
public void setConfigFile(LocalizationFile configFile) {
|
||||
File file = configFile.getFile();
|
||||
fileName = configFile.getName();
|
||||
try {
|
||||
xml = (SubscriptionManagerConfigXML) unmarshaller.unmarshal(file);
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
this.currentConfigFile = configFile;
|
||||
if (!file.exists()) {
|
||||
if (xml == null) {
|
||||
xml = new SubscriptionManagerConfigXML();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
xml = (SubscriptionManagerConfigXML) unmarshaller
|
||||
.unmarshal(file);
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the available configuration files to list.
|
||||
*
|
||||
* @return Map of context:name to LocalizationFile.
|
||||
*/
|
||||
public Map<String, LocalizationFile> getConfigFileNameMap() {
|
||||
String[] extensions = new String[] { ".xml" };
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
TreeMap<String, LocalizationFile> locFileMap = new TreeMap<String, LocalizationFile>();
|
||||
ArrayList<LocalizationContext> contextList = new ArrayList<LocalizationContext>();
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.BASE));
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.SITE));
|
||||
contextList.add(pm.getContext(LocalizationType.CAVE_STATIC,
|
||||
LocalizationLevel.USER));
|
||||
LocalizationFile[] locFiles = pm.listFiles(contextList
|
||||
.toArray(new LocalizationContext[contextList.size()]),
|
||||
CONFIG_PATH, extensions, false, true);
|
||||
|
||||
if (locFiles == null) {
|
||||
return new TreeMap<String, LocalizationFile>();
|
||||
}
|
||||
|
||||
for (int i = 0; i < locFiles.length; i++) {
|
||||
String locFile = locFiles[i].getName();
|
||||
int idx = locFile.lastIndexOf("/");
|
||||
String newStr = locFile.substring(idx + 1);
|
||||
|
||||
locFileMap.put(locFiles[i].getContext().getLocalizationLevel()
|
||||
+ ":" + newStr, locFiles[i]);
|
||||
}
|
||||
return locFileMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hidden and visible columns in the configuration.
|
||||
*
|
||||
|
@ -352,7 +326,6 @@ public class SubscriptionConfigurationManager {
|
|||
}
|
||||
|
||||
xml.setColumnList(columnList);
|
||||
saveXml();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -394,15 +367,91 @@ public class SubscriptionConfigurationManager {
|
|||
saveXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the localization (config) file path
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getLocalizationPath() {
|
||||
return CONFIG_PATH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default config file's full path
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultXMLConfig() {
|
||||
return DEFAULT_CONFIG_XML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default config file's name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDefaultXMLConfigFileName() {
|
||||
return DEFAULT_CONFIG_XML_FILE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sorted Column
|
||||
*
|
||||
* @param columnName
|
||||
* @param sortDirection
|
||||
*/
|
||||
public void setSortedColumn(String columnName, SortDirection sortDirection) {
|
||||
xml.setSortColumn(columnName, sortDirection);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unmarshal the file.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @throws JAXBException
|
||||
*/
|
||||
public SubscriptionManagerConfigXML unmarshall(File file)
|
||||
throws JAXBException {
|
||||
Object obj = unmarshaller.unmarshal(file);
|
||||
if (obj instanceof SubscriptionManagerConfigXML) {
|
||||
return (SubscriptionManagerConfigXML) obj;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the currentConfigFile
|
||||
*/
|
||||
public LocalizationFile getCurrentConfigFile() {
|
||||
return currentConfigFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentConfigFile
|
||||
* the currentConfigFile to set
|
||||
*/
|
||||
public void setCurrentConfigFile(LocalizationFile currentConfigFile) {
|
||||
this.currentConfigFile = currentConfigFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the localization file.
|
||||
*
|
||||
* @param file
|
||||
* the file to delete
|
||||
*/
|
||||
public void deleteXml(LocalizationFile file) {
|
||||
try {
|
||||
boolean success = file.delete();
|
||||
if (!success) {
|
||||
statusHandler.handle(Priority.WARN,
|
||||
"Error deleting " + file.getName());
|
||||
}
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error deleting " + file.getName(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -31,25 +27,15 @@ import org.eclipse.swt.events.SelectionEvent;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.ColumnXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.raytheon.viz.ui.widgets.duallist.DualList;
|
||||
import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
||||
|
||||
|
@ -68,6 +54,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
* instead. Added configuration file management controls to
|
||||
* this dialog.
|
||||
* Sep 04, 2013 2314 mpduff Load/save config dialog now non-blocking.
|
||||
* Nov 06, 2013 2358 mpduff Removed configuration file management from this dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -76,11 +63,6 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
*/
|
||||
|
||||
public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
||||
|
||||
/** Status Handler */
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubscriptionManagerDlg.class);
|
||||
|
||||
/** Callback to SubscriptionManagerDialog */
|
||||
private final ITableChange callback;
|
||||
|
||||
|
@ -90,31 +72,11 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
/** Dual list widget */
|
||||
private DualList dualList;
|
||||
|
||||
/**
|
||||
* Configuration file selection combo.
|
||||
*/
|
||||
private Combo fileCombo;
|
||||
|
||||
/**
|
||||
* Map of context level:file name to LocalizationFile.
|
||||
*/
|
||||
private Map<String, LocalizationFile> configFileMap;
|
||||
|
||||
/**
|
||||
* Configuration manager.
|
||||
*/
|
||||
private final SubscriptionConfigurationManager configManager;
|
||||
|
||||
/**
|
||||
* Delete saved configuration file dialog.
|
||||
*/
|
||||
private LoadSaveConfigDlg deleteDialog;
|
||||
|
||||
/**
|
||||
* Load saved configuration file dialog.
|
||||
*/
|
||||
private LoadSaveConfigDlg loadDlg;
|
||||
|
||||
/**
|
||||
* Initialization Constructor.
|
||||
*
|
||||
|
@ -143,70 +105,10 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
shell.setLayout(gl);
|
||||
shell.setLayoutData(gd);
|
||||
|
||||
createTopControls();
|
||||
createMain();
|
||||
createBottomButtons();
|
||||
}
|
||||
|
||||
private void createTopControls() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gl = new GridLayout(2, false);
|
||||
Composite topComp = new Composite(shell, SWT.NONE);
|
||||
topComp.setLayout(gl);
|
||||
topComp.setLayoutData(gd);
|
||||
|
||||
Composite comp = new Composite(topComp, SWT.NONE);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
|
||||
gl = new GridLayout(4, false);
|
||||
comp.setLayout(gl);
|
||||
comp.setLayoutData(gd);
|
||||
|
||||
Label configurationFileLabel = new Label(comp, SWT.NONE);
|
||||
configurationFileLabel.setText("Configuration:");
|
||||
|
||||
GridData comboData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
fileCombo = new Combo(comp, SWT.READ_ONLY);
|
||||
fileCombo.setLayoutData(comboData);
|
||||
fileCombo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
handleConfigSelected();
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
updateFileCombo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the file combo based on the available configurations and currently
|
||||
* selected config.
|
||||
*/
|
||||
private void updateFileCombo() {
|
||||
configFileMap = configManager.getConfigFileNameMap();
|
||||
fileCombo.removeAll();
|
||||
|
||||
int index = 0;
|
||||
for (Entry<String, LocalizationFile> entry : configFileMap.entrySet()) {
|
||||
fileCombo.add(entry.getKey());
|
||||
if (configManager.isCurrentConfig(entry.getValue())) {
|
||||
fileCombo.select(index);
|
||||
}
|
||||
++index;
|
||||
}
|
||||
|
||||
if (fileCombo.getSelectionIndex() < 0 && index > 0) {
|
||||
fileCombo.select(0);
|
||||
}
|
||||
}
|
||||
|
||||
private void createMain() {
|
||||
GridData groupData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
|
||||
GridLayout groupLayout = new GridLayout(1, false);
|
||||
|
@ -291,80 +193,6 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
close();
|
||||
}
|
||||
});
|
||||
|
||||
Button newBtn = new Button(bottomComp, SWT.PUSH);
|
||||
newBtn.setText("New");
|
||||
newBtn.setLayoutData(btnData);
|
||||
newBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleNew();
|
||||
}
|
||||
});
|
||||
Button deleteBtn = new Button(bottomComp, SWT.PUSH);
|
||||
deleteBtn.setText("Delete");
|
||||
deleteBtn.setLayoutData(btnData);
|
||||
deleteBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Open dialog to remove a configuration.
|
||||
*/
|
||||
protected void handleDelete() {
|
||||
if (deleteDialog == null || deleteDialog.isDisposed()) {
|
||||
deleteDialog = new LoadSaveConfigDlg(shell, DialogType.DELETE,
|
||||
configManager.getLocalizationPath(),
|
||||
configManager.getDefaultXMLConfig());
|
||||
deleteDialog.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile file = (LocalizationFile) returnValue;
|
||||
try {
|
||||
file.delete();
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
updateFileCombo();
|
||||
handleApply();
|
||||
}
|
||||
}
|
||||
});
|
||||
deleteDialog.open();
|
||||
} else {
|
||||
deleteDialog.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open dialog for a new configuration.
|
||||
*/
|
||||
protected void handleNew() {
|
||||
if (loadDlg == null || loadDlg.isDisposed()) {
|
||||
loadDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS,
|
||||
configManager.getLocalizationPath(),
|
||||
configManager.getDefaultXMLConfig(), true);
|
||||
loadDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile file = (LocalizationFile) returnValue;
|
||||
configManager.saveXml(file);
|
||||
handleApply();
|
||||
updateFileCombo();
|
||||
}
|
||||
}
|
||||
});
|
||||
loadDlg.open();
|
||||
} else {
|
||||
loadDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -389,19 +217,4 @@ public class SubscriptionManagerConfigDlg extends CaveSWTDialog {
|
|||
handleApply();
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a selected configuration.
|
||||
*
|
||||
* @throws JAXBException
|
||||
*/
|
||||
private void handleConfigSelected() throws JAXBException {
|
||||
String selectedKey = fileCombo.getItem(fileCombo.getSelectionIndex());
|
||||
LocalizationFile selectedFile = configFileMap.get(selectedKey);
|
||||
|
||||
configManager.setConfigFile(selectedFile);
|
||||
updateDualListSelections();
|
||||
callback.tableChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -28,6 +29,8 @@ import java.util.Set;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
|
@ -57,6 +60,12 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
|||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.datadelivery.service.ISubscriptionNotificationService;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -67,16 +76,20 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
|
||||
import com.raytheon.uf.viz.datadelivery.help.HelpManager;
|
||||
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp.SubscriptionType;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.approve.SubscriptionApprovalDlg;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.xml.SubscriptionManagerConfigXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.raytheon.viz.ui.presenter.IDisplay;
|
||||
|
||||
/**
|
||||
|
@ -128,6 +141,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Jul 26, 2013 2232 mpduff Refactored Data Delivery permissions.
|
||||
* Sep 25. 2013 2409 mpduff Add check for widget disposed after calling configuration.
|
||||
* Oct 25, 2013 2292 mpduff Move overlap checks to edex.
|
||||
* Nov 06, 2013 2358 mpduff Resurrected file management code.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -225,6 +239,15 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
/** The office display list */
|
||||
private final SortedSet<String> officeDisplayItems = new TreeSet<String>();
|
||||
|
||||
/** Load config dialog */
|
||||
private LoadSaveConfigDlg loadDlg;
|
||||
|
||||
/** Delete config dialog */
|
||||
private LoadSaveConfigDlg deleteDlg;
|
||||
|
||||
/** SaveAs config dialog */
|
||||
private LoadSaveConfigDlg saveAsDlg;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -242,13 +265,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
setText("Data Delivery Subscription Manager");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
super.disposed();
|
||||
// save any table sort direction changes
|
||||
SubscriptionConfigurationManager.getInstance().saveXml();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -371,6 +387,59 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
|
||||
new MenuItem(fileMenu, SWT.SEPARATOR);
|
||||
|
||||
MenuItem setDefaultMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
setDefaultMI.setText("Set as Default");
|
||||
setDefaultMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSetDefault();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem loadConfigMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
loadConfigMI.setText("Load Configuration...");
|
||||
loadConfigMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
try {
|
||||
handleLoadConfig();
|
||||
} catch (JAXBException e) {
|
||||
statusHandler
|
||||
.handle(com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem saveConfigMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveConfigMI.setText("Save Configuration");
|
||||
saveConfigMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSaveConfig();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem saveConfigAsMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveConfigAsMI.setText("Save Configuration As...");
|
||||
saveConfigAsMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
handleSaveAsConfig();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem deleteConfigMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
deleteConfigMI.setText("Delete Configuration...");
|
||||
deleteConfigMI.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleDeleteConfig();
|
||||
}
|
||||
});
|
||||
|
||||
new MenuItem(fileMenu, SWT.SEPARATOR);
|
||||
|
||||
MenuItem exitMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
exitMI.setText("Exit");
|
||||
exitMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -690,6 +759,138 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default configuration file.
|
||||
*/
|
||||
private void handleSetDefault() {
|
||||
SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
|
||||
String fileName = configMan.getDefaultXMLConfig();
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||
|
||||
LocalizationFile locFile = pm.getLocalizationFile(context, fileName);
|
||||
|
||||
try {
|
||||
configMan.setCurrentConfigFile(locFile);
|
||||
configMan.saveXml();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(
|
||||
com.raytheon.uf.common.status.UFStatus.Priority.ERROR,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configuration action.
|
||||
*/
|
||||
private void handleLoadConfig() throws JAXBException {
|
||||
if (loadDlg == null || loadDlg.isDisposed()) {
|
||||
final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
loadDlg = new LoadSaveConfigDlg(shell, DialogType.OPEN,
|
||||
configMan.getLocalizationPath(),
|
||||
configMan.getDefaultXMLConfigFileName(), true);
|
||||
loadDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
try {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
// Get the name of the selected file
|
||||
if (fileName != null && fileName.exists()) {
|
||||
File file = fileName.getFile();
|
||||
|
||||
if (file != null) {
|
||||
SubscriptionManagerConfigXML xml = configMan
|
||||
.unmarshall(file);
|
||||
configMan.setXml(xml);
|
||||
configMan.setCurrentConfigFile(fileName);
|
||||
tableChanged();
|
||||
}
|
||||
}
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
loadDlg = null;
|
||||
}
|
||||
});
|
||||
|
||||
loadDlg.open();
|
||||
} else {
|
||||
loadDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save configuration action.
|
||||
*/
|
||||
private void handleSaveConfig() {
|
||||
final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
if (configMan.getCurrentConfigFile() == null) {
|
||||
handleSaveAsConfig();
|
||||
} else {
|
||||
// configMan.setConfigFile(configMan.getCurrentConfigFile());
|
||||
configMan.saveXml();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save as configuration action.
|
||||
*/
|
||||
private void handleSaveAsConfig() {
|
||||
final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
if (saveAsDlg == null || saveAsDlg.isDisposed()) {
|
||||
saveAsDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS,
|
||||
configMan.getLocalizationPath(),
|
||||
configMan.getDefaultXMLConfigFileName());
|
||||
saveAsDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
configMan.setConfigFile(fileName);
|
||||
configMan.saveXml();
|
||||
}
|
||||
}
|
||||
});
|
||||
saveAsDlg.open();
|
||||
} else {
|
||||
saveAsDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete configuration action.
|
||||
*/
|
||||
private void handleDeleteConfig() {
|
||||
final SubscriptionConfigurationManager configMan = SubscriptionConfigurationManager
|
||||
.getInstance();
|
||||
if (deleteDlg == null || deleteDlg.isDisposed()) {
|
||||
deleteDlg = new LoadSaveConfigDlg(shell, DialogType.DELETE,
|
||||
configMan.getLocalizationPath(), true);
|
||||
deleteDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
configMan.deleteXml(fileName);
|
||||
tableChanged();
|
||||
}
|
||||
}
|
||||
});
|
||||
deleteDlg.open();
|
||||
} else {
|
||||
deleteDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the copy action.
|
||||
*/
|
||||
|
@ -850,7 +1051,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
try {
|
||||
if (DataDeliveryServices.getPermissionsService()
|
||||
.checkPermission(user, msg, permission).isAuthorized()) {
|
||||
final List<Subscription> updatedList = new ArrayList<Subscription>();
|
||||
|
||||
int count = tableComp.getTable().getSelectionCount();
|
||||
|
||||
|
@ -1143,21 +1343,33 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
return exceptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void activateButtonUpdate(String text) {
|
||||
activateBtn.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void groupSelectionUpdate(String fileName) {
|
||||
// unused
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getGroupNameTxt() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void tableSelection() {
|
||||
// not currently used
|
||||
|
@ -1171,6 +1383,9 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
|
|||
return DataDeliveryUtils.showYesNoMessage(shell, title, message) == SWT.YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void tableLock(boolean isLocked) {
|
||||
// no-op
|
||||
|
|
|
@ -20,25 +20,14 @@
|
|||
-->
|
||||
<?eclipse version="3.2"?>
|
||||
<plugin>
|
||||
<extension
|
||||
<!-- Re-enabled when base/site/user permissions are set up -->
|
||||
<!-- <extension
|
||||
point="com.raytheon.viz.ui.contextualMenu">
|
||||
|
||||
<contextualMenu
|
||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.EnableDisableMetarAction"
|
||||
capabilityInterface="com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource"
|
||||
name="MetarAction"
|
||||
sortID="113"/>
|
||||
<contextualMenu
|
||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.EnableDisableMesowestAction"
|
||||
capabilityInterface="com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource"
|
||||
name="MesowestAction"
|
||||
sortID="114"/>
|
||||
<!-- Re-enabled when base/site/user permissions are set up -->
|
||||
<!-- <contextualMenu
|
||||
actionClass="com.raytheon.viz.pointdata.ui.cmenu.ViewPlotModelAction"
|
||||
name="Edit Plot Model"
|
||||
sortID="115"/> -->
|
||||
</extension>
|
||||
sortID="115"/>
|
||||
</extension> -->
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.core.resource">
|
||||
<resource
|
||||
|
|
|
@ -57,7 +57,6 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
|||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
|
||||
import com.raytheon.viz.pointdata.PlotModelGenerator;
|
||||
|
@ -75,19 +74,23 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 11/20/2006 brockwoo Initial creation.
|
||||
* 02/17/2009 njensen Refactored to new rsc architecture.
|
||||
* 03/17/2009 2105 jsanchez Plot goessounding/poessounding availability.
|
||||
* 03/30/2009 2169 jsanchez Updated initNewFrame.
|
||||
* 04/09/2009 952 jsanchez Plot acars.
|
||||
* 04/13/2009 2251 jsanchez Plot profilers.
|
||||
* 05/12/2009 2338 jsanchez Updated resourceChanged. Registered units.
|
||||
* 06/08/2009 2450 jsanchez Updated inpsect method to find closest plot.
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 08/09/2012 1011 jkorman Added screenToWorldRatio calc to paintInternal.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Nov 20, 2006 brockwoo Initial creation.
|
||||
* Feb 17, 2009 njensen Refactored to new rsc architecture.
|
||||
* Mar 17, 2009 2105 jsanchez Plot goessounding/poessounding
|
||||
* availability.
|
||||
* Mar 30, 2009 2169 jsanchez Updated initNewFrame.
|
||||
* Apr 09, 2009 952 jsanchez Plot acars.
|
||||
* Apr 13, 2009 2251 jsanchez Plot profilers.
|
||||
* May 12, 2009 2338 jsanchez Updated resourceChanged. Registered
|
||||
* units.
|
||||
* Jun 08, 2009 2450 jsanchez Updated inpsect method to find closest
|
||||
* plot.
|
||||
* Aug 09, 2012 1011 jkorman Added screenToWorldRatio calc to
|
||||
* paintInternal.
|
||||
* Nov 06, 2013 2493 bsteffen Removed IPlotDataResource
|
||||
*
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -97,7 +100,7 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
*/
|
||||
public class PlotResource extends
|
||||
AbstractVizResource<PlotResourceData, MapDescriptor> implements
|
||||
IPlotDataResource, IResourceDataChanged {
|
||||
IResourceDataChanged {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PlotResource.class);
|
||||
|
||||
|
@ -109,10 +112,6 @@ public class PlotResource extends
|
|||
|
||||
private DataTime displayedObsTime;
|
||||
|
||||
private boolean metarEnabled;
|
||||
|
||||
private boolean mesowestEnabled;
|
||||
|
||||
private VA_Advanced progDisc;
|
||||
|
||||
private double actualPlotWidth;
|
||||
|
@ -197,8 +196,6 @@ public class PlotResource extends
|
|||
public PlotResource(PlotResourceData data, LoadProperties props) {
|
||||
super(data, props);
|
||||
this.dataTimes = new ArrayList<DataTime>();
|
||||
metarEnabled = true;
|
||||
mesowestEnabled = true;
|
||||
this.progDisc = new VA_Advanced();
|
||||
this.stationsToParse = new ArrayList<PluginDataObject>();
|
||||
this.frameInfo = new HashMap<String, FrameInformation>();
|
||||
|
@ -446,46 +443,6 @@ public class PlotResource extends
|
|||
generator.shutdown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if mesowest data is being displayed by the layer .
|
||||
*
|
||||
* @return Whether mesowest is enabled or not
|
||||
*/
|
||||
public boolean isMesowestEnabled() {
|
||||
return mesowestEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if metar data is being displayed by the layer.
|
||||
*
|
||||
* @return Whether metar is enabled or not
|
||||
*/
|
||||
public boolean isMetarEnabled() {
|
||||
return metarEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables mesowest data.
|
||||
*
|
||||
* @param flag
|
||||
* Enable or disable mesowest on the display
|
||||
*/
|
||||
public void setMesowestMode(boolean flag) {
|
||||
mesowestEnabled = flag;
|
||||
// aTarget.setNeedsRefresh(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables/disables metar data.
|
||||
*
|
||||
* @param flag
|
||||
* Enable or disable metar on the display
|
||||
*/
|
||||
public void setMetarMode(boolean flag) {
|
||||
metarEnabled = flag;
|
||||
// aTarget.setNeedsRefresh(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataTime[] getDataTimes() {
|
||||
try {
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* 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.pointdata.ui.cmenu;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enable/Disable metar data within a layer
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 28, 2006 brockwoo Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
* @version 1
|
||||
*/
|
||||
|
||||
public class EnableDisableMesowestAction extends AbstractRightClickAction {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
||||
boolean isEnabled = rsc.isMesowestEnabled();
|
||||
rsc.setMesowestMode(!isEnabled);
|
||||
this.setChecked(!isEnabled);
|
||||
if (isEnabled && !rsc.isMetarEnabled()) {
|
||||
rsc.setMetarMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedRsc(ResourcePair selectedRsc) {
|
||||
super.setSelectedRsc(selectedRsc);
|
||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
||||
|
||||
boolean curState = rsc.isMesowestEnabled();
|
||||
this.setChecked(curState);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#getText()
|
||||
*/
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Enable Mesowest";
|
||||
}
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/**
|
||||
* 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.pointdata.ui.cmenu;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.IPlotDataResource;
|
||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||
|
||||
/**
|
||||
*
|
||||
* Enable/Disable metar data within a layer
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 28, 2006 brockwoo Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author brockwoo
|
||||
* @version 1
|
||||
*/
|
||||
|
||||
public class EnableDisableMetarAction extends AbstractRightClickAction {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
||||
boolean isEnabled = rsc.isMetarEnabled();
|
||||
rsc.setMetarMode(!isEnabled);
|
||||
this.setChecked(!isEnabled);
|
||||
if (isEnabled && !rsc.isMesowestEnabled()) {
|
||||
rsc.setMesowestMode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedRsc(ResourcePair selectedRsc) {
|
||||
super.setSelectedRsc(selectedRsc);
|
||||
IPlotDataResource rsc = (IPlotDataResource) getSelectedRsc();
|
||||
|
||||
boolean curState = rsc.isMetarEnabled();
|
||||
this.setChecked(curState);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#getText()
|
||||
*/
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Enable METAR";
|
||||
}
|
||||
|
||||
}
|
11
deltaScripts/14.2.1/dropMesowest.sh
Normal file
11
deltaScripts/14.2.1/dropMesowest.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
# DR #2493 remove mesowest from the database
|
||||
|
||||
PSQL="/awips2/psql/bin/psql"
|
||||
|
||||
SQL_COMMAND="
|
||||
delete from plugin_info where name = 'mesowest';
|
||||
drop table if exists mesowest;
|
||||
drop sequence if exists mesowestseq;
|
||||
"
|
||||
${PSQL} -U awips -d metadata -c "${SQL_COMMAND}"
|
|
@ -90,12 +90,13 @@
|
|||
</appender>
|
||||
|
||||
<appender name="ThreadBasedLog" class="com.raytheon.uf.common.status.logback.ThreadBasedAppender">
|
||||
<threadPatterns>HarvesterLog:harvesterThreadPool.*,crawlerThreadPool.*,Crawler.*</threadPatterns>
|
||||
<threadPatterns>HarvesterLog:harvesterThreadPool.*,crawlerThreadPool.*,Crawler.*,RetrievalLog:retrievalThreadPool.*,retrievalThreadPool.*,Retrieval.*</threadPatterns>
|
||||
<defaultAppender>console</defaultAppender>
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="HarvesterLog"/>
|
||||
<appender-ref ref="RetrievalLog"/>
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="com.raytheon">
|
||||
<level value="INFO"/>
|
||||
</logger>
|
||||
|
@ -201,16 +202,6 @@
|
|||
<appender-ref ref="RetrievalLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.registry" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="console"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.edex.datadelivery.registry" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="console"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.raytheon.uf.common.datadelivery.bandwidth" additivity="false">
|
||||
<level value="INFO"/>
|
||||
<appender-ref ref="BandwidthManagerLog"/>
|
||||
|
|
|
@ -234,7 +234,7 @@
|
|||
<!-- Registry production mode -->
|
||||
<include>ebxml.*\.xml</include>
|
||||
<includeMode>dataDeliveryTemplate</includeMode>
|
||||
<include>adhoc-datadelivery-wfo.xml</include>
|
||||
<include>datadelivery-wfo-cron.xml</include>
|
||||
<exclude>.*datadelivery-ncf.*</exclude>
|
||||
<exclude>harvester-*</exclude>
|
||||
<exclude>crawler-*</exclude>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<connection>
|
||||
<!-- for OGC it's your FQDN
|
||||
!!!!!PLACE YOUR URL HERE!!!!!!-->
|
||||
<url>http://your.url.here:8085</url>
|
||||
<url>http://your.url.here:8085/wfs</url>
|
||||
<userName>user</userName>
|
||||
<password>password</password>
|
||||
<encryption>CLEAR</encryption>
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.monitor.data;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* Constants for Observations within the Decision Assistance Tool Suite that
|
||||
|
@ -29,10 +27,13 @@ import java.util.TimeZone;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 10, 2009 1999 grichard Initial creation.
|
||||
* Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to VarName for SWELL
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Feb 10, 2009 1999 grichard Initial creation.
|
||||
* Jan 26, 2010 4268 skorolev Corrected DisplayVarName according to
|
||||
* VarName for SWELL
|
||||
* Nov 06, 2013 2493 bsteffen Remove unused constants.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
|
@ -45,16 +46,6 @@ public final class ObConst {
|
|||
private ObConst() {
|
||||
}
|
||||
|
||||
// Date Format
|
||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm");
|
||||
|
||||
public static SimpleDateFormat obTimeFormat = DATE_FORMAT;
|
||||
|
||||
static {
|
||||
obTimeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
// Time Window in units of hours
|
||||
public static final int THREAT_INTERVAL_HOURS = 2;
|
||||
|
||||
|
@ -85,21 +76,6 @@ public final class ObConst {
|
|||
|
||||
public static final String SKC_SKY_STRING = "SKC";
|
||||
|
||||
// Image type used for Fog Monitor
|
||||
public enum ImageType {
|
||||
VIS, IR3_9, IR10_7, Undefined_ImageType
|
||||
}
|
||||
|
||||
// Intensity Level
|
||||
public enum IntensityLevel {
|
||||
LIGHT, MODERATE, HEAVY
|
||||
};
|
||||
|
||||
// Monitor Area
|
||||
// public enum MonitorArea {
|
||||
// SS, FM, SS_FM
|
||||
// }
|
||||
|
||||
// Chosen Application Key
|
||||
public enum ChosenAppKey {
|
||||
SNOW, FOG, SAFESEAS
|
||||
|
@ -115,11 +91,6 @@ public final class ObConst {
|
|||
BLACK, GRAY, GREEN, YELLOW, RED, YELLOW_LO, YELLOW_HI, RED_LO, RED_HI, UNDEFINED_THREATLEVEL
|
||||
}
|
||||
|
||||
// Threat Level Strings
|
||||
public static final String[] THREAT_LEVEL_STRINGS = { "black", "gray",
|
||||
"green", "yellow", "red", "yellow_lo", "yellow_hi", "red_lo",
|
||||
"red_hi" };
|
||||
|
||||
// Report Type
|
||||
public enum ReportType {
|
||||
SYNOPTIC_FIXED_LAND,
|
||||
|
@ -158,19 +129,6 @@ public final class ObConst {
|
|||
VISIBILITY, WIND_SPEED, MAX_WIND_SPEED, GUST_SPEED, TEMPERATURE, WIND_CHILL, SNOW_DEPTH, PRIM_SWELL_HT, PRIM_SWELL_PD, PRIM_SWELL_DIR, SEC_SWELL_HT, SEC_SWELL_PD, SEC_SWELL_DIR, STATIONARY, WAVE_HEIGHT, WAVE_PERIOD, WAVE_STEEPNESS, LATITUDE, LONGITUDE, NOMINAL_DATETIME, OBSERVATION_DATETIME, PLATFORM_ID, PRESSURE, PRES_CHANGE, WIND_DIR, FOG, ZONE_ID, DEWPOINT, PRES_WX, SEA_SURFACE_TEMPERATURE, HOURLY_PRECIP, SNINCR_HOURLY, SNINCR_TOTAL, FROSTBITE_TIME, RELATIVE_HUMIDITY, CEILING, DEWPOINT_DEPR, SEA_LEVEL_PRESS, UNDEFINED_VARIABLE
|
||||
}
|
||||
|
||||
// Variable Name Strings
|
||||
public static final String[] VAR_NAME_TEXT = { "GUST_SPEED", "LATITUDE",
|
||||
"LONGITUDE", "NOMINAL_DATETIME", "OBSERVATION_DATETIME",
|
||||
"PLATFORM_ID", "PRESSURE", "PRES_CHANGE", "PRIM_SWELL_DIR",
|
||||
"PRIM_SWELL_HT", "PRIM_SWELL_PD", "SEC_SWELL_DIR", "SEC_SWELL_HT",
|
||||
"SEC_SWELL_PD", "STATIONARY", "TEMPERATURE", "VISIBILITY",
|
||||
"WAVE_HEIGHT", "WAVE_PERIOD", "WAVE_STEEPNESS", "WIND_DIR",
|
||||
"WIND_SPEED", "MAX_WIND_SPEED", "FOG", "ZONE_ID", "DEWPOINT",
|
||||
"PRES_WX", "SEA_SURFACE_TEMPERATURE", "HOURLY_PRECIP",
|
||||
"SNOW_DEPTH", "SNINCR_HOURLY", "SNINCR_TOTAL", "WIND_CHILL",
|
||||
"FROSTBITE_TIME", "RELATIVE_HUMIDITY", "CEILING", "DEWPOINT_DEPR",
|
||||
"SEA_LEVEL_PRESS", "UNDEFINED_VARIABLE" };
|
||||
|
||||
// Display Variable Names
|
||||
public enum DisplayVarName {
|
||||
SCA_WIND_SPEED, SCA_GUST_SPEED, SCA_MAX_WIND_SPEED, SCA_WAVE_HEIGHT, GALE_WIND_SPEED, GALE_GUST_SPEED, GALE_MAX_WIND_SPEED, STORM_WIND_SPEED, STORM_GUST_SPEED, STORM_MAX_WIND_SPEED, HURRICANE_WIND_SPEED, HURRICANE_GUST_SPEED, HURRICANE_MAX_WIND_SPEED, VAR_WIND_DIR, VAR_WIND_SPEED, VAR_MAX_WIND_SPEED, VAR_GUST_SPEED, VAR_VISIBILITY, VAR_TEMPERATURE, VAR_DEWPOINT, VAR_SEA_SURFACE_TEMPERATURE, VAR_WAVE_HEIGHT, VAR_WAVE_STEEPNESS, VAR_TIME, VAR_LATITUDE, VAR_LONGITUDE, VAR_PRESSURE, VAR_PRES_CHANGE, VAR_SNOW_DEPTH, VAR_SNINCR_HOURLY, VAR_SNINCR_TOTAL, VAR_WIND_CHILL, VAR_FROSTBITE_TIME, VAR_HOURLY_PRECIP, VAR_PRIM_SWELL_HT, VAR_PRIM_SWELL_PD, VAR_PRIM_SWELL_DIR, VAR_SEC_SWELL_HT, VAR_SEC_SWELL_PD, VAR_SEC_SWELL_DIR, VAR_FOG, BLIZ_WIND_SPEED, BLIZ_GUST_SPEED, BLIZ_MAX_WIND_SPEED, BLIZ_VISIBILITY, FRZ_HOURLY_PRECIP, FRZ_TEMPERATURE, HSW_SNOW_DEPTH, HSW_SNINCR_HOURLY, HSW_SNINCR_TOTAL, VAR_RELATIVE_HUMIDITY, VAR_CEILING, VAR_DEWPOINT_DEPR, VAR_SEA_LEVEL_PRESS
|
||||
|
@ -200,24 +158,6 @@ public final class ObConst {
|
|||
"kts", "kts", "nm", "in", "F", "in", "in", "in", "%", "ftx100",
|
||||
"F", "mb" };
|
||||
|
||||
// Remarks section delimiter in METAR
|
||||
public static final String REMARK_EXPR = "RMK";
|
||||
|
||||
// Snow increasing rapidly remark expression in a METAR's remarks section
|
||||
public static final String SNINCR_EXPR = "(SNINCR )(\\d+)/(\\d+)";
|
||||
|
||||
// Snow depth remark expression in a METAR's remarks section
|
||||
public static final String SNOW_DEPTH_EXPR = "4/\\(d{3})";
|
||||
|
||||
// Metar plugin name
|
||||
public static final String METAR_PLUGIN_NAME = "obs";
|
||||
|
||||
// Marine plugin name
|
||||
public static final String MARINE_PLUGIN_NAME = "scfobs";
|
||||
|
||||
// Meso plugin name
|
||||
public static final String MESO_PLUGIN_NAME = "mesowest";
|
||||
|
||||
// Default station identifier
|
||||
public static final String DEFAULT_STATION_NAME = "KOMA";
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<name>Local</name>
|
||||
<extRetentionHours>168</extRetentionHours>
|
||||
<dataSet>
|
||||
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|mesowest|qc)</dirPattern>
|
||||
<dirPattern>(ldadhydro|ldadmesonet|ldadprofiler|ldad_manual|qc)</dirPattern>
|
||||
<filePattern>.*(\d{4})-(\d{2})-(\d{2})-(\d{2}).*</filePattern>
|
||||
<displayLabel>{1}</displayLabel>
|
||||
<dateGroupIndices>2,3,4,5</dateGroupIndices>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
</license>
|
||||
|
||||
<requires>
|
||||
<import feature="com.raytheon.uf.edex.registry.client.feature" version="0.0.0"/>
|
||||
<import feature="com.raytheon.uf.edex.registry.client.feature" version="0.0.0"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
|
@ -80,27 +80,13 @@
|
|||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.unitconverter"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.dataset.urn"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.ogc.common"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.obs.ogc"
|
||||
download-size="0"
|
||||
|
|
|
@ -24,3 +24,6 @@ Require-Bundle: com.google.guava;bundle-version="1.0.0",
|
|||
com.raytheon.uf.common.util;bundle-version="1.12.1174",
|
||||
org.hibernate;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.edex.datadelivery.event.dao,
|
||||
com.raytheon.uf.edex.datadelivery.event.handler,
|
||||
com.raytheon.uf.edex.datadelivery.event.notification
|
||||
|
|
|
@ -32,6 +32,7 @@ Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
|||
com.raytheon.uf.common.stats;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.decodertools;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.registry.ebxml;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.datadelivery.event;bundle-version="1.0.0",
|
||||
org.apache.http;bundle-version="4.1.2"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- Cleans up old Adhoc subscriptions in the registry when the data for
|
||||
them expires This only runs within the WFO registry mode (Adhoc subscriptions
|
||||
are only allowed there) -->
|
||||
|
||||
<bean id="AdhocSubscriptionCleaner"
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.adhoc.AdhocSubscriptionCleaner" />
|
||||
|
||||
<camelContext id="adhocsubscription-cleanup" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<endpoint id="processAdhocSubscriptions"
|
||||
uri="clusteredquartz://registry/processAdhocSubscriptions/?cron=${adhocsubscription-process.cron}" />
|
||||
<route id="processSubscriptionsFromQuartz">
|
||||
<from uri="processAdhocSubscriptions" />
|
||||
<bean ref="AdhocSubscriptionCleaner" method="processSubscriptions" />
|
||||
</route>
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -0,0 +1,46 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<!-- Cleans up old Adhoc subscriptions in the registry when the data for
|
||||
them expires This only runs within the WFO registry mode (Adhoc subscriptions
|
||||
are only allowed there) -->
|
||||
|
||||
<bean id="AdhocSubscriptionCleaner"
|
||||
class="com.raytheon.uf.edex.datadelivery.retrieval.adhoc.AdhocSubscriptionCleaner" />
|
||||
|
||||
<!-- Subscription check bean. Functions the check subscriptions should be placed in this file. -->
|
||||
<bean id="subscriptionChecker" class="com.raytheon.uf.edex.datadelivery.retrieval.util.SubscriptionChecker">
|
||||
<constructor-arg type="java.lang.String" value="jms-generic:topic:notify.msg" />
|
||||
<property name="notificationDao" ref="notificationDao" />
|
||||
</bean>
|
||||
|
||||
<camelContext id="wfo-cron" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler">
|
||||
<endpoint id="processAdhocSubscriptions"
|
||||
uri="quartz://registry/processAdhocSubscriptions/?cron=${adhocsubscription-process.cron}" />
|
||||
|
||||
<endpoint id="checkSubscriptions"
|
||||
uri="quartz://registry/checkExpiredSubscriptions/?cron=${checkExpiredSubscription.cron}" />
|
||||
|
||||
<endpoint id="checkEndingSubscriptions"
|
||||
uri="quartz://registry/checkEndingSubscriptions/?cron=${checkEndingSubscription.cron}" />
|
||||
|
||||
<route id="processSubscriptionsFromQuartz">
|
||||
<from uri="processAdhocSubscriptions" />
|
||||
<bean ref="AdhocSubscriptionCleaner" method="processSubscriptions" />
|
||||
</route>
|
||||
|
||||
<route id="subscriptionEndingCheckFromQuartz">
|
||||
<from uri="checkEndingSubscriptions" />
|
||||
<bean ref="subscriptionChecker" method="activePeriodEndCheck" />
|
||||
</route>
|
||||
|
||||
<route id="subscriptionCheckFromQuartz">
|
||||
<from uri="checkSubscriptions" />
|
||||
<bean ref="subscriptionChecker" method="expirationCheck" />
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
</beans>
|
|
@ -10,4 +10,9 @@ sbn.retrieval.transfer.wmo.header=LZ{0}{1}9{2} KWBC {3,date,ddHH00}\r\r\n
|
|||
retrieval.task.frequency=1 MINUTES
|
||||
# How often to check for retrieved subscriptions to notify of
|
||||
# Valid units: [MILLISECONDS, SECONDS, MINUTES, HOURS, DAYS]
|
||||
subnotify.task.frequency=1 MINUTES
|
||||
subnotify.task.frequency=1 MINUTES
|
||||
|
||||
# Cron for Subscription Expiration Checker - currently 2 minutes past the hour
|
||||
checkExpiredSubscription.cron=0+2+*+*+*+?
|
||||
# Cron for subscriptions nearing the end of their active period - currently once/day at 00:15Z
|
||||
checkEndingSubscription.cron=0+15+0+*+*+?
|
|
@ -0,0 +1,271 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.retrieval.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.datadelivery.event.notification.NotificationRecord;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.edex.core.EDEXUtil;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.datadelivery.event.notification.NotificationDao;
|
||||
|
||||
/**
|
||||
* A class to hold various subscription checks.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 29, 2013 2450 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
@Transactional
|
||||
public class SubscriptionChecker {
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubscriptionChecker.class);
|
||||
|
||||
/** Notification DAO for sending/storing notification messages */
|
||||
private NotificationDao notificationDao;
|
||||
|
||||
/** End point URI */
|
||||
private String uri;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public SubscriptionChecker() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with notification URI parameter.
|
||||
*
|
||||
* @param uri
|
||||
* Notification uri
|
||||
*/
|
||||
public SubscriptionChecker(String uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for subscriptions that have expired in the last hour.
|
||||
*/
|
||||
public void expirationCheck() {
|
||||
statusHandler.info("Starting expiration check...");
|
||||
ISubscriptionHandler handler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
List<Subscription> subList = null;
|
||||
try {
|
||||
subList = handler.getAll();
|
||||
|
||||
List<Subscription> expiredList = getNewlyExpiredSubscriptions(
|
||||
subList, TimeUtil.MILLIS_PER_HOUR);
|
||||
|
||||
if (!expiredList.isEmpty()) {
|
||||
StringBuilder buffer = new StringBuilder(
|
||||
"Expired Subscriptions: ");
|
||||
|
||||
for (Subscription sub : expiredList) {
|
||||
buffer.append(sub.getName()).append(" ");
|
||||
}
|
||||
|
||||
NotificationRecord record = new NotificationRecord();
|
||||
record.setCategory("Subscription");
|
||||
record.setDate(TimeUtil.newGmtCalendar());
|
||||
record.setMessage(buffer.toString());
|
||||
record.setPriority(3);
|
||||
record.setUsername("System");
|
||||
|
||||
// Send the notification
|
||||
storeAndSend(record, uri);
|
||||
statusHandler.debug(buffer.toString());
|
||||
}
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for subscriptions that will become inactive in the next 24 hours.
|
||||
*/
|
||||
public void activePeriodEndCheck() {
|
||||
statusHandler.info("Starting active period check...");
|
||||
ISubscriptionHandler handler = DataDeliveryHandlers
|
||||
.getSubscriptionHandler();
|
||||
List<Subscription> subList = null;
|
||||
try {
|
||||
subList = handler.getAll();
|
||||
|
||||
List<Subscription> stoppingList = getSubscriptionsNearingEndOfActivePeriod(subList);
|
||||
|
||||
if (!stoppingList.isEmpty()) {
|
||||
StringBuilder buffer = new StringBuilder(
|
||||
"Subscriptions becoming inactive in Next 24 hrs: ");
|
||||
|
||||
for (Subscription sub : stoppingList) {
|
||||
buffer.append(sub.getName()).append(" ");
|
||||
}
|
||||
|
||||
NotificationRecord record = new NotificationRecord();
|
||||
record.setCategory("Subscription");
|
||||
record.setDate(TimeUtil.newGmtCalendar());
|
||||
record.setMessage(buffer.toString());
|
||||
record.setPriority(3);
|
||||
record.setUsername("System");
|
||||
|
||||
// Send the notification
|
||||
storeAndSend(record, uri);
|
||||
statusHandler.debug(buffer.toString());
|
||||
}
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for subscriptions that have expired within a time period defined by
|
||||
* expiredPeriod.
|
||||
*
|
||||
* If expiredPeriod is one hour then a subscription will be flagged as
|
||||
* expired if it expired within the last hour
|
||||
*
|
||||
* @param subList
|
||||
* List of subscriptions to check
|
||||
* @param expiredPeriod
|
||||
* amount of time for expiration, in milliseconds
|
||||
*
|
||||
* @return List of subscriptions marked as expired
|
||||
*/
|
||||
@VisibleForTesting
|
||||
List<Subscription> getNewlyExpiredSubscriptions(List<Subscription> subList,
|
||||
long expiredPeriod) {
|
||||
List<Subscription> expired = new ArrayList<Subscription>();
|
||||
statusHandler.debug("Checking for expired subs");
|
||||
if (subList != null && !subList.isEmpty()) {
|
||||
Date now = TimeUtil.newGmtCalendar().getTime();
|
||||
for (Subscription sub : subList) {
|
||||
Date end = sub.getSubscriptionEnd();
|
||||
if (end == null) {
|
||||
continue;
|
||||
} else if (end.before(now)) {
|
||||
if (now.getTime() - end.getTime() < expiredPeriod) {
|
||||
expired.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return expired;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for subscriptions that are nearing the end of their active period.
|
||||
*
|
||||
* @param subList
|
||||
* List of subscriptions to check
|
||||
* @return List of subscriptions that are nearing the end of their active
|
||||
* period
|
||||
*/
|
||||
@VisibleForTesting
|
||||
List<Subscription> getSubscriptionsNearingEndOfActivePeriod(
|
||||
List<Subscription> subList) {
|
||||
List<Subscription> endingList = new ArrayList<Subscription>();
|
||||
statusHandler.debug("Checking for subs nearing end of active period");
|
||||
|
||||
if (subList != null && !subList.isEmpty()) {
|
||||
Calendar now = TimeUtil.newGmtCalendar();
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
|
||||
for (Subscription sub : subList) {
|
||||
Date end = sub.getActivePeriodEnd();
|
||||
if (end == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
cal.setTimeInMillis(end.getTime());
|
||||
cal.set(Calendar.YEAR, now.get(Calendar.YEAR));
|
||||
if (now.before(cal)
|
||||
&& (cal.getTimeInMillis() - now.getTimeInMillis() < TimeUtil.MILLIS_PER_DAY)) {
|
||||
endingList.add(sub);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return endingList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the record in the notification table.
|
||||
*
|
||||
* @param record
|
||||
*/
|
||||
private void storeAndSend(NotificationRecord record, String endpoint) {
|
||||
if (record != null) {
|
||||
notificationDao.createOrUpdate(record);
|
||||
try {
|
||||
byte[] bytes = SerializationUtil.transformToThrift(record);
|
||||
EDEXUtil.getMessageProducer().sendAsyncUri(endpoint, bytes);
|
||||
} catch (EdexException e) {
|
||||
statusHandler.error("Error sending record to " + endpoint, e);
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.error("Error serializing record to " + endpoint,
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the notificationDao
|
||||
*/
|
||||
public NotificationDao getNotificationDao() {
|
||||
return notificationDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param notificationDao
|
||||
* the notificationDao to set
|
||||
*/
|
||||
public void setNotificationDao(NotificationDao notificationDao) {
|
||||
this.notificationDao = notificationDao;
|
||||
}
|
||||
}
|
|
@ -269,13 +269,6 @@
|
|||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.mesowest"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.edex.plugin.qc"
|
||||
download-size="0"
|
||||
|
|
|
@ -42,5 +42,4 @@ Export-Package: com.raytheon.uf.edex.ogc.common,
|
|||
com.raytheon.uf.edex.ogc.common.time,
|
||||
com.raytheon.uf.edex.ogc.common.util
|
||||
Import-Package: com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.edex.plugin.dataset.urn,
|
||||
org.apache.cxf.helpers
|
||||
|
|
|
@ -12,7 +12,6 @@ package com.raytheon.uf.edex.ogc.common.spatial;
|
|||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.plugin.dataset.urn.URNLookup;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -32,7 +31,7 @@ import com.raytheon.uf.edex.plugin.dataset.urn.URNLookup;
|
|||
*/
|
||||
public interface NativeCrsAuthority {
|
||||
|
||||
public static final String NATIVE_CRS_PREFIX = URNLookup.WXSRV_URN_PREFIX
|
||||
public static final String NATIVE_CRS_PREFIX = "urn:x-wxsrv:"
|
||||
+ "crs:";
|
||||
|
||||
public CoordinateReferenceSystem lookup(String URN) throws OgcException;
|
||||
|
|
|
@ -66,9 +66,10 @@ import com.vividsolutions.jts.geom.Envelope;
|
|||
* Jul 23, 2013 bclement Initial creation
|
||||
* Aug 08, 2013 2097 dhladky Made operational
|
||||
* Aug 30, 2013 2098 dhladky Improved
|
||||
* Spet 2, 2013 2098 dhladky Updated how times are managed.
|
||||
* Sept 2, 2013 2098 dhladky Updated how times are managed.
|
||||
* Sept 30, 2013 1797 dhladky Generics
|
||||
* Oct 10, 2013 1797 bgonzale Refactored registry Time objects.
|
||||
* Nov 6, 2013 2525 dhladky Stop appending "/wfs"
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -316,8 +317,6 @@ public class WfsRegistryCollectorAddon<D extends SimpleDimension, L extends Simp
|
|||
StringBuilder sb2 = new StringBuilder();
|
||||
sb2.append(getConfiguration().getProvider().getConnection()
|
||||
.getUrl());
|
||||
sb2.append("/");
|
||||
sb2.append(getAgent().getWfs());
|
||||
pdsmd.setUrl(sb2.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.plugin.dataset.urn</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,8 +0,0 @@
|
|||
#Tue Apr 02 10:27:06 CDT 2013
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,12 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Dataset-URN
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.dataset.urn
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.springframework;bundle-version="2.5.6",
|
||||
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.edex.plugin.dataset.urn
|
|
@ -1,6 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/,\
|
||||
bin/
|
|
@ -1,17 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="cfNameResource" class="com.raytheon.uf.edex.plugin.dataset.urn.CFNameResource">
|
||||
<property name="configFileResource">
|
||||
<value>file:///${edex.home}/data/utility/edex_static/base/wxsrv/namedata/ncep_to_cf_mapping.csv</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="cfNameLookup" class="com.raytheon.uf.edex.plugin.dataset.urn.CFNameLookup">
|
||||
<constructor-arg>
|
||||
<ref bean="cfNameResource" />
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,165 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
|
||||
package com.raytheon.uf.edex.plugin.dataset.urn;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* Singleton to facilitate the lookup of the CF Standard name from a shortened
|
||||
* name such as those in GRIB processing. Also maintains a mapping of the CF names
|
||||
* to ontology individuals to facilitate dynamic ontology updates and individual
|
||||
* creation.
|
||||
* @author behemmi
|
||||
*
|
||||
*/
|
||||
public class CFNameLookup {
|
||||
|
||||
private static CFNameLookup instance;
|
||||
|
||||
private IUFStatusHandler log = UFStatus.getHandler(this.getClass());
|
||||
|
||||
private Map<String, String> ncepToCFMapping;
|
||||
|
||||
protected Map<String, String> cfToNcepMapping;
|
||||
private Map<String, String> cfToOntologyRelationMapping;
|
||||
private Map<String, String> cfToOntologyClassMapping;
|
||||
|
||||
private CFNameLookup(CFNameResource resource) {
|
||||
ncepToCFMapping = new HashMap<String, String>();
|
||||
cfToOntologyRelationMapping = new HashMap<String, String>();
|
||||
cfToOntologyClassMapping = new HashMap<String, String>();
|
||||
cfToNcepMapping = new HashMap<String, String>();
|
||||
|
||||
try {
|
||||
if (resource.getConfigFileResource() != null) {
|
||||
InputStream configStream = resource.getConfigFileResource().getInputStream();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(configStream));
|
||||
String line = null;
|
||||
|
||||
while((line = in.readLine()) != null) {
|
||||
if(line.startsWith("#") || line.length() == 0) {
|
||||
//comment, ignore
|
||||
continue;
|
||||
}
|
||||
|
||||
//limit splitting to 2 to account for multiple tabs and trim for map insert
|
||||
String[] parts = line.split("\t", 2);
|
||||
if(parts != null && parts.length > 1) {
|
||||
|
||||
//check for an Ontology relation after the CF Name
|
||||
String[] ontRelParts = parts[1].trim().split("\t", 2);
|
||||
if(ontRelParts != null && ontRelParts.length > 1) {
|
||||
|
||||
//check for an Ontology class after the Ontoogy relation
|
||||
String[] ontClassParts = ontRelParts[1].trim().split("\t", 2);
|
||||
if(ontClassParts != null && ontClassParts.length > 1) {
|
||||
//this line has everything, populate all the HashMaps
|
||||
cfToOntologyClassMapping.put(ontRelParts[0].trim(), ontClassParts[1].trim());
|
||||
cfToOntologyRelationMapping.put(ontRelParts[0].trim(), ontClassParts[0].trim());
|
||||
ncepToCFMapping.put(parts[0].toUpperCase().trim(), ontRelParts[0].trim());
|
||||
cfToNcepMapping.put(ontRelParts[0].trim(),
|
||||
parts[0].toUpperCase().trim());
|
||||
} else {
|
||||
//only entries up the relation are present
|
||||
cfToOntologyRelationMapping.put(ontRelParts[0].trim(), ontRelParts[1].trim());
|
||||
ncepToCFMapping.put(parts[0].toUpperCase().trim(), ontRelParts[0].trim());
|
||||
cfToNcepMapping.put(ontRelParts[0].trim(),
|
||||
parts[0].toUpperCase().trim());
|
||||
log.warn("CF Name "
|
||||
+ ontRelParts[0].trim()
|
||||
+ " not mapped to Ontology Class in Config");
|
||||
}
|
||||
} else {
|
||||
//only the cf and ncep entries are on this line
|
||||
ncepToCFMapping.put(parts[0].toUpperCase().trim(), parts[1].trim());
|
||||
cfToNcepMapping.put(parts[1].trim(), parts[0]
|
||||
.toUpperCase().trim());
|
||||
log.warn("CF Name " + parts[1].trim()
|
||||
+ " not mapped to Ontology Info in Config");
|
||||
}
|
||||
} else {
|
||||
log.warn("NCEP Name " + parts[0]
|
||||
+ " not mapped to CF Name in Config");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Config File Resource null");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("Configured mapping to CF Names not available", e);
|
||||
}
|
||||
instance = this;
|
||||
}
|
||||
|
||||
public static CFNameLookup getInstance(){
|
||||
//expecting instantiation from spring so no 'new' call here
|
||||
//like in the normal singleton pattern
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CF Name if available, defaults to the ncep name otherwise
|
||||
*
|
||||
* @param ncepName
|
||||
* @return
|
||||
*/
|
||||
public String getCFFromNCEP(String ncepName) {
|
||||
String cfName = ncepName;
|
||||
if(ncepToCFMapping.containsKey(ncepName.toUpperCase())) {
|
||||
cfName = ncepToCFMapping.get(ncepName.toUpperCase());
|
||||
}
|
||||
return cfName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the NCEP name if available, defaults to the cf name otherwise
|
||||
*
|
||||
* @param cfName
|
||||
* @return
|
||||
*/
|
||||
public String getNCEPFromCF(String cfName) {
|
||||
String ncepName = cfName;
|
||||
if (cfToNcepMapping.containsKey(cfName)) {
|
||||
ncepName = cfToNcepMapping.get(cfName).toUpperCase();
|
||||
}
|
||||
|
||||
return ncepName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the associated ontology axiom for a given CF Name, returns null
|
||||
* if no entities are associated
|
||||
* @param cfName
|
||||
* @return
|
||||
*/
|
||||
public String getOntologyRelationFromCF(String cfName) {
|
||||
return cfToOntologyRelationMapping.get(cfName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the associated ontology class for a given CF Name, returns null
|
||||
* if no entities are associated
|
||||
* @param cfName
|
||||
* @return
|
||||
*/
|
||||
public String getOntologyclassFromCF(String cfName) {
|
||||
return cfToOntologyClassMapping.get(cfName);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
|
||||
package com.raytheon.uf.edex.plugin.dataset.urn;
|
||||
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
public class CFNameResource {
|
||||
|
||||
/**
|
||||
* Spring resource for properties file, this is preferred over a filepath
|
||||
* string
|
||||
*/
|
||||
protected Resource configFileResource = null;
|
||||
|
||||
public Resource getConfigFileResource() {
|
||||
return configFileResource;
|
||||
}
|
||||
|
||||
public void setConfigFileResource(Resource configFileResource) {
|
||||
this.configFileResource = configFileResource;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,156 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.dataset.urn;
|
||||
|
||||
|
||||
/**
|
||||
* Lookup URNs.
|
||||
*
|
||||
* @author ekladstrup
|
||||
* @version 1.0
|
||||
*/
|
||||
public class URNLookup {
|
||||
|
||||
public static final String WXSRV_URN_PREFIX = "urn:x-wxsrv:";
|
||||
|
||||
public static final String MODEL_URN_PREFIX = WXSRV_URN_PREFIX + "Dataset";
|
||||
|
||||
// From ucar.edu WXCM primer
|
||||
public static final String FDC_AIRCRAFT_REPORT = "urn:fdc:icao:procedure:AircraftReport";
|
||||
|
||||
// From ucar.edu WXCM primer
|
||||
public static final String ICAO_CODE_PREFIX = "urn:icao:code:weatherStation";
|
||||
|
||||
private static enum State {
|
||||
START, ONE_SLASH, MULT_SLASH, ONE_COLON
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert EDEX internal ID to external URN
|
||||
*
|
||||
* Single slashes are replaced by single colons. Any additional slashes
|
||||
* immediately following are converted into URN escape sequences. 'foo/bar'
|
||||
* -> 'foo:bar', 'foo//bar' -> 'foo:%2fbar'. Any colons in the local string
|
||||
* are escaped with another colon. 'foo:bar/baz' -> 'foo::bar:baz'. Other
|
||||
* non-URN characters are escaped using URN escape formatting.
|
||||
*
|
||||
* Dataset URN prefix is attached.
|
||||
*
|
||||
* @param local
|
||||
* dataURI based ID
|
||||
* @return
|
||||
*/
|
||||
public static String localToUrn(String local) {
|
||||
State s = State.START;
|
||||
StringBuilder sb = new StringBuilder(MODEL_URN_PREFIX).append(':');
|
||||
for (int i = 0; i < local.length(); ++i) {
|
||||
char curr = local.charAt(i);
|
||||
switch (curr) {
|
||||
case '/':
|
||||
if (s.equals(State.START)) {
|
||||
s = State.ONE_SLASH;
|
||||
sb.append(':');
|
||||
} else if (s.equals(State.ONE_SLASH)) {
|
||||
s = State.MULT_SLASH;
|
||||
sb.append("%2f");
|
||||
} else if (s.equals(State.MULT_SLASH)) {
|
||||
sb.append("%2f");
|
||||
}
|
||||
break;
|
||||
case ':':
|
||||
sb.append("::");
|
||||
s = State.START;
|
||||
break;
|
||||
case '%':
|
||||
case '?':
|
||||
case '#':
|
||||
case ' ':
|
||||
sb.append(String.format("%%%02x", (short) curr));
|
||||
s = State.START;
|
||||
break;
|
||||
default:
|
||||
sb.append(curr);
|
||||
s = State.START;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert external URN to internal EDEX ID
|
||||
*
|
||||
* URN escaped characters are converted to ASCII. Single colons are
|
||||
* converted to slashes. Colon pairs are converted to single colons.
|
||||
*
|
||||
* Dataset URN prefix is assumed to be on input.
|
||||
*
|
||||
* @param urn
|
||||
* @return dataURI based ID
|
||||
*/
|
||||
public static String urnToLocal(String urn) {
|
||||
// add 1 since the last ":" is not included in the length
|
||||
String unique = urn.substring(MODEL_URN_PREFIX.length() + 1);
|
||||
State s = State.START;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < unique.length(); ++i) {
|
||||
char curr = unique.charAt(i);
|
||||
char next;
|
||||
switch (curr) {
|
||||
case ':':
|
||||
if (s.equals(State.START)) {
|
||||
s = State.ONE_COLON;
|
||||
continue;
|
||||
} else {
|
||||
sb.append(':');
|
||||
s = State.START;
|
||||
continue;
|
||||
}
|
||||
case '%':
|
||||
next = (char) Short.parseShort(unique.substring(i + 1, i + 3),
|
||||
16);
|
||||
i += 2;
|
||||
break;
|
||||
default:
|
||||
next = curr;
|
||||
break;
|
||||
}
|
||||
if (s.equals(State.ONE_COLON)) {
|
||||
sb.append('/');
|
||||
s = State.START;
|
||||
}
|
||||
sb.append(next);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getAircraftReportURN() {
|
||||
return FDC_AIRCRAFT_REPORT;
|
||||
}
|
||||
|
||||
public static String icaoToUrn(String station) {
|
||||
return ICAO_CODE_PREFIX + ":" + station;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slice the icao urn and return the local part
|
||||
*
|
||||
* @param urn
|
||||
* @return Blank string or local part if prefix is the proper icao prefix,
|
||||
* null if the prefix does not match expectations
|
||||
*/
|
||||
public static String urnToIcao(String urn) {
|
||||
if (urn.startsWith(ICAO_CODE_PREFIX)) {
|
||||
// add 1 since the last ":" is not included in the length
|
||||
return urn.substring(ICAO_CODE_PREFIX.length() + 1);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,278 +0,0 @@
|
|||
#This file contains a user editable mapping of names that would be seen as part of data ingest to
|
||||
#more standardized CF (NetCDF Climate and Forecast) names. The first list is taken directly from
|
||||
#the NetCDF Climate and Forecast (CF) Metadata Convention website and the entries that follow
|
||||
#are as needed additions based on what is being seen in data. The third column is a listing
|
||||
#of ontology names that map to the cf names. This allows for updates and additions to both
|
||||
#the ontology and the CF list while maintaining the codes ability to generate ontology individuals.
|
||||
#note that the third column is case sensitive.
|
||||
|
||||
#all values from http://cf-pcmdi.llnl.gov/documents/cf-standard-names/ncep-grib-code-cf-standard-name-mapping
|
||||
#NCEP #CF Name #Ontology Axiom IRI #Ontology Class IRI
|
||||
PRES air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
PRMSL air_pressure_at_sea_level http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
PTEND tendency_of_air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
ICAHT standard_atmosphere_reference_height
|
||||
GP geopotential http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
HGT geopotential_height http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
DIST altitude
|
||||
HSTDV height_standard_deviation
|
||||
TOZNE equivalent_thickness_at_stp_of_atmosphere_o3_content
|
||||
TMP air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
VTMP virtual_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
POT air_potential_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
EPOT pseudo_equivalent_potential_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
T MAX max_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
T MIN min_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
DPT dew_point_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
DEPR dew_point_depression http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
LAPR air_temperature_lapse_rate http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
VIS visibility_in_air
|
||||
RDSP1 radar_spectra_1
|
||||
RDSP2 radar_spectra_2
|
||||
RDSP3 radar_spectra_3
|
||||
PLI parcel_lifted_index
|
||||
TMP A air_temperature_anomaly http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
PRESA air_pressure_anomaly http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
GP A geopotential_height_anomaly http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
WVSP1 wave_spectra_1
|
||||
WVSP2 wave_spectra_2
|
||||
WVSP3 wave_spectra_3
|
||||
WDIR wind_from_direction http://wxsrv/ontology/weather.owl#hasWindDirection http://wxsrv/ontology/weather.owl#WindDirection
|
||||
WIND wind_speed http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
U GRD eastward_wind http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
V GRD northward_wind http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
STRM atmosphere_horizontal_streamfunction
|
||||
V POT atmosphere_horizontal_velocity_potential http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
MNTSF montgomery_stream_function
|
||||
SGCVV vertical_air_velocity_expressed_as_tendency_of_sigma http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
V VEL vertical_air_velocity_expressed_as_tendency_of_pressure http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
DZDT upward_air_velocity http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
ABS V atmosphere_absolute_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
ABS D atmosphere_absolute_divergence
|
||||
REL V atmosphere_relative_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
REL D divergence_of_wind http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
VUCSH eastward_wind_shear http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
VVCSH northward_wind_shear http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
DIR C direction_of_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterDirection http://wxsrv/ontology/weather.owl#SeaWaterDirection
|
||||
SP C sea_water_speed http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
UOGRD eastward_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
VOGRD northward_sea_water_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
SPF H specific_humidity
|
||||
R H relative_humidity http://wxsrv/ontology/weather.owl#hasRelativeHumidity http://wxsrv/ontology/weather.owl#RelativeHumidity
|
||||
MIXR humidity_mixing_ratio
|
||||
P WAT atmosphere_water_vapour_content
|
||||
VAPP water_vapour_pressure
|
||||
SAT D water_vapour_saturation_deficit
|
||||
EVP water_evaporation_amount
|
||||
C ICE atmosphere_cloud_ice_content
|
||||
PRATE precipitation_flux
|
||||
TSTM thunderstorm_probability
|
||||
A PCP precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
NCPCP large_scale_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
ACPCP convective_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
SRWEQ snowfall_flux
|
||||
WEASD surface_snow_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
SNO D surface_snow_thickness http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
MIXHT ocean_mixed_layer_thickness
|
||||
TTHDP transient_thermocline_depth
|
||||
MTHD main_thermocline_depth
|
||||
MTHA main_thermocline_anomoly
|
||||
T CDC cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
CDCON convective_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
L CDC low_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
M CDC medium_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
H CDC high_cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
C WAT atmosphere_cloud_condensed_water_content
|
||||
BLI best_lifted_index
|
||||
SNO C convective_snowfall_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
SNO L large_scale_snowfall_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
WTMP sea_water_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
LAND land_area_fraction http://wxsrv/ontology/weather.owl#hasLandAreaFraction http://wxsrv/ontology/weather.owl#LandAreaFraction
|
||||
DSL M sea_surface_height_above_sea_level
|
||||
SFC R surface_roughness_length
|
||||
ALBDO surface_albedo
|
||||
TSOIL soil_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
SOIL soil_moisture_content
|
||||
VEG vegetation_area_fraction
|
||||
SALTY sea_water_salinity
|
||||
DEN density
|
||||
WATR surface_runoff_amount
|
||||
ICE C sea_ice_area_fraction
|
||||
ICETK sea_ice_thickness
|
||||
DICED direction_of_sea_ice_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterDirection http://wxsrv/ontology/weather.owl#SeaWaterDirection
|
||||
SICED sea_ice_speed http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
U ICE sea_ice_eastward_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
V ICE sea_ice_northward_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
ICE G tendency_of_sea_ice_thickness_due_to_thermodynamics
|
||||
ICE D divergence_of_sea_ice_velocity http://wxsrv/ontology/weather.owl#hasSeaWaterSpeed http://wxsrv/ontology/weather.owl#SeaWaterSpeed
|
||||
SNO M surface_snow_melt_amount
|
||||
HTSGW significant_height_of_wind_and_swell_waves
|
||||
WVDIR direction_of_wind_wave_velocity
|
||||
WVHGT significant_height_of_wind_waves
|
||||
WVPER wind_wave_period
|
||||
SWDIR direction_of_swell_wave_velocity
|
||||
SWELL significant_height_of_swell_waves
|
||||
SWPER swell_wave_period
|
||||
DIRPW primary_wave_direction
|
||||
PERPW primary_wave_mean_period
|
||||
DIRSW secondary_wave_direction
|
||||
PERSW secondary_wave_mean_period
|
||||
NSWRS surface_net_upward_shortwave_flux
|
||||
NLWRS surface_net_upward_longwave_flux
|
||||
NSWRT toa_net_upward_shortwave_flux
|
||||
NLWRT toa_net_upward_longwave_flux
|
||||
LWAVR net_upward_longwave_flux_in_air
|
||||
SWAVR net_upward_shortwave_flux_in_air
|
||||
G RAD surface_downwelling_shortwave_flux
|
||||
BRTMP brightness_temperature
|
||||
LWRAD wave_number_radiance
|
||||
SWRAD wave_length_radiance
|
||||
LHTFL surface_upward_latent_heat_flux
|
||||
SHTFL surface_upward_sensible_heat_flux
|
||||
BLYDP boundary_layer_dissipation
|
||||
U FLX downward_eastward_momentum_flux_in_air
|
||||
V FLX downward_northward_momentum_flux_in_air
|
||||
WMIXE wind_mixing_energy_flux_into_ocean
|
||||
IMG image_data
|
||||
MSLSA standard_atmospheric_reduction_mean_sea_level_pressure
|
||||
MSLMA maps_system_reduction_mean_sea_level_pressure
|
||||
MSLET nam_model_reduction_mean_sea_level_pressure
|
||||
LFTX surface_lifted_index
|
||||
4LFTX best_four_layer_lifted_index
|
||||
KX k_index
|
||||
SX sweat_index
|
||||
MCONV horizontal_moisture_divergence
|
||||
VW SH wind_speed_shear
|
||||
TSLSA standard_atmospheric_reduction_three_hour pressure_tendency
|
||||
BVF2 brunt_vaisala_frequency
|
||||
PVMW density_weighted_potontial_vorticity
|
||||
CRAIN categorical_rain
|
||||
CFRZR categorical_freezing_rain
|
||||
CICEP categorical_ice_pellets
|
||||
CSNOW categorical_snow
|
||||
SOILW volumetric_soil_moisture_content
|
||||
PEVPR potential_evaporation_rate
|
||||
CWORK cloud_work_function
|
||||
UGWD gravity_wave_stress_zonal_flux
|
||||
VGWD gravity_wave_stress_meridonial_flux
|
||||
PV potential_vorticity
|
||||
COVMZ meridonail_zonal_wind_covariance
|
||||
COVTZ temperature_zonal_wind_covariance
|
||||
COVTM temperature_meridonail_wind_covariance
|
||||
CLWMR cloud_mixing_ratio
|
||||
O3MR ozone_mixing_ratio
|
||||
GFLUX ground_heat_flux
|
||||
CIN convective_inhibition
|
||||
CAPE atmosphere_specific_convective_available_potential_energy
|
||||
TKE turbulent_kinetic_energy
|
||||
CONDP surface_parcel_condensation_pressure
|
||||
CSUSF clear_sky_upward_solar_flux
|
||||
CSDSF clear_sky_downward_solar_flux
|
||||
CSULF clear_sky_upward_long_wave_flux
|
||||
CSDLF clear_sky_downward_long_wave_flux
|
||||
CFNSF cloud_forcing_net_solar_flux
|
||||
CFNLF cloud_forcing_net_long_wave_flux
|
||||
VBDSF visible_beam_downward_solar_flux
|
||||
VDDSF visible_diffuse_downward_solar_flux
|
||||
NBDSF near_ir_beam_downward_solar_flux
|
||||
NDDSF near_ir_diffuse_downward_solar_flux
|
||||
MFLX momentum_flux
|
||||
LMH mass_point_model_surface
|
||||
LMV velocity_point_model_surface
|
||||
MLYNO model_layer_number
|
||||
NLAT latitude
|
||||
ELON east_longitude
|
||||
LPSX log_pressure_x_gradient
|
||||
LPSY log_pressure_y_gradient
|
||||
HGTX height_x_gradient
|
||||
HGTY height_y_gradient
|
||||
VPTMP virtual_potential_temperature
|
||||
HLCY storm_relative_helicity
|
||||
PROB probability_from_ensemble
|
||||
PROBN climate_normalized_probability_from_ensemble
|
||||
POP probability_of_precipitation
|
||||
CPOFP percent_of_frozen_precipitation
|
||||
CPOZP probability_of_freezing_precipitation
|
||||
USTM u_component_of_storm_motion
|
||||
VSTM v_component_of_storm_motion
|
||||
ICWAT ice_free_water_surface
|
||||
DSWRF downward_short_wave_rad_flux
|
||||
DLWRF downward_long_wave_rad_flux
|
||||
UVI untra_violet_index
|
||||
MSTAV moisture_availability
|
||||
SFEXC exchange_coefficient
|
||||
MIXLY surface_mixed_layers
|
||||
USWRF upward_short_wave_rad_flux
|
||||
ULWRF upward_long_wave_rad_flux
|
||||
CDLYR amound_of_non_convective_cloud
|
||||
CPRAT convective_precipitation_rate
|
||||
TTDIA temperature_tendency_by_all_physics
|
||||
TTRAD temperature_tendency_by_all_radiation
|
||||
TTPHY temperature_tendency_by_nonradiation_physics
|
||||
PREIX precipitation_index
|
||||
TSD1D std_dev_irt_over_1x1_deg_area
|
||||
NLGSP natural_log_of_surface_pressure
|
||||
HPBL planetary_boundary_layer_height
|
||||
5WAVH 5_wave_geopotential_height
|
||||
CNWAT plant_canopy_surface_water
|
||||
BMIXL blackadars_mixing_length_scale
|
||||
AMIXL asymptotic_mixing_length_scale
|
||||
PEVAP potential_evaporation
|
||||
SNOHF snow_phase_change_heat_flux
|
||||
MFLUX convective_cloud_mass_flux
|
||||
DTRF downward_total_radiation_flux
|
||||
UTRF upward_total_radiation_flux
|
||||
BGRUN baseflow_groundwater_runoff
|
||||
SSRUN storm_surface_runoff
|
||||
03TOT total_ozone
|
||||
SNOWC snow_cover
|
||||
SNOWT snow_temperature
|
||||
LRGHR large_scale_condensate_heat_rate
|
||||
CNVHR deep_convective_heating_rate
|
||||
CNVMR deep_convective_moistening_rate
|
||||
SHAHR shallow_convective_heating_rate
|
||||
SHAMR shallow_convectine_moistening_rate
|
||||
VDFHR vertical_diffusion_heating_rate
|
||||
VDFUA vertical_diffusion_zonal_acceleration
|
||||
VDFVA vertical_diffusion_meridonal_acceleration
|
||||
VDFMR vertical_diffusion_moistening_rate
|
||||
SWHR solar_radiative_heating_rate
|
||||
LWHR long_wave_radiative_heating_rate
|
||||
CD drag_coefficient
|
||||
FRICV friction_velocity
|
||||
RI richardson_number
|
||||
HLCY storm_relative_helicity
|
||||
|
||||
#other mapping added based on what was seen in data
|
||||
GH geopotential_height http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
T temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
RH relative_humidity http://wxsrv/ontology/weather.owl#hasRelativeHumidity http://wxsrv/ontology/weather.owl#RelativeHumidity
|
||||
UW horizontal_wind_vector http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
VW vertical_wind_vector http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
ICIP icing_probability http://wxsrv/ontology/weather.owl#hasIcingProbability http://wxsrv/ontology/weather.owl#IcingProbability
|
||||
PVV pressure_vertical_velocity
|
||||
|
||||
#eta218 xml short name entries that do not already exist in the cf mapping
|
||||
HELI helicity_sigma
|
||||
TCC cloud_area_fraction http://wxsrv/ontology/weather.owl#hasCloudAreaFraction http://wxsrv/ontology/weather.owl#CloudAreaFraction
|
||||
TP precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
STATICCORIOLIS coriolis_parameter
|
||||
MNT min_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
MXT max_air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
P air_pressure http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
T air_temperature http://wxsrv/ontology/weather.owl#hasTemperature http://wxsrv/ontology/weather.owl#Temperature
|
||||
STATICSPACING grid_spacing
|
||||
WD wind_from_direction http://wxsrv/ontology/weather.owl#hasWindDirection http://wxsrv/ontology/weather.owl#WindDirection
|
||||
WS wind_speed http://wxsrv/ontology/weather.owl#hasWindSpeed http://wxsrv/ontology/weather.owl#WindSpeed
|
||||
PLI parcel_lifted_index
|
||||
PMSL air_pressure_at_sea_level http://wxsrv/ontology/weather.owl#hasBarometricPressure http://wxsrv/ontology/weather.owl#BarometricPressure
|
||||
EMSP eta_mean_sea_level_pressure
|
||||
CP convective_precipitation_amount http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
PW precipitable_water
|
||||
STATICTOPO tolography
|
||||
SLI surface_lifted_index
|
||||
AV atmosphere_absolute_vorticity http://wxsrv/ontology/weather.owl#hasWindShear http://wxsrv/ontology/weather.owl#WindShear
|
||||
REFC composite_radar_reflectivity
|
||||
REFD derived_radar_reflectivity
|
||||
SND surface_snow_thickness http://wxsrv/ontology/weather.owl#hasPrecipitationAmount http://wxsrv/ontology/weather.owl#PrecipitationAmount
|
||||
THP thunderstorm_probability
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.plugin.grib.ogc</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,8 +0,0 @@
|
|||
#Thu Jun 07 13:59:55 CDT 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,37 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ogc
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.grib.ogc
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.springframework;bundle-version="2.5.6",
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.ogc.common;bundle-version="1.0.0",
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
com.raytheon.uf.edex.database;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin;bundle-version="1.12.1174",
|
||||
org.hibernate;bundle-version="1.0.0",
|
||||
org.geotools;bundle-version="2.6.4",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.wms;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.wcs;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
org.apache.camel;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.datastorage;bundle-version="1.12.1174",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
org.apache.commons.collections;bundle-version="3.2.0",
|
||||
com.raytheon.uf.edex.plugin.dataset.urn;bundle-version="1.0.0",
|
||||
ucar.nc2;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.plugin.unitconverter;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.spatial;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.gridcoverage;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.parameter;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.plugin.grid;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.edex.plugin.grib.ogc
|
|
@ -1,2 +0,0 @@
|
|||
com.raytheon.uf.edex.plugin.grib.ogc.GribDimension
|
||||
com.raytheon.uf.edex.plugin.grib.ogc.GribLayer
|
|
@ -1,5 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/
|
|
@ -1,102 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="gribDecoder" class="com.raytheon.edex.plugin.grib.GribDecoder" />
|
||||
|
||||
<bean id="ingest-grib" class="org.apache.camel.component.jms.JmsComponent">
|
||||
<constructor-arg ref="jmsIngestGribConfig" />
|
||||
<property name="taskExecutor" ref="gribThreadPool" />
|
||||
</bean>
|
||||
|
||||
<bean id="jmsIngestGribConfig" class="org.apache.camel.component.jms.JmsConfiguration"
|
||||
factory-bean="jmsConfig" factory-method="copy">
|
||||
</bean>
|
||||
|
||||
<bean id="gribThreadPool"
|
||||
class="com.raytheon.uf.edex.esb.camel.spring.JmsThreadPoolTaskExecutor">
|
||||
<property name="corePoolSize" value="${grib-decode.count.threads}" />
|
||||
<property name="maxPoolSize" value="${grib-decode.count.threads}" />
|
||||
</bean>
|
||||
|
||||
<bean id="largeFileChecker" class="com.raytheon.edex.plugin.grib.GribLargeFileChecker" />
|
||||
|
||||
<bean id="gribSplitter" class="com.raytheon.edex.plugin.grib.GribSplitter">
|
||||
<constructor-arg value="${edex.home}/data/tmp/"/>
|
||||
</bean>
|
||||
|
||||
<bean id="useLatestAggregationStrategy" class="org.apache.camel.processor.aggregate.UseLatestAggregationStrategy" />
|
||||
|
||||
<bean id="largeFileLockRelease" class="com.raytheon.edex.plugin.grib.GribLockRelease" />
|
||||
|
||||
<bean id="gribDecodeCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="grib-decode"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gribPostProcessor"
|
||||
class="com.raytheon.edex.plugin.grib.decoderpostprocessors.GribPostProcessor"
|
||||
factory-method="getInstance" />
|
||||
|
||||
<bean id="gribTableLookup" class="com.raytheon.edex.util.grib.GribTableLookup"
|
||||
factory-method="getInstance" depends-on="gridRegistered" />
|
||||
|
||||
<bean id="gribModelLookup"
|
||||
class="com.raytheon.edex.plugin.grib.util.GribModelLookup"
|
||||
factory-method="getInstance" />
|
||||
|
||||
<bean id="gribSpatialCache"
|
||||
class="com.raytheon.edex.plugin.grib.spatial.GribSpatialCache"
|
||||
factory-method="getInstance" depends-on="gridcoveragelookup"/>
|
||||
|
||||
<camelContext id="grib-decode" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<endpoint id="gribJmsEndpoint" uri="ingest-grib:queue:Ingest.Grib?concurrentConsumers=${grib-decode.count.threads}&destinationResolver=#qpidDurableResolver" />
|
||||
|
||||
<!-- Begin Grib Decode Route -->
|
||||
<route id="gribIngestRoute">
|
||||
<from ref="gribJmsEndpoint" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>grid</constant>
|
||||
</setHeader>
|
||||
<!-- strategyRef is needed because of camel bug https://issues.apache.org/activemq/browse/CAMEL-3333,
|
||||
without the strategy it uses the original message in the multicast and it loses the largeFileLock header -->
|
||||
<split strategyRef="useLatestAggregationStrategy">
|
||||
<method bean="gribSplitter" method="split" />
|
||||
<choice>
|
||||
<when>
|
||||
<simple>${header.CamelSplitSize} == 1</simple>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="stringToFile" />
|
||||
<bean ref="largeFileChecker" />
|
||||
<bean ref="gribDecoder" />
|
||||
<bean ref="gribSplitter" method="clean" />
|
||||
<!-- send for processing -->
|
||||
<bean ref="gribPostProcessor" method="process" />
|
||||
<multicast parallelProcessing="false">
|
||||
<to uri="direct-vm:persistIndexAlert" />
|
||||
<to uri="direct-vm:gribOgc" />
|
||||
</multicast>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:grib?level=ERROR"/>
|
||||
</doCatch>
|
||||
<doFinally>
|
||||
<bean ref="largeFileLockRelease" />
|
||||
</doFinally>
|
||||
</doTry>
|
||||
</when>
|
||||
<otherwise>
|
||||
<to uri="ingest-grib:queue:Ingest.Grib" />
|
||||
</otherwise>
|
||||
</choice>
|
||||
</split>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -1,44 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean class="com.raytheon.uf.edex.ogc.common.util.AddonPropsPostProcessor">
|
||||
<constructor-arg>
|
||||
<map value-type="java.lang.Class">
|
||||
<entry key="gridProperties">
|
||||
<map>
|
||||
<entry key="dao" value="com.raytheon.uf.edex.plugin.grib.ogc.GridNotifyDao" />
|
||||
</map>
|
||||
</entry>
|
||||
</map>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="gribCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="grid-ogc-camel"/>
|
||||
</bean>
|
||||
|
||||
<camelContext id="grid-ogc-camel" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="true">
|
||||
|
||||
<!-- Begin Grib Routes -->
|
||||
<route id="gribIngestRoute">
|
||||
<from uri="direct-vm:gribOgc" />
|
||||
<bean ref="gribLayerCollector" method="add"/>
|
||||
</route>
|
||||
|
||||
<route id="gridPurgeExpired">
|
||||
<from uri="jms-generic:topic:Purge.expired.grid?destinationResolver=#qpidDurableResolver" />
|
||||
<bean ref="gribLayerCollector" method="purgeExpired"/>
|
||||
</route>
|
||||
|
||||
<route id="gridPurgeAll">
|
||||
<from uri="jms-generic:topic:Purge.all.grid?destinationResolver=#qpidDurableResolver" />
|
||||
<bean ref="gribLayerCollector" method="purgeAll"/>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
</beans>
|
|
@ -1,42 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="gribLayerCollector" class="com.raytheon.uf.edex.plugin.grib.ogc.GribLayerCollector" >
|
||||
<constructor-arg ref="layerStore" />
|
||||
</bean>
|
||||
|
||||
<bean id="gridWcsLayerTransformer" class="com.raytheon.uf.edex.ogc.common.db.LayerTransformer">
|
||||
<constructor-arg value="grid"/>
|
||||
<constructor-arg ref="gribLayerCollector"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gridWmsLayerTransformer" class="com.raytheon.uf.edex.ogc.common.db.LayerTransformer">
|
||||
<constructor-arg value="grid"/>
|
||||
<constructor-arg>
|
||||
<bean class="com.raytheon.uf.edex.plugin.grib.ogc.GridWmsLayerCache">
|
||||
<constructor-arg ref="gribLayerCollector"/>
|
||||
</bean>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="gribWmsSource" class="com.raytheon.uf.edex.plugin.grib.ogc.GribWmsSource">
|
||||
<constructor-arg ref="gridProperties"/>
|
||||
<constructor-arg ref="gridWmsLayerTransformer"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gribWcsSource" class="com.raytheon.uf.edex.plugin.grib.ogc.GribWcsSource">
|
||||
<constructor-arg ref="gridProperties"/>
|
||||
<constructor-arg ref="gridWcsLayerTransformer"/>
|
||||
<constructor-arg ref="gribLayerCollector"/>
|
||||
</bean>
|
||||
|
||||
<bean id="gridNativeCrsAuth" class="com.raytheon.uf.edex.plugin.grib.ogc.GribNativeCrsAuthority"/>
|
||||
|
||||
<bean id="gridVerticalEnabler" class="com.raytheon.uf.edex.plugin.grib.ogc.GridVerticalEnabler"/>
|
||||
|
||||
<bean id="gridFieldAdapter" class="com.raytheon.uf.edex.plugin.grib.ogc.GridFieldAdapter"/>
|
||||
|
||||
</beans>
|
|
@ -1,150 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.db.LayerTransformer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleDimension;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleLayer;
|
||||
import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil;
|
||||
import com.raytheon.uf.edex.ogc.common.time.ForecastTimeUtil;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class GribDimension extends SimpleDimension {
|
||||
|
||||
private static final long serialVersionUID = 1232298678216203380L;
|
||||
|
||||
public static final String REFTIME_DIM = "REFTIME";
|
||||
|
||||
public static final String FORECAST_OFFSET_DIM = "FORECAST_OFFSET";
|
||||
|
||||
public static final String PARAM_DIM = "PARAMETER";
|
||||
|
||||
private transient DataTime defaultTime = null;
|
||||
|
||||
protected transient IUFStatusHandler log = UFStatus.getHandler(this
|
||||
.getClass());
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected Set<String> values;
|
||||
|
||||
public GribDimension() {
|
||||
}
|
||||
|
||||
public GribDimension(String name, String units) {
|
||||
this.name = name;
|
||||
this.units = units;
|
||||
this.values = new TreeSet<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param otherDim
|
||||
*/
|
||||
public GribDimension(GribDimension other) {
|
||||
super(other);
|
||||
this.values = new TreeSet<String>(other.values);
|
||||
}
|
||||
|
||||
public void setValues(Set<String> values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.ogc.common.db.SimpleDimension#getDefaultValue()
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultValue(SimpleLayer<?> layer) {
|
||||
String rval = null;
|
||||
if (GribDimension.REFTIME_DIM.equals(name)) {
|
||||
DataTime time = getDefaultTime(layer);
|
||||
rval = LayerTransformer.format(time.getRefTime());
|
||||
} else if (GribDimension.FORECAST_OFFSET_DIM.equals(name)) {
|
||||
DataTime time = getDefaultTime(layer);
|
||||
rval = time.getFcstTime() + "S";
|
||||
} else if (name.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX)) {
|
||||
rval = getLevel(true);
|
||||
} else {
|
||||
rval = getString(true);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
private String getLevel(boolean lowest) {
|
||||
TreeMap<Double, String> sorted = new TreeMap<Double, String>();
|
||||
if (this.getValues().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
for (String val : this.getValues()) {
|
||||
String level1 = StringUtils.split(val, '_')[0];
|
||||
sorted.put(Double.parseDouble(level1), val);
|
||||
}
|
||||
Double key = lowest ? sorted.firstKey() : sorted.lastKey();
|
||||
return sorted.get(key);
|
||||
}
|
||||
|
||||
protected DataTime getDefaultTime(SimpleLayer<?> layer) {
|
||||
if (defaultTime == null){
|
||||
try {
|
||||
SortedSet<DataTime> times = new ForecastTimeUtil()
|
||||
.getDataTimes(layer, layer.getDefaultTime(),
|
||||
new HashMap<String, String>(0));
|
||||
defaultTime = times.last();
|
||||
} catch (OgcException e) {
|
||||
log.error("Problem getting default times", e);
|
||||
return new DataTime(layer.getDefaultTime());
|
||||
}
|
||||
}
|
||||
return defaultTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy contents of from into to
|
||||
*
|
||||
* @param to
|
||||
* @param from
|
||||
*/
|
||||
public static void copy(Collection<GribDimension> to,
|
||||
Collection<GribDimension> from) {
|
||||
for (GribDimension d : from) {
|
||||
to.add(new GribDimension(d));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,180 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleLayer;
|
||||
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public abstract class GribLayer extends SimpleLayer<GribDimension> {
|
||||
|
||||
private static final long serialVersionUID = 6934503885157257766L;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected String coverageName;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected String crsWkt;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected double nativeMinX;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected double nativeMinY;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected double nativeMaxX;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected double nativeMaxY;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected boolean vertical = true;
|
||||
|
||||
public GribLayer() {
|
||||
}
|
||||
|
||||
public GribLayer(GribLayer other) {
|
||||
super(other);
|
||||
this.times = new TreeSet<Date>(other.getTimes());
|
||||
this.coverageName = other.getCoverageName();
|
||||
this.crsWkt = other.getCrsWkt();
|
||||
this.nativeMaxX = other.nativeMaxX;
|
||||
this.nativeMaxY = other.nativeMaxY;
|
||||
this.nativeMinX = other.nativeMinX;
|
||||
this.nativeMinY = other.nativeMinY;
|
||||
this.vertical = other.vertical;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the coverageName
|
||||
*/
|
||||
public String getCoverageName() {
|
||||
return coverageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param coverageName
|
||||
* the coverageName to set
|
||||
*/
|
||||
public void setCoverageName(String coverageName) {
|
||||
this.coverageName = coverageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the crsWkt
|
||||
*/
|
||||
public String getCrsWkt() {
|
||||
return crsWkt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param crsWkt
|
||||
* the crsWkt to set
|
||||
*/
|
||||
public void setCrsWkt(String crsWkt) {
|
||||
this.crsWkt = crsWkt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nativeMinX
|
||||
*/
|
||||
public double getNativeMinX() {
|
||||
return nativeMinX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nativeMinX
|
||||
* the nativeMinX to set
|
||||
*/
|
||||
public void setNativeMinX(double nativeMinX) {
|
||||
this.nativeMinX = nativeMinX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nativeMinY
|
||||
*/
|
||||
public double getNativeMinY() {
|
||||
return nativeMinY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nativeMinY
|
||||
* the nativeMinY to set
|
||||
*/
|
||||
public void setNativeMinY(double nativeMinY) {
|
||||
this.nativeMinY = nativeMinY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nativeMaxX
|
||||
*/
|
||||
public double getNativeMaxX() {
|
||||
return nativeMaxX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nativeMaxX
|
||||
* the nativeMaxX to set
|
||||
*/
|
||||
public void setNativeMaxX(double nativeMaxX) {
|
||||
this.nativeMaxX = nativeMaxX;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nativeMaxY
|
||||
*/
|
||||
public double getNativeMaxY() {
|
||||
return nativeMaxY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nativeMaxY
|
||||
* the nativeMaxY to set
|
||||
*/
|
||||
public void setNativeMaxY(double nativeMaxY) {
|
||||
this.nativeMaxY = nativeMaxY;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the vertical
|
||||
*/
|
||||
public boolean isVertical() {
|
||||
return vertical;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param vertical
|
||||
* the vertical to set
|
||||
*/
|
||||
public void setVertical(boolean vertical) {
|
||||
this.vertical = vertical;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.measure.unit.SI;
|
||||
import javax.measure.unit.Unit;
|
||||
|
||||
import org.geotools.geometry.jts.JTS;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
import org.opengis.geometry.MismatchedDimensionException;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridInfoRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.gridcoverage.GridCoverage;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcLayer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.DefaultLayerCollector;
|
||||
import com.raytheon.uf.edex.ogc.common.db.ILayerStore;
|
||||
import com.raytheon.uf.edex.ogc.common.db.LayerTransformer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleDimension;
|
||||
import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.AltUtil;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
public class GribLayerCollector extends
|
||||
DefaultLayerCollector<GribDimension, GridCompositeLayer, GridRecord> {
|
||||
|
||||
public GribLayerCollector(ILayerStore store) {
|
||||
super(GridCompositeLayer.class, GridRecord.class, store);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addToDims(GridCompositeLayer layer, GridRecord rec) {
|
||||
DataTime dt = rec.getDataTime();
|
||||
GridInfoRecord info = rec.getInfo();
|
||||
Level level = info.getLevel();
|
||||
Set<? extends SimpleDimension> dims = layer.getDimensions();
|
||||
for (SimpleDimension d : dims) {
|
||||
String name = d.getName();
|
||||
Set<String> values = d.getValues();
|
||||
if (GribDimension.REFTIME_DIM.equals(name)) {
|
||||
values.add(LayerTransformer.format(dt.getRefTime()));
|
||||
} else if (GribDimension.FORECAST_OFFSET_DIM.equals(name)) {
|
||||
values.add(dt.getFcstTime() + "S");
|
||||
} else if (name.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX)) {
|
||||
values.add(LevelDimUtil.formatLevelValue(level));
|
||||
} else if (GribDimension.PARAM_DIM.equals(name)) {
|
||||
values.add(getParameter(rec));
|
||||
} else {
|
||||
log.warn("Unknown grib dimension: " + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parameter string from record
|
||||
*
|
||||
* @param rec
|
||||
* @return
|
||||
*/
|
||||
private String getParameter(GridRecord rec) {
|
||||
String fieldName = rec.getInfo().getParameter().getAbbreviation();
|
||||
return GribRecordFinder.dbToOgcParameter(fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addToTimes(GridCompositeLayer layer, GridRecord rec) {
|
||||
String parameter = getParameter(rec);
|
||||
layer.addTime(parameter, rec.getDataTime().getValidTime().getTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean initializeLayer(GridCompositeLayer layer, GridRecord rec) {
|
||||
GridInfoRecord info = rec.getInfo();
|
||||
Level level = info.getLevel();
|
||||
Parameter parameter = info.getParameter();
|
||||
if (parameter.getAbbreviation().startsWith("static")) {
|
||||
return false;
|
||||
}
|
||||
Unit<?> unit = level.getMasterLevel().getUnit();
|
||||
if (unit == null) {
|
||||
layer.setVertical(false);
|
||||
}
|
||||
try {
|
||||
AltUtil.convert(SI.METER, unit, 1);
|
||||
} catch (Exception e) {
|
||||
layer.setVertical(false);
|
||||
}
|
||||
GridCoverage cov = info.getLocation();
|
||||
if (cov == null) {
|
||||
log.warn("Recieved record without coverage!");
|
||||
return false;
|
||||
}
|
||||
layer.setCoverageName(cov.getName());
|
||||
String crsWkt = cov.getCrsWKT();
|
||||
if (crsWkt == null) {
|
||||
crsWkt = cov.getCrs().toWKT();
|
||||
}
|
||||
layer.setCrsWkt(crsWkt);
|
||||
layer.setNx(cov.getNx());
|
||||
layer.setNy(cov.getNy());
|
||||
layer.setTargetCrsCode("CRS:84");
|
||||
try {
|
||||
Envelope env = getProperBounds(layer, cov, info);
|
||||
layer.setTargetMinx(env.getMinX());
|
||||
layer.setTargetMiny(env.getMinY());
|
||||
layer.setTargetMaxx(env.getMaxX());
|
||||
layer.setTargetMaxy(env.getMaxY());
|
||||
layer.setCrs84Bounds(JTS.toGeometry(env));
|
||||
} catch (Exception e) {
|
||||
log.error("Unable to get crs84 bounds", e);
|
||||
return false;
|
||||
}
|
||||
String levelUnit = level.getMasterLevel().getUnitString();
|
||||
MasterLevel master = level.getMasterLevel();
|
||||
TreeSet<GribDimension> dims = new TreeSet<GribDimension>();
|
||||
dims.add(new GribDimension(GribDimension.REFTIME_DIM, "ISO8601"));
|
||||
dims.add(new GribDimension(GribDimension.FORECAST_OFFSET_DIM, "ISO8601"));
|
||||
String levelName = LevelDimUtil.LEVEL_DIM_PREFIX + master.getName();
|
||||
dims.add(new GribDimension(levelName, levelUnit));
|
||||
dims.add(new GribDimension(GribDimension.PARAM_DIM, parameter.getUnit()
|
||||
.toString()));
|
||||
layer.addDimensions(getParameter(rec), dims);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ReferencedEnvelope getProperBounds(GribLayer layer,
|
||||
GridCoverage cov, GridInfoRecord info) throws FactoryException,
|
||||
MismatchedDimensionException, TransformException {
|
||||
String dataset = info.getDatasetId();
|
||||
// the gemglobal and gfs global grids are already in a crs:84
|
||||
// projection,
|
||||
// so there is no transformation needed.
|
||||
if (dataset.equals("GEMGlobal") || dataset.equals("GFS230")
|
||||
|| dataset.equals("GlobalWave")) {
|
||||
return new ReferencedEnvelope(-180.0, 180.0, -90.0, 90.0,
|
||||
cov.getCrs());
|
||||
}
|
||||
|
||||
// the polygon is not projected properly, must get native bounds and
|
||||
// reproject into crs:84
|
||||
CoordinateReferenceSystem nativeCrs = cov.getCrs();
|
||||
Envelope env = JTS.transform(cov.getGeometry(),
|
||||
MapUtil.getTransformFromLatLon(nativeCrs))
|
||||
.getEnvelopeInternal();
|
||||
ReferencedEnvelope nativeEnv = new ReferencedEnvelope(env.getMinX(),
|
||||
env.getMaxX(), env.getMinY(), env.getMaxY(), nativeCrs);
|
||||
layer.setNativeMinX(env.getMinX());
|
||||
layer.setNativeMinY(env.getMinY());
|
||||
layer.setNativeMaxX(env.getMaxX());
|
||||
layer.setNativeMaxY(env.getMaxY());
|
||||
ReferencedEnvelope crs84Env = nativeEnv.transform(
|
||||
MapUtil.LATLON_PROJECTION, true);
|
||||
// This is to fix when non-polar coverages cross poles or opposite
|
||||
// meridian
|
||||
// This will completely break polar coverages
|
||||
double minx = crs84Env.getMinX();
|
||||
double miny = crs84Env.getMinY();
|
||||
double maxx = crs84Env.getMaxX();
|
||||
double maxy = crs84Env.getMaxY();
|
||||
if (maxx > 180 || minx < -180) {
|
||||
// coverage crosses opposite meridian, advertise all the way around
|
||||
minx = -180;
|
||||
maxx = 180;
|
||||
}
|
||||
if (maxy > 90) {
|
||||
// coverage crosses north pole, truncate
|
||||
maxy = 90;
|
||||
}
|
||||
if (miny < -90) {
|
||||
// coverage crosses south pole, truncate
|
||||
miny = -90;
|
||||
}
|
||||
return new ReferencedEnvelope(minx, maxx, miny, maxy,
|
||||
crs84Env.getCoordinateReferenceSystem());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLayerName(GridRecord rec) {
|
||||
return createLayerName(rec);
|
||||
}
|
||||
|
||||
public static String createLayerName(GridRecord rec) {
|
||||
GridInfoRecord info = rec.getInfo();
|
||||
GridCoverage cov = info.getLocation();
|
||||
String levelName = info.getLevel().getMasterLevel().getName();
|
||||
return info.getDatasetId() + OgcLayer.keySeparator + cov.getName()
|
||||
+ OgcLayer.keySeparator + levelName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.db.LayerCollector#copy(com.raytheon.uf
|
||||
* .edex.ogc.common.db.SimpleLayer)
|
||||
*/
|
||||
@Override
|
||||
protected GridCompositeLayer copy(GridCompositeLayer orig) {
|
||||
return new GridCompositeLayer(orig);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.opengis.parameter.ParameterValueGroup;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
import org.opengis.referencing.operation.Projection;
|
||||
|
||||
import com.raytheon.uf.common.gridcoverage.GridCoverage;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.database.dao.CoreDao;
|
||||
import com.raytheon.uf.edex.database.dao.DaoConfig;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException.Code;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 6, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GribNativeCrsAuthority implements NativeCrsAuthority {
|
||||
|
||||
public static final String ID = "grib";
|
||||
|
||||
private final CoreDao covDao = new CoreDao(
|
||||
DaoConfig.forClass(GridCoverage.class));
|
||||
|
||||
private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority#lookup(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public CoordinateReferenceSystem lookup(String urn) throws OgcException {
|
||||
if ( urn == null){
|
||||
return null;
|
||||
}
|
||||
String local = urn.substring(NATIVE_CRS_PREFIX.length());
|
||||
String[] parts = local.split(":");
|
||||
try {
|
||||
List<?> res = covDao.queryBySingleCriteria("name", parts[0]);
|
||||
if (res == null || res.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
GridCoverage cov = (GridCoverage) res.get(0);
|
||||
return cov.getCrs();
|
||||
} catch (DataAccessLayerException e) {
|
||||
log.error("Unable to lookup coverage", e);
|
||||
throw new OgcException(Code.InternalServerError, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cov
|
||||
* @return Native CRS URN for coverage
|
||||
*/
|
||||
public static String createURN(GridCoverage cov) {
|
||||
String name = cov.getName();
|
||||
// TODO assumption that all native grid systems are projected
|
||||
ProjectedCRS crs = (ProjectedCRS) cov.getCrs();
|
||||
return createURN(name, crs);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param coverageName
|
||||
* @param crs
|
||||
* @return Native CRS URN for coverage
|
||||
*/
|
||||
public static String createURN(String coverageName, ProjectedCRS crs) {
|
||||
Projection conv = crs.getConversionFromBase();
|
||||
ParameterValueGroup params = conv.getParameterValues();
|
||||
String projName = params.getDescriptor().getName().getCode();
|
||||
return NATIVE_CRS_PREFIX + coverageName + ":" + projName;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.uf.edex.ogc.common.spatial.NativeCrsAuthority#getId()
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return ID;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,402 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.classic.Session;
|
||||
import org.hibernate.criterion.Conjunction;
|
||||
import org.hibernate.criterion.Criterion;
|
||||
import org.hibernate.criterion.Disjunction;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridInfoRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginDao;
|
||||
import com.raytheon.uf.edex.database.plugin.PluginFactory;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException.Code;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcLayer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.LayerTransformer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleDimension;
|
||||
import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil;
|
||||
import com.raytheon.uf.edex.ogc.common.time.ForecastTimeUtil;
|
||||
import com.raytheon.uf.edex.plugin.dataset.urn.CFNameLookup;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GribRecordFinder {
|
||||
|
||||
public static final String INFO_ALIAS = "info_alias";
|
||||
|
||||
public static final String LEVEL_ALIAS = "level_alias";
|
||||
|
||||
public static final String MASTER_LEVEL_ALIAS = "master_level_alias";
|
||||
|
||||
public static final String COV_ALIAS = "cov_alias";
|
||||
|
||||
public static final String INFO = "info";
|
||||
|
||||
public static final String LEVEL = "info_alias.level";
|
||||
|
||||
public static final String LEVLE_ONE = LEVEL_ALIAS + ".levelonevalue";
|
||||
|
||||
public static final String LEVLE_TWO = LEVEL_ALIAS + ".leveltwovalue";
|
||||
|
||||
public static final String MASTER_LEVEL = LEVEL_ALIAS + ".masterLevel";
|
||||
|
||||
public static final String LEVEL_UNIT = MASTER_LEVEL_ALIAS + ".unitString";
|
||||
|
||||
public static final String LEVEL_NAME = MASTER_LEVEL_ALIAS + ".name";
|
||||
|
||||
public static final String DS_NAME = INFO_ALIAS + ".datasetId";
|
||||
|
||||
public static final String COVERAGE = INFO_ALIAS + ".location";
|
||||
|
||||
public static final String COVERAGE_NAME = COV_ALIAS + ".name";
|
||||
|
||||
public static final String PARAM = INFO_ALIAS + ".parameter";
|
||||
|
||||
public static final String PARAM_ALIAS = "param_alias";
|
||||
|
||||
public static final String PARAM_ABBV = PARAM_ALIAS + ".abbreviation";
|
||||
|
||||
public static final String REF_TIME = "dataTime.refTime";
|
||||
|
||||
public static final String FCST_TIME = "dataTime.fcstTime";
|
||||
|
||||
public static class Comp implements Comparator<GridRecord> {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(GridRecord left, GridRecord right) {
|
||||
Date rightRef = right.getDataTime().getRefTime();
|
||||
Date leftRef = left.getDataTime().getRefTime();
|
||||
int rval = rightRef.compareTo(leftRef);
|
||||
if (rval == 0) {
|
||||
GridInfoRecord leftInfo = left.getInfo();
|
||||
GridInfoRecord rightInfo = right.getInfo();
|
||||
// FIXME this doesn't take units into account
|
||||
Level leftLevel = leftInfo.getLevel();
|
||||
Level rightLevel = rightInfo.getLevel();
|
||||
rval = (int) (leftLevel.getLevelonevalue() - rightLevel
|
||||
.getLevelonevalue());
|
||||
if (rval == 0) {
|
||||
if (leftInfo.getEnsembleId() != null) {
|
||||
if (rightInfo.getEnsembleId() != null) {
|
||||
rval = leftInfo.getEnsembleId().compareTo(
|
||||
rightInfo.getEnsembleId());
|
||||
} else {
|
||||
rval = 1;
|
||||
}
|
||||
} else {
|
||||
if (rightInfo.getEnsembleId() != null) {
|
||||
rval = -1;
|
||||
} else {
|
||||
rval = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<GridRecord> findWms(
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer,
|
||||
String key, String layerName, Date time,
|
||||
Map<String, String> dimensions) throws OgcException {
|
||||
GridParamLayer l = getLayer(transformer, layerName);
|
||||
SortedSet<DataTime> times = new ForecastTimeUtil().getDataTimes(l,
|
||||
time, dimensions);
|
||||
return findInternal(l, transformer, key, times, dimensions,
|
||||
parseWmsId(layerName));
|
||||
}
|
||||
|
||||
public static List<GridRecord> findWms(
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer,
|
||||
String key, String layerName, String time,
|
||||
Map<String, String> dimensions) throws OgcException {
|
||||
GridParamLayer l = getLayer(transformer, layerName);
|
||||
SortedSet<DataTime> times = new ForecastTimeUtil().getDataTimes(l,
|
||||
time, dimensions);
|
||||
return findInternal(l, transformer, key, times, dimensions,
|
||||
parseWmsId(layerName));
|
||||
}
|
||||
|
||||
protected static List<GridRecord> findInternal(GridParamLayer l,
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer,
|
||||
String key, SortedSet<DataTime> times,
|
||||
Map<String, String> dimensions, Criterion idCrit)
|
||||
throws OgcException {
|
||||
Criterion levelCrit = getLevel(dimensions, l);
|
||||
String param = ogcToDbParameter(l.getParameter());
|
||||
// TODO ensure consistency in which level gets returned
|
||||
// TODO add support for more dimensions
|
||||
return query(key, times, param, idCrit, levelCrit);
|
||||
}
|
||||
|
||||
public static GridParamLayer getLayer(
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer,
|
||||
String layerName) throws OgcException {
|
||||
GridParamLayer rval;
|
||||
try {
|
||||
rval = transformer.find(layerName);
|
||||
} catch (OgcException e) {
|
||||
throw new OgcException(Code.InternalServerError, e);
|
||||
}
|
||||
if (rval == null) {
|
||||
throw new OgcException(Code.LayerNotDefined);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
protected static String getIntDim(Map<String, String> dimensions,
|
||||
String key, GribLayer layer) throws OgcException {
|
||||
String rval = getDim(dimensions, key, layer);
|
||||
if (rval != null) {
|
||||
try {
|
||||
Integer i = Integer.parseInt(rval);
|
||||
rval = i.toString();
|
||||
} catch (Exception e) {
|
||||
throw new OgcException(Code.InvalidDimensionValue, key
|
||||
+ " must be a bare integer");
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
protected static String getDim(Map<String, String> dimensions, String key,
|
||||
GribLayer layer) {
|
||||
String rval = dimensions.get(key);
|
||||
if (rval == null) {
|
||||
SimpleDimension dim = layer.getDimension(key);
|
||||
rval = dim.getDefaultValue(layer);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dimensions
|
||||
* @param l
|
||||
* @return null if level value not in dimensions and not in layer
|
||||
* @throws OgcException
|
||||
*/
|
||||
protected static Criterion getLevel(Map<String, String> dimensions,
|
||||
GribLayer layer) throws OgcException {
|
||||
String dimName = null;
|
||||
// find level dimension in request
|
||||
for (String dim : dimensions.keySet()) {
|
||||
String lower = dim.toLowerCase();
|
||||
if (lower.startsWith(LevelDimUtil.LEVEL_DIM_PREFIX.toLowerCase())) {
|
||||
dimName = dim;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SimpleDimension dim;
|
||||
String value;
|
||||
if (dimName == null) {
|
||||
return null;
|
||||
} else {
|
||||
dim = layer.getDimension(dimName);
|
||||
if (dim == null) {
|
||||
return null;
|
||||
}
|
||||
value = dimensions.get(dimName);
|
||||
}
|
||||
// undo any case changes
|
||||
dimName = dim.getName();
|
||||
return parseLevel(dimName, value, dim.getUnits());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected static List<GridRecord> query(String key,
|
||||
SortedSet<DataTime> times, String param, Criterion idCrit,
|
||||
Criterion levelCrit) throws OgcException {
|
||||
Session sess = null;
|
||||
try {
|
||||
PluginDao dao = PluginFactory.getInstance().getPluginDao(key);
|
||||
SessionFactory sessFact = dao.getSessionFactory();
|
||||
sess = sessFact.openSession();
|
||||
Criteria criteria = sess.createCriteria(GridRecord.class);
|
||||
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
|
||||
Disjunction or = Restrictions.disjunction();
|
||||
Criterion paramCrit = Restrictions.eq(PARAM_ABBV, param);
|
||||
for (DataTime dt : times) {
|
||||
Conjunction and = Restrictions.conjunction();
|
||||
and.add(idCrit).add(paramCrit);
|
||||
if (levelCrit != null) {
|
||||
and.add(levelCrit);
|
||||
}
|
||||
and.add(getTimeCrit(dt));
|
||||
or.add(and);
|
||||
}
|
||||
criteria.add(or);
|
||||
modCriteria(criteria);
|
||||
List<GridRecord> res = (List<GridRecord>) criteria.list();
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
throw new OgcException(Code.InternalServerError);
|
||||
} finally {
|
||||
if (sess != null) {
|
||||
sess.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dt
|
||||
* @return
|
||||
*/
|
||||
private static Criterion getTimeCrit(DataTime dt) {
|
||||
return Restrictions.and(Restrictions.eq(FCST_TIME, dt.getFcstTime()),
|
||||
Restrictions.eq(REF_TIME, dt.getRefTime()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dimName
|
||||
* @param value
|
||||
* @param defaultUnits
|
||||
* @return
|
||||
* @throws OgcException
|
||||
*/
|
||||
public static Criterion parseLevel(String dimName, String value,
|
||||
String defaultUnits) throws OgcException {
|
||||
Level level = LevelDimUtil.parseLevel(dimName, value, defaultUnits);
|
||||
if (level == null) {
|
||||
return Restrictions.eq(LEVEL_NAME,
|
||||
dimName.substring(LevelDimUtil.LEVEL_DIM_PREFIX.length()));
|
||||
}
|
||||
Criterion nameEq = Restrictions.eq(LEVEL_NAME, level.getMasterLevel()
|
||||
.getName());
|
||||
Conjunction and = Restrictions.conjunction();
|
||||
and.add(nameEq);
|
||||
and.add(Restrictions.eq(LEVLE_ONE, level.getLevelonevalue()));
|
||||
and.add(Restrictions.eq(LEVLE_TWO, level.getLeveltwovalue()));
|
||||
|
||||
String units = level.getMasterLevel().getUnitString();
|
||||
if (units != null) {
|
||||
and.add(Restrictions.eq(LEVEL_UNIT, units));
|
||||
} else {
|
||||
and.add(Restrictions.isNull(LEVEL_UNIT));
|
||||
}
|
||||
|
||||
return and;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
* @throws OgcException
|
||||
*/
|
||||
public static Criterion parseWcsId(String id) throws OgcException {
|
||||
String[] parts = id.split(OgcLayer.keySeparator);
|
||||
String model;
|
||||
String coverage;
|
||||
String level;
|
||||
if (parts.length < 3) {
|
||||
throw new OgcException(Code.InvalidFormat, "Invalid id format");
|
||||
} else {
|
||||
level = parts[2];
|
||||
coverage = parts[1];
|
||||
model = parts[0];
|
||||
}
|
||||
Conjunction and = Restrictions.conjunction();
|
||||
and.add(Restrictions.eq(DS_NAME, model));
|
||||
and.add(Restrictions.eq(COVERAGE_NAME, coverage));
|
||||
and.add(Restrictions.eq(LEVEL_NAME, level));
|
||||
return and;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @return
|
||||
* @throws OgcException
|
||||
*/
|
||||
public static Criterion parseWmsId(String id) throws OgcException {
|
||||
String[] parts = id.split(OgcLayer.keySeparator);
|
||||
String model;
|
||||
String coverage;
|
||||
String level;
|
||||
String param;
|
||||
if (parts.length < 4) {
|
||||
throw new OgcException(Code.InvalidFormat, "Invalid id format");
|
||||
} else {
|
||||
level = parts[3];
|
||||
coverage = parts[1];
|
||||
model = parts[0];
|
||||
param = ogcToDbParameter(parts[2]);
|
||||
}
|
||||
Conjunction and = Restrictions.conjunction();
|
||||
and.add(Restrictions.eq(DS_NAME, model));
|
||||
and.add(Restrictions.eq(COVERAGE_NAME, coverage));
|
||||
and.add(Restrictions.eq(LEVEL_NAME, level));
|
||||
and.add(Restrictions.eq(PARAM_ABBV, param));
|
||||
return and;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add grid aliases to criteria
|
||||
*
|
||||
* @param criteria
|
||||
* @return
|
||||
*/
|
||||
public static Criteria modCriteria(Criteria criteria) {
|
||||
criteria = criteria.createAlias(INFO, INFO_ALIAS);
|
||||
criteria = criteria.createAlias(PARAM, PARAM_ALIAS);
|
||||
criteria = criteria.createAlias(LEVEL, LEVEL_ALIAS);
|
||||
criteria = criteria.createAlias(MASTER_LEVEL, MASTER_LEVEL_ALIAS);
|
||||
return criteria.createAlias(COVERAGE, COV_ALIAS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert OGC parameter name to name stored in database
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
public static String ogcToDbParameter(String parameter) {
|
||||
return CFNameLookup.getInstance().getNCEPFromCF(parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert parameter name stored in database to OGC name
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
public static String dbToOgcParameter(String parameter) {
|
||||
return CFNameLookup.getInstance().getCFFromNCEP(parameter);
|
||||
}
|
||||
}
|
|
@ -1,459 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import javax.measure.unit.Unit;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.apache.commons.collections.map.LRUMap;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.criterion.Conjunction;
|
||||
import org.hibernate.criterion.Criterion;
|
||||
import org.hibernate.criterion.Disjunction;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginProperties;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.db.LayerTransformer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleDimension;
|
||||
import com.raytheon.uf.edex.ogc.common.level.LevelDimUtil;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.AltUtil;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.Composite3DBoundingBox;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference;
|
||||
import com.raytheon.uf.edex.plugin.unitconverter.UnitLookup;
|
||||
import com.raytheon.uf.edex.wcs.WcsException;
|
||||
import com.raytheon.uf.edex.wcs.WcsException.Code;
|
||||
import com.raytheon.uf.edex.wcs.reg.CoverageTransform;
|
||||
import com.raytheon.uf.edex.wcs.reg.DefaultWcsSource;
|
||||
import com.raytheon.uf.edex.wcs.reg.RangeAxis;
|
||||
import com.raytheon.uf.edex.wcs.reg.RangeField;
|
||||
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* @author jelkins
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GribWcsSource extends
|
||||
DefaultWcsSource<GribDimension, GribLayer, GridRecord> {
|
||||
|
||||
private CoverageTransform<GribDimension, GribLayer> _cTransform;
|
||||
|
||||
private static final String PARAM_KEY = GribDimension.PARAM_DIM;
|
||||
|
||||
/**
|
||||
* @param props
|
||||
* @param layerTable
|
||||
*/
|
||||
public GribWcsSource(PluginProperties props,
|
||||
LayerTransformer<GribDimension, GribLayer> transformer,
|
||||
GribLayerCollector collector) {
|
||||
super(props, transformer);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getCoverageTransform()
|
||||
*/
|
||||
@Override
|
||||
public CoverageTransform<GribDimension, GribLayer> getCoverageTransform() {
|
||||
if (_cTransform == null) {
|
||||
_cTransform = new CoverageTransform<GribDimension, GribLayer>(
|
||||
transformer.getKey()) {
|
||||
@Override
|
||||
protected List<RangeField> getRangeFields(GribLayer layer) {
|
||||
List<RangeField> rval = new ArrayList<RangeField>();
|
||||
SimpleDimension params = layer
|
||||
.getDimension(GribDimension.PARAM_DIM);
|
||||
for (String name : params.getValues()) {
|
||||
rval.add(new RangeField(name, null));
|
||||
}
|
||||
SimpleDimension refDim = layer
|
||||
.getDimension(GribDimension.REFTIME_DIM);
|
||||
rval.add(convert(refDim));
|
||||
return rval;
|
||||
}
|
||||
|
||||
protected RangeField convert(SimpleDimension dim) {
|
||||
String name = dim.getName();
|
||||
Set<String> fromVals = dim.getValues();
|
||||
String units = dim.getUnits();
|
||||
RangeField rf = new RangeField(name, null);
|
||||
List<RangeAxis> axis = new ArrayList<RangeAxis>(1);
|
||||
if (units == null) {
|
||||
// use dim name as axis label
|
||||
units = name;
|
||||
}
|
||||
axis.add(new RangeAxis(units, fromVals));
|
||||
rf.setAxis(axis);
|
||||
return rf;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private final Map<String, Unit<?>> cache = Collections
|
||||
.synchronizedMap(new LRUMap(3));
|
||||
|
||||
private Unit<?> getUnit(String str) {
|
||||
Unit<?> rval = cache.get(str);
|
||||
if (rval == null) {
|
||||
rval = Unit.valueOf(str);
|
||||
cache.put(str, rval);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected VerticalCoordinate getVertical(GribLayer layer)
|
||||
throws WcsException {
|
||||
if (!layer.isVertical()) {
|
||||
return null;
|
||||
}
|
||||
List<GribDimension> levels = LayerTransformer
|
||||
.getDimsByPrefix(layer,
|
||||
LevelDimUtil.LEVEL_DIM_PREFIX);
|
||||
if (levels.isEmpty()) {
|
||||
log.error("attempted to get vertical component of empty layer");
|
||||
throw new WcsException(Code.InternalServerError);
|
||||
}
|
||||
// TODO get sample that represents majority
|
||||
SimpleDimension sample = levels.get(0);
|
||||
Unit<?> targetUnits = getUnit(sample.getUnits());
|
||||
String levelName = sample.getName().substring(
|
||||
LevelDimUtil.LEVEL_DIM_PREFIX.length());
|
||||
Reference targetRef = VerticalLevelLookup
|
||||
.getReference(levelName);
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
for (SimpleDimension l : levels) {
|
||||
String unitStr = l.getUnits();
|
||||
Unit<?> unit = cache.get(unitStr);
|
||||
if (unit == null) {
|
||||
unit = Unit.valueOf(unitStr);
|
||||
cache.put(unitStr, unit);
|
||||
}
|
||||
levelName = sample.getName().substring(
|
||||
LevelDimUtil.LEVEL_DIM_PREFIX.length());
|
||||
Reference ref = VerticalLevelLookup
|
||||
.getReference(levelName);
|
||||
for ( String val : l.getValues()){
|
||||
VerticalCoordinate vert = parseLevelValue(val,
|
||||
unit, ref);
|
||||
VerticalCoordinate convert = AltUtil.convert(
|
||||
targetUnits, targetRef, vert);
|
||||
min = Math.min(min, convert.getMin());
|
||||
max = Math.max(max, convert.getMax());
|
||||
}
|
||||
}
|
||||
return new VerticalCoordinate(min, max, targetUnits,
|
||||
targetRef);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.CoverageTransform#getBboxes(
|
||||
* com.raytheon.uf.edex.ogc.common.db.SimpleLayer)
|
||||
*/
|
||||
@Override
|
||||
protected List<Composite3DBoundingBox> getBboxes(GribLayer layer)
|
||||
throws WcsException {
|
||||
List<Composite3DBoundingBox> rval = new ArrayList<Composite3DBoundingBox>(
|
||||
2);
|
||||
VerticalCoordinate vert = getVertical(layer);
|
||||
ReferencedEnvelope crs84Horiz = getHorizontal(layer);
|
||||
rval.add(new Composite3DBoundingBox(crs84Horiz, vert));
|
||||
try {
|
||||
GribLayer griblayer = (GribLayer) layer;
|
||||
CoordinateReferenceSystem crs = CRS.parseWKT(griblayer
|
||||
.getCrsWkt());
|
||||
ReferencedEnvelope nativeHoriz = new ReferencedEnvelope(
|
||||
griblayer.getNativeMinX(),
|
||||
griblayer.getNativeMaxX(),
|
||||
griblayer.getNativeMinY(),
|
||||
griblayer.getNativeMaxY(), crs);
|
||||
String native2DCrsUrn = GribNativeCrsAuthority
|
||||
.createURN(griblayer.getCoverageName(),
|
||||
(ProjectedCRS) crs);
|
||||
rval.add(new Composite3DBoundingBox(nativeHoriz,
|
||||
native2DCrsUrn, vert));
|
||||
} catch (FactoryException e) {
|
||||
log.error("Unable to determine native BBOX", e);
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
return _cTransform;
|
||||
}
|
||||
|
||||
private void addToMap(Map<String, Set<String>> map, String key, String item) {
|
||||
Set<String> list = map.get(key);
|
||||
if (list == null) {
|
||||
list = new TreeSet<String>();
|
||||
map.put(key, list);
|
||||
}
|
||||
list.add(item);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#parseFields(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
protected Map<String, Set<String>> parseFields(List<RangeField> fields)
|
||||
throws WcsException {
|
||||
if (fields == null) {
|
||||
return new HashMap<String, Set<String>>(0);
|
||||
}
|
||||
Map<String, Set<String>> rval = new HashMap<String, Set<String>>(
|
||||
fields.size());
|
||||
for (RangeField rf : fields) {
|
||||
String key = rf.getIdentifier().toLowerCase();
|
||||
if (rf.getAxis() == null || rf.getAxis().isEmpty()) {
|
||||
addToMap(rval, PARAM_KEY, rf.getIdentifier());
|
||||
continue;
|
||||
}
|
||||
for (RangeAxis ra : rf.getAxis()) {
|
||||
Set<String> keys = ra.getKeys();
|
||||
if (keys != null && !keys.isEmpty()) {
|
||||
rval.put(key, keys);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param val
|
||||
* @return
|
||||
* @throws WcsException
|
||||
*/
|
||||
private VerticalCoordinate parseLevelValue(String val, Unit<?> unit,
|
||||
Reference ref) throws WcsException {
|
||||
Matcher m = LevelDimUtil.levelPattern.matcher(val);
|
||||
if (m.matches()) {
|
||||
double val1 = Double.parseDouble(m.group(1));
|
||||
if (m.group(3) == null) {
|
||||
return new VerticalCoordinate(val1, unit, ref);
|
||||
} else {
|
||||
double val2 = Double.parseDouble(m.group(3));
|
||||
return new VerticalCoordinate(val1, val2, unit, ref);
|
||||
}
|
||||
}
|
||||
throw new WcsException(Code.InvalidParameterValue,
|
||||
"Invalid level field value: " + val);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarField()
|
||||
*/
|
||||
@Override
|
||||
protected String getScalarField() {
|
||||
return GribRecordFinder.PARAM_ABBV;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getFilterClause(java.lang
|
||||
* .String, com.raytheon.uf.common.time.DataTime, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
protected Conjunction getFilterClause(String id, DataTime time,
|
||||
Map<String, Set<String>> fields) throws WcsException {
|
||||
Conjunction and = Restrictions.conjunction();
|
||||
try {
|
||||
and.add(GribRecordFinder.parseWcsId(id));
|
||||
} catch (OgcException e) {
|
||||
throw new WcsException(e);
|
||||
}
|
||||
for (Entry<String, Set<String>> e : fields.entrySet()) {
|
||||
if (e.getKey().equalsIgnoreCase(GribDimension.REFTIME_DIM)) {
|
||||
Set<String> values = e.getValue();
|
||||
if (values == null || values.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (values.size() == 1) {
|
||||
Calendar cal = DatatypeConverter.parseDateTime(values
|
||||
.iterator().next());
|
||||
and.add(Restrictions.eq(GribRecordFinder.REF_TIME,
|
||||
cal.getTime()));
|
||||
continue;
|
||||
}
|
||||
Disjunction or = Restrictions.disjunction();
|
||||
Iterator<String> iter = values.iterator();
|
||||
while (iter.hasNext()) {
|
||||
String val = iter.next();
|
||||
Calendar cal = DatatypeConverter.parseDateTime(val);
|
||||
or.add(Restrictions.eq(GribRecordFinder.REF_TIME,
|
||||
cal.getTime()));
|
||||
}
|
||||
and.add(or);
|
||||
}
|
||||
}
|
||||
addIfNotNull(and, parseTime(time));
|
||||
and.add(Restrictions.not(Restrictions.like(GribRecordFinder.PARAM_ABBV,
|
||||
"static%")));
|
||||
return and;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add criteria to conjunction if not null
|
||||
*
|
||||
* @param and
|
||||
* @param crit
|
||||
*/
|
||||
private void addIfNotNull(Conjunction and, Criterion crit) {
|
||||
if (crit != null) {
|
||||
and.add(crit);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarValue(com.raytheon
|
||||
* .uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected String getScalarValue(GridRecord record) throws WcsException {
|
||||
return GribRecordFinder.dbToOgcParameter(new GridFieldAdapter()
|
||||
.getCoverageField(record));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getAltitude(com.raytheon
|
||||
* .uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected VerticalCoordinate getAltitude(GridRecord record)
|
||||
throws WcsException {
|
||||
return new GridVerticalEnabler().getVerticalCoordinate(record);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarUnit(com.raytheon
|
||||
* .uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected Unit<?> getScalarUnit(GridRecord record) {
|
||||
return record.getInfo().getParameter().getUnit();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#isUpPositive(com.raytheon
|
||||
* .uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isUpPositive(GridRecord record) {
|
||||
MasterLevel masterLevel = record.getInfo().getLevel()
|
||||
.getMasterLevel();
|
||||
return !"DEC".equalsIgnoreCase(masterLevel.getType());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#modCriteria(org.hibernate
|
||||
* .Criteria)
|
||||
*/
|
||||
@Override
|
||||
protected Criteria modCriteria(Criteria criteria) {
|
||||
return GribRecordFinder.modCriteria(criteria);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarKey()
|
||||
*/
|
||||
@Override
|
||||
protected String getScalarKey() {
|
||||
return PARAM_KEY;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getUcarUnit(com.raytheon
|
||||
* .uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected ucar.units.Unit getUcarUnit(GridRecord record) {
|
||||
Unit<?> parameterUnitObject = record.getInfo().getParameter().getUnit();
|
||||
return UnitLookup.getInstance().getUcarFromJsr(parameterUnitObject);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.DefaultWcsSource#getScalarCrit(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
protected Criterion getScalarCrit(String value) {
|
||||
return super.getScalarCrit(GribRecordFinder.ogcToDbParameter(value));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginProperties;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.db.LayerTransformer;
|
||||
import com.raytheon.uf.edex.wms.WmsException;
|
||||
import com.raytheon.uf.edex.wms.WmsException.Code;
|
||||
import com.raytheon.uf.edex.wms.reg.DefaultWmsSource;
|
||||
import com.raytheon.uf.edex.wms.styling.ColormapStyleProvider;
|
||||
import com.raytheon.uf.edex.wms.styling.ICoverageStyleProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jelkins
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GribWmsSource extends
|
||||
DefaultWmsSource<GribDimension, GridParamLayer, GridRecord> {
|
||||
|
||||
protected ColormapStyleProvider<GridRecord> styler = new GridStyleProvider(
|
||||
this, "Grid/Default");
|
||||
|
||||
public GribWmsSource(PluginProperties props,
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer)
|
||||
throws PluginException {
|
||||
super(props, props.getPluginName(), transformer);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wms.reg.DefaultWmsSource#getRecord(java.lang.String,
|
||||
* java.lang.String, java.lang.String, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
protected GridRecord getRecord(String layer, String time, String elevation,
|
||||
Map<String, String> dimensions) throws WmsException {
|
||||
LayerTransformer<GribDimension, GridParamLayer> transformer;
|
||||
List<GridRecord> res;
|
||||
try {
|
||||
transformer = getTransformer();
|
||||
res = GribRecordFinder.findWms(transformer, key, layer, time,
|
||||
dimensions);
|
||||
} catch (OgcException e) {
|
||||
WmsException err = new WmsException(e);
|
||||
if (err.getCode().equals(Code.InternalServerError)) {
|
||||
log.error("Problem getting grib layer: " + layer);
|
||||
}
|
||||
throw err;
|
||||
} catch (PluginException e) {
|
||||
log.error("Unable to get transformer for grib", e);
|
||||
throw new WmsException(Code.InternalServerError);
|
||||
}
|
||||
if (res.isEmpty()) {
|
||||
throw new WmsException(Code.LayerNotDefined,
|
||||
"No layer matching all specified dimensions found");
|
||||
}
|
||||
if (res.size() > 1) {
|
||||
Collections.sort(res, new GribRecordFinder.Comp());
|
||||
}
|
||||
return res.get(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wms.reg.DefaultWmsSource#getStyleProvider(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
protected ICoverageStyleProvider<GridRecord> getStyleProvider(String layer)
|
||||
throws WmsException {
|
||||
return styler;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,224 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.edex.ogc.common.db.SimpleLayer;
|
||||
|
||||
/**
|
||||
* Grid layer that sorts dimensions by parameter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 27, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridCompositeLayer extends GribLayer {
|
||||
|
||||
private static final long serialVersionUID = 6178813246077412635L;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected HashMap<String, TreeSet<GribDimension>> dimensions = new HashMap<String, TreeSet<GribDimension>>();
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected HashMap<String, TreeSet<Date>> timeMap = new HashMap<String, TreeSet<Date>>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GridCompositeLayer() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
*/
|
||||
public GridCompositeLayer(GridCompositeLayer other) {
|
||||
super(other);
|
||||
this.dimensions = new HashMap<String, TreeSet<GribDimension>>(
|
||||
other.dimensions.size());
|
||||
for (Entry<String, TreeSet<GribDimension>> e : other.dimensions
|
||||
.entrySet()) {
|
||||
TreeSet<GribDimension> set = new TreeSet<GribDimension>();
|
||||
GribDimension.copy(set, e.getValue());
|
||||
this.dimensions.put(e.getKey(), set);
|
||||
}
|
||||
this.timeMap = new HashMap<String, TreeSet<Date>>(other.timeMap.size());
|
||||
for (Entry<String, TreeSet<Date>> e : other.timeMap.entrySet()) {
|
||||
this.timeMap.put(e.getKey(), new TreeSet<Date>(e.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<GribDimension> getDimensions() {
|
||||
HashMap<String, GribDimension> byDim = new HashMap<String, GribDimension>();
|
||||
for (Entry<String, TreeSet<GribDimension>> e : dimensions.entrySet()) {
|
||||
for (GribDimension dim : e.getValue()) {
|
||||
GribDimension aggregate = byDim.get(dim.getName());
|
||||
if (aggregate == null) {
|
||||
byDim.put(dim.getName(), dim);
|
||||
continue;
|
||||
}
|
||||
aggregate.getValues().addAll(dim.getValues());
|
||||
}
|
||||
}
|
||||
return new TreeSet<GribDimension>(byDim.values());
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.ogc.common.db.SimpleLayer#getTimes()
|
||||
*/
|
||||
@Override
|
||||
public TreeSet<Date> getTimes() {
|
||||
TreeSet<Date> rval = new TreeSet<Date>();
|
||||
for (Entry<String, TreeSet<Date>> e : timeMap.entrySet()) {
|
||||
rval.addAll(e.getValue());
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add time for parameter
|
||||
*
|
||||
* @param parameter
|
||||
* @param time
|
||||
*/
|
||||
public void addTime(String parameter, Date time) {
|
||||
TreeSet<Date> set = timeMap.get(parameter);
|
||||
if (set == null) {
|
||||
set = new TreeSet<Date>();
|
||||
timeMap.put(parameter, set);
|
||||
}
|
||||
set.add(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
* @return empty list if parameter has no times
|
||||
*/
|
||||
public TreeSet<Date> getTimes(String parameter) {
|
||||
TreeSet<Date> treeSet = timeMap.get(parameter);
|
||||
if (treeSet == null) {
|
||||
return new TreeSet<Date>();
|
||||
} else {
|
||||
return new TreeSet<Date>(treeSet);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.db.SimpleLayer#updateDates(com.raytheon
|
||||
* .uf.edex.ogc.common.db.SimpleLayer)
|
||||
*/
|
||||
@Override
|
||||
public void updateDates(SimpleLayer<GribDimension> other) {
|
||||
if (!(other instanceof GridCompositeLayer)) {
|
||||
return;
|
||||
}
|
||||
GridCompositeLayer shiny = (GridCompositeLayer) other;
|
||||
for (Entry<String, TreeSet<Date>> e : shiny.timeMap.entrySet()) {
|
||||
TreeSet<Date> thisSet = this.timeMap.get(e.getKey());
|
||||
if (thisSet == null) {
|
||||
this.timeMap.put(e.getKey(), new TreeSet<Date>(e.getValue()));
|
||||
} else {
|
||||
thisSet.addAll(e.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
* @return empty set if no dimensions for parameter
|
||||
*/
|
||||
public TreeSet<GribDimension> getDimensions(String parameter) {
|
||||
TreeSet<GribDimension> rval = dimensions.get(parameter);
|
||||
if (rval == null) {
|
||||
return new TreeSet<GribDimension>();
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
* @param dims
|
||||
*/
|
||||
public void addDimensions(String parameter, TreeSet<GribDimension> dims) {
|
||||
dimensions.put(parameter, dims);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.db.SimpleLayer#updateDims(com.raytheon
|
||||
* .uf.edex.ogc.common.db.SimpleLayer)
|
||||
*/
|
||||
@Override
|
||||
public void updateDims(SimpleLayer<GribDimension> other) {
|
||||
if (!(other instanceof GridCompositeLayer)) {
|
||||
return;
|
||||
}
|
||||
GridCompositeLayer shiny = (GridCompositeLayer) other;
|
||||
for (String key : shiny.dimensions.keySet()) {
|
||||
TreeSet<GribDimension> otherDims = shiny.dimensions.get(key);
|
||||
TreeSet<GribDimension> thisDims = dimensions.get(key);
|
||||
if (thisDims == null) {
|
||||
thisDims = new TreeSet<GribDimension>();
|
||||
GribDimension.copy(thisDims, otherDims);
|
||||
dimensions.put(key, thisDims);
|
||||
} else {
|
||||
updateDimLists(thisDims, otherDims);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.db.SimpleLayer#getDimension(java.lang
|
||||
* .String)
|
||||
*/
|
||||
@Override
|
||||
public GribDimension getDimension(String dimension) {
|
||||
// TODO slow
|
||||
return getDimMap(getDimensions()).get(dimension);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return set of parameter names for composite layer
|
||||
*/
|
||||
public Set<String> getParameters() {
|
||||
return dimensions.keySet();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.edex.plugin.dataset.urn.CFNameLookup;
|
||||
import com.raytheon.uf.edex.wcs.reg.IFieldAdapted;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 5, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridFieldAdapter implements IFieldAdapted<GridRecord> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wcs.reg.FieldAdapted#getCoverageField(java.lang.
|
||||
* Object)
|
||||
*/
|
||||
@Override
|
||||
public String getCoverageField(GridRecord record) {
|
||||
CFNameLookup lookup = CFNameLookup.getInstance();
|
||||
String abbr = record.getInfo().getParameter().getAbbreviation();
|
||||
return lookup.getCFFromNCEP(abbr);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.wcs.reg.FieldAdapted#getSupportedClass()
|
||||
*/
|
||||
@Override
|
||||
public Class<GridRecord> getSupportedClass() {
|
||||
return GridRecord.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridConstants;
|
||||
import com.raytheon.uf.edex.database.plugin.PurgeResults;
|
||||
import com.raytheon.uf.edex.ogc.common.db.PurgeNotification;
|
||||
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||
|
||||
/**
|
||||
* Dao with purge notification for grid
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 6, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridNotifyDao extends GridDao {
|
||||
|
||||
private final PurgeNotification notify;
|
||||
|
||||
/**
|
||||
* @throws PluginException
|
||||
*/
|
||||
public GridNotifyDao() throws PluginException {
|
||||
this(GridConstants.GRID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pluginName
|
||||
* @throws PluginException
|
||||
*/
|
||||
public GridNotifyDao(String pluginName) throws PluginException {
|
||||
super(pluginName);
|
||||
this.notify = new PurgeNotification(pluginName);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.plugin.grid.dao.GridDao#purgeExpiredData()
|
||||
*/
|
||||
@Override
|
||||
public void purgeExpiredData() throws PluginException {
|
||||
PurgeResults res = super.purgeExpiredDataWithResults();
|
||||
notify.purgeExpiredData(res);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.plugin.grid.dao.GridDao#purgeAllData()
|
||||
*/
|
||||
@Override
|
||||
public void purgeAllData() throws PluginException {
|
||||
super.purgeAllData();
|
||||
notify.purgeAllData();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
||||
/**
|
||||
* Grid layer that has dimensions for a single parameter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 27, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridParamLayer extends GribLayer {
|
||||
|
||||
private static final long serialVersionUID = -5614814725742630980L;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected TreeSet<GribDimension> dimensions;
|
||||
|
||||
@XmlElement
|
||||
@DynamicSerializeElement
|
||||
protected String parameter;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public GridParamLayer() {
|
||||
super();
|
||||
dimensions = new TreeSet<GribDimension>();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
*/
|
||||
public GridParamLayer(GridParamLayer other) {
|
||||
super(other);
|
||||
this.parameter = other.parameter;
|
||||
this.dimensions = new TreeSet<GribDimension>();
|
||||
GribDimension.copy(this.dimensions, other.dimensions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param other
|
||||
*/
|
||||
public GridParamLayer(String parameter, GridCompositeLayer other) {
|
||||
super(other);
|
||||
this.parameter = parameter;
|
||||
this.times = new TreeSet<Date>(other.getTimes(parameter));
|
||||
TreeSet<GribDimension> otherDims = other.getDimensions(parameter);
|
||||
this.dimensions = new TreeSet<GribDimension>();
|
||||
for (GribDimension dim : otherDims) {
|
||||
if (dim.getName().equalsIgnoreCase(GribDimension.PARAM_DIM)) {
|
||||
continue;
|
||||
}
|
||||
this.dimensions.add(new GribDimension(dim));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.plugin.grib.ogc.GribLayer#getDimensions()
|
||||
*/
|
||||
@Override
|
||||
public Set<GribDimension> getDimensions() {
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parameter
|
||||
*/
|
||||
public String getParameter() {
|
||||
return parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
* the parameter to set
|
||||
*/
|
||||
public void setParameter(String parameter) {
|
||||
this.parameter = parameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dimensions
|
||||
* the dimensions to set
|
||||
*/
|
||||
public void setDimensions(TreeSet<GribDimension> dimensions) {
|
||||
this.dimensions = dimensions;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import javax.measure.unit.Unit;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grid.util.GridStyleUtil;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
|
||||
import com.raytheon.uf.edex.ogc.common.IStyleLookupCallback;
|
||||
import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
|
||||
import com.raytheon.uf.edex.wms.WmsException;
|
||||
import com.raytheon.uf.edex.wms.WmsException.Code;
|
||||
import com.raytheon.uf.edex.wms.styling.ColormapStyleProvider;
|
||||
|
||||
/**
|
||||
* Style provider specific to grid colormapped imagery
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 2, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridStyleProvider extends ColormapStyleProvider<GridRecord> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param styleLibraryFileName
|
||||
* @param defaultColormap
|
||||
*/
|
||||
public GridStyleProvider(IStyleLookupCallback<GridRecord> callback,
|
||||
String defaultColormap) {
|
||||
super(callback, defaultColormap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param styleLibraryFileName
|
||||
*/
|
||||
public GridStyleProvider(IStyleLookupCallback<GridRecord> callback) {
|
||||
super(callback);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getCriteria(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected ParamLevelMatchCriteria getCriteria(GridRecord record)
|
||||
throws WmsException {
|
||||
return GridStyleUtil
|
||||
.getMatchCriteria((GridRecord) record);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getParamUnits(
|
||||
* com.raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected Unit<?> getParamUnits(GridRecord record) throws WmsException {
|
||||
Parameter parameter = record.getInfo().getParameter();
|
||||
return parameter.getUnit();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.wms.styling.ColormapStyleProvider#getRawData(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
protected Object getRawData(GridRecord record) throws WmsException {
|
||||
Object data;
|
||||
try {
|
||||
GridDao dao = new GridDao();
|
||||
IDataRecord[] res = dao.getHDF5Data(record, 0);
|
||||
FloatDataRecord datarecord = (FloatDataRecord) res[0];
|
||||
data = datarecord.getFloatData();
|
||||
} catch (PluginException e) {
|
||||
log.error("Unable to retrieve grib data", e);
|
||||
throw new WmsException(Code.InternalServerError);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import javax.measure.unit.SI;
|
||||
import javax.measure.unit.Unit;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference;
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 30, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridVerticalEnabler implements VerticalEnabled<GridRecord> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled#getVerticalCoordinate
|
||||
* (java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public VerticalCoordinate getVerticalCoordinate(GridRecord rec) {
|
||||
if (rec.getInfo() == null) {
|
||||
return null;
|
||||
}
|
||||
Level level = rec.getInfo().getLevel();
|
||||
if (level == null) {
|
||||
return null;
|
||||
}
|
||||
double l1 = level.getLevelonevalue();
|
||||
double l2 = level.getLeveltwovalue();
|
||||
MasterLevel master = level.getMasterLevel();
|
||||
VerticalCoordinate.Reference ref;
|
||||
if (master.getUnit() == null) {
|
||||
ref = Reference.UNKNOWN;
|
||||
} else if (SI.PASCAL.isCompatible(master.getUnit())) {
|
||||
ref = Reference.PRESSURE_LEVEL;
|
||||
} else if ("FHAG".equalsIgnoreCase(master.getName())) {
|
||||
ref = Reference.ABOVE_GROUND;
|
||||
} else if (SI.METER.isCompatible(master.getUnit())) {
|
||||
ref = Reference.ABOVE_MSL;
|
||||
} else {
|
||||
ref = Reference.UNKNOWN;
|
||||
}
|
||||
if (l2 == Level.INVALID_VALUE) {
|
||||
return new VerticalCoordinate(l1, master.getUnit(), ref);
|
||||
} else {
|
||||
return new VerticalCoordinate(l1, l2, master.getUnit(), ref);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled#getSupportedClass
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public Class<GridRecord> getSupportedClass() {
|
||||
return GridRecord.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.ogc.common.spatial.VerticalEnabled#
|
||||
* getDefaultVerticalUnit()
|
||||
*/
|
||||
@Override
|
||||
public Unit<?> getDefaultVerticalUnit() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.raytheon.uf.edex.ogc.common.OgcException;
|
||||
import com.raytheon.uf.edex.ogc.common.OgcLayer;
|
||||
import com.raytheon.uf.edex.ogc.common.db.ILayerCache;
|
||||
|
||||
/**
|
||||
* Layer cache adapter to split composite levels into parameter levels
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 26, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GridWmsLayerCache implements ILayerCache<GribDimension, GribLayer> {
|
||||
|
||||
private final ILayerCache<GribDimension, GridCompositeLayer> cache;
|
||||
|
||||
/**
|
||||
* @param cache
|
||||
*/
|
||||
public GridWmsLayerCache(ILayerCache<GribDimension, GridCompositeLayer> cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.edex.ogc.common.db.LayerCache#getLayers()
|
||||
*/
|
||||
@Override
|
||||
public List<GribLayer> getLayers() throws OgcException {
|
||||
List<GridCompositeLayer> origLayers = cache.getLayers();
|
||||
List<GribLayer> rval = new ArrayList<GribLayer>(origLayers.size());
|
||||
for (GridCompositeLayer orig : origLayers) {
|
||||
String[] parts = StringUtils.split(orig.getName(),
|
||||
OgcLayer.keySeparator);
|
||||
for (String param : orig.getParameters()) {
|
||||
rval.add(getParamLayer(orig, parts, param));
|
||||
}
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orig
|
||||
* @param name
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
private GridParamLayer getParamLayer(GridCompositeLayer orig, String name,
|
||||
String param) {
|
||||
GridParamLayer paramLayer = new GridParamLayer(param, orig);
|
||||
paramLayer.setName(name);
|
||||
return paramLayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param orig
|
||||
* @param parts
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
private GribLayer getParamLayer(GridCompositeLayer orig, String[] parts,
|
||||
String param) {
|
||||
LinkedList<String> partList = new LinkedList<String>(
|
||||
Arrays.asList(parts));
|
||||
partList.add(parts.length - 1, param);
|
||||
return getParamLayer(orig,
|
||||
StringUtils.join(partList, OgcLayer.keySeparator), param);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.edex.ogc.common.db.LayerCache#getLayer(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public GribLayer getLayer(String name) throws OgcException {
|
||||
String[] parts = StringUtils.split(name,
|
||||
OgcLayer.keySeparator);
|
||||
LinkedList<String> partList = new LinkedList<String>(
|
||||
Arrays.asList(parts));
|
||||
String param = partList.remove(parts.length - 2);
|
||||
GridCompositeLayer layer = cache.getLayer(StringUtils.join(partList,
|
||||
OgcLayer.keySeparator));
|
||||
if (layer == null) {
|
||||
return null;
|
||||
}
|
||||
return getParamLayer(layer, name, param);
|
||||
}
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.grib.ogc;
|
||||
|
||||
import com.raytheon.uf.edex.ogc.common.spatial.VerticalCoordinate.Reference;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 26, 2013 bclement Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bclement
|
||||
* @version 1.0
|
||||
*/
|
||||
public class VerticalLevelLookup {
|
||||
|
||||
public static Reference getReference(String masterLevel) {
|
||||
if ("FH".equalsIgnoreCase(masterLevel)) {
|
||||
return Reference.ABOVE_MSL;
|
||||
}
|
||||
if ("MB".equalsIgnoreCase(masterLevel)) {
|
||||
return Reference.PRESSURE_LEVEL;
|
||||
}
|
||||
if ("FHAG".equalsIgnoreCase(masterLevel)) {
|
||||
return Reference.ABOVE_GROUND;
|
||||
}
|
||||
return Reference.UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,241 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<styleRuleLibrary>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/DpT/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>90</upperMaximum>
|
||||
<upperMinimum>-60</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/DpT/MB.*</layerRegex>
|
||||
<levelRange level="level1" unit="hPa">
|
||||
<upper>1050</upper>
|
||||
<lower>500</lower>
|
||||
</levelRange>
|
||||
<mapRange type="log">
|
||||
<upperMaximum>308.15</upperMaximum>
|
||||
<lowerMaximum>278.15</lowerMaximum>
|
||||
<upperMinimum>213.15</upperMinimum>
|
||||
<lowerMinimum>213.15</lowerMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/DpT/MB.*</layerRegex>
|
||||
<levelRange level="level1" unit="hPa">
|
||||
<upper>500</upper>
|
||||
<lower>250</lower>
|
||||
</levelRange>
|
||||
<mapRange type="log">
|
||||
<upperMaximum>278.15</upperMaximum>
|
||||
<lowerMaximum>233.15</lowerMaximum>
|
||||
<upperMinimum>213.15</upperMinimum>
|
||||
<lowerMinimum>173.15</lowerMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/WGS/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>36.0111111</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/T/SFC.*</layerRegex>
|
||||
<mapRange type="linear">
|
||||
<!-- 115F in Kelvin -->
|
||||
<upperMaximum>319.261111</upperMaximum>
|
||||
<!-- -40F in Kelvin -->
|
||||
<upperMinimum>233.15</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/T/MB.*</layerRegex>
|
||||
<levelRange level="level1" unit="hPa">
|
||||
<upper>1050</upper>
|
||||
<lower>500</lower>
|
||||
</levelRange>
|
||||
<mapRange type="log" >
|
||||
<upperMaximum>318.15</upperMaximum>
|
||||
<upperMinimum>233.15</upperMinimum>
|
||||
</mapRange>
|
||||
<!--
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>319.261111</upperMaximum>
|
||||
<upperMinimum>233.15</upperMinimum>
|
||||
</mapRange>
|
||||
-->
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>10</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/AV/[^/]*.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<!-- units in /s -->
|
||||
<upperMaximum>0.00030</upperMaximum>
|
||||
<upperMinimum>-0.00005</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/BLI/[^/]*.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<!-- units in C -->
|
||||
<upperMaximum>15</upperMaximum>
|
||||
<upperMinimum>-15</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/CAPE/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>5000</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/TCC/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum></upperMaximum>
|
||||
<upperMinimum></upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<values>25 50 75</values>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/WS/MB.*</layerRegex>
|
||||
<levelRange level="level1" unit="hPa">
|
||||
<upper>1050</upper>
|
||||
<lower>850</lower>
|
||||
</levelRange>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>75</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>10</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/WS/MB.*</layerRegex>
|
||||
<levelRange level="level1" unit="hPa">
|
||||
<upper>850</upper>
|
||||
<lower>200</lower>
|
||||
</levelRange>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>0</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
<lowerMaximum>200</lowerMaximum>
|
||||
<lowerMinimum>75</lowerMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>20</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/WS/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>75</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>10</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/HTSGW/SFC.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>20</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>5</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/ICIP/.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>1</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>0.1</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/ICI/.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>5</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/icing_severity</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>1</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/SLDP/.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>1</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/icing_sld</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>0.25</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*/TPFI/.*</layerRegex>
|
||||
<mapRange type="linear" >
|
||||
<upperMaximum>1</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
<colorMapName>Grid/aviation_turbulence_index</colorMapName>
|
||||
<colorbarLabeling>
|
||||
<increment>0.25</increment>
|
||||
</colorbarLabeling>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<layerRegex>.*</layerRegex>
|
||||
<colorMapName>Grid/gridded data</colorMapName>
|
||||
<mapRange type="linear" replaceable="true" >
|
||||
<upperMaximum>255</upperMaximum>
|
||||
<upperMinimum>0</upperMinimum>
|
||||
</mapRange>
|
||||
</styleRule>
|
||||
|
||||
</styleRuleLibrary>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.plugin.mesowest</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?eclipse-pydev version="1.0"?>
|
||||
|
||||
<pydev_project>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.5</pydev_property>
|
||||
<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
|
||||
</pydev_project>
|
|
@ -1,7 +0,0 @@
|
|||
#Tue Mar 03 17:15:37 GMT+00:00 2009
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,17 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Mesowest Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.mesowest
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.raytheon.edex.common,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.edex.decodertools;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.localization,
|
||||
org.geotools,
|
||||
javax.persistence,
|
||||
javax.measure
|
||||
Export-Package: com.raytheon.uf.edex.plugin.mesowest,
|
||||
com.raytheon.uf.edex.plugin.mesowest.common
|
||||
Import-Package: org.apache.commons.logging
|
|
@ -1,129 +0,0 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
import sys, os, time, re, string, getopt
|
||||
import copy
|
||||
import LogStream
|
||||
import pupynere
|
||||
from com.raytheon.uf.common.pointdata.spatial import SurfaceObsLocation
|
||||
from java.lang import Double
|
||||
from java.lang import Integer
|
||||
|
||||
class MesowestDecoder():
|
||||
|
||||
def __init__(self, text=None, filePath=None):
|
||||
|
||||
self._parameters = ['altimeter', 'dewpoint', 'relHumidity', 'stationId', 'rawMessage', 'temperature', 'windDir', 'windGust', 'windSpeed', 'precipAccum']
|
||||
self._mappings = ['altimeter', 'dwpt', 'humidity', 'stationId', 'obsText', 'temp', 'windDirection', 'windGust', 'windSpeed', 'precip']
|
||||
|
||||
|
||||
#to ensure time calls are based on Zulu
|
||||
os.environ['TZ'] = "GMT0"
|
||||
|
||||
self._deleteAfterProcessing = 0
|
||||
if filePath is None:
|
||||
self._incomingFilename = None
|
||||
else:
|
||||
self._incomingFilename = filePath
|
||||
|
||||
def decode(self):
|
||||
fillValue = None
|
||||
missing = None
|
||||
mesowestReports = list()
|
||||
obsList = dict()
|
||||
net = pupynere.netcdf_file(self._incomingFilename,"r")
|
||||
records = net._recs
|
||||
for x in range(records):
|
||||
stationId = ''.join(net.variables['stationId'][x])
|
||||
reportTime = net.variables['reportTime'][x] * 1000
|
||||
if obsList.has_key(reportTime):
|
||||
if stationId in obsList[reportTime]:
|
||||
continue
|
||||
else:
|
||||
obsList[reportTime].append(stationId)
|
||||
else:
|
||||
obsList[reportTime] = list()
|
||||
obsList[reportTime].append(stationId)
|
||||
mesowestReport = dict()
|
||||
for paramNum in range(len(self._parameters)):
|
||||
param = self._parameters[paramNum]
|
||||
mapping = self._mappings[paramNum]
|
||||
variable = net.variables[param]
|
||||
# Set the missing value if available
|
||||
try:
|
||||
missing = variable.missing_value
|
||||
except AttributeError:
|
||||
missing = None
|
||||
# Set the fill value if available
|
||||
try:
|
||||
fillValue = variable._FillValue
|
||||
except AttributeError:
|
||||
fillValue = None
|
||||
if len(variable.shape) == 1:
|
||||
if fillValue != None and variable[x] == fillValue:
|
||||
mesowestReport[mapping] = Double(-9999.0)
|
||||
continue
|
||||
if missing != None:
|
||||
# Odd case where certain values are -764 in the netcdf
|
||||
if variable[x] == missing or variable[x] < -600:
|
||||
mesowestReport[mapping] = Double(-9999.0)
|
||||
continue
|
||||
mesowestReport[mapping] = Double.valueOf(str(variable[x]))
|
||||
elif len(variable.shape) > 1 and variable.shape[1] > 3:
|
||||
mesowestReport[mapping] = ''.join(variable[x])
|
||||
|
||||
location = SurfaceObsLocation()
|
||||
lat = Double.valueOf(str(net.variables['latitude'][x]))
|
||||
lon = Double.valueOf(str(net.variables['longitude'][x]))
|
||||
elv = Double.valueOf(str(net.variables['elevation'][x]))
|
||||
location.assignLocation(lat.doubleValue(),lon.doubleValue());
|
||||
location.setElevation(Integer(elv.intValue()));
|
||||
location.setStationId(stationId)
|
||||
mesowestReport['location'] = location
|
||||
mesowestReport['timeObs'] = long(reportTime)
|
||||
mesowestReport['dataTime'] = mesowestReport['timeObs']
|
||||
mesowestReport['networkType'] = ''.join(net.variables['stationType'][x])
|
||||
mesowestReports.append(mesowestReport)
|
||||
net.close()
|
||||
return mesowestReports
|
||||
|
||||
|
||||
def _usage(self):
|
||||
#Prints out usage information if started without sufficient command
|
||||
#line arguments.
|
||||
s = "This tool is not meant to be run from the command line."
|
||||
print s
|
||||
LogStream.logProblem(s)
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
LogStream.logEvent("MesowestDecoder Starting")
|
||||
decoder = MesowestDecoder()
|
||||
decoder.decode()
|
||||
decoder = None
|
||||
LogStream.logEvent("MesowestDecoder Finished")
|
||||
except:
|
||||
LogStream.logProblem("Caught Exception: ", LogStream.exc())
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
sys.exit(0)
|
|
@ -1,6 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
res/,\
|
||||
MesowestDecoder.py
|
|
@ -1,21 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
|
||||
|
||||
<bean id="mesowestPluginName" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="mesowest" />
|
||||
</bean>
|
||||
|
||||
<bean id="mesowestProperties" class="com.raytheon.uf.common.dataplugin.PluginProperties">
|
||||
<property name="pluginName" ref="mesowestPluginName" />
|
||||
<property name="pluginFQN" value="com.raytheon.uf.edex.plugin.mesowest" />
|
||||
<property name="dao" value="com.raytheon.uf.edex.plugin.mesowest.dao.MESOWestDao" />
|
||||
<property name="record" value="com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord" />
|
||||
</bean>
|
||||
|
||||
<bean factory-bean="pluginRegistry" factory-method="register">
|
||||
<constructor-arg value="mesowest"/>
|
||||
<constructor-arg ref="mesowestProperties"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,75 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="mesowestDatabase" class="java.lang.String">
|
||||
<constructor-arg type="java.lang.String" value="metadata" />
|
||||
</bean>
|
||||
|
||||
<bean id="mesowestFilter" class="com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter">
|
||||
<constructor-arg type="java.lang.String" value="mesowest_filters.xml" />
|
||||
<constructor-arg type="java.lang.String" value="SITE" />
|
||||
</bean>
|
||||
|
||||
<bean id="mesowestInitializer" class="com.raytheon.edex.plugin.DefaultPluginInitializer">
|
||||
<constructor-arg ref="mesowestPluginName" />
|
||||
|
||||
</bean>
|
||||
|
||||
<bean id="mesowestSeparator" class="com.raytheon.uf.edex.plugin.mesowest.MESOWestSeparator" />
|
||||
|
||||
<!--bean id="mesowestDecoder" class="com.raytheon.uf.edex.plugin.mesowest.MESOWestDecoder">
|
||||
<constructor-arg ref="mesowestPluginName" />
|
||||
</bean-->
|
||||
|
||||
<bean id="mesowestDecoder" class="com.raytheon.uf.edex.python.decoder.PythonDecoder">
|
||||
<property name="pluginName" value="mesowest" />
|
||||
<property name="pluginFQN" value="com.raytheon.uf.edex.plugin.mesowest" />
|
||||
<property name="moduleName" value="MesowestDecoder" />
|
||||
<property name="recordClassname"
|
||||
value="com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord" />
|
||||
</bean>
|
||||
|
||||
<bean id="mesowestCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="mesowest-camel"/>
|
||||
</bean>
|
||||
|
||||
<camelContext id="mesowest-camel"
|
||||
xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
<!--
|
||||
<endpoint id="mesowestFileEndpoint" uri="file:${edex.home}/data/sbn/mesowest?noop=true&idempotent=false" />
|
||||
|
||||
<route id="mesowestFileConsumerRoute">
|
||||
<from ref="mesowestFileEndpoint" />
|
||||
<bean ref="fileToString" />
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>mesowest</constant>
|
||||
</setHeader>
|
||||
<to uri="jms-durable:queue:Ingest.Mesowest" />
|
||||
</route>
|
||||
-->
|
||||
|
||||
<!-- Begin MESOWest routes -->
|
||||
<route id="mesowestIngestRoute">
|
||||
<from uri="jms-durable:queue:Ingest.Mesowest"/>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="stringToFile" />
|
||||
<bean ref="mesowestDecoder" method="decode" />
|
||||
<bean ref="mesowestFilter" method="filter" />
|
||||
<to uri="direct-vm:indexAlert" />
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to
|
||||
uri="log:warning?level=ERROR" />
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
</beans>
|
|
@ -1,148 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestParser;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 03, 2009 jkorman Initial creation
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MESOWestDecoder {
|
||||
|
||||
private final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private String pluginName = "mesowest";
|
||||
|
||||
private final Map<String, MESOWestParser> parserMap = new HashMap<String, MESOWestParser>();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public MESOWestDecoder(String name) {
|
||||
this.pluginName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next decoded data record.
|
||||
*
|
||||
* @return One record of decoded data.
|
||||
* @throws DecoderException
|
||||
* Thrown if no data is available.
|
||||
*/
|
||||
public PluginDataObject[] decode(IDecoderInput input) {
|
||||
|
||||
PluginDataObject[] decodedData = null;
|
||||
String traceId = null;
|
||||
|
||||
logger.debug("MESOWestDecoder.decode()");
|
||||
|
||||
if (input != null) {
|
||||
traceId = input.getProperty(MESOWestConstants.TRACEID);
|
||||
|
||||
MESOWestRecord record = null;
|
||||
|
||||
String type = input.getProperty(MESOWestConstants.K_DATATYPE);
|
||||
if (MESOWestConstants.T_PARMHEADER.equals(type)) {
|
||||
parserMap.put(input.getProperty("uuid"), new MESOWestParser(
|
||||
input.getReport()));
|
||||
logger.debug("Created parser ");
|
||||
} else if (MESOWestConstants.T_LASTITEM.equals(type)) {
|
||||
parserMap.remove(input.getProperty("uuid"));
|
||||
logger.debug("Destroyed parser ");
|
||||
} else {
|
||||
MESOWestParser parser = parserMap
|
||||
.get(input.getProperty("uuid"));
|
||||
if (parser != null) {
|
||||
if (input.getReport().length() > 10) {
|
||||
if ((record = parser.decode(input.getReport())) != null) {
|
||||
record.setTraceId(traceId);
|
||||
record.setObsText(input.getReport() + "\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Unexpected data in data stream");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (record != null) {
|
||||
logger.info("Decoded obs " + record.getStationId());
|
||||
|
||||
try {
|
||||
record.constructDataURI();
|
||||
} catch (PluginException e) {
|
||||
throw new DecoderException(
|
||||
"Unable to construct dataURI", e);
|
||||
}
|
||||
|
||||
decodedData = new PluginDataObject[] { record };
|
||||
} else {
|
||||
logger.info(String.format("%s - Decoded no obs", traceId));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Error in MESOWestDecoder", e);
|
||||
} finally {
|
||||
if (decodedData == null) {
|
||||
decodedData = new PluginDataObject[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("null input data in MESOWestDecoder");
|
||||
}
|
||||
|
||||
return decodedData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pluginName
|
||||
*/
|
||||
public String getPluginName() {
|
||||
return pluginName;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,212 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest;
|
||||
|
||||
import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractFilterElement;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.AbstractObsFilter;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.PluginDataObjectFilter;
|
||||
import com.raytheon.uf.edex.decodertools.core.filterimpl.RectFilterElement;
|
||||
|
||||
/**
|
||||
* A filter for mesowest data that is configured through XML.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 23, 2009 jkorman Initial creation
|
||||
* Oct 22, 2013 2361 njensen Use JAXBManager for XML
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class MESOWestFilter extends AbstractObsFilter {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private static final String FILTER_CONFIG = "mesowest_filters.xml";
|
||||
|
||||
public MESOWestFilter() {
|
||||
}
|
||||
|
||||
public MESOWestFilter(String site) {
|
||||
try {
|
||||
IPathManager manager = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationContext siteContext = manager.getContextForSite(
|
||||
EDEX_STATIC, site);
|
||||
|
||||
File siteDir = manager.getFile(siteContext, "");
|
||||
if (siteDir.exists()) {
|
||||
try {
|
||||
File srcFile = new File(siteDir, FILTER_CONFIG);
|
||||
JAXBManager jaxb = new JAXBManager(MESOWestFilter.class,
|
||||
PluginDataObjectFilter.class);
|
||||
AbstractObsFilter filter = jaxb.unmarshalFromXmlFile(
|
||||
AbstractObsFilter.class, srcFile);
|
||||
this.setFilterElements(filter.getFilterElements());
|
||||
this.setFilterName(filter.getFilterName());
|
||||
} catch (JAXBException e) {
|
||||
logger.error("Unable to unmarshall filter config", e);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error creating filter. Creating default empty", e);
|
||||
setFilterName("Default");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply the list of filters against given input data.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public PluginDataObject[] filter(PluginDataObject[] reports) {
|
||||
int reportCount = 0;
|
||||
if (reports != null) {
|
||||
for (int i = 0; i < reports.length; i++) {
|
||||
boolean keep = false;
|
||||
for (AbstractFilterElement element : filterElements) {
|
||||
PluginDataObject r = element.filter(reports[i]);
|
||||
if (r != null) {
|
||||
if (AbstractObsFilter.INCLUDE_TYPE.equals(element
|
||||
.getFilterType())) {
|
||||
keep = keep | true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!keep) {
|
||||
reports[i] = null;
|
||||
} else {
|
||||
reportCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (reportCount == 0) {
|
||||
reports = new PluginDataObject[0];
|
||||
} else {
|
||||
PluginDataObject[] newReports = new PluginDataObject[reportCount];
|
||||
int i = 0;
|
||||
for (PluginDataObject report : reports) {
|
||||
if (report != null) {
|
||||
newReports[i++] = report;
|
||||
}
|
||||
}
|
||||
reports = newReports;
|
||||
}
|
||||
return reports;
|
||||
}
|
||||
|
||||
public static final void main(String[] args) {
|
||||
|
||||
AbstractObsFilter filter = new MESOWestFilter();
|
||||
filter.setFilterName("TestFilter");
|
||||
|
||||
RectFilterElement rect = new RectFilterElement();
|
||||
rect.setLowerRightLat(40.0);
|
||||
rect.setLowerRightLon(-90.0);
|
||||
rect.setUpperLeftLat(45.0);
|
||||
rect.setUpperLeftLon(-95.0);
|
||||
rect.setFilterElementName("OAX.WFO");
|
||||
rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
||||
filter.addFilterElement(rect);
|
||||
|
||||
rect = new RectFilterElement();
|
||||
rect.setLowerRightLat(46.0);
|
||||
rect.setLowerRightLon(-90.0);
|
||||
rect.setUpperLeftLat(49.0);
|
||||
rect.setUpperLeftLon(-100.0);
|
||||
rect.setFilterElementName("Upperbasin");
|
||||
rect.setFilterType(AbstractObsFilter.INCLUDE_TYPE);
|
||||
filter.addFilterElement(rect);
|
||||
|
||||
String s = null;
|
||||
|
||||
try {
|
||||
JAXBContext ctx = JAXBContext.newInstance(MESOWestFilter.class,
|
||||
RectFilterElement.class);
|
||||
|
||||
Marshaller msh = ctx.createMarshaller();
|
||||
|
||||
msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
|
||||
|
||||
ByteArrayOutputStream istrm = new ByteArrayOutputStream();
|
||||
msh.marshal(filter, istrm);
|
||||
|
||||
s = istrm.toString();
|
||||
|
||||
System.out.println(s);
|
||||
|
||||
rect = null;
|
||||
filter = null;
|
||||
|
||||
Unmarshaller umsh = ctx.createUnmarshaller();
|
||||
|
||||
ByteArrayInputStream ostrm = new ByteArrayInputStream(s.getBytes());
|
||||
filter = (AbstractObsFilter) umsh.unmarshal(ostrm);
|
||||
|
||||
System.out.println(filter.getFilterName());
|
||||
System.out.println(filter.getClass().getName());
|
||||
|
||||
List<AbstractFilterElement> elements = filter.getFilterElements();
|
||||
for (AbstractFilterElement element : elements) {
|
||||
System.out.println(element.getFilterElementName());
|
||||
}
|
||||
|
||||
} catch (JAXBException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,218 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.edex.esb.Headers;
|
||||
import com.raytheon.edex.plugin.AbstractRecordSeparator;
|
||||
import com.raytheon.uf.edex.decodertools.core.DecoderInput;
|
||||
import com.raytheon.uf.edex.decodertools.core.IDecoderInput;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.decoder.MESOWestConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 20090310 1969 jkorman Initial Coding.
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
public class MESOWestSeparator extends AbstractRecordSeparator {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private static final int MIN_LINE_LEN = 10;
|
||||
|
||||
private byte[] messageData = null;
|
||||
|
||||
private Headers headerData = null;
|
||||
|
||||
private List<String> reports = null;
|
||||
|
||||
private String traceId = null;
|
||||
|
||||
private int currentReport = -1;
|
||||
|
||||
private UUID uuid = null;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @param headers
|
||||
*/
|
||||
private MESOWestSeparator(byte[] data, Headers headers) {
|
||||
headerData = headers;
|
||||
if (headerData != null) {
|
||||
traceId = (String) headerData.get(MESOWestConstants.TRACEID);
|
||||
}
|
||||
|
||||
uuid = UUID.randomUUID();
|
||||
|
||||
setData(data, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty constructor so Spring doesn't complain. TODO : Make sure this is
|
||||
* needed.
|
||||
*/
|
||||
public MESOWestSeparator() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of a separator using the supplied data.
|
||||
*
|
||||
* @param data
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static MESOWestSeparator separate(byte[] data, Headers headers)
|
||||
throws Exception {
|
||||
return new MESOWestSeparator(data, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next record. This implementation returns the record as a String.
|
||||
*
|
||||
* @return The next observation record as a String.
|
||||
*/
|
||||
@Override
|
||||
public IDecoderInput next() {
|
||||
IDecoderInput data = null;
|
||||
if (hasNext()) {
|
||||
|
||||
String rpt = reports.get(currentReport++);
|
||||
data = new DecoderInput(null, rpt);
|
||||
data.setProperty("uuid", uuid.toString());
|
||||
|
||||
if (rpt.startsWith(MESOWestConstants.D_PARMLEADER)) {
|
||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
||||
MESOWestConstants.T_PARMHEADER);
|
||||
} else if (rpt.startsWith(MESOWestConstants.LAST_DATA_ITEM)) {
|
||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
||||
MESOWestConstants.T_LASTITEM);
|
||||
} else {
|
||||
data.setProperty(MESOWestConstants.K_DATATYPE,
|
||||
MESOWestConstants.T_REPORTDATA);
|
||||
}
|
||||
data.setProperty(MESOWestConstants.TRACEID, traceId);
|
||||
}
|
||||
logger.debug("Separator.next()");
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is there another record available?
|
||||
*
|
||||
* @return Is there another record available?
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
logger.debug("Separator.hasNext()");
|
||||
boolean hasNext = false;
|
||||
if (reports != null) {
|
||||
if (reports.size() > 0) {
|
||||
hasNext = currentReport < reports.size();
|
||||
} else {
|
||||
reports.clear();
|
||||
reports = null;
|
||||
}
|
||||
}
|
||||
return hasNext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the raw message data and invoke the internal message separation
|
||||
* process.
|
||||
*
|
||||
* @param rawMessage
|
||||
* The raw weather text message.
|
||||
*/
|
||||
@Override
|
||||
public void setData(byte[] rawMessage, Headers headers) {
|
||||
currentReport = -1;
|
||||
reports = new ArrayList<String>();
|
||||
if (rawMessage != null) {
|
||||
|
||||
InputStream strm = new ByteArrayInputStream(rawMessage);
|
||||
|
||||
separate(strm);
|
||||
}
|
||||
|
||||
if ((reports != null) && (reports.size() > 0)) {
|
||||
currentReport = 0;
|
||||
} else {
|
||||
logger.info("No reports found in data.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message data.
|
||||
*
|
||||
* @return The cleaned message data.
|
||||
*/
|
||||
public byte[] getMessage() {
|
||||
return messageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Separate the mesonet data, one report per line. No need to account for
|
||||
* reports spanning lines.
|
||||
*
|
||||
* @param strm
|
||||
* An input stream to the meso data.
|
||||
*/
|
||||
private void separate(InputStream strm) {
|
||||
BufferedReader in = null;
|
||||
|
||||
try {
|
||||
in = new BufferedReader(new InputStreamReader(strm));
|
||||
|
||||
String s = null;
|
||||
while ((s = in.readLine()) != null) {
|
||||
if (s.length() > MIN_LINE_LEN) {
|
||||
reports.add(s.trim());
|
||||
}
|
||||
}
|
||||
reports.add(MESOWestConstants.LAST_DATA_ITEM);
|
||||
|
||||
} catch (IOException ioe) {
|
||||
logger.error("Error reading mesowest data " + ioe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,772 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.common;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.measure.quantity.Angle;
|
||||
import javax.measure.quantity.Length;
|
||||
import javax.measure.quantity.Pressure;
|
||||
import javax.measure.quantity.Temperature;
|
||||
import javax.measure.quantity.Velocity;
|
||||
import javax.measure.unit.NonSI;
|
||||
import javax.measure.unit.SI;
|
||||
import javax.measure.unit.Unit;
|
||||
import javax.persistence.Access;
|
||||
import javax.persistence.AccessType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
|
||||
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
||||
/**
|
||||
* Record for mesowest data
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 03, 2009 jkorman Initial creation
|
||||
* Apr 12, 2013 1857 bgonzale Added SequenceGenerator annotation.
|
||||
* May 07, 2013 1869 bsteffen Remove dataURI column from
|
||||
* PluginDataObject.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Oct 22, 2013 2361 njensen Remove XML annotations
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "mesowestseq")
|
||||
@Table(name = "mesowest", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
|
||||
@DynamicSerialize
|
||||
public class MESOWestRecord extends PluginDataObject implements
|
||||
ISpatialEnabled, IDecoderGettable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public static final String OBS_TEXT = "text";
|
||||
|
||||
public static final Unit<Length> LENGTH_UNIT = SI.METER;
|
||||
|
||||
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.KELVIN;
|
||||
|
||||
public static final Unit<Velocity> WIND_SPEED_UNIT = SI.METERS_PER_SECOND;
|
||||
|
||||
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
|
||||
|
||||
public static final Unit<Pressure> PRESSURE_UNIT = SI.PASCAL;
|
||||
|
||||
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
|
||||
|
||||
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
|
||||
static {
|
||||
PARM_MAP.put("T", SFC_TEMP);
|
||||
PARM_MAP.put("DpT", SFC_DWPT);
|
||||
PARM_MAP.put("WS", SFC_WNDSPD);
|
||||
PARM_MAP.put("WD", SFC_WNDDIR);
|
||||
PARM_MAP.put("WGS", SFC_WNDGST);
|
||||
PARM_MAP.put("ASET", "SFC.PRESS.ALTIMETER");
|
||||
PARM_MAP.put("PMSL", PRES_SLP);
|
||||
PARM_MAP.put("NLAT", STA_LAT);
|
||||
PARM_MAP.put("NLON", STA_LON);
|
||||
PARM_MAP.put("STA", "STA");
|
||||
PARM_MAP.put("stationid", "STA");
|
||||
PARM_MAP.put("message", OBS_TEXT);
|
||||
PARM_MAP.put(OBS_TEXT, OBS_TEXT);
|
||||
}
|
||||
|
||||
@DataURI(position = 1)
|
||||
@DynamicSerializeElement
|
||||
private String networkType;
|
||||
|
||||
// Time of the observation.
|
||||
@DataURI(position = 2)
|
||||
@DynamicSerializeElement
|
||||
private Calendar timeObs;
|
||||
|
||||
@Embedded
|
||||
@DataURI(position = 3, embedded = true)
|
||||
@DynamicSerializeElement
|
||||
private SurfaceObsLocation location;
|
||||
|
||||
// Observation air temperature in degrees Kelvin.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double temp;
|
||||
|
||||
// Observation dewpoint temperature in degrees Kelvin.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double dwpt;
|
||||
|
||||
// 24 Hour maximum temperature in degrees Kelvin.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double maxT24;
|
||||
|
||||
// 24 Hour minimum temperature in degrees Kelvin.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double minT24;
|
||||
|
||||
// Relative Humidity in percent.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double humidity;
|
||||
|
||||
// Observation wind direction in angular degrees. Integer
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double windDirection;
|
||||
|
||||
// Observation wind speed in meters per second.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double windSpeed;
|
||||
|
||||
// Observation wind gust in meters per second.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double windGust;
|
||||
|
||||
// Observation pressure in Pa.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double pressure;
|
||||
|
||||
// Observation pressure in Pa.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double seaLevelPressure;
|
||||
|
||||
// Observation pressure in Pa.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double altimeter;
|
||||
|
||||
// Observation precip in mm.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip;
|
||||
|
||||
// 1 minute precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_01M;
|
||||
|
||||
// 5 minute precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_05M;
|
||||
|
||||
// 10 minute precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_10M;
|
||||
|
||||
// 15 minute precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_15M;
|
||||
|
||||
// 30 minute precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_30M;
|
||||
|
||||
// 1 hour precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_01H;
|
||||
|
||||
// 3 hour precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_03H;
|
||||
|
||||
// 6 hour precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_06H;
|
||||
|
||||
// 24 hour precip in inches.
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private Double precip_24H;
|
||||
|
||||
// Raw observation text
|
||||
@Column
|
||||
@DynamicSerializeElement
|
||||
private String obsText;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public MESOWestRecord() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for DataURI construction through base class. This is used by
|
||||
* the notification service.
|
||||
*
|
||||
* @param uri
|
||||
* A data uri applicable to this class.
|
||||
*/
|
||||
public MESOWestRecord(String uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this observation's geometry.
|
||||
*
|
||||
* @return The geometry for this observation.
|
||||
*/
|
||||
public Geometry getGeometry() {
|
||||
return location.getGeometry();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the geometry latitude.
|
||||
*
|
||||
* @return The geometry latitude.
|
||||
*/
|
||||
public double getLatitude() {
|
||||
return location.getLatitude();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the geometry longitude.
|
||||
*
|
||||
* @return The geometry longitude.
|
||||
*/
|
||||
public double getLongitude() {
|
||||
return location.getLongitude();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the station identifier for this observation.
|
||||
*
|
||||
* @return the stationId
|
||||
*/
|
||||
public String getStationId() {
|
||||
return location.getStationId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the elevation, in meters, of the observing platform or location.
|
||||
*
|
||||
* @return The observation elevation, in meters.
|
||||
*/
|
||||
public Integer getElevation() {
|
||||
return location.getElevation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the location
|
||||
*/
|
||||
public SurfaceObsLocation getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param location
|
||||
* the location to set
|
||||
*/
|
||||
public void setLocation(SurfaceObsLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getNetworkType() {
|
||||
return networkType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public void setNetworkType(String type) {
|
||||
networkType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the timeObs
|
||||
*/
|
||||
public Calendar getTimeObs() {
|
||||
return timeObs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeObs
|
||||
* the timeObs to set
|
||||
*/
|
||||
public void setTimeObs(Calendar timeObs) {
|
||||
this.timeObs = timeObs;
|
||||
}
|
||||
|
||||
// ******************************************
|
||||
|
||||
/**
|
||||
* @return the temp
|
||||
*/
|
||||
public Double getTemp() {
|
||||
return temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param temp
|
||||
* the temp to set
|
||||
*/
|
||||
public void setTemp(Double temp) {
|
||||
this.temp = temp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dwpt
|
||||
*/
|
||||
public Double getDwpt() {
|
||||
return dwpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dwpt
|
||||
* the dwpt to set
|
||||
*/
|
||||
public void setDwpt(Double dwpt) {
|
||||
this.dwpt = dwpt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maxT24
|
||||
*/
|
||||
public Double getMaxT24() {
|
||||
return maxT24;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param maxT24
|
||||
* the maxT24 to set
|
||||
*/
|
||||
public void setMaxT24(Double maxT24) {
|
||||
this.maxT24 = maxT24;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the minT24
|
||||
*/
|
||||
public Double getMinT24() {
|
||||
return minT24;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param minT24
|
||||
* the minT24 to set
|
||||
*/
|
||||
public void setMinT24(Double minT24) {
|
||||
this.minT24 = minT24;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the humidity
|
||||
*/
|
||||
public Double getHumidity() {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param humidity
|
||||
* the humidity to set
|
||||
*/
|
||||
public void setHumidity(Double humidity) {
|
||||
this.humidity = humidity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windDirection
|
||||
*/
|
||||
public Double getWindDirection() {
|
||||
return windDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windDirection
|
||||
* the windDirection to set
|
||||
*/
|
||||
public void setWindDirection(Double windDirection) {
|
||||
this.windDirection = windDirection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windSpeed
|
||||
*/
|
||||
public Double getWindSpeed() {
|
||||
return windSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windSpeed
|
||||
* the windSpeed to set
|
||||
*/
|
||||
public void setWindSpeed(Double windSpeed) {
|
||||
this.windSpeed = windSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the windGust
|
||||
*/
|
||||
public Double getWindGust() {
|
||||
return windGust;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windGust
|
||||
* the windGust to set
|
||||
*/
|
||||
public void setWindGust(Double windGust) {
|
||||
this.windGust = windGust;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pressure
|
||||
*/
|
||||
public Double getPressure() {
|
||||
return pressure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pressure
|
||||
* the pressure to set
|
||||
*/
|
||||
public void setPressure(Double pressure) {
|
||||
this.pressure = pressure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the seaLevelPressure
|
||||
*/
|
||||
public Double getSeaLevelPressure() {
|
||||
return seaLevelPressure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param seaLevelPressure
|
||||
* the seaLevelPressure to set
|
||||
*/
|
||||
public void setSeaLevelPressure(Double seaLevelPressure) {
|
||||
this.seaLevelPressure = seaLevelPressure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the altimeter
|
||||
*/
|
||||
public Double getAltimeter() {
|
||||
return altimeter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param altimeter
|
||||
* the altimeter to set
|
||||
*/
|
||||
public void setAltimeter(Double altimeter) {
|
||||
this.altimeter = altimeter;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip
|
||||
*/
|
||||
public Double getPrecip() {
|
||||
return precip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip
|
||||
* the precip to set
|
||||
*/
|
||||
public void setPrecip(Double precip) {
|
||||
this.precip = precip;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_01M
|
||||
*/
|
||||
public Double getPrecip_01M() {
|
||||
return precip_01M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_01M
|
||||
* the precip_01M to set
|
||||
*/
|
||||
public void setPrecip_01M(Double precip_01M) {
|
||||
this.precip_01M = precip_01M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_05M
|
||||
*/
|
||||
public Double getPrecip_05M() {
|
||||
return precip_05M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_05M
|
||||
* the precip_05M to set
|
||||
*/
|
||||
public void setPrecip_05M(Double precip_05M) {
|
||||
this.precip_05M = precip_05M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_10M
|
||||
*/
|
||||
public Double getPrecip_10M() {
|
||||
return precip_10M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_10M
|
||||
* the precip_10M to set
|
||||
*/
|
||||
public void setPrecip_10M(Double precip_10M) {
|
||||
this.precip_10M = precip_10M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_15M
|
||||
*/
|
||||
public Double getPrecip_15M() {
|
||||
return precip_15M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_15M
|
||||
* the precip_15M to set
|
||||
*/
|
||||
public void setPrecip_15M(Double precip_15M) {
|
||||
this.precip_15M = precip_15M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_30M
|
||||
*/
|
||||
public Double getPrecip_30M() {
|
||||
return precip_30M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_30M
|
||||
* the precip_30M to set
|
||||
*/
|
||||
public void setPrecip_30M(Double precip_30M) {
|
||||
this.precip_30M = precip_30M;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_01H
|
||||
*/
|
||||
public Double getPrecip_01H() {
|
||||
return precip_01H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_01H
|
||||
* the precip_01H to set
|
||||
*/
|
||||
public void setPrecip_01H(Double precip_01H) {
|
||||
this.precip_01H = precip_01H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_03H
|
||||
*/
|
||||
public Double getPrecip_03H() {
|
||||
return precip_03H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_03H
|
||||
* the precip_03H to set
|
||||
*/
|
||||
public void setPrecip_03H(Double precip_03H) {
|
||||
this.precip_03H = precip_03H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_06H
|
||||
*/
|
||||
public Double getPrecip_06H() {
|
||||
return precip_06H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_06H
|
||||
* the precip_06H to set
|
||||
*/
|
||||
public void setPrecip_06H(Double precip_06H) {
|
||||
this.precip_06H = precip_06H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the precip_24H
|
||||
*/
|
||||
public Double getPrecip_24H() {
|
||||
return precip_24H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param precip_24H
|
||||
* the precip_24H to set
|
||||
*/
|
||||
public void setPrecip_24H(Double precip_24H) {
|
||||
this.precip_24H = precip_24H;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the obsText
|
||||
*/
|
||||
public String getObsText() {
|
||||
return obsText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param obsText
|
||||
* the obsText to set
|
||||
*/
|
||||
public void setObsText(String obsText) {
|
||||
this.obsText = obsText;
|
||||
}
|
||||
|
||||
// ******************************************
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setSpatialObject(SurfaceObsLocation loc) {
|
||||
location = loc;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public SurfaceObsLocation getSpatialObject() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class implements IDecoderGettable so return this instance.
|
||||
*
|
||||
* @return The reference to this instance.
|
||||
*/
|
||||
@Override
|
||||
public IDecoderGettable getDecoderGettable() {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public String getString(String paramName) {
|
||||
String retValue = null;
|
||||
String pName = PARM_MAP.get(paramName);
|
||||
if ("STA".matches(pName)) {
|
||||
retValue = getStationId();
|
||||
} else if (OBS_TEXT.equals(pName)) {
|
||||
retValue = getStationId();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStrings(String paramName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Amount getValue(String paramName) {
|
||||
Amount a = null;
|
||||
String pName = PARM_MAP.get(paramName);
|
||||
|
||||
if (SFC_TEMP.equals(pName)) {
|
||||
a = new Amount(temp, TEMPERATURE_UNIT);
|
||||
} else if (SFC_DWPT.equals(pName)) {
|
||||
a = new Amount(dwpt, TEMPERATURE_UNIT);
|
||||
} else if (SFC_WNDSPD.equals(pName)) {
|
||||
a = new Amount(windSpeed, WIND_SPEED_UNIT);
|
||||
} else if (SFC_WNDGST.equals(pName)) {
|
||||
a = new Amount(windGust, WIND_SPEED_UNIT);
|
||||
} else if (SFC_WNDDIR.equals(pName)) {
|
||||
a = new Amount(windDirection, WIND_DIR_UNIT);
|
||||
} else if (PRES_ALTSG.equals(pName)) {
|
||||
a = new Amount(altimeter, PRESSURE_UNIT);
|
||||
} else if (STA_LAT.equals(pName)) {
|
||||
a = new Amount(getLatitude(), LOCATION_UNIT);
|
||||
} else if (STA_LON.equals(pName)) {
|
||||
a = new Amount(getLongitude(), LOCATION_UNIT);
|
||||
} else if (PRES_SLP.equals(pName)) {
|
||||
a = new Amount(seaLevelPressure, PRESSURE_UNIT);
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Collection<Amount> getValues(String paramName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Column
|
||||
@Access(AccessType.PROPERTY)
|
||||
public String getDataURI() {
|
||||
return super.getDataURI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "mesowest";
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.edex.db.dao.DefaultPluginDao;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.edex.database.DataAccessLayerException;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2009 1939 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MESOWestDao extends DefaultPluginDao {
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new ReccoDao
|
||||
* @throws PluginException
|
||||
*/
|
||||
public MESOWestDao(String pluginName) throws PluginException {
|
||||
super(pluginName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an bufrua report using the datauri .
|
||||
*
|
||||
* @param dataURI
|
||||
* The dataURI to match against.
|
||||
* @return The report record if it exists.
|
||||
*/
|
||||
public MESOWestRecord queryByDataURI(String dataURI) {
|
||||
MESOWestRecord report = null;
|
||||
List<?> obs = null;
|
||||
try {
|
||||
obs = queryBySingleCriteria("dataURI", dataURI);
|
||||
} catch (DataAccessLayerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if((obs != null)&&(obs.size() > 0)) {
|
||||
report = (MESOWestRecord) obs.get(0);
|
||||
}
|
||||
return report;
|
||||
}
|
||||
}
|
|
@ -1,164 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.decoder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2009 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MESOWestConstants {
|
||||
|
||||
public static final String LAST_DATA_ITEM = "##### LAST DATA ITEM #####";
|
||||
|
||||
public static final String TRACEID = "traceId";
|
||||
|
||||
public static final String K_DATATYPE = "datatype";
|
||||
|
||||
public static final String T_PARMHEADER = "parmheader";
|
||||
|
||||
public static final String T_REPORTDATA = "report";
|
||||
|
||||
public static final String T_LASTITEM = LAST_DATA_ITEM;
|
||||
|
||||
public static final String D_PARMLEADER = "PARM =";
|
||||
|
||||
public static final String D_PARM_DELIMIT = ";";
|
||||
|
||||
public static final String P_STNID = "STNID";
|
||||
|
||||
public static final String P_LAT = "latitude";
|
||||
|
||||
public static final String P_LON = "longitude";
|
||||
|
||||
public static final String P_ELEV = "ELEV";
|
||||
|
||||
public static final String P_STNTYPE = "STNTYPE";
|
||||
|
||||
public static final String P_DATATIME = "DATETIME";
|
||||
|
||||
//*******************************************
|
||||
|
||||
public static final String P_SFCTEMP = "TMPF";
|
||||
|
||||
public static final String P_SFCDWPT = "DWPF";
|
||||
//************************
|
||||
|
||||
public static final String P_MIN_T_24H = "LO24";
|
||||
|
||||
public static final String P_MAX_T_24H = "HI24";
|
||||
|
||||
//************************
|
||||
public static final String P_WINDSPD = "SKNT";
|
||||
|
||||
public static final String P_WINDDIR = "DRCT";
|
||||
|
||||
public static final String P_WINDGST = "GUST";
|
||||
|
||||
public static final String P_HUMIDITY = "RELH";
|
||||
|
||||
public static final String P_PRESSURE = "PRES";
|
||||
|
||||
public static final String P_ALTIMETER = "ALTI";
|
||||
|
||||
public static final String P_SEA_LVL_PRES = "PMSL";
|
||||
|
||||
//************************
|
||||
public static final String P_PRECIP_01M = "P1MI";
|
||||
|
||||
public static final String P_PRECIP_05M = "P05I";
|
||||
|
||||
public static final String P_PRECIP_10M = "P10I";
|
||||
|
||||
public static final String P_PRECIP_15M = "P15I";
|
||||
|
||||
public static final String P_PRECIP_30M = "P30I";
|
||||
|
||||
public static final String P_PRECIP_01H = "P01I";
|
||||
|
||||
public static final String P_PRECIP_03H = "P03I";
|
||||
|
||||
public static final String P_PRECIP_06H = "P06I";
|
||||
|
||||
public static final String P_PRECIP_24H = "P24I";
|
||||
|
||||
private static int PARM_POS = 0;
|
||||
private static Map<Integer,String> parmMap = new HashMap<Integer,String>();
|
||||
static {
|
||||
parmMap.put(PARM_POS++,P_STNID);
|
||||
parmMap.put(PARM_POS++,P_LAT);
|
||||
parmMap.put(PARM_POS++,P_LON);
|
||||
parmMap.put(PARM_POS++,P_ELEV);
|
||||
parmMap.put(PARM_POS++,P_STNTYPE);
|
||||
parmMap.put(PARM_POS++,P_DATATIME);
|
||||
}
|
||||
|
||||
// YYYYMMDD/HHMM
|
||||
// 20090303/1950
|
||||
|
||||
public static final String D_DATEFMT = "yyyyMMdd/HHmm";
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static int getParmPos() {
|
||||
return PARM_POS;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<Integer,String> getParmMap() {
|
||||
Map<Integer,String> map = new HashMap<Integer,String>();
|
||||
map.putAll(parmMap);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, MESOWestElement> getValuesMap() {
|
||||
Map<String, MESOWestElement> values = new HashMap<String, MESOWestElement>();
|
||||
for(String s : parmMap.values()) {
|
||||
values.put(s, new MESOWestElement(s));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.decoder;
|
||||
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2009 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MESOWestElement {
|
||||
|
||||
private final String elementName;
|
||||
|
||||
private String elementValue = null;
|
||||
|
||||
public MESOWestElement(String name) {
|
||||
elementName = name;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getElementName() {
|
||||
return elementName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getElementValue() {
|
||||
return elementValue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setElementValue(String value) {
|
||||
elementValue = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return elementValue;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,345 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.decoder;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.edex.decodertools.core.DecoderTools;
|
||||
import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2009 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MESOWestParser {
|
||||
|
||||
private Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private Map<Integer, String> paramMap = null;
|
||||
|
||||
private Map<String, MESOWestElement> valuesMap = null;
|
||||
|
||||
private SimpleDateFormat dateFormat = new SimpleDateFormat(
|
||||
MESOWestConstants.D_DATEFMT);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parameters
|
||||
*/
|
||||
public MESOWestParser(String parameters) {
|
||||
|
||||
paramMap = MESOWestConstants.getParmMap();
|
||||
valuesMap = MESOWestConstants.getValuesMap();
|
||||
parameters = parameters.trim();
|
||||
if (parameters.startsWith(MESOWestConstants.D_PARMLEADER)) {
|
||||
|
||||
parameters = parameters.substring(
|
||||
MESOWestConstants.D_PARMLEADER.length()).trim();
|
||||
|
||||
String[] parms = parameters.split(MESOWestConstants.D_PARM_DELIMIT,
|
||||
-1);
|
||||
|
||||
int index = MESOWestConstants.getParmPos();
|
||||
for (String s : parms) {
|
||||
paramMap.put(index, s);
|
||||
valuesMap.put(s, new MESOWestElement(s));
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param report
|
||||
* @return
|
||||
*/
|
||||
public MESOWestRecord decode(String report) {
|
||||
// Clear out the old data!
|
||||
clearValueMap();
|
||||
String[] parts = report.split(",", -1);
|
||||
|
||||
if ((parts != null) && (parts.length > 5)) {
|
||||
int index = 0;
|
||||
for (String s : parts) {
|
||||
String elementName = paramMap.get(index++);
|
||||
|
||||
MESOWestElement element = valuesMap.get(elementName);
|
||||
if (element != null) {
|
||||
element.setElementValue(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return getDecodedData();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private MESOWestRecord getDecodedData() {
|
||||
|
||||
MESOWestRecord record = getLocationInfo(new MESOWestRecord());
|
||||
if (record != null) {
|
||||
// Now go get specific data elements
|
||||
Double val = getFloatValue(MESOWestConstants.P_SFCTEMP);
|
||||
val = DecoderTools.fahrenheitToCelsius(val);
|
||||
record.setTemp(DecoderTools.celsiusToKelvin(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_SFCDWPT);
|
||||
val = DecoderTools.fahrenheitToCelsius(val);
|
||||
record.setDwpt(DecoderTools.celsiusToKelvin(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_MAX_T_24H);
|
||||
val = DecoderTools.fahrenheitToCelsius(val);
|
||||
record.setMaxT24(DecoderTools.celsiusToKelvin(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_MIN_T_24H);
|
||||
val = DecoderTools.fahrenheitToCelsius(val);
|
||||
record.setMinT24(DecoderTools.celsiusToKelvin(val));
|
||||
|
||||
record.setHumidity(getFloatValue(MESOWestConstants.P_HUMIDITY));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_WINDSPD);
|
||||
record.setWindSpeed(DecoderTools.ktsToMSec(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_WINDGST);
|
||||
record.setWindGust(DecoderTools.ktsToMSec(val));
|
||||
|
||||
record.setWindDirection(getFloatValue(MESOWestConstants.P_WINDDIR));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_PRESSURE);
|
||||
record.setPressure(DecoderTools.hPaToPa(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_ALTIMETER);
|
||||
record.setAltimeter(DecoderTools.inToPa(val));
|
||||
|
||||
val = getFloatValue(MESOWestConstants.P_SEA_LVL_PRES);
|
||||
record.setSeaLevelPressure(DecoderTools.hPaToPa(val));
|
||||
|
||||
|
||||
record.setPrecip_01M(getFloatValue(MESOWestConstants.P_PRECIP_01M));
|
||||
record.setPrecip_05M(getFloatValue(MESOWestConstants.P_PRECIP_05M));
|
||||
record.setPrecip_10M(getFloatValue(MESOWestConstants.P_PRECIP_10M));
|
||||
record.setPrecip_15M(getFloatValue(MESOWestConstants.P_PRECIP_15M));
|
||||
record.setPrecip_30M(getFloatValue(MESOWestConstants.P_PRECIP_30M));
|
||||
record.setPrecip_01H(getFloatValue(MESOWestConstants.P_PRECIP_01H));
|
||||
record.setPrecip_03H(getFloatValue(MESOWestConstants.P_PRECIP_03H));
|
||||
record.setPrecip_06H(getFloatValue(MESOWestConstants.P_PRECIP_06H));
|
||||
record.setPrecip_24H(getFloatValue(MESOWestConstants.P_PRECIP_24H));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the parsed values from each element prior to accepting new data.
|
||||
*/
|
||||
private void clearValueMap() {
|
||||
for (MESOWestElement element : valuesMap.values()) {
|
||||
element.setElementValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private MESOWestRecord getLocationInfo(MESOWestRecord data) {
|
||||
|
||||
Calendar obsTime = null;
|
||||
|
||||
MESOWestElement m = valuesMap.get(MESOWestConstants.P_DATATIME);
|
||||
if (m != null) {
|
||||
String s = m.getElementValue();
|
||||
if (s != null) {
|
||||
try {
|
||||
Date d = dateFormat.parse(s);
|
||||
if (d != null) {
|
||||
Calendar c = TimeTools.newCalendar(d.getTime());
|
||||
if (c != null) {
|
||||
obsTime = TimeTools.copy(c);
|
||||
data.setTimeObs(obsTime);
|
||||
|
||||
DataTime t = new DataTime(TimeTools.copy(obsTime));
|
||||
data.setDataTime(t);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
logger.error("Invalid date [" + s + "]");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.error("Date missing");
|
||||
data = null;
|
||||
}
|
||||
|
||||
if (obsTime != null) {
|
||||
|
||||
Double lat = getFloatValue(MESOWestConstants.P_LAT);
|
||||
Double lon = getFloatValue(MESOWestConstants.P_LON);
|
||||
Integer elev = getIntValue(MESOWestConstants.P_ELEV);
|
||||
|
||||
if ((lat != null) && (lon != null) && (elev != null)) {
|
||||
SurfaceObsLocation location = new SurfaceObsLocation();
|
||||
location.assignLocation(lat, lon);
|
||||
location.setElevation(elev);
|
||||
|
||||
String stnId = getStringValue(MESOWestConstants.P_STNID);
|
||||
if (stnId != null) {
|
||||
location.setStationId(stnId);
|
||||
|
||||
data.setSpatialObject(location);
|
||||
data.setNetworkType(getStringValue(MESOWestConstants.P_STNTYPE));
|
||||
} else {
|
||||
data = null;
|
||||
logger.error("Station Id missing");
|
||||
}
|
||||
} else {
|
||||
data = null;
|
||||
logger.error("Spatial information missing");
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private String getStringValue(String key) {
|
||||
String sValue = null;
|
||||
|
||||
MESOWestElement value = valuesMap.get(key);
|
||||
if (value != null) {
|
||||
sValue = value.getElementValue();
|
||||
}
|
||||
return sValue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private Double getFloatValue(String key) {
|
||||
Double floatValue = null;
|
||||
|
||||
MESOWestElement value = valuesMap.get(key);
|
||||
if (value != null) {
|
||||
try {
|
||||
floatValue = Double.parseDouble(value.getElementValue());
|
||||
} catch (NumberFormatException nfe) {
|
||||
|
||||
}
|
||||
}
|
||||
return floatValue;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
private Integer getIntValue(String key) {
|
||||
Integer intValue = null;
|
||||
|
||||
MESOWestElement value = valuesMap.get(key);
|
||||
if (value != null) {
|
||||
try {
|
||||
intValue = Integer.parseInt(value.getElementValue());
|
||||
} catch (NumberFormatException nfe) {
|
||||
|
||||
}
|
||||
}
|
||||
return intValue;
|
||||
}
|
||||
|
||||
public static final void main(String[] args) {
|
||||
|
||||
String parms = " PARM = TMPF;RELH;SKNT;GUST;DRCT;QFLG;DWPF;PRES;PMSL;ALTI;P03D;SOLR;WNUM;VSBY;CHC1;CHC2;CHC3;CIG;TLKE;FT;FM;HI6;LO6;PEAK;HI24;LO24;PREC;P01I;P03I;P06I;P24I;P05I;P10I;P15I;SNOW;PACM;SACM;WEQS;P30I;PWVP;TSOI;MSOI;STEN;TSRD;EVAP;TRD1;TRD2;TRD3;TRD4;TFZ1;TFZ2;TFZ3;TFZ4;RSS1;RSS2;RSS3;RSS4";
|
||||
|
||||
String data1 = "KAAT,41.49139,-120.56444,4373,1,20090303/2009,32,92.96,18,27,230,2,30.2,,,29.81,,,740,0.5,36,73,194,700,,,,,,27,,,,0.01,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
|
||||
|
||||
String data2 = "KRSP,,,,1,20090312/1254,28.94,53.05,7,19,340,,14,,1031.2,30.39,,,,10,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
|
||||
MESOWestParser parser = new MESOWestParser(parms);
|
||||
|
||||
MESOWestRecord record = parser.decode(data2);
|
||||
|
||||
System.out.println("******************************");
|
||||
if (record != null) {
|
||||
Calendar c = record.getTimeObs();
|
||||
if (c != null) {
|
||||
System.out.println(String.format(
|
||||
"* time | %1$tY%1$tm%1$td%1$tH%1$tM", record
|
||||
.getTimeObs()));
|
||||
} else {
|
||||
System.out.println("* time | null");
|
||||
}
|
||||
System.out.println("* latitude | " + record.getLatitude());
|
||||
System.out.println("* longitude | " + record.getLongitude());
|
||||
System.out.println("* station id | " + record.getStationId());
|
||||
System.out.println("* network | " + record.getNetworkType());
|
||||
|
||||
System.out.println("*************");
|
||||
System.out.println("* temperature = " + record.getTemp());
|
||||
System.out.println("* dewpoint = " + record.getDwpt());
|
||||
System.out.println("* humidity % = " + record.getHumidity());
|
||||
System.out.println("* wind speed = " + record.getWindSpeed());
|
||||
System.out.println("* wind gust = " + record.getWindGust());
|
||||
System.out.println("* wind direction = "
|
||||
+ record.getWindDirection());
|
||||
System.out.println("* pressure = " + record.getPressure());
|
||||
System.out.println("* slp = "
|
||||
+ record.getSeaLevelPressure());
|
||||
System.out.println("* altimeter = " + record.getAltimeter());
|
||||
} else {
|
||||
System.out.println("* No data decoded");
|
||||
System.out.println("*************");
|
||||
System.out.println("******************************");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.decoder;
|
||||
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2009 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MWFloatElement extends MESOWestElement {
|
||||
|
||||
private Double floatValue = null;
|
||||
|
||||
public MWFloatElement(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void setElementValue(String value) {
|
||||
super.setElementValue(value);
|
||||
|
||||
try {
|
||||
floatValue = Double.parseDouble(value);
|
||||
} catch(NumberFormatException nfe) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
||||
|
||||
|
||||
|
||||
return record;
|
||||
}
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.edex.plugin.mesowest.decoder;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.uf.edex.plugin.mesowest.common.MESOWestRecord;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 10, 2009 jkorman Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author jkorman
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MWIntElement extends MESOWestElement {
|
||||
|
||||
private Integer intValue = null;
|
||||
|
||||
public MWIntElement(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
@Override
|
||||
public void setElementValue(String value) {
|
||||
super.setElementValue(value);
|
||||
|
||||
try {
|
||||
intValue = Integer.parseInt(value);
|
||||
} catch(NumberFormatException nfe) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MESOWestRecord getDecodedData(MESOWestRecord record) {
|
||||
|
||||
StringBuilder sb = new StringBuilder(getElementName());
|
||||
sb.setCharAt(0,Character.toUpperCase(sb.charAt(0)));
|
||||
sb.insert(0,"get");
|
||||
|
||||
String methodName = sb.toString();
|
||||
Method m = null;
|
||||
|
||||
try {
|
||||
m = record.getClass().getDeclaredMethod(methodName, Integer.class);
|
||||
if(m != null) {
|
||||
|
||||
try {
|
||||
m.invoke(record, intValue);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (SecurityException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.plugin.unitconverter</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,8 +0,0 @@
|
|||
#Thu May 09 11:58:40 CDT 2013
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,12 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Unitconverter
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.plugin.unitconverter
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: ucar.nc2;bundle-version="1.0.0",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.edex.plugin.unitconverter
|
|
@ -1,4 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
|
@ -1,199 +0,0 @@
|
|||
/**
|
||||
* Copyright 09/24/12 Raytheon Company.
|
||||
*
|
||||
* Unlimited Rights
|
||||
* This software was developed pursuant to Contract Number
|
||||
* DTFAWA-10-D-00028 with the US Government. The US Government’s rights
|
||||
* in and to this copyrighted software are as specified in DFARS
|
||||
* 252.227-7014 which was made part of the above contract.
|
||||
*/
|
||||
package com.raytheon.uf.edex.plugin.unitconverter;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.measure.unit.UnitFormat;
|
||||
|
||||
import ucar.units.NoSuchUnitException;
|
||||
import ucar.units.PrefixDBException;
|
||||
import ucar.units.SpecificationException;
|
||||
import ucar.units.UnitDBException;
|
||||
import ucar.units.UnitFormatManager;
|
||||
import ucar.units.UnitParseException;
|
||||
import ucar.units.UnitSystemException;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 9, 2013 ekladstrup Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ekladstrup
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class UnitLookup {
|
||||
|
||||
private final IUFStatusHandler log = UFStatus.getHandler(this.getClass());
|
||||
|
||||
protected static UnitLookup instance = null;
|
||||
|
||||
protected Map<javax.measure.unit.Unit<?>, ucar.units.Unit> jsrToUcarMap = new HashMap<javax.measure.unit.Unit<?>, ucar.units.Unit>();
|
||||
|
||||
protected Map<ucar.units.Unit, javax.measure.unit.Unit<?>> ucarToJsrMap = new HashMap<ucar.units.Unit, javax.measure.unit.Unit<?>>();
|
||||
|
||||
protected UnitLookup() {
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationContext[] searchHierarchy = pm
|
||||
.getLocalSearchHierarchy(LocalizationType.EDEX_STATIC);
|
||||
|
||||
LocalizationFile unitFile = null;
|
||||
|
||||
for (LocalizationContext ctx : searchHierarchy) {
|
||||
LocalizationFile localizationFile = pm.getLocalizationFile(ctx,
|
||||
"wxsrv" + IPathManager.SEPARATOR + "units"
|
||||
+ IPathManager.SEPARATOR + "unitMapping.tsv");
|
||||
|
||||
if (localizationFile.exists() && unitFile == null) {
|
||||
unitFile = localizationFile;
|
||||
}
|
||||
}
|
||||
|
||||
File file = unitFile.getFile();
|
||||
|
||||
BufferedReader reader = null;
|
||||
|
||||
try {
|
||||
if (file.exists() && file.canRead()) {
|
||||
reader = new BufferedReader(new FileReader(file));
|
||||
|
||||
String line = reader.readLine();
|
||||
|
||||
while (line != null) {
|
||||
if (!line.startsWith("#") && !line.trim().isEmpty()) {
|
||||
String[] unitStrings = line.split("\t");
|
||||
String jsrUnitString = unitStrings[0];
|
||||
String udunitString = unitStrings[1];
|
||||
|
||||
try {
|
||||
if (jsrUnitString != null
|
||||
&& !jsrUnitString.isEmpty()
|
||||
&& udunitString != null
|
||||
&& !udunitString.isEmpty()) {
|
||||
javax.measure.unit.Unit<?> jsrUnit = (javax.measure.unit.Unit<?>) UnitFormat
|
||||
.getUCUMInstance().parseObject(
|
||||
jsrUnitString);
|
||||
ucar.units.Unit udunit = UnitFormatManager
|
||||
.instance().parse(udunitString);
|
||||
|
||||
jsrToUcarMap.put(jsrUnit, udunit);
|
||||
ucarToJsrMap.put(udunit, jsrUnit);
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
log.warn("Unable to parse javax unit string \""
|
||||
+ jsrUnitString + "\"");
|
||||
} catch (NoSuchUnitException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
} catch (UnitParseException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
} catch (SpecificationException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
} catch (UnitDBException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
} catch (PrefixDBException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
} catch (UnitSystemException e) {
|
||||
log.warn("Unable to parse ucar unit string \""
|
||||
+ udunitString + "\"");
|
||||
}
|
||||
}
|
||||
line = reader.readLine();
|
||||
}
|
||||
} else {
|
||||
log.error("Unable to open unit mapping file "
|
||||
+ file.getAbsolutePath());
|
||||
}
|
||||
} catch (FileNotFoundException e1) {
|
||||
// file not found even after file.exists() check
|
||||
log.error(
|
||||
"unit mapping file not found at " + file.getAbsolutePath(),
|
||||
e1);
|
||||
} catch (IOException e1) {
|
||||
// failed to read file even after file.canRead() check
|
||||
log.error(
|
||||
"Unable to read unit mapping file "
|
||||
+ file.getAbsolutePath(), e1);
|
||||
} finally {
|
||||
if (reader != null) {
|
||||
try {
|
||||
reader.close();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static UnitLookup getInstance() {
|
||||
if (instance == null) {
|
||||
synchronized (UnitLookup.class) {
|
||||
if (instance == null) {
|
||||
instance = new UnitLookup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* From a ucar unit return the jsr unit, or null if not found
|
||||
*
|
||||
* @param ucarUnit
|
||||
* @return a jsr unit or null if not found
|
||||
*/
|
||||
public javax.measure.unit.Unit<?> getJsrFromUcar(ucar.units.Unit ucarUnit) {
|
||||
return ucarToJsrMap.get(ucarUnit);
|
||||
}
|
||||
|
||||
/**
|
||||
* From a jsr unit return the ucar unit or null if not found
|
||||
*
|
||||
* @param jsrUnit
|
||||
* @return
|
||||
*/
|
||||
public ucar.units.Unit getUcarFromJsr(javax.measure.unit.Unit<?> jsrUnit) {
|
||||
return jsrToUcarMap.get(jsrUnit);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
# jsr ucar
|
||||
#tab separated
|
||||
Pa*s^-1 kg.m-1.s-3
|
||||
mm*s^-1 0.0010 m.s-1
|
||||
mm 0.0010 m
|
||||
Pa Pa
|
||||
s^-1 s-1
|
||||
m m
|
||||
K K
|
||||
K*s^-1 K.s-1
|
||||
m*s^-1 m.s-1
|
||||
degree_angle 0.017453292519943295 rad
|
||||
s s
|
||||
J*kg^-1 m2.s-2
|
||||
% 0.01
|
||||
kg*m^-2 kg.m-2
|
Can't render this file because it has a wrong number of fields in line 2.
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.edex.wcs</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,8 +0,0 @@
|
|||
#Thu Feb 16 10:57:42 CST 2012
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,36 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Wcs
|
||||
Bundle-SymbolicName: com.raytheon.uf.edex.wcs
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: com.raytheon.uf.edex.ogc.common;bundle-version="1.0.0",
|
||||
net.opengis;bundle-version="1.0.2",
|
||||
org.geotools;bundle-version="2.6.4",
|
||||
com.raytheon.edex.common;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.localization;bundle-version="1.12.1174",
|
||||
javax.measure;bundle-version="1.0.0",
|
||||
org.apache.commons.codec;bundle-version="1.4.0",
|
||||
org.apache.commons.pool;bundle-version="1.3.0",
|
||||
ogc.tools.gml;bundle-version="1.0.2",
|
||||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
org.apache.camel;bundle-version="1.0.0",
|
||||
org.apache.commons.cxf;bundle-version="1.0.0",
|
||||
javax.persistence;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.nc4;bundle-version="1.0.0",
|
||||
com.raytheon.uf.edex.plugin.dataset.urn;bundle-version="1.0.0",
|
||||
ucar.nc2;bundle-version="1.0.0",
|
||||
org.apache.commons.collections;bundle-version="3.2.0",
|
||||
com.raytheon.uf.edex.plugin.unitconverter;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.spatial;bundle-version="1.0.0",
|
||||
org.eclipse.jetty;bundle-version="7.6.9",
|
||||
com.raytheon.uf.common.status;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.log;bundle-version="1.12.1174"
|
||||
Export-Package: com.raytheon.uf.edex.wcs,
|
||||
com.raytheon.uf.edex.wcs.format,
|
||||
com.raytheon.uf.edex.wcs.provider,
|
||||
com.raytheon.uf.edex.wcs.querystore,
|
||||
com.raytheon.uf.edex.wcs.reg,
|
||||
com.raytheon.uf.edex.wcs.request,
|
||||
com.raytheon.uf.edex.wcs.soap1_1_2
|
|
@ -1,135 +0,0 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:wcs="http://www.opengis.net/wcs/1.1" xmlns:wcs-soap="http://www.opengis.net/wcs/soap/1.1"
|
||||
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:ows="http://www.opengis.net/ows/1.1" targetNamespace="http://wcs.edex.uf.raytheon.com"
|
||||
xmlns:tns="http://wcs.edex.uf.raytheon.com" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- WCS request/response types -->
|
||||
<!-- ============================================================== -->
|
||||
<wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:schema targetNamespace="http://www.opengis.net/wcs/1.1" xmlns:wcs="http://www.opengis.net/wcs/1.1" xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
|
||||
elementFormDefault="qualified" version="1.1.2">
|
||||
<xsd:include schemaLocation="http://schemas.opengis.net/wcs/1.1/wcsAll.xsd" />
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- WCS request messages -->
|
||||
<!-- ============================================================== -->
|
||||
<wsdl:message name="GetCapabilitiesRequest">
|
||||
<wsdl:part name="Body" element="wcs:GetCapabilities" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="DescribeCoverageRequest">
|
||||
<wsdl:part name="Body" element="wcs:DescribeCoverage" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetCoverageRequest">
|
||||
<wsdl:part name="Body" element="wcs:GetCoverage" />
|
||||
</wsdl:message>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- WCS response messages -->
|
||||
<!-- ============================================================== -->
|
||||
<wsdl:message name="GetCapabilitiesResponse">
|
||||
<wsdl:part name="Body" element="wcs:Capabilities" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="DescribeCoverageResponse">
|
||||
<wsdl:part name="Body" element="wcs:CoverageDescriptions" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="GetCoverageResponse">
|
||||
<wsdl:part name="response" element="wcs:Coverages" />
|
||||
<wsdl:part name="coverageData" type="xsd:base64Binary" />
|
||||
</wsdl:message>
|
||||
<wsdl:message name="ServiceExceptionReport">
|
||||
<wsdl:part name="Body" element="ows:ExceptionReport" />
|
||||
</wsdl:message>
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- WCS port -->
|
||||
<!-- ============================================================== -->
|
||||
<wsdl:portType name="WcsPortType">
|
||||
<wsdl:operation name="GetCapabilitiesOperation">
|
||||
<wsdl:input message="tns:GetCapabilitiesRequest" />
|
||||
<wsdl:output message="tns:GetCapabilitiesResponse" />
|
||||
<wsdl:fault name="ServiceExceptionReport"
|
||||
message="tns:ServiceExceptionReport" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="DescribeCoverageOperation">
|
||||
<wsdl:input message="tns:DescribeCoverageRequest" />
|
||||
<wsdl:output message="tns:DescribeCoverageResponse" />
|
||||
<wsdl:fault name="ServiceExceptionReport"
|
||||
message="tns:ServiceExceptionReport" />
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetCoverageOperation">
|
||||
<wsdl:input message="tns:GetCoverageRequest" />
|
||||
<wsdl:output message="tns:GetCoverageResponse" />
|
||||
<wsdl:fault name="ServiceExceptionReport"
|
||||
message="tns:ServiceExceptionReport" />
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<!-- ============================ Bindings Section ================================ -->
|
||||
|
||||
<!-- ============================================================== -->
|
||||
<!-- WCS binding -->
|
||||
<!-- ============================================================== -->
|
||||
<wsdl:binding name="WcsSoapBinding" type="tns:WcsPortType">
|
||||
<soap:binding style="document"
|
||||
transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="GetCapabilitiesOperation">
|
||||
<soap:operation />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
<wsdl:fault name="ServiceExceptionReport">
|
||||
<soap:fault name="ServiceExceptionReport"
|
||||
use="literal" />
|
||||
</wsdl:fault>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="DescribeCoverageOperation">
|
||||
<soap:operation />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:output>
|
||||
<wsdl:fault name="ServiceExceptionReport">
|
||||
<soap:fault name="ServiceExceptionReport"
|
||||
use="literal" />
|
||||
</wsdl:fault>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="GetCoverageOperation">
|
||||
<soap:operation />
|
||||
<wsdl:input>
|
||||
<soap:body use="literal" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<mime:multipartRelated>
|
||||
<mime:part>
|
||||
<soap:body parts="response" use="literal"/>
|
||||
</mime:part>
|
||||
<mime:part>
|
||||
<mime:content part="coverageData" type="application/octet-stream"/>
|
||||
</mime:part>
|
||||
</mime:multipartRelated>
|
||||
</wsdl:output>
|
||||
<wsdl:fault name="ServiceExceptionReport">
|
||||
<soap:fault name="ServiceExceptionReport"
|
||||
use="literal" />
|
||||
</wsdl:fault>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
|
||||
<!-- ============================ Service Section ================================ -->
|
||||
<wsdl:service name="wcs">
|
||||
<wsdl:port name="Wcs" binding="tns:WcsSoapBinding">
|
||||
<soap:address location="http://0.0.0.0:8086/wcs1.1.2"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
|
@ -1,8 +0,0 @@
|
|||
source.. = src/
|
||||
bin.includes = .project,\
|
||||
.classpath,\
|
||||
META-INF/,\
|
||||
build.properties,\
|
||||
.settings/,\
|
||||
.,\
|
||||
res/
|
|
@ -1,19 +0,0 @@
|
|||
@startuml
|
||||
|
||||
node "EDEX Data Plug-in Adapter" {
|
||||
() "Ingest Endpoint" as ingest
|
||||
[Plug-in Data Decoder] as decoder
|
||||
[Plug-in Layer Metadata Collector] as collector
|
||||
}
|
||||
|
||||
database "PostgreSQL" {
|
||||
frame "MetaData" {
|
||||
[Layer Metadata] as layer
|
||||
}
|
||||
}
|
||||
|
||||
ingest -> decoder
|
||||
decoder -> collector
|
||||
collector -> layer
|
||||
|
||||
@enduml
|
|
@ -1,42 +0,0 @@
|
|||
@startuml
|
||||
|
||||
package "EDEX WCS Component" {
|
||||
[WCS HTTP Endpoint] as wcshttp
|
||||
[WCS SOAP Endpoint] as wcssoap
|
||||
() "HTTP/REST/JETTY" -- wcshttp
|
||||
() "HTTP/SOAP/CXF" -- wcssoap
|
||||
|
||||
[WCS 1.1.2 Provider] as wcs112
|
||||
|
||||
() "WCS Source" as isrc
|
||||
}
|
||||
|
||||
node "EDEX Data Plug-in Adapter" {
|
||||
[Plug-in WCS Source] as psrc
|
||||
}
|
||||
|
||||
database "PostgreSQL" {
|
||||
frame "MetaData" {
|
||||
[Coverage Metadata] as layer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
database "PyPies" {
|
||||
frame "Data" {
|
||||
[Data Record] as record
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wcshttp -- wcs112
|
||||
wcssoap -- wcs112
|
||||
|
||||
wcs112 -- isrc
|
||||
|
||||
isrc -left- psrc
|
||||
|
||||
psrc <-up- record
|
||||
psrc <-up- layer
|
||||
|
||||
@enduml
|
|
@ -1,53 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
|
||||
<bean id="wcsCoverageStore" class="com.raytheon.uf.edex.ogc.common.BasicFileStore" >
|
||||
<constructor-arg value="wcsCoverageStore" />
|
||||
</bean>
|
||||
|
||||
<bean id="netcdfWcsFormatter" class="com.raytheon.uf.edex.wcs.format.NetCdfFormatter">
|
||||
<constructor-arg ref="wcsCoverageStore" />
|
||||
</bean>
|
||||
|
||||
<bean id="wcsJaxbManager" class="com.raytheon.uf.edex.ogc.common.jaxb.OgcJaxbManager">
|
||||
<constructor-arg>
|
||||
<list>
|
||||
<value>net.opengis.wcs.v_1_1_2.ObjectFactory</value>
|
||||
<value>net.opengis.ows.v_1_1_0.ObjectFactory</value>
|
||||
<value>net.opengis.gml.v_3_1_1.ObjectFactory</value>
|
||||
<value>net.opengis.wms.v_1_3_0.ObjectFactory</value>
|
||||
</list>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean id="wcsQueryStore" class="com.raytheon.uf.edex.wcs.querystore.WcsQueryStore">
|
||||
<constructor-arg ref="wcsJaxbManager"/>
|
||||
</bean>
|
||||
|
||||
<bean id="wcsProvider" class="com.raytheon.uf.edex.wcs.provider.OgcWcsProvider">
|
||||
<constructor-arg ref="wcsJaxbManager"/>
|
||||
<!-- these need to be kept in sync with services -->
|
||||
<property name="restPort" value="8085" />
|
||||
<property name="covStorePath" value="coverage" />
|
||||
</bean>
|
||||
|
||||
<bean id="wcsStoreEndpoint" class="com.raytheon.uf.edex.wcs.CoverageStoreEndpoint">
|
||||
<constructor-arg ref="wcsCoverageStore"/>
|
||||
</bean>
|
||||
|
||||
<bean id="defactoEnabler" class="com.raytheon.uf.edex.wcs.request.DefactoEnabler"/>
|
||||
|
||||
<camelContext id="wcs-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||
|
||||
<route id="WcsStoreRest">
|
||||
<from uri="jetty:http://0.0.0.0:8085/coverage" />
|
||||
<bean ref="wcsStoreEndpoint" />
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
|
||||
|
||||
</beans>
|
|
@ -1,35 +0,0 @@
|
|||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="wcsHandler" class="com.raytheon.uf.edex.wcs.WcsHttpHandler">
|
||||
<constructor-arg ref="wcsProvider"/>
|
||||
</bean>
|
||||
|
||||
<bean id="wcsHttpPool" class="com.raytheon.uf.edex.ogc.common.http.SingleHttpPool">
|
||||
<constructor-arg ref="wcsHandler" />
|
||||
</bean>
|
||||
|
||||
<bean id="wcserv" class="com.raytheon.uf.edex.ogc.common.http.OgcHttpEndpoint">
|
||||
<constructor-arg ref="wcsHttpPool" />
|
||||
</bean>
|
||||
|
||||
<bean id="defactoEnabler" class="com.raytheon.uf.edex.wcs.request.DefactoEnabler"/>
|
||||
|
||||
<camelContext id="wcs-rest-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">
|
||||
|
||||
<route id="WcsRest">
|
||||
<from uri="jetty:http://0.0.0.0:8085/wcs" />
|
||||
<bean ref="wcserv" />
|
||||
</route>
|
||||
|
||||
<route id="WcsRestDefacto">
|
||||
<from uri="jetty:http://0.0.0.0:8085/dfo-wcs" />
|
||||
<bean ref="defactoEnabler" />
|
||||
<bean ref="wcserv" />
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
|
||||
</beans>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue