Issue #2258 Convert profiler sounding to var height with hodo.
Change-Id: I7b8c704ebc847169c2d09bb0bea13d0b60a9cff6 Former-commit-id:32a0b19a38
[formerly 2aab48d1032c0b6fd14645437836ad5ca13cb415] Former-commit-id:0c2f894b82
This commit is contained in:
parent
a8868c5beb
commit
b7b18e02bf
4 changed files with 167 additions and 1 deletions
|
@ -34,6 +34,7 @@ import org.eclipse.core.runtime.IExtensionRegistry;
|
|||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.RecordFactory;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
|
@ -56,6 +57,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 20, 2009 njensen Initial creation
|
||||
* Aug 15, 2013 2258 bsteffen Convert profiler sounding to var height
|
||||
* with hodo.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -136,6 +139,14 @@ public class VarHeightResourceData extends AbstractRequestableResourceData
|
|||
VarHeightResource rsc = null;
|
||||
if (objects.length > 0) {
|
||||
PluginDataObject pdo = objects[0];
|
||||
if (point == null && pdo instanceof ISpatialEnabled) {
|
||||
/*
|
||||
* This is here to allow more flexibility in bundles, if a
|
||||
* bundle has no point than use the point in the pdo.
|
||||
*/
|
||||
point = ((ISpatialEnabled) pdo).getSpatialObject()
|
||||
.getGeometry().getCoordinate();
|
||||
}
|
||||
AbstractVarHeightAdapter<?> adapter = getAdapter(pdo);
|
||||
adapter.setResourceData(this);
|
||||
rsc = new VarHeightResource(this, loadProperties, adapter);
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.viz.objectiveanalysis.rsc.OAResourceData;
|
|||
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
|
||||
import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData;
|
||||
import com.raytheon.uf.viz.xy.varheight.rsc.VarHeightResourceData;
|
||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||
import com.raytheon.viz.pointdata.util.AbstractPointDataInventory;
|
||||
import com.raytheon.viz.volumebrowser.vbui.SelectedData;
|
||||
|
@ -73,6 +74,8 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* May 08, 2013 DR14824 mgamazaychikov Added alterProductParameters method
|
||||
* May 09, 2013 1869 bsteffen Modified D2D time series of point data to
|
||||
* work without dataURI.
|
||||
* Aug 15, 2013 2258 bsteffen Convert profiler sounding to var height
|
||||
* with hodo.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -485,7 +488,8 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
|||
((CrossSectionResourceData) resourceData).setStationIDs(closest);
|
||||
return resourceData;
|
||||
case SOUNDING:
|
||||
if (catalogEntry.getSelectedData().getSourcesKey().equals("bufrua")) {
|
||||
if (getPlugin(catalogEntry.getSelectedData().getSourcesKey())
|
||||
.equals("bufrua")) {
|
||||
return new BufruaNSharpResourceData();
|
||||
} else if (catalogEntry.getSelectedData().getSourcesKey()
|
||||
.equals("modelsoundingETA")) {
|
||||
|
@ -493,6 +497,16 @@ public class PointDataCatalog extends AbstractInventoryDataCatalog {
|
|||
} else if (catalogEntry.getSelectedData().getSourcesKey()
|
||||
.equals("modelsoundingGFS")) {
|
||||
return resourceData = new MdlSndNSharpResourceData("GFSSND");
|
||||
} else if (catalogEntry.getSelectedData().getSourcesKey()
|
||||
.equals("profiler")) {
|
||||
VarHeightResourceData vhData = new VarHeightResourceData();
|
||||
vhData.setPoint(getPointCoordinate(catalogEntry));
|
||||
vhData.setParameter("Wind");
|
||||
vhData.setParameterName("Wind");
|
||||
vhData.setPointLetter(getPointLetter(catalogEntry));
|
||||
vhData.setSource(catalogEntry.getSelectedData()
|
||||
.getSourcesText());
|
||||
return vhData;
|
||||
}
|
||||
default:
|
||||
return super.getResourceData(catalogEntry, resourceType);
|
||||
|
|
117
deltaScripts/13.6.1/updateSkewtDisplays.py
Normal file
117
deltaScripts/13.6.1/updateSkewtDisplays.py
Normal file
|
@ -0,0 +1,117 @@
|
|||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
xsitype = '{http://www.w3.org/2001/XMLSchema-instance}type'
|
||||
|
||||
def upgradeBundle(bundleFile):
|
||||
tree = ET.parse(bundleFile)
|
||||
root = tree.getroot()
|
||||
iterpath = 'bundles/bundle/displayList/displays'
|
||||
if root.tag == 'bundle':
|
||||
iterpath = 'displayList/displays'
|
||||
for display in root.iterfind(iterpath):
|
||||
if display.get(xsitype) == "skewtDisplay":
|
||||
plugins = getPlugins(display)
|
||||
nsharp = False
|
||||
varheight = False
|
||||
for plugin in plugins:
|
||||
nsharp |= isNsharp(plugin)
|
||||
varheight |= isHodoVarHeight(plugin)
|
||||
if varheight and nsharp:
|
||||
# This will cause the bundle to continue loading old sounding,
|
||||
# this is not a big problem until that is deleted
|
||||
print 'Cannot convert bundle with both var height hodo and nsharp'
|
||||
elif varheight:
|
||||
convertDisplayToHodoVarHeight(display)
|
||||
elif nsharp:
|
||||
convertDisplayToNsharp(display)
|
||||
elif display.get(xsitype) == "d2DNSharpDisplay":
|
||||
display.set(xsitype,'nsharpSkewTPaneDisplay')
|
||||
descriptor = display.find('descriptor')
|
||||
descriptor.set(xsitype,'nsharpSkewTPaneDescriptor')
|
||||
tree.write(bundleFile.replace('.xml','-converted.xml'))
|
||||
|
||||
def getPlugins(xmlDisplay):
|
||||
plugins = set()
|
||||
for resourceData in xmlDisplay.iterfind('descriptor/resource/resourceData'):
|
||||
plugin = getPluginName(resourceData)
|
||||
if plugin is not None:
|
||||
plugins.add(plugin)
|
||||
return plugins;
|
||||
|
||||
def getPluginName(resourceData):
|
||||
if resourceData.get(xsitype) == 'gribSoundingSkewTResourceData':
|
||||
return 'grib'
|
||||
elif resourceData.get(xsitype) == 'skewTResourceData':
|
||||
return getConstraintValue(resourceData, 'pluginName')
|
||||
return None
|
||||
|
||||
def getConstraintValue(resourceData, key):
|
||||
for mapping in resourceData.iterfind('metadataMap/mapping'):
|
||||
if(mapping.get('key') == key):
|
||||
return mapping.find('constraint').get('constraintValue')
|
||||
return None
|
||||
|
||||
def isNsharp(plugin):
|
||||
return plugin == 'grib' or plugin == 'bufrua' or\
|
||||
plugin == 'goes' or plugin == 'poes' or\
|
||||
plugin == 'acarssounding' or\
|
||||
plugin == 'NAM' or plugin == 'GFS'
|
||||
|
||||
def isHodoVarHeight(plugin):
|
||||
return plugin == 'radar' or plugin == 'profiler'
|
||||
|
||||
def convertDisplayToNsharp(xmlDisplay):
|
||||
# TODO this will be written when all the nsharp types are converted.
|
||||
pass
|
||||
|
||||
def convertDisplayToHodoVarHeight(xmlDisplay):
|
||||
xmlDisplay.set(xsitype,'varHeightRenderableDisplay')
|
||||
xmlDisplay.set('tabTitle','Var vs height : Log 1050-150')
|
||||
descriptor = xmlDisplay.find('descriptor')
|
||||
descriptor.set(xsitype,'varHeightHodoDescriptor')
|
||||
toRemove = []
|
||||
for resource in descriptor.iterfind('resource'):
|
||||
resourceData = resource.find('resourceData')
|
||||
pluginName = getPluginName(resourceData)
|
||||
type = resourceData.get(xsitype)
|
||||
if type == 'skewTBkgResourceData':
|
||||
toRemove.append(resource)
|
||||
elif type == 'skewTResourceData':
|
||||
resourceData.set(xsitype,'varHeightResourceData')
|
||||
resourceData.set('parameter','Wind')
|
||||
resourceData.set('parameterName','Wind')
|
||||
if pluginName == 'radar':
|
||||
ET.SubElement(resourceData, 'source').text = 'VWP'
|
||||
else:
|
||||
ET.SubElement(resourceData, 'source').text = pluginName
|
||||
else:
|
||||
print "Removing unrecognized resource of type: " + type
|
||||
descriptor.remove(resource)
|
||||
for resource in toRemove:
|
||||
descriptor.remove(resource)
|
||||
|
||||
heightScale = ET.SubElement(descriptor, 'heightScale')
|
||||
heightScale.set('unit','MILLIBARS')
|
||||
heightScale.set('name','Log 1050-150')
|
||||
heightScale.set('minVal','1050.0')
|
||||
heightScale.set('maxVal','150.0')
|
||||
heightScale.set('parameter','P')
|
||||
heightScale.set('parameterUnit','hPa')
|
||||
heightScale.set('scale','LOG')
|
||||
heightScale.set('heightType','PRESSURE')
|
||||
ET.SubElement(heightScale, 'labels').text = '1000,850,700,500,400,300,250,200,150'
|
||||
|
||||
gridGeometry = descriptor.find('gridGeometry')
|
||||
gridGeometry.set('rangeX','0 999')
|
||||
gridGeometry.set('rangeY','0 999')
|
||||
gridGeometry.set('envelopeMinX','0.0')
|
||||
gridGeometry.set('envelopeMaxX','1000.0')
|
||||
gridGeometry.set('envelopeMinY','0.0')
|
||||
gridGeometry.set('envelopeMaxY','1000.0')
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for arg in sys.argv[1:]:
|
||||
upgradeBundle(arg)
|
24
deltaScripts/13.6.1/updateSkewtProcedures.sh
Normal file
24
deltaScripts/13.6.1/updateSkewtProcedures.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
# This script will update any D2D procedures files
|
||||
# which use older skewT displays to use Nsharp.
|
||||
|
||||
IFS=$'\n'
|
||||
files=`ls /awips2/edex/data/utility/cave_static/*/*/procedures/*.xml`
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "No procedures found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MY_DIR=`dirname $0`
|
||||
|
||||
for f in $files; do
|
||||
grep 'skewtDisplay\|d2DNSharpDisplay' $f > /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
echo Updating $f
|
||||
python $MY_DIR/updateSkewtDisplays.py $f
|
||||
fi
|
||||
done
|
||||
|
||||
echo "INFO: the update has completed successfully!"
|
||||
exit 0
|
Loading…
Add table
Reference in a new issue