doc and readme updates, new datatyes document

This commit is contained in:
Michael James 2018-10-03 12:27:46 -06:00
parent 30e625349c
commit baac805148
5 changed files with 186 additions and 76 deletions

View file

@ -46,6 +46,11 @@ AWIPS Python Data Access Framework
:target: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
:alt: PRs Welcome
About
-----
The python-awips package provides a data access framework for requesting grid and geometry datasets from an AWIPS `EDEX <http://unidata.github.io/awips2/#edex>`_ server. AWIPS and python-awips packages are released and maintained by UCAR's `Unidata Program Center <http://www.unidata.ucar.edu/software/awips2/>`_ in Boulder, Colorado.
Install
-------
@ -64,8 +69,11 @@ Conda Environment
Requirements
------------
- Python >= 2.7
- pip install numpy shapely six
- python >= 2.7
- numpy
- six
- shapely
Documentation
-------------

View file

@ -38,6 +38,7 @@ extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx.ext.autosectionlabel',
'notebook_gen_sphinxext'
]
@ -57,7 +58,7 @@ master_doc = 'index'
# General information about the project.
project = 'python-awips'
copyright = '2016, Unidata'
copyright = '2018, Unidata'
author = 'Unidata'
# The version info for the project you're documenting, acts as replacement for

122
docs/source/datatypes.rst Normal file
View file

@ -0,0 +1,122 @@
====================
Available Data Types
====================
.. _awips.dataaccess.DataAccessLayer.getGeometryData(request, times=[]): api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getGeometryData
.. _awips.dataaccess.DataAccessLayer.getGridData(request, times=[]): api/DataAccessLayer.html#awips.dataaccess.DataAccessLayer.getGridData
.. _RadarCommon.get_hdf5_data(idra): api/RadarCommon.html
binlightning
------------
- Shapely Point::
POINT (-65.65293884277344 -16.94915580749512)
- returned by `awips.dataaccess.DataAccessLayer.getGeometryData(request, times=[])`_
- example (GLM)::
request = DataAccessLayer.newDataRequest()
request.setDatatype("binlightning")
request.addIdentifier("source", "GLMgr")
request.setParameters("intensity")
times = DataAccessLayer.getAvailableTimes(request)
response = DataAccessLayer.getGeometryData(request, times[-10:-1])
for ob in response:
dir(ob.getGeometry())
------------------
grid
----
- NumPy Array
- returned by: `awips.dataaccess.DataAccessLayer.getGridData(request, times=[])`_
- example::
request = DataAccessLayer.newDataRequest()
request.setDatatype("grid")
request.setLocationNames("RAP13")
request.setParameters("T")
request.setLevels("2.0FHAG")
cycles = DataAccessLayer.getAvailableTimes(request, True)
times = DataAccessLayer.getAvailableTimes(request)
fcstRun = DataAccessLayer.getForecastRun(cycles[-1], times)
response = DataAccessLayer.getGridData(request, [fcstRun[-1]])
for grid in response:
data = grid.getRawData()
lons, lats = grid.getLatLonCoords()
------------------
warning
-------
- Shapely MultiPolygon, Polygon::
MULTIPOLYGON ((-92.092348410 46.782322971, ..., -92.092348410 46.782322971),
(-90.948581075 46.992865960, ..., -90.948581075 46.992865960),
...
(-92.274543999 46.652773000, ..., -92.280511999 46.656933000),
(-92.285491999 46.660741000, ..., -92.285491999 46.660741000))
- returned by `awips.dataaccess.DataAccessLayer.getGeometryData(request, times=[])`_
- example::
request = DataAccessLayer.newDataRequest()
request.setDatatype("warning")
request.setParameters('phensig')
times = DataAccessLayer.getAvailableTimes(request)
response = DataAccessLayer.getGeometryData(request, times[-50:-1])
for ob in response:
poly = ob.getGeometry()
site = ob.getLocationName()
pd = ob.getDataTime().getValidPeriod()
ref = ob.getDataTime().getRefTime()
------------------
radar
-----
- NumPy Array
- returned by: `RadarCommon.get_hdf5_data(idra)`_
- example::
request = DataAccessLayer.newDataRequest()
request.setDatatype("radar")
request.setLocationNames("klzk")
# Get latest time for site
datatimes = DataAccessLayer.getAvailableTimes(request)
dateTimeStr = str(datatimes[-1])
#dateTimeStr = "2017-02-02 03:53:03"
buffer = 60 # seconds
dateTime = datetime.strptime(dateTimeStr, '%Y-%m-%d %H:%M:%S')
# Build timerange +/- buffer
beginRange = dateTime - timedelta(0, buffer)
endRange = dateTime + timedelta(0, buffer)
timerange = TimeRange(beginRange, endRange)
client = ThriftClient.ThriftClient("edex-cloud.unidata.ucar.edu")
request = GetRadarDataRecordRequest()
request.setTimeRange(timerange)
request.setRadarId("klzk")
request.setProductCode("94") # N0Q
request.setPrimaryElevationAngle("0.5")
response = client.sendRequest(request)
for record in response.getData():
# Get record hdf5 data
idra = record.getHdf5Data()
rdat,azdat,depVals,threshVals = RadarCommon.get_hdf5_data(idra)
dim = rdat.getDimension()
lat,lon = float(record.getLatitude()),float(record.getLongitude())
radials,rangeGates = rdat.getSizes()
# Convert raw byte to pixel value
rawValue=np.array(rdat.getByteData())

