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: 6044

License: GPL v2

Copyright: (C) 2006 Kurt Schwehr

Date: 2007-04-23

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
source code
 
stripNameSpaces(xmlString)
Nuke the xmlns sections.
source code
 
lonlatText2decimal(lonlatString)
Convert positions as found in the xml into decimal lon/lat
source code
 
getWaterLevelStationsBBox(ll, ur)
Return a list of Station Class objects.
source code
Variables [hide private]
  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>: {'lat': '21 57.3 N', 'state': 'HI', 'long': '159 21.4 W'}}}
>>> 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