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

[AWIPS #QVN-243999]: DAF PIREPs



Also, realized the response took out all of the white space, so you can't tell 
where to indent. I've attached a text file now.

Thanks,

Tiffany Meyer
AWIPS Lead Software Engineer
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.
#!/awips2/python/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("obs")
req.setDatatype("pirep")

#print out available parameters
param = DataAccessLayer.getAvailableParameters(req)
print(param)

#set the parameter to turbulence intensity
req.setParameters('timeObs', 'longitude', 'latitude', 'flightLevel', 
'numLayer', 'turbInten', 'turbTopHeight', 'turbBaseHeight')

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)

layerCount=0
layerString="\t"
header=1
#['flightLevel', 'numLayer', 'timeObs', 'latitude', 'longitude']
#['turbBaseHeight', 'turbTopHeight', 'turbInten']

for d in data:
    params = d.getParameters()
    print( params)
    if('numLayer' in params):
        dataString=""
        if(int(d.getString('numLayer')) == 0):
            layerString="\t"
        layerCount=0
        for p in params:
            dataString=dataString+","+d.getString(p)
        dataString=dataString.lstrip(',')
        print(dataString,"\n",layerString)
    if('turbInten' in params):
        if(layerCount == 0):
            layerString="\t"
            layerCount=layerCount+1
        for p in params:
            layerString=layerString+","+d.getString(p)
        layerString=layerString+"\n\t"