View file

@ -2,23 +2,37 @@
Python AWIPS Data Access Framework
==================================
`AWIPS <http://unidata.github.io/awips2>`_ is a weather display and analysis package developed by the National Weather Service for operational forecasting. UCAR's `Unidata Program Center <http://www.unidata.ucar.edu/software/awips2/>`_ supports a non-operational open-source release of the AWIPS software (`EDEX <http://unidata.github.io/awips2/#edex>`_, `CAVE <http://unidata.github.io/awips2/#cave>`_, and `python-awips <https://github.com/Unidata/python-awips>`_).
The python-awips package provides a data access framework for requesting grid and geometry datasets from an `EDEX <http://unidata.github.io/awips2/#edex>`_ server.
`AWIPS <http://unidata.github.io/awips2>`_ is a weather display and analysis package developed by the National Weather Service for operational forecasting. UCAR's `Unidata Program Center <http://www.unidata.ucar.edu/software/awips2/>`_ supports a non-operational open-source release of the AWIPS software (`EDEX <http://unidata.github.io/awips2/#edex>`_, `CAVE <http://unidata.github.io/awips2/#cave>`_, and `python-awips <https://github.com/Unidata/python-awips>`_).
.. _Jupyter Notebook: http://nbviewer.jupyter.org/github/Unidata/python-awips/tree/master/examples/notebooks
Install
-------
Pip Install
-----------
- pip install python-awips
Requirements
~~~~~~~~~~~~
Conda Environment Install
-------------------------
To install the latest version of python-awips, with all required and optional packages:
- git clone https://github.com/Unidata/python-awips.git
- cd python-awips
- conda env create -f environment.yml
- source activate python-awips
- python setup.py install --force
- jupyter notebook examples
Requirements
------------
- python 2.7+
- numpy
- shapely
- six
- Python 2.7+
- Shapely 1.4+
- MetPy and enum34 to run the `Jupyter Notebook`_ examples
Quick Example
~~~~~~~~~~~~~
@ -31,29 +45,31 @@ Quick Example
list(dataTypes)
['acars',
'binlightning',
'bufrmosavn',
'bufrmoseta',
'bufrmosgfs',
'bufrmoshpc',
'bufrmoslamp',
'bufrmosmrf',
'bufrua',
'climate',
'common_obs_spatial',
'gfe',
'grid',
'hydro',
'maps',
'modelsounding',
'obs',
'practicewarning',
'radar',
'radar_spatial',
'satellite',
'sfcobs',
'topo',
'warning']
'binlightning',
'bufrmosavn',
'bufrmoseta',
'bufrmosgfs',
'bufrmoshpc',
'bufrmoslamp',
'bufrmosmrf',
'bufrua',
'climate',
'common_obs_spatial',
'gfe',
'gfeeditarea',
'grid',
'maps',
'modelsounding',
'obs',
'practicewarning',
'profiler',
'radar',
'radar_spatial',
'satellite',
'sfcobs',
'topo',
'warning']
request = DataAccessLayer.newDataRequest()
request.setDatatype("satellite")
@ -91,15 +107,15 @@ Quick Example
See the `API Documentation <api/DataAccessLayer.html>`_ for more information.
-------------
Documentation
-------------
----------------------
Read The Docs Contents
----------------------
.. toctree::
:maxdepth: 2
install
api/index
datatypes
examples/index
dev
gridparms

View file

@ -1,37 +0,0 @@
.. _Jupyter Notebook: http://nbviewer.jupyter.org/github/Unidata/python-awips/tree/master/examples/notebooks
Installation
------------------
- pip install python-awips
Requirements
~~~~~~~~~~~~
- Python 2.7 or later
- pip install numpy shapely
- pip install metpy enum34 - to run `Jupyter Notebook`_ examples
Install from Github
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- git clone https://github.com/Unidata/python-awips.git && cd python-awips
- python setup.py install
Install for AWIPS
~~~~~~~~~~~~~~~~~
On standalone AWIPS systems, the full `AWIPS Python Stack <about.html#awips-ii-python-stack>`_ is installed to ``/awips2/python`` as RPM packages.
Easy install on an AWIPS system
* For Unidata AWIPS release **16.2.2+**:
* /awips2/python/bin/easy_install pip
* /awips2/python/bin/pip install python-awips
* For releases before and up to **16.1.5** you may need to run
* yum install awips2-python-setuptools