mirror of
https://github.com/Unidata/python-awips.git
synced 2025-02-23 14:57:56 -05:00
python-awips 0.9.1
This commit is contained in:
parent
63ae234f5f
commit
ffcb14f82e
53 changed files with 70 additions and 75 deletions
0
LISCENSE.txt
Normal file
0
LISCENSE.txt
Normal file
17
README.md
17
README.md
|
@ -8,20 +8,7 @@
|
|||
|
||||
### Install
|
||||
|
||||
* git clone https://github.com/mjames-upc/edexpy.git
|
||||
* cd edexpy
|
||||
* git clone https://github.com/Unidata/awips-python.git
|
||||
* cd awips-python
|
||||
* python setup.py install
|
||||
|
||||
### Use
|
||||
|
||||
#### GRID
|
||||
|
||||
./data/grid/gridInventory.csh HRRR T
|
||||
|
||||
#### Radar
|
||||
|
||||
python data/radar/a2invradStub.py --icao kftg --date 2015-06-22 --time 17:09
|
||||
|
||||
#### Obs
|
||||
|
||||
python data/metar/a2gtmtrStub.py -b "2015-06-18 21:40" -e "2015-06-18 22:00" -s KCLK
|
||||
|
|
|
@ -42,7 +42,7 @@ from dynamicserialize import DynamicSerializationManager
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 09/30/08 chammack Initial Creation.
|
||||
# 11/03/10 5849 cjeanbap Moved to ufpy package from
|
||||
# 11/03/10 5849 cjeanbap Moved to awips package from
|
||||
# com.raytheon.uf.tools.cli
|
||||
# 01/07/11 5645 cjeanbap Added audio file to Status Message.
|
||||
# 05/27/11 3050 cjeanbap Added if-statement to check Priority
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#
|
||||
# __init__.py for ufpy package
|
||||
# __init__.py for awips package
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#
|
||||
# Published interface for ufpy.dataaccess package
|
||||
# Published interface for awips.dataaccess package
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
|
@ -53,7 +53,7 @@ if sys.modules.has_key('JavaImporter'):
|
|||
import JepRouter
|
||||
router = JepRouter
|
||||
else:
|
||||
from ufpy.dataaccess import ThriftClientRouter
|
||||
from awips.dataaccess import ThriftClientRouter
|
||||
router = ThriftClientRouter.ThriftClientRouter(THRIFT_HOST)
|
||||
USING_NATIVE_THRIFT = True
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#
|
||||
#
|
||||
|
||||
from ufpy.dataaccess import IData
|
||||
from awips.dataaccess import IData
|
||||
|
||||
class PyData(IData):
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
#
|
||||
#
|
||||
|
||||
from ufpy.dataaccess import IGeometryData
|
||||
from ufpy.dataaccess import PyData
|
||||
from awips.dataaccess import IGeometryData
|
||||
from awips.dataaccess import PyData
|
||||
|
||||
class PyGeometryData(IGeometryData, PyData.PyData):
|
||||
|
|
@ -35,8 +35,8 @@
|
|||
import numpy
|
||||
import warnings
|
||||
|
||||
from ufpy.dataaccess import IGridData
|
||||
from ufpy.dataaccess import PyData
|
||||
from awips.dataaccess import IGridData
|
||||
from awips.dataaccess import PyData
|
||||
|
||||
NO_UNIT_CONVERT_WARNING = """
|
||||
The ability to unit convert grid data is not currently available in this version of the Data Access Framework.
|
|
@ -50,9 +50,9 @@ from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import G
|
|||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetOptionalIdentifiersRequest
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataaccess.request import GetSupportedDatatypesRequest
|
||||
|
||||
from ufpy import ThriftClient
|
||||
from ufpy.dataaccess import PyGeometryData
|
||||
from ufpy.dataaccess import PyGridData
|
||||
from awips import ThriftClient
|
||||
from awips.dataaccess import PyGeometryData
|
||||
from awips.dataaccess import PyGridData
|
||||
|
||||
|
||||
class ThriftClientRouter(object):
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#
|
||||
# __init__.py for ufpy.dataaccess package
|
||||
# __init__.py for awips.dataaccess package
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
|
@ -18,7 +18,7 @@
|
|||
# further licensing information.
|
||||
##
|
||||
|
||||
from ufpy import ThriftClient
|
||||
from awips import ThriftClient
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import DatabaseID
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.db.objects import ParmID
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#
|
||||
# __init__.py for ufpy.gfe package
|
||||
# __init__.py for awips.gfe package
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
import os
|
||||
import logging
|
||||
from ufpy import AlertVizHandler
|
||||
from awips import AlertVizHandler
|
||||
import Record
|
||||
|
||||
avh = AlertVizHandler.AlertVizHandler(host=os.getenv("BROKER_ADDR","localhost"), port=9581, category='LOCAL', source='ANNOUNCER', level=logging.NOTSET)
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
#
|
||||
# __init__.py for ufpy package
|
||||
# __init__.py for awips package
|
||||
#
|
||||
#
|
||||
# SOFTWARE HISTORY
|
|
@ -52,7 +52,7 @@ class ListenThread(threading.Thread):
|
|||
threading.Thread.__init__(self)
|
||||
|
||||
def run(self):
|
||||
from ufpy import QpidSubscriber
|
||||
from awips import QpidSubscriber
|
||||
self.qs = QpidSubscriber.QpidSubscriber(self.hostname, self.portNumber, True)
|
||||
self.qs.topicSubscribe(self.topicName, self.receivedMessage)
|
||||
|
|
@ -43,7 +43,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -41,7 +41,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import argparse
|
|||
import numpy
|
||||
import sys
|
||||
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(conflict_handler="resolve")
|
||||
|
|
|
@ -33,7 +33,7 @@ import argparse
|
|||
import numpy
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import DataTime
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -34,7 +34,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -36,7 +36,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -36,7 +36,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -36,7 +36,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -37,7 +37,7 @@ import sys
|
|||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level
|
||||
|
||||
|
|
|
@ -37,14 +37,14 @@ import sys
|
|||
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
from ufpy import ThriftClient
|
||||
from awips import ThriftClient
|
||||
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.radar.request import GetRadarDataRecordRequest
|
||||
|
||||
def get_default_host():
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
return DataAccessLayer.THRIFT_HOST
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ import argparse
|
|||
import sys
|
||||
|
||||
from datetime import datetime
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -32,7 +32,7 @@ import argparse
|
|||
import numpy
|
||||
import sys
|
||||
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(conflict_handler="resolve")
|
||||
|
|
|
@ -44,7 +44,7 @@ import sys
|
|||
|
||||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.time import TimeRange
|
||||
|
||||
def get_args():
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#
|
||||
|
||||
|
||||
from ufpy.dataaccess import IDataRequest
|
||||
from awips.dataaccess import IDataRequest
|
||||
|
||||
from dynamicserialize.dstypes.com.vividsolutions.jts.geom import Envelope
|
||||
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.level import Level
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
```python
|
||||
#!python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
from shapely.geometry import Polygon,Point
|
||||
from datetime import datetime
|
||||
|
||||
|
@ -64,19 +64,19 @@ DAF query to get all states took 21.915029 seconds
|
|||
|
||||
```python
|
||||
Filter state objects to one that contains polygon took 0.382097 seconds
|
||||
[<ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x2bebdd0>]
|
||||
[<awips.dataaccess.PyGeometryData.PyGeometryData object at 0x2bebdd0>]
|
||||
Polygon is in the state of Oklahoma
|
||||
```
|
||||
|
||||
```python
|
||||
Filter state objects to one that contains point took 0.2028 seconds
|
||||
[<ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x2beb9d0>]
|
||||
[<awips.dataaccess.PyGeometryData.PyGeometryData object at 0x2beb9d0>]
|
||||
Point is in the state of Iowa
|
||||
```
|
||||
|
||||
```python
|
||||
Filter state objects to the ones that intersect polygon took 0.4032 seconds
|
||||
[<ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x2beb610>, <ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x2bebdd0>]
|
||||
[<awips.dataaccess.PyGeometryData.PyGeometryData object at 0x2beb610>, <awips.dataaccess.PyGeometryData.PyGeometryData object at 0x2bebdd0>]
|
||||
Polygon intersects the state of Texas
|
||||
Polygon intersects the state of Oklahoma
|
||||
```
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/awips2/python/bin/python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
|
||||
# set everything up
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
```python
|
||||
#!python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
import numpy as np
|
||||
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
|
@ -70,7 +70,7 @@ May 12 15 12:00:00 GMT (May 12 15 12:00:00 , May 12 15 13:00:00 )
|
|||
```
|
||||
|
||||
```python
|
||||
[<ufpy.dataaccess.PyGridData.PyGridData object at 0x26f9690>]
|
||||
[<awips.dataaccess.PyGridData.PyGridData object at 0x26f9690>]
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
```python
|
||||
#!python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
#Initiate a new DataRequest
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
```python
|
||||
#!python
|
||||
import numpy as np
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
#Initiate a new DataRequest
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
```python
|
||||
#!python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
request.setDatatype("obs")
|
||||
|
@ -33,7 +33,7 @@ print "Dewpoint is",ob.getString("dewpoint")
|
|||
```
|
||||
|
||||
```python
|
||||
[<ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x19718d0>]
|
||||
[<awips.dataaccess.PyGeometryData.PyGeometryData object at 0x19718d0>]
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
```python
|
||||
#!/awips2/python/bin/python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
import numpy as np
|
||||
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
|
@ -27,7 +27,7 @@ May 04 15 18:45:19 GMT
|
|||
```
|
||||
|
||||
```python
|
||||
[<ufpy.dataaccess.PyGridData.PyGridData object at 0x157d550>]
|
||||
[<awips.dataaccess.PyGridData.PyGridData object at 0x157d550>]
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
```python
|
||||
#!python
|
||||
#!/awips2/python/bin/python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
#Initiate a new DataRequest
|
||||
b = DataAccessLayer.newDataRequest()
|
||||
|
@ -25,7 +25,7 @@ b.setLocationNames("Oklahoma","Texas","Kansas")
|
|||
#Finally lets request some data. There are two types of data (Grid, Geometry) here we are
|
||||
#requesting geometry data and therefore use the getGeometryData method. We pass it our DataRequest object
|
||||
#that has all of our parameters and None for the DataTime object argument since maps are time agnostic
|
||||
#This returns a list of ufpy.dataaccess.PyGeometryData.PyGeometryData objects.
|
||||
#This returns a list of awips.dataaccess.PyGeometryData.PyGeometryData objects.
|
||||
c = DataAccessLayer.getGeometryData(b, None)
|
||||
print c
|
||||
|
||||
|
@ -50,7 +50,7 @@ for shape in c:
|
|||
```
|
||||
|
||||
```python
|
||||
[<ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4410>, <ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4510>, <ufpy.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4550>]
|
||||
[<awips.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4410>, <awips.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4510>, <awips.dataaccess.PyGeometryData.PyGeometryData object at 0x1ec4550>]
|
||||
```
|
||||
|
||||
```python
|
||||
|
|
|
@ -5,7 +5,7 @@ You could do this same type of request using any other geometry. For example, yo
|
|||
```python
|
||||
#!python
|
||||
#!/awips2/python/bin/python
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
import numpy as np
|
||||
|
||||
# First we will request the OUN CWA from the maps database.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
```python
|
||||
#!python
|
||||
import numpy as np
|
||||
from ufpy.dataaccess import DataAccessLayer
|
||||
from awips.dataaccess import DataAccessLayer
|
||||
|
||||
#Initiate a new DataRequest
|
||||
request = DataAccessLayer.newDataRequest()
|
||||
|
@ -23,12 +23,12 @@ t = DataAccessLayer.getAvailableTimes(request)
|
|||
#requesting gridded data and therefore use the getGridData method. We pass it our DataRequest object
|
||||
#that has all of our model, parameter, and level information and also a list of DataTime objects we want
|
||||
#the data for. In this case just give us the data from the last DataTime in the above list (t[-1]). This returns
|
||||
#a list of ufpy.dataaccess.PyGridData.PyGridData objects.
|
||||
#a list of awips.dataaccess.PyGridData.PyGridData objects.
|
||||
response = DataAccessLayer.getGridData(request, [t[-1]])
|
||||
print response
|
||||
|
||||
#Since we only asked for one DataTime we only have one PyGridData object. Lets pull this out
|
||||
#into a variable named data. Then we can use functions available from ufpy.dataaccess.PyGridData.PyGridData
|
||||
#into a variable named data. Then we can use functions available from awips.dataaccess.PyGridData.PyGridData
|
||||
#objects (see module for more methods or details)
|
||||
data = response[0]
|
||||
|
||||
|
@ -48,7 +48,7 @@ print data.getRawData()
|
|||
Our response object is a list of !PyGridData objects
|
||||
```python
|
||||
|
||||
[<ufpy.dataaccess.PyGridData.PyGridData object at 0x1d39910>]
|
||||
[<awips.dataaccess.PyGridData.PyGridData object at 0x1d39910>]
|
||||
```
|
||||
|
||||
Output of our print statement getting the units
|
||||
|
|
2
setup.cfg
Normal file
2
setup.cfg
Normal file
|
@ -0,0 +1,2 @@
|
|||
[metadata]
|
||||
description-file = README.md
|
14
setup.py
14
setup.py
|
@ -2,9 +2,15 @@ from distutils.core import setup
|
|||
from setuptools import find_packages
|
||||
|
||||
setup(
|
||||
name='ufpy',
|
||||
version='',
|
||||
#packages=['ufpy','ufpy.dataaccess',],
|
||||
name='python-awips',
|
||||
version='0.9.1',
|
||||
description='A framework for requesting AWIPS meteorological datasets from an EDEX server',
|
||||
packages=find_packages(exclude='data'),
|
||||
license='Creative Commons Attribution-Noncommercial-Share Alike license',
|
||||
license='Apache 2.0 / Various + US Export Controlled Technical Data',
|
||||
url='http://www.unidata.ucar.edu/software/awips2',
|
||||
download_url='https://github.com/Unidata/python-awips',
|
||||
author_email='mjames@ucar.edu',
|
||||
author='Michael James',
|
||||
requires=['argparse','shapely','numpy']
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue