Merge "Issue #3498 Provide upgrade scripts for Topo file name in D2D procedures and saved displays" into omaha_14.2.2

Former-commit-id: 1ed1ff3aabd3d3a4835591940fc70647147667f6
This commit is contained in:
Ron Anderson 2014-08-06 16:14:00 -05:00 committed by Gerrit Code Review
commit a1ea3eb3bc
3 changed files with 56 additions and 1 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/env python
# This script will update any saved displays which use older skewT displays to # This script will update any saved displays which use older skewT displays to
# use Nsharp. # use Nsharp.
# #

View file

@ -0,0 +1,31 @@
#!/usr/bin/env python
# This script will update any saved displays or procedures with the old Topo file name
#
# This update only needs to be run if there are saved displays being stored
# outside of localization, for procedures saved in localization,
# updateTopoFile.sh will automatically call this.
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) == "d2DMapRenderableDisplay":
for resourceData in display.iterfind('descriptor/resource/resourceData'):
if resourceData.get(xsitype) == 'topoResourceData':
for topoFile in resourceData.iterfind('topoFile'):
if topoFile.text == 'srtm30.hdf':
topoFile.text = 'defaultTopo.h5'
tree.write(bundleFile)
if __name__ == '__main__':
for arg in sys.argv[1:]:
upgradeBundle(arg)

View file

@ -0,0 +1,24 @@
#!/bin/bash
# This script will update any D2D procedures files
# which use the old Topo file name
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 'srtm30.hdf' $f > /dev/null
if [ $? -eq 0 ]; then
echo Updating $f
python $MY_DIR/updateTopoFile.py $f
fi
done
echo "INFO: the update has completed successfully!"
exit 0