mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-24 06:57:56 -05:00
- code brought over from the following raytheon repos and directories: - awips2 repo: - awips2/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.alertviz/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.mpe/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.dataplugin.text/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.dataplugin.grid/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.activetable/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.management/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.dataplugin.gfe/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.dataplugin.radar/pythonPackages - awips2/edexOsgi/com.raytheon.uf.common.site/pythonPackages - awips2-core repo: - awips2-core/common/com.raytheon.uf.common.auth/pythonPackages - awips2-core/common/com.raytheon.uf.common.message/pythonPackages - awips2-core/common/com.raytheon.uf.common.localization/pythonPackages - awips2-core/common/com.raytheon.uf.common.datastorage/pythonPackages - awips2-core/common/com.raytheon.uf.common.pointdata/pythonPackages - awips2-core/common/com.raythoen.uf.common.pypies/pythonPackages - awips2-core/common/com.raytheon.uf.common.dataaccess/pythonPackages - awips2-core/common/com.raytheon.uf.common.dataplugin.level/pythonPackages - awips2-core/common/com.raytheon.uf.common.serialization/pythonPackages - awips2-core/common/com.raytheon.uf.common.time/pythonPackages - awips2-core/common/com.raytheon.uf.common.dataplugin/pythonPackages - awips2-core/common/com.raytheon.uf.common.dataquery/pythonPackages - awips2-rpm repo: had to untar and unzip the thirft repo, then go into /lib/py and run `python setup.py build` and then copy in from the build/ subdirectory -foss/thrift-0.14.1/packaged/thrift-0.14.1/lib/py/build/lib.macosx-10.9-x86_64-cpython-38/thrift
91 lines
3.5 KiB
Python
91 lines
3.5 KiB
Python
##
|
|
# This software was developed and / or modified by Raytheon Company,
|
|
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
|
#
|
|
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
|
# This software product contains export-restricted data whose
|
|
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
|
# to non-U.S. persons whether in the United States or abroad requires
|
|
# an export license or other authorization.
|
|
#
|
|
# Contractor Name: Raytheon Company
|
|
# Contractor Address: 6825 Pine Street, Suite 340
|
|
# Mail Stop B8
|
|
# Omaha, NE 68106
|
|
# 402.291.0100
|
|
#
|
|
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
|
# further licensing information.
|
|
##
|
|
|
|
|
|
from ufpy.dataaccess import DataAccessLayer as DAL
|
|
|
|
from . import baseDafTestCase
|
|
from . import params
|
|
import unittest
|
|
|
|
#
|
|
# Test DAF support for pirep data
|
|
#
|
|
# SOFTWARE HISTORY
|
|
#
|
|
# Date Ticket# Engineer Description
|
|
# ------------ ---------- ----------- --------------------------
|
|
# 01/19/16 4795 mapeters Initial Creation.
|
|
# 04/11/16 5548 tgurney Cleanup
|
|
# 04/18/16 5548 tgurney More cleanup
|
|
# 12/07/16 5981 tgurney Parameterize
|
|
# 12/20/16 5981 tgurney Add envelope test
|
|
#
|
|
#
|
|
|
|
|
|
class PirepTestCase(baseDafTestCase.DafTestCase):
|
|
"""Test DAF support for pirep data"""
|
|
|
|
datatype = "pirep"
|
|
|
|
def testGetAvailableParameters(self):
|
|
req = DAL.newDataRequest(self.datatype)
|
|
self.runParametersTest(req)
|
|
|
|
def testGetAvailableLocations(self):
|
|
req = DAL.newDataRequest(self.datatype)
|
|
self.runLocationsTest(req)
|
|
|
|
def testGetAvailableTimes(self):
|
|
req = DAL.newDataRequest(self.datatype)
|
|
req.setLocationNames(params.AIRPORT)
|
|
self.runTimesTest(req)
|
|
|
|
def testGetGeometryData(self):
|
|
req = DAL.newDataRequest(self.datatype)
|
|
req.setLocationNames(params.AIRPORT)
|
|
req.setParameters("temperature", "windSpeed", "hazardType", "turbType")
|
|
print("Testing getGeometryData()")
|
|
geomData = DAL.getGeometryData(req)
|
|
self.assertIsNotNone(geomData)
|
|
print("Number of geometry records: " + str(len(geomData)))
|
|
print("Sample geometry data:")
|
|
for record in geomData[:self.sampleDataLimit]:
|
|
print("level=", record.getLevel(), end="")
|
|
# One dimensional parameters are reported on the 0.0UNKNOWN level.
|
|
# 2D parameters are reported on MB levels from pressure.
|
|
if record.getLevel() == "0.0UNKNOWN":
|
|
print(" temperature=" + record.getString("temperature") + record.getUnit("temperature"), end="")
|
|
print(" windSpeed=" + record.getString("windSpeed") + record.getUnit("windSpeed"), end="")
|
|
else:
|
|
print(" hazardType=" + record.getString("hazardType"), end="")
|
|
print(" turbType=" + record.getString("turbType"), end="")
|
|
print(" geometry=", record.getGeometry())
|
|
print("getGeometryData() complete\n")
|
|
|
|
def testGetGeometryDataWithEnvelope(self):
|
|
req = DAL.newDataRequest(self.datatype)
|
|
req.setParameters("temperature", "windSpeed", "hazardType", "turbType")
|
|
req.setEnvelope(params.ENVELOPE)
|
|
print("Testing getGeometryData()")
|
|
data = DAL.getGeometryData(req)
|
|
for item in data:
|
|
self.assertTrue(params.ENVELOPE.contains(item.getGeometry()))
|