Using OWSLib to access Bureau of Meteorology Water Data Services (using Sensor Observation Service 2.0)

This py notebook shows how to retrieve water data from the Bureau of Meteorology's water data services (see The data service is a Sensor Observation Service (SOS) v2.0.

Service setup and metadata

The following imports the required OWSLib library, and contructs the base service object using the BoM service URL. Note that some of the functions use here are not yet merged into OWSLib (see

In [6]:
from owslib.sos import SensorObservationService
from owslib.swe.observation.sos200 import SOSGetObservationResponse
from IPython.core.display import HTML

service = SensorObservationService('',version='2.0.0')

We now have a service description document (capabilities doc). This describes what the service can do and provides some identifiers for various data offerings. For example, we can extract all the available observed properties from the service:

In [11]:
str =''
for prop in service.observed_properties:
    str += '<li>' + prop.replace('','') + '</li>'
  • Water Course Discharge
  • Rainfall
  • Water Course Level
  • Generic
  • Dry Air Temperature
  • Electrical Conductivity @ 25C
  • pH
  • Water Temperature
  • Relative Humidity
  • Storage Level
  • Storage Volume
  • Turbidity
  • Ground Water Level
  • Evaporation
  • Wind Direction
  • Wind Run
  • Wind Speed
  • Retrieving descriptions of available data streams

    This still doesn't describe identifiers for stations, or exactly which variables/phenomena are available at each station. To do this we need to use the 'GetDataAvailability' function. This call can be used to describe the available data series at a particular station. This is not part of the core SOS 2.0 spec, but it has been implemented by the Bureau using the HydroSOS profile.

    This still needs to be implemented in OWSLib Will try and add it.

    An example using an HTTP KvP request:

    Retrieving feature descriptions

    The Bureau service supports the GetFeatureOfInterest call, which is useful for discovering features with spatial filters. This call is not in OWSLib yet, but can be made using straight HTTP calls. I'll add an example..

    Retrieving observations

    This example below requests water course discharge data for a specific monitoring site ( - a site in Tasmania), for the period 1st Jan 2016 to 5th March 2016

    In [13]:
    response = service.get_observation(featureOfInterest='',
                                       observedProperties=[' Course Discharge'],

    WaterML2.0 observation parser, plotting with pandas

    Once you have the service response, you can parse the response uing the OWSLib SOSGetObservationResponse class. This will identify the type of service response (in this case, WaterML2.0) and provide a parsed object.

    Here we just pull out the time-value pairs and pass to Pandas to plot. Note that missing points and gaps are correctly passed through.

    In [7]:
    %matplotlib inline
    from owslib.etree import etree
    import pandas as pd
    from pandas import Series
    et = etree.fromstring(response)
    parsed_response = SOSGetObservationResponse(et)
    for o in parsed_response.observations[0:2]:
        series = o.get_result()
        dates = [p.datetime for p in series]
        values = [p.value for p in series]  
        series = pd.Series(values, index=dates)

    And there we have it. A discharge series - for any station in Australia.

    In [ ]: