Here is a quick guide to getting WOFpy up and running.
Follow the steps below to install WOFpy and its prerequisites on a Windows computer.
The wof package (in the subfolder named wof) is now accessible from any directory.
Note
If you edit code in the wof folder, you may need to run setup.py again to apply the changes to your system.
Example services are included with WOFpy. Each example consists of data, Data Access Objects (DAOs), models, and the service definition. The examples are located in the examples folder.
The general procedure for each example is to set up any required data connections, use Python to run the runserver.py script, and test the service using a Web browser or other client application. The script should print service endpoint URIs in the window used to execute the script.
When testing is complete, you should stop the service. For example, if you started the service using a command window in Windows, you can stop the service by pressing CTRL+C in the command window.
Note
These examples are run in debug mode for demonstration purposes. In a production environment, you would use something like IIS or Apache to manage the service.
The examples are described in more detail below.
This example is located in the examples/barebones folder.
This example shows how to access a very simple SQLite database located in the LCM_Data subfolder. The database only has three tables in it: one for sites, one for variables, and one for data values. The remaining information required for WaterML is read from a config file.
Follow the steps below to run this example.
This example is located in the examples/swis folder.
This example shows how to access a more complicated SQLite database based on early designs of the Texas Water Development Board’s Surface Water Information System (SWIS) database.
Follow the steps below to run this example.
This example is located in the examples/odm_sqlserver folder.
This example shows how to access CUAHSI Observations Data Model (ODM) databases in Microsoft SQL Server. The example uses the Little Bear River ODM 1.1 example database from the HIS website at http://his.cuahsi.org/odmdatabases.html.
Follow the steps below to run this example.
This example is located in the examples/cbi folder.
This example shows how to access a Web service provided by the Conrad Blucher Institute (CBI) for the Texas Coastal Ocean Observation Network (TCOON). TCOON is a live network with new values continuously pouring in from sensors along the Texas coast. Data access is provided by a variant of the OGC’s Sensor Observation Service (SOS). We will provide access to the data with a WaterOneFlow service by wrapping the TCOON SOS service with our data access object (DAO) and supporting modules. Because site and variable descriptions do not change frequently in TCOON, we store that information in a local SQLite database. The result is a Web service that uses both a SQLite database and another Web service to provide data to the client. Of course, the client has no idea that this is happening. All the client cares about is that we provide access using a standard WaterOneFlow service and send responses back in WaterML format!
This example requires an internet connection to access the TCOON Web service. To prepare your service, you will make a cache of sites and variables available from TCOON. Then you will run the service.
Follow the steps below to run this example.
This example is located in the examples folder.
This folder contains a runserver_multiple.py script demonstrating how to run multiple services at once. It uses the barebones and SWIS examples. Follow the steps below to run this example.
Running the examples is a great way to learn the REST syntax for accessing data with WOFpy. The examples create a web page with sample URIs illustrating the required syntax. You can click the URIs in your browser to see the results. The syntax is also described below.
All query results are provided in WaterML 1.0 unless specified otherwise.
Note
The time format is ISO time. You can leave out the time component and just write YYYY-MM-DD. You can specify time zone by appending the offset from Universal Time Coordinates (UTC) in hours to the end of the date string, or by appending Z to indicate UTC. For example, to specify April 5, 2011, 5:00 PM in US Central Standard Time: 2011-04-05T05:00-06
See Wikipedia for more examples.
Note
WaterML 2.0 format is only available for GetValues requests.
The SOAP endpoint follows the WaterOneFlow standard, whose method signatures and WaterML responses are described on the HIS website at http://his.cuahsi.org/wofws.html.
One of the easiest ways to test the SOAP endpoint is to use the free soapUI program. To test with soapUI: