I have uploaded a new set of files onto the NPSource project download area (http://sourceforge.net/projects/npsource/ - the package name is "Web-Hydro Objects") which contain a new web-enabled hydrologic modeling library written in PHP. The libraries contain object-oriented web hydro modeling capabilities, as well as routines to automatically retrieve USGS monitoring data.
A simple demo which models the effects of water withdrawals from a stream can be run from my server at:
http://soulswimmer.dynalias.net/models/wsdemo/demo.php
This demo simulates a system with a reach that has its flow inputs defined by a USGS gage output, and has two withdrawals, one of which goes into a modeled reservoir with a daily yield demand of 72 CFS. The user can select a USGS gage to act as the upstream inflow of the modeled reach, the reach length and base width (the demo assumes side slope Z = 1.0), and area factor to scale flow input, a time step, a simulation start/end date, and the triggers for the stream water withdrawals. After entering the input data, clicking on "Show Time Series" will run the simulation. The routine will go out to the USGS NWIS system and retrieve the upstream flow input for the desired time period, then run the simulation, executing water withdrawals from the simulated reach according to the rules entered. The output will be displayed in a general hydrograph form with pre and post-withdrawal flows, and pre and post-withdrawal flow-duration curves. There will also be downloadable CSV files of the flow output.
The default inputs in this demo will model a scenario with two realistic withdrawals from the James River near Richmond Virginia. Users may also choose any NWIS accessible USGS station for upstream flow input to the modeled reach. You may base water withdrawals on the reach Inflow (Qin), outflow (Qout), or the depth of flow. Be kind using the demo on soulswimmer.dynalis.net, as this server is beyond rickety (a P133 Mhz), a 5 year simulation takes about 5 minutes, and something longer than about 10 years will consume too much memory and crash the routine. When installed on a modern machine the demo will run 5 years in less than 30 seconds, with a majority of that time spent retrieving the USGS data.
Installation instructions are in the file README.txt that is in the file web_hydro_objects_0.1.tar.gz downloadable from the Source Forge site (listed above). This library has been run successfully on both Linux and Windows systems (both running apache web server).
Please feel free to contact me on this listserv, or at rburghol@vt.edu with any requests, comments, or suggestions.
Rob
Below is installation description for web hydro objects libraries and demo.
README.txt
Description:
The PHP library lib_hydrology.php contains a prototype set of Object Oriented routines for constructing a hydrologic model that can be run via a web interface. The objects contained in this library include: a surface infiltration and runoff object, a trapezoidal channel storage routing object, a rule-based water withdrawal object (which interacts with the channel storage routing object)
Requirements:
- >= PHP 5.1
- >= jpgraph 2.2 - Necessary only for the graphical output when running the demo "demo.php", technically, the hydrology objects do NOT require jpgraph.
Installation:
- unpack hydro_demo.tar.gz into your web server folder
- Set the variables: "$basedir" - base folder for install, "$libdir" - location of where you installed the accompanying library files, and "$glibdir" - location of jpgraph libraries, only needed if you use the graphing in the demo.php file.
- Make sure that the sub-directory "out" is writeable by the web-server process. The graphs and csv output files will be stored there.
- Run the routine by accessing "demo.php" on your site in a browser. Use default data, or enter your own USGS gage, stream reach dimensions, and withdrawal rules.
File Manifest:
- test4.php - beta version of a flow routing and reservoir withdrawal rule algorithms in lib_hydrology.php
- config.php - configuration information. You must set the proper path in the variable "$basedir" for your installation.
Component libraries:
lib_hydrology.php - contains functions recently ported into php from a C library that I have been developing to perform routine hydrology calculations, such as green-ampt infiltration rates, soil properties estimates from sand/clay fractions, and storage routing in trapezoidal channels. lib_usgs.php - library for retrieving data from the USGS gage network. Can retrieve both real-time and historical data for stream gages, lakes, and groundwater wells. db_functions.php - a menagerie of functions misc_functions.php - another menagerie
file_functions.php - functions for reading and writing to files lib_plot.php - some basic graphing functions