Package noaadata :: Module stations
[hide private]
[frames] | no frames]

Module stations

source code

Handling code for noaa stations data.

The Web Services Description Language (WSDL) definition for the query/response from the NOAA Axis server.


See Also:
NOAA Axis page, WSDL, SOAP XML request, SOAP XML response, Java SOAP code, Web interface, XPathTutorial, python lxml
Authors:
Kurt Schwehr, Kurt Schwehr

Version: 5303

License: GPL v2

Copyright: (C) 2006 Kurt Schwehr

Classes [hide private]
  Station
A single station
  ActiveStations
Custom wrapper around the ActiveStations that allows the system to fail back to a precaptured list of stations and instruments

Functions [hide private]
  getActiveStationsSoappy(debug=False)
Use the old SOAPpy interface to get the stations
  stripNameSpaces(xmlString)
Nuke the xmlns sections.
  lonlatText2decimal(lonlatString)
Convert positions as found in the xml into decimal lon/lat
  getWaterLevelStationsBBox(ll, ur)
Return a list of Station Class objects.

Variables [hide private]
  __date__ = '2007-01-04'
Date of last svn commit
  hamptonRoadsBBox = [(-77.5, 36.5), (-74.5, 38.0)]

Function Details [hide private]

getActiveStationsSoappy(debug=False)

source code 

Use the old SOAPpy interface to get the stations

Here is the results for one station:

print response.station[1]

<SOAPpy.Types.structType station at 20681072>: {'parameter': ['', ''], 'metadata': <SOAPpy.Types.structType metadata at 20683272>: 'date_established': '1954-11-24', 'location': <SOAPpy.Types.structType location at 20635240>: }}
>>> response = getActiveStationsSoappy()
>>> str(response.station[1].metadata.location.lat)
'21 57.3 N'
>>> str(response.station[1].metadata.location.long)
'159 21.4 W'
>>> str(response.station[1].metadata.location.state)
'HI'
Parameters:
  • debug - set to true to see more information about the transaction
Returns:
a large typestring

stripNameSpaces(xmlString)

source code 
Nuke the xmlns sections. They cause lxml to make strange output.

Bug: would be better to use regex to nuke the xmlns. Currently very brittle. FIX!

lonlatText2decimal(lonlatString)

source code 
Convert positions as found in the xml into decimal lon/lat
>>> lonlatText2decimal('21 57.3 N')
21.954999999999998
>>> lonlatText2decimal('159 21.4 W')
-159.35666666666665

getWaterLevelStationsBBox(ll, ur)

source code 
Return a list of Station Class objects. Hides the fetch of the Active Stations

Variables Details [hide private]

__date__

Date of last svn commit
Value:
'2007-01-04'                                                           
      

hamptonRoadsBBox

None
Value:
[(-77.5, 36.5), (-74.5, 38.0)]