[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AWIPS #QVN-243999]: DAF PIREPs
- Subject: [AWIPS #QVN-243999]: DAF PIREPs
- Date: Thu, 16 Jul 2020 12:03:51 -0600
Hi Jamie,
I've been playing around with it a little, so I'm actually pulling more
parameters than you were
interested in originally, so you can remove those if you'd like.
The code is below:
#!/awips2/python/bin/python
from awips.dataaccess import DataAccessLayer
#connect to unidata edex
DataAccessLayer.changeEDEXHost("edex-cloud.unidata.ucar.edu")
#create a request and set the data type
req = DataAccessLayer.newDataRequest()
req.setDatatype("pirep")
#print out available parameters
param = DataAccessLayer.getAvailableParameters(req)
print(sorted(param))
#set the parameter to turbulence intensity
params = ['timeObs', 'longitude', 'latitude', 'flightLevel', 'turbInten',
'turbTopHeight', 'turbBaseHeight', 'obsId', 'refTime', 'dataURI', 'reportType',
"wmoHeader"]
req.setParameters(*params)
print(req)
#print out available location names
locations = DataAccessLayer.getAvailableLocationNames(req)
#print (locations)
#actually get the data for the request -- this returns an array
data = DataAccessLayer.getGeometryData(req)
print (len(data))
#print(data[0])
#print(data[0].getParameters())
#print(data[0].getString("turbInten"))
#print(data[1])
#print(data[1].getParameters())
#print(data[1].getString("turbInten"))
#cycle through all the objects and print out their turbulence intensities
for d in data:
turb = ""
timeObs = ""
flightLvl = ""
turbTop = ""
turbBase = ""
lat = ""
lon = ""
time = ""
id = ""
dataUri = ""
header = ""
type = ""
params = d.getParameters()
if "turbInten" in params:
turb = d.getString("turbInten")
if "timeObs" in params:
timeObs = d.getString("timeObs")
if "flightLvl" in params:
flightLvl = d.getString("flightLevel")
if "turbTopHeight" in params:
turbTop = d.getString("turbTopHeight")
if "turbBase" in params:
turbBase = d.getString("turbBaseHeight")
if "longitude" in params:
lon = d.getString("longitude")
if "latitude" in params:
lat = d.getString("latitude")
if "obsId" in params:
id = d.getString("obsId")
if "refTime" in params:
time = d.getString("refTime")
if "dataURI" in params:
dataUri = d.getString("dataURI")
if "reportType" in params:
type = d.getString("reportType")
if "wmoHeader" in params:
header = d.getString("wmoHeader")
# if(turbTop != "" and turbTop != "-9999"):
print("timeObs: ", timeObs, "turbInten: ", turb, "turbTop: ", turbTop,
"turbBase: ", turbBase, "flightLevel: ", flightLvl, "lon: ", lon, "lat: ", lat,
"id: ", id, "time: ", time, "dataURI: ", dataUri, "report: ", type, "header: ",
header)
--Shay Carter
Software Engineer II
UCAR - Unidata
Ticket Details
===================
Ticket ID: QVN-243999
Department: Support AWIPS
Priority: Normal
Status: Open
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.