Omaha #3591 Adding original, unaltered scripts.

Change-Id: Ia1f60b645d283674985be542054c4dd20c2c5fa8

Former-commit-id: 08bdd905e2 [formerly 53495a767b] [formerly 1a0aa971ef] [formerly 08bdd905e2 [formerly 53495a767b] [formerly 1a0aa971ef] [formerly ce15b03ce4 [formerly 1a0aa971ef [formerly ee00a93cac391a1c8e0f9236815b5ed270e9f9fb]]]]
Former-commit-id: ce15b03ce4
Former-commit-id: 8bf2c881cd [formerly 416c83769d] [formerly 508bacd573bd9a85594fa06946549eb02bcda889 [formerly 01ed47b7be]]
Former-commit-id: 619402014606e95d54a4f09ef5233f0df76fb494 [formerly 41f434fb46]
Former-commit-id: f6abb030d5
This commit is contained in:
Nathan Bowler 2014-09-23 10:43:01 -04:00
parent 75d4bf69a5
commit 5d18489ef6
3 changed files with 285 additions and 0 deletions

View file

@ -0,0 +1,111 @@
# pointDataQuery.stationName_lat_lon.py
from com.raytheon.uf.common.message.response import ResponseMessageGeneric
import PointDataQuery
# 1.
pdq = PointDataQuery.PointDataQuery("sfcobs")
# 3. the stuff we want returned to us in PointDataContainer
reqPar = "stationId,timeObs"
reqPar += ",latitude,longitude,elevation,reportType,wx_present,visibility"
reqPar += ",seaLevelPress,stationPress,pressChange3Hour,pressChangeChar"
reqPar += ",temperature,dewpoint,seaSurfaceTemp,wetBulb"
reqPar += ",windDir,windSpeed,equivWindSpeed10m,windGust"
reqPar += ",precip1Hour,precip6Hour,precip24Hour"
pdq.setRequestedParameters(reqPar)
# 2. some constraints
pdq.addConstraint("dataTime","BBBBB:00.0",">=")
pdq.addConstraint("dataTime","EEEEE:00.0","<=")
# 5.1 execute() returns a ResponseMessageGeneric
pdq.requestAllLevels()
rmg = pdq.execute()
# 5.1, cont'd. RMG's payload is a PointDataContainer
pdc = rmg.getContents()
#return ResponseMessageGeneric(pdc)
# Initialize conversion array for wx. Would be better to read from a
# file, but do not know how to do this through the UEngine.
wxstr = [ " ", " ", " ", " ", "FU", "HZ", "DU", "BLSA", "PO", "VCSS", \
"BR", "BCFG", "MIFG", "VCTS", "VCSH", "VCSH", "VCSH", " ", "SQ", "+FC", \
"DZ", "RA", "SN", "RA SN", "FZRA", "SHRA", "SHRA SHSN", "SHGR", "FG FZFG", "TS", \
"SS", "SS", "SS", "+SS", "+SS", "+SS", "DRSN", " ", "BLSN", "+BLSN", \
"VCFG", "BCFG", "FG FZFG", "FG FZFG", "FG FZFG", "FG FZFG", "FG FZFG", "FG FZFG", "FZFG", "FZFG", \
"-DZ", "-DZ", "DZ", "DZ", "+DZ", "+DZ", "-FZDZ", "FZDZ", "-DZ -RA", "DZ RA", \
"-RA", "-RA", "RA", "RA", "+RA", "+RA", "-FZRA", "FZRA", "-RA -SN", "RA SN", \
"-SN", "-SN", "SN", "SN", "+SN", "+SN", "IC", "SG", "IC", "PE", \
"-SHRA", "SHRA", "+SHRA", "-SHSN -SHRA", "SHSN SHRA", "-SNSN", "SHSN", "-SHPE", "SHPE", " ", \
"SHGR", "-RA", "+RA", "-RA -SN -GR", "+RA +SN +GR", "TSRA", "TSPE", "+TSRA", " ", "+TSPE" ]
# Get the data for each requested parameter.
sName = pdc.getPointDataTypes().get("stationId").getStringData()
tobs = pdc.getPointDataTypes().get("timeObs").getLongData()
lat = pdc.getPointDataTypes().get("latitude").getFloatData()
lon = pdc.getPointDataTypes().get("longitude").getFloatData()
elev = pdc.getPointDataTypes().get("elevation").getFloatData()
typ = pdc.getPointDataTypes().get("reportType").getIntData()
wx = pdc.getPointDataTypes().get("wx_present").getIntData()
vis = pdc.getPointDataTypes().get("visibility").getIntData()
msl = pdc.getPointDataTypes().get("seaLevelPress").getFloatData()
p = pdc.getPointDataTypes().get("stationPress").getFloatData()
pchg = pdc.getPointDataTypes().get("pressChange3Hour").getFloatData()
pchr = pdc.getPointDataTypes().get("pressChangeChar").getIntData()
temp = pdc.getPointDataTypes().get("temperature").getFloatData()
dpt = pdc.getPointDataTypes().get("dewpoint").getFloatData()
th2o = pdc.getPointDataTypes().get("seaSurfaceTemp").getFloatData()
tw = pdc.getPointDataTypes().get("wetBulb").getFloatData()
dir = pdc.getPointDataTypes().get("windDir").getFloatData()
spd = pdc.getPointDataTypes().get("windSpeed").getFloatData()
s10 = pdc.getPointDataTypes().get("equivWindSpeed10m").getFloatData()
gust = pdc.getPointDataTypes().get("windGust").getFloatData()
pr1 = pdc.getPointDataTypes().get("precip1Hour").getFloatData()
pr6 = pdc.getPointDataTypes().get("precip6Hour").getFloatData()
pr24 = pdc.getPointDataTypes().get("precip24Hour").getFloatData()
# 5.2 and 5.3
if len(tobs) == 0 :
msg = "couldn't get data"
return ResponseMessageGeneric(msg)
msg = "\n"
i = 0
while i < len(tobs) :
msg += sName[i] + ","
msg += str(tobs[i]/1000) + ","
msg += "%.4f"%lat[i] + ","
msg += "%.4f"%lon[i] + ","
msg += "%.0f"%elev[i] + ","
if typ[i] < 1001 or typ[i] > 1007 :
msg += "-32767,"
elif typ[i] == 1001 or typ[i] == 1004 or typ[i] == 1005 :
msg += "0,"
else :
msg += "1,"
if wx[i] < 0 or wx[i] > 99 :
msg += " ,"
else :
msg += wxstr[wx[i]] + ","
msg += str(vis[i]) + ","
msg += "%.2f"%msl[i] + ","
msg += "%.2f"%p[i] + ","
msg += "%.0f"%pchg[i] + ","
if pchr[i] <= -9999 :
pchr[i] = -32767
msg += str(pchr[i]) + " ,"
msg += "%.1f"%temp[i] + ","
msg += "%.1f"%dpt[i] + ","
msg += "%.1f"%th2o[i] + ","
msg += "%.1f"%tw[i] + ","
msg += "%.0f"%dir[i] + ","
msg += "%.1f"%spd[i] + ","
msg += "%.1f"%s10[i] + ","
msg += "%.1f"%gust[i] + ","
msg += "%.2f"%pr1[i] + ","
msg += "%.2f"%pr6[i] + ","
msg += "%.2f"%pr24[i] + "\n"
i += 1
return ResponseMessageGeneric(msg)

