[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AWIPS #QVN-243999]: DAF PIREPs



Hi Jamie,

I just wanted to try one other thing for the attachments.  Because copying into 
the email directly loses
the white space (tabs) which can be annoying to put back together properly.
Can you download this attachment?
What does it say exactly?
Thanks!

--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.
#!/Users/scarter/miniconda2/envs/python3-awips/bin/python

from awips.dataaccess import DataAccessLayer

#connect to unidata edex
DataAccessLayer.changeEDEXHost("edex-cloud.unidata.ucar.edu")

#get a list of supported data types from the edex
types = DataAccessLayer.getSupportedDatatypes()
#print(types)

#create a request and set the data type
req = DataAccessLayer.newDataRequest()
req.setDatatype("pirep")

#print out required identifiers
#required = DataAccessLayer.getRequiredIdentifiers(req)
#print(required)

#print out optional identifiers
#optional = DataAccessLayer.getOptionalIdentifiers(req)
#print(optional)

#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 out the turbulence intensity for one of the data objects in the array
#print data[3].getString("turbInten")
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 = ""
#    print(d)
    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(timeObs != "" and turb != ""):
#        print("timeObs: ", timeObs, "turbInten: ", turb)

    # 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)