WOFpy is a Python package that implements CUAHSI's WaterOneFlow Web service. WaterOneFlow is a Web service with methods for querying time series of water data at point locations, and which returns data in WaterML format, providing standardized access to water data.
WOFpy reads data from a Data Access Object (DAO) and translates the data into WaterML.
DAOs can represent a variety of data sources,
including databases, text files, and Web sites or services.
You can view example DAOs in the examples folder,
or write your own based on the BaseDao class in wof/dao.py
.
WOFpy uses Python version 2.7.
Extensive documentation is available at http://pythonhosted.org/WOFpy/
In general, the easiest method is to utilize the conda package from the ODM2 channel.
conda install wofpy --channel odm2
This is new material that is up to date. The sections "Running the Examples" and "Publishing Your Data", below, might be out of date.
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. See the documentation for more information.
A quick way to use the examples is via the wofpy_config
CLI.
Type wofpy_config --help
to display the usage Instructions.
wofpy_config MyWorkingDirectory
The command above will create and populate the MyWorkingDirectory
with the files needed to run the odm2 timeseries
example.
Right now that is is only one tested example,
in the future extra options will enable the user to choose the base example used.
Follow the general steps below to publish your data with WOFpy.
- Write a new DAO class based on wof.dao.BaseDao; the methods should return objects as defined in wof.models. This class helps WOFpy read your data.
- Write a new config file like those found in the examples,
e.g.
wof/examples/flask/odm2/timeseries/odm2_config_timeseries.cfg
. This file contains static descriptors of your Web service such as the name of your water observations network. - Write a new runserver script to use the new DAO you implemented. See files named runserver_*.py in the examples folder for examples.
- To test, open a command window, navigate where your runserver file is located, and use Python to run the script, e.g., python runserver.py.
This work was supported by National Science Foundation Grant ACI-1339834. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.