View file

@ -0,0 +1,112 @@
#!/bin/csh
#
# A script wrapper around a UEngine call that is meant to get all available
# maritime data in the A-II database over a specified range of times.
# The data is output to stdout as ASCII. Each line is one time/platform
# combination. The individual data items are comma delimited.
# This version can adapt to use a python stub that calls the
# data access framework.
#
# Usage:
#
# a2gtboy.csh {p} {c} yyyy-mm-dd hh:mm yyyy-mm-dd hh:mm
#
# The literal p and c flags are optional. The p flag 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/a2gtboyNNNNN.py
# where NNNNN is a unix process id. The c flag means to retreive the
# Laps set of variables, instead of the default MSAS set.
#
#
# Not using the 'c' format, the MSAS set of variables, outputs the following
# variables for each line:
#
# stationId,timeObs,latitude,longitude,elevation,seaLevelPress,
# stationPress,temperature,dewpoint,windDir,windSpeed,pressChange3Hour
#
# Using the 'c' format, the Laps set of variables, outputs the following
# variables for each line:
#
# stationId,timeObs,latitude,longitude,elevation,reportType,wx_present,
# visibility,seaLevelPress,stationPress,pressChange3Hour,pressChangeChar,
# temperature,dewpoint,seaSurfaceTemp,wetBulb,windDir,windSpeed,
# equivWindSpeed10m,windGust,precip1Hour,precip6Hour,precip24Hour
#
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 stubbase = a2gtboyStub.py
if ( "$1" == "c" ) then
shift
set stubbase = a2cvboyStub.py
endif
#
# Locate python stub that we will modify to create the final python logic.
#
if ( -e ./$stubbase ) then
set stubpy = ./$stubbase
else if ( -e $mydir/$stubbase ) then
set stubpy = $mydir/$stubbase
else if ( -e $FXA_HOME/src/dm/maritime/$stubbase ) then
set stubpy = $FXA_HOME/src/dm/maritime/$stubbase
else if ( -e $FXA_HOME/bin/$stubbase ) then
set stubpy = $FXA_HOME/bin/$stubbase
else
bash -c "echo could not find $stubbase 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 specpy = /tmp/a2gtboy${$}.py
rm -rf $specpy >& /dev/null
touch $specpy
chmod 775 $specpy
cat $stubpy | sed "s/BBBBB/$1 $2/g" | sed "s/EEEEE/$3 $4/g" > $specpy
if ( "$method" == "daf" ) then
/awips2/python/bin/python $specpy
else
cd $UE_BIN_PATH
( uengine -r python < $specpy ) | grep -v '<' | sed -n '3,$p'
endif
if ( "$rmpy" == "yes" ) rm -rf $specpy >& /dev/null
#

View file

@ -0,0 +1,62 @@
# pointDataQuery.stationName_lat_lon.py
from com.raytheon.uf.common.message.response import ResponseMessageGeneric
import PointDataQuery
# 1.
pdq = PointDataQuery.PointDataQuery("sfcobs")
# 3. the stuff we want returned to us in PointDataContainer
reqPar = "stationId,timeObs"
reqPar += ",latitude,longitude,elevation,seaLevelPress,stationPress"
reqPar += ",temperature,dewpoint,windDir,windSpeed,pressChange3Hour"
pdq.setRequestedParameters(reqPar)
# 2. some constraints
pdq.addConstraint("dataTime","BBBBB:00.0",">=")
pdq.addConstraint("dataTime","EEEEE:00.0","<=")
# 5.1 execute() returns a ResponseMessageGeneric
rmg = pdq.execute()
# 5.1, cont'd. RMG's payload is a PointDataContainer
pdc = rmg.getContents()
#return ResponseMessageGeneric(pdc)
# Get the data for each requested parameter.
sName = pdc.getPointDataTypes().get("stationId").getStringData()
tobs = pdc.getPointDataTypes().get("timeObs").getLongData()
lat = pdc.getPointDataTypes().get("latitude").getFloatData()
lon = pdc.getPointDataTypes().get("longitude").getFloatData()
elev = pdc.getPointDataTypes().get("elevation").getFloatData()
msl = pdc.getPointDataTypes().get("seaLevelPress").getFloatData()
p = pdc.getPointDataTypes().get("stationPress").getFloatData()
temp = pdc.getPointDataTypes().get("temperature").getFloatData()
dpt = pdc.getPointDataTypes().get("dewpoint").getFloatData()
dir = pdc.getPointDataTypes().get("windDir").getFloatData()
spd = pdc.getPointDataTypes().get("windSpeed").getFloatData()
pchg = pdc.getPointDataTypes().get("pressChange3Hour").getFloatData()
# 5.2 and 5.3
if len(tobs) == 0 :
msg = "couldn't get data"
return ResponseMessageGeneric(msg)
msg = "\n"
i = 0
while i < len(tobs) :
msg += sName[i] + ","
msg += str(tobs[i]/1000) + ","
msg += "%.4f"%lat[i] + ","
msg += "%.4f"%lon[i] + ","
msg += "%.0f"%elev[i] + ","
msg += "%.2f"%msl[i] + ","
msg += "%.2f"%p[i] + ","
msg += "%.1f"%temp[i] + ","
msg += "%.1f"%dpt[i] + ","
msg += "%.0f"%dir[i] + ","
msg += "%.1f"%spd[i] + ","
msg += "%.0f"%pchg[i] + "\n"
i += 1
return ResponseMessageGeneric(msg)