Omaha #3600 Adding original, unaltered radar inventory scripts.
Change-Id: I2bd8de7b36aeba4cb5e58d6b153a249d72ac91bb Former-commit-id:fa50620721
[formerly5d3312b1d4
] [formerlyc84b7c3f0f
] [formerlyfa50620721
[formerly5d3312b1d4
] [formerlyc84b7c3f0f
] [formerly68c4943c27
[formerlyc84b7c3f0f
[formerly 965405355e5f053266bd50977c59dff760ee4f0b]]]] Former-commit-id:68c4943c27
Former-commit-id:c605b91f7a
[formerly5480e6e8fd
] [formerly 123cc8e25d8ce9c928dfb5c80dea1f5c35a4cb0d [formerlyb59d2d69cd
]] Former-commit-id: ee18bbdb3de8716c5ba5b7f7973c279bb2559b0a [formerlyaf24524eeb
] Former-commit-id:e3c49cb766
This commit is contained in:
parent
efff8d6032
commit
d9f480ecdc
2 changed files with 231 additions and 0 deletions
216
pythonPackages/msaslaps/radar/a2invrad.csh
Normal file
216
pythonPackages/msaslaps/radar/a2invrad.csh
Normal file
|
@ -0,0 +1,216 @@
|
|||
#!/bin/csh
|
||||
#
|
||||
# A script wrapper that is meant to get inventories of radar data
|
||||
# from the A-II database. The data is output to stdout as ASCII.
|
||||
# This version can adapt to use a python stub that calls the
|
||||
# data access framework.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# a2invrad.csh p radar date time msgcode elev
|
||||
#
|
||||
# p - A literal p.
|
||||
# radar - four character radar id
|
||||
# date - yyyy-mo-dd
|
||||
# time - hh:mm
|
||||
# msgcode - RPG message code
|
||||
# elev - tilt angle/layer value. defaults to 0.
|
||||
#
|
||||
# All arguments are optional, but must retain the specified order.
|
||||
#
|
||||
# The literal p option means preserve the final version of the python
|
||||
# submitted to the UEngine instead of cleaning it up. The path to the
|
||||
# finalized python is /tmp/a2invradNNNNN.py where NNNNN is a unix process id.
|
||||
# This argument does not change the output of the script.
|
||||
#
|
||||
# If no radar id is supplied, the only other useable arguments are the
|
||||
# date and time, and what is returned is a list of radars.
|
||||
#
|
||||
# The date and time must be supplied together. If not supplied, then the
|
||||
# information returned covers all times, otherwise +/- one minute from
|
||||
# the supplied date and time.
|
||||
#
|
||||
# If the message code is not supplied, or is a literal '+', then what is
|
||||
# listed is the available message code for the specified radar. The plus
|
||||
# sign causes some descriptive information to be supplied with the returned
|
||||
# codes.
|
||||
#
|
||||
# If the message code is supplied and the tilt/layer is a literal '+',
|
||||
# then what is returned is a list of tilts available for the specified
|
||||
# message code.
|
||||
#
|
||||
# When a message code is supplied but no tilt is supplied, this is meant
|
||||
# to return a list of times for a non-tilt based product, such as storm
|
||||
# total precip. Otherwise if a tilt/layer is supplied, this is meant
|
||||
# to return a list of times for product that are for a specific tilt,
|
||||
# like base reflectivity.
|
||||
#
|
||||
# When tilt angles are specified on the command line, or are returned
|
||||
# in response to a tilt angle argument of '+', these tilt angles are
|
||||
# primary tilt angles for a range of tilts. When tilt angles are returned
|
||||
# with a time inventory, then these are the actual tilt angle of the
|
||||
# data received.
|
||||
#
|
||||
#
|
||||
set rmpy = yes
|
||||
if ( "$1" == "p" ) then
|
||||
set rmpy = no
|
||||
shift
|
||||
endif
|
||||
#
|
||||
# Identify directory this script is in, will be one of the directories we
|
||||
# search for other files in.
|
||||
#
|
||||
set mydir = `dirname $0`
|
||||
set d1 = `echo $mydir | cut -c1`
|
||||
if ( "$mydir" == '.' ) then
|
||||
set mydir = $PWD
|
||||
else if ( "$d1" != "/" ) then
|
||||
set mydir = $PWD/$mydir
|
||||
endif
|
||||
set mydir = `(cd $mydir ; pwd)`
|
||||
if ( ! $?FXA_HOME ) set FXA_HOME = xxxx
|
||||
set fxa_home = $FXA_HOME
|
||||
if ( $?STAGING ) then
|
||||
set fxa_home = $STAGING/D-2D
|
||||
endif
|
||||
#
|
||||
# Locate python stub that we will modify to create the final python logic.
|
||||
#
|
||||
if ( -e ./a2invradStub.py ) then
|
||||
set stubpy = ./a2invradStub.py
|
||||
else if ( -e $mydir/a2invradStub.py ) then
|
||||
set stubpy = $mydir/a2invradStub.py
|
||||
else if ( -e $fxa_home/src/dm/radar/a2invradStub.py ) then
|
||||
set stubpy = $fxa_home/src/dm/radar/a2invradStub.py
|
||||
else if ( -e $FXA_HOME/bin/a2invradStub.py ) then
|
||||
set stubpy = $FXA_HOME/bin/a2invradStub.py
|
||||
else
|
||||
bash -c "echo could not find a2invradStub.py 1>&2"
|
||||
exit
|
||||
endif
|
||||
#
|
||||
# Determine if we are using the data access framework or the uEngine.
|
||||
#
|
||||
grep DataAccessLayer $stubpy >& /dev/null
|
||||
if ( $status == 0 ) then
|
||||
set method = "daf"
|
||||
else
|
||||
#
|
||||
# Set up the environment we need to run the UEngine.
|
||||
#
|
||||
set method = "uengine"
|
||||
if ( -e ./UEngine.cshsrc ) then
|
||||
set ueenv = ./UEngine.cshsrc
|
||||
else if ( -e $mydir/UEngine.cshsrc ) then
|
||||
set ueenv = $mydir/UEngine.cshsrc
|
||||
else if ( -e $FXA_HOME/src/dm/point/UEngine.cshsrc ) then
|
||||
set ueenv = $FXA_HOME/src/dm/point/UEngine.cshsrc
|
||||
else if ( -e $FXA_HOME/bin/UEngine.cshsrc ) then
|
||||
set ueenv = $FXA_HOME/bin/UEngine.cshsrc
|
||||
else
|
||||
bash -c "echo could not find UEngine.cshsrc 1>&2"
|
||||
exit
|
||||
endif
|
||||
source $ueenv
|
||||
endif
|
||||
#
|
||||
#
|
||||
set rrr = `echo $1 | grep '[a-z][a-z][a-z][a-z]'`
|
||||
if ( "$rrr" != "" ) shift
|
||||
#
|
||||
# Set range of time we will request this information over, will default to
|
||||
# essentially forever.
|
||||
#
|
||||
set aaa = "1970-01-01 00:00:00.0"
|
||||
set bbb = "2038-01-01 00:00:00.0"
|
||||
set mydate = `echo "$1" | grep '.*-.*-'`
|
||||
set mytime = `echo "$2" | grep ':'`
|
||||
if ( "$mydate" != "" && "$mytime" != "" ) then
|
||||
shift
|
||||
shift
|
||||
if ( -x ./gtasUtil ) then
|
||||
set gtasUtil = ./gtasUtil
|
||||
else if ( -x $mydir/gtasUtil ) then
|
||||
set gtasUtil = $mydir/gtasUtil
|
||||
else if ( -x $fxa_home/src/dm/point/gtasUtil ) then
|
||||
set gtasUtil = $fxa_home/src/dm/point/gtasUtil
|
||||
else if ( -x $FXA_HOME/bin/gtasUtil ) then
|
||||
set gtasUtil = $FXA_HOME/bin/gtasUtil
|
||||
else
|
||||
bash -c "echo could not find gtasUtil executable 1>&2"
|
||||
exit
|
||||
endif
|
||||
set aaa = `$gtasUtil = $mydate $mytime -60`
|
||||
set bbb = `$gtasUtil = $mydate $mytime 60`
|
||||
endif
|
||||
#
|
||||
# Modify the text of special tags in stub to create finalized script.
|
||||
#
|
||||
set binary = no
|
||||
set specpy = /tmp/a2invrad${$}.py
|
||||
rm -rf $specpy >& /dev/null
|
||||
touch $specpy
|
||||
chmod 775 $specpy
|
||||
set lastcmd = cat
|
||||
if ( "$rrr" == "" ) then
|
||||
cat $stubpy | grep -v "KKKK" | grep -v "MMMM" | grep -v "EEEE" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | \
|
||||
grep -v 'Code")' | grep -v 'Time")' | grep -v 'Angle")' \
|
||||
>> $specpy
|
||||
else if ( "$1" == "" ) then
|
||||
cat $stubpy | sed "s/KKKK/$rrr/g" | grep -v "MMMM" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | grep -v 'icao")' | \
|
||||
sed 's/^.*EEEE.*$//g' | grep -v 'Time")' | grep -v 'Angle")' \
|
||||
>> $specpy
|
||||
else if ( "$1" == "+" ) then
|
||||
cat $stubpy | sed "s/KKKK/$rrr/g" | grep -v "MMMM" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | grep -v 'icao")' | \
|
||||
sed 's/^.*EEEE.*$//g' | grep -v 'Time")' | grep -v 'Angle")' \
|
||||
>> $specpy
|
||||
if ( -e ./msgCodeSeds.txt ) then
|
||||
set mctrans = $PWD/msgCodeSeds.txt
|
||||
else if ( -e $mydir/msgCodeSeds.txt ) then
|
||||
set mctrans = $mydir/msgCodeSeds.txt
|
||||
else if ( -e $fxa_home/src/dm/radar/msgCodeSeds.txt ) then
|
||||
set mctrans = $fxa_home/src/dm/radar/msgCodeSeds.txt
|
||||
else if ( -e $FXA_HOME/data/msgCodeSeds.txt ) then
|
||||
set mctrans = $FXA_HOME/data/msgCodeSeds.txt
|
||||
else
|
||||
bash -c "echo could not find msgCodeSeds.txt 1>&2"
|
||||
exit
|
||||
endif
|
||||
set lastcmd = "sed -f $mctrans"
|
||||
else if ( "$2" == "" ) then
|
||||
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$1/g" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | grep -v 'icao")' | \
|
||||
sed 's/EEEE/0.0/g' | grep -v 'Angle")' | grep -v 'Code")' \
|
||||
>> $specpy
|
||||
else if ( "$2" == "+" ) then
|
||||
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$1/g" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | grep -v 'icao")' | \
|
||||
sed 's/^.*EEEE.*$//g' | grep -v 'Time")' | grep -v 'Code")' | \
|
||||
sed 's/true/primary/g' >> $specpy
|
||||
else
|
||||
cat $stubpy | sed "s/KKKK/$rrr/g" | sed "s/MMMM/$1/g" | \
|
||||
sed "s/AAAAA/$aaa/g" | sed "s/BBBBB/$bbb/g" | grep -v 'icao")' | \
|
||||
sed "s/EEEE/$2/g" | grep -v 'Code")' >> $specpy
|
||||
set binary = yes
|
||||
endif
|
||||
#
|
||||
# Submit the temporary python script stripping xml stuff, then remove it
|
||||
#
|
||||
if ( "$method" == "daf" ) then
|
||||
/awips2/python/bin/python $specpy
|
||||
else if ( "$binary" == "yes" ) then
|
||||
cd $UE_BIN_PATH
|
||||
( uengine -r python < $specpy ) |& sed 's|.*</items>.*|@|g' | \
|
||||
grep -E 'attributes|@' | cut '-d"' -f4 | tr '\n' ' ' | tr '@' '\n' | \
|
||||
sed 's/00000.*$//g' | sed 's/^ *//g' | sed 's/ *$//g'
|
||||
else
|
||||
cd $UE_BIN_PATH
|
||||
( uengine -r python < $specpy ) |& grep attributes | cut '-d"' -f4 | \
|
||||
$lastcmd
|
||||
endif
|
||||
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
|
||||
#
|
15
pythonPackages/msaslaps/radar/a2invradStub.py
Normal file
15
pythonPackages/msaslaps/radar/a2invradStub.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import CatalogQuery
|
||||
|
||||
query = CatalogQuery.CatalogQuery("radar")
|
||||
query.addConstraint("icao","KKKK","=")
|
||||
query.addConstraint("productCode","MMMM","in")
|
||||
query.addConstraint("primaryElevationAngle","EEEE","=")
|
||||
query.addConstraint("dataTime","AAAAA",">=")
|
||||
query.addConstraint("dataTime","BBBBB","<=")
|
||||
|
||||
query.setDistinctField("icao")
|
||||
query.setDistinctField("dataTime")
|
||||
query.setDistinctField("trueElevationAngle")
|
||||
query.setDistinctField("productCode")
|
||||
|
||||
return query.executeWrapped()
|
Loading…
Add table
Reference in a new issue