README March 1, 1996 SWPROD Determination of Primary Productivity and Community Metabolism in Streams and Lakes using Diel Oxygen Measurements SWPROD - Version 1.2 1996/03/18 swprod1.2.DGUX.tar.gz - Distribution prepared on a Data General AViiON under DG/UX 5.4 swprod1.2.source.tar.gz - Distribution that includes the source code but no compiled software TABLE OF CONTENTS A. DESCRIPTION B. DOCUMENTATION C. EXTRACTING FILES D COMPILING E. INSTALLING F. RUNNING THE PROGRAM G. TESTING H. CONTACTS A. DESCRIPTION Program calculates daytime net productivity, night respiration, and total community metabolism from a diel series of dissolved oxygen, temperature, and salinity measurements. An Odum approach is used for the solution of the oxygen-balance equation at a single station in a stream or as a difference between upstream and downstream stations. Net oxygen production and subsequent community metabolism of horizontal lake segments are calculated assuming a one-dimensional model using a finite-difference equation. The results are useful for general aquatic ecosystem characterization and as input to water- quality models for dissolved-oxygen analysis of aquatic environments. B. DOCUMENTATION Stephens, D.W., and Jennings, M.E., 1976, Determination of Primary productivity and community metabolism in streams and lakes using diel oxygen measurements: U.S. Geological Survey Computer Contribution, 100 p. C. EXTRACTING FILES Compressed tar files are used to distribute pre-compiled versions of the software and the source code. All of the files needed to install swprod1.2 are contained in the files swprod1.2.______.tar.gz (where ______ is a string indicating the file contains either the source code or a pre-compiled version of the program for the indicated operating system). The source version of the tar file contains the source code and all other files needed to compile and install the software on a UNIX-based computer. For either type of distribution, the directory swprod1.2 will be created (or overwritten) when the files are extracted from the tar tape. If the swprod1.2 directory already exists, you may want to delete or rename it before extracting the files. The following are the steps to extract the files from a distribution tar file. Steps in extracting files explanation --------------------------------------- ----------------------------------- mv swprod1.2.____.tar.gz /usr/opt/wrdapp If the tar file is not already in the directory where you want the distribution installed, move it there. cd /usr/opt/wrdapp If you are not in the directory where the tar file is located, go there. gunzip swprod1.2.____.tar.gz Uncompress the distribution file. tar xf swprod1.2.____.tar Extract the distribution files from the tar file. This creates the following directory structure (the contents of each directory are shown to the right): swprod1.2 copy of this README file `-----bin compiled executable `-----bin_data message file required during execution `-----doc documentation files (see file Contents) `-----src Makefile (and, with source tar, the source code) `-----test scripts to run verification tests `-----data standard data sets used in verification tests Notes: a) The bin subdirectory is not included in the swprod1.2.source.tar.gz distribution, it is created during compilation. b) Source code is included only with the swprod1.2.source.tar.gz distribution. c) It is recommended that no user files be kept in the swprod1.2 directory structure. If you plan to put files in the swprod1.2 directory structure, do so only by creating subdirectories under swprod1.2. d) The software is configured for installation under the directory /usr/opt/wrdapp. The wrdapp directory may be a separate file system mounted at /usr/opt/wrdapp. e) To compile a new version of the software, you will need an ANSI-compilant Fortran 77 compiler. D. COMPILING If you have retrieved a pre-compiled distribution of the software, skip to the Installing section below. If a compiled version of the software is not available for your computer, or if you want to build the executable yourself, follow the instructions in this section. The source code is provided in the swprod1.2.source.tar.gz distribution so that users can generate the executable themselves. Little or no support can be provided for users generating their own versions of the software. In general, the requirements are ANSI-compliant Fortran 77 and a minimum level of knowledge of the compiler and the UNIX operating system. As provided, the make file and source code are set up for use on Data General AViiON workstations running the DG/UX operating system. To generate the executable and message file, do the following: 1. The values for the indicated variables in the following swprod1.2 files may need to be modified (see the file swprod1.2/doc/versions.doc for more details): may need to be modified ----------------------- version compiler file name variables flags name --------------------- --------- ------------ src/Makefile FFLAGS F77 test/test.sh WrdA 2. Run the Makefile program in the src directory to compile the source and build the message file. In the directory swprod1.2/src, run the make: cd swprod1.2/src make The swprod1.2/src/Makefile will: a. Create the directory swprod1.2/bin if it does not already exist. b. Compile the source code and place the swprod executable in the directory swprod1.2/bin. E. INSTALLING To make the swprod program easy to use, it should be installed in a directory included in the user's search path. The Makefile in swprod1.2/src contains instructions to optionally place a link in a specified directory to the executable contained in swprod1.2/bin. Use the following commands to do this: cd swprod1.2/src make install [BINDIR=bin_path] where bin_path is the name of a directory in the user's search path. If BINDIR is specified, a link to the executable (swprod1.2/bin/swprod) is placed in the specified directory. If BINDIR is not specified, no link is set and the full pathname of the executable is required to run the program. For example, if the search path is /usr/bin:/usr/opt/bin:/usr/local/bin, you can use the following command to install the program: make install BINDIR=/usr/local/bin Notes: a) Brackets "[xxx]" are used to indicate optional arguments to commands. b) To create and delete links to the swprod executable, the installer must have sufficient rights to the BINDIR directory. F. RUNNING THE PROGRAM After the swprod executable is properly installed (see Installing, above) in a directory that is included in the user's PATH, the program can be executed with the command "swprod". G. TESTING Test data sets are provided to verify that the program is correctly installed and running on the system. The tests may also be looked at as examples of how to use the program. The directory swprod1.2/test contains the scripts to run the tests. The directory swprod1.2/data contains the input data and the expected results for each test. Tests are usually run in the swprod1.2/test directory, but they can be run in any user directory. Type the following command to test the program installation: [path]/test.sh [start [stop]] where: path = path to the script use "." if running the tests in the swprod1.2/test directory use full pathname if not running the test in swprod1.2/test start = the number of the first test to perform default = 1 stop = the number of the last test to perform default = 3 For example: command what happens ------------------------------------- --------------------- ./test.sh runs all of the tests ./test.sh 1 1 runs the first test ./test.sh 2 3 runs tests 2 and 3 /usr/opt/wrdapp/swprod1.2/test/test.sh runs all of the tests After the tests are completed, the results are compared to the expected results (found in swprod1.2/data). See the file check.out; if all goes well, there should be no differences. To clean up after the tests, type the command: ./clean.sh Note: The standard data sets were created on a Data General AViiON workstation. You may notice slight numeric differences in the results on other computers. These are generally due to different round-off algorithms and the different architecture of the central processing unit chip. The tests are described in the table below, where 'test' is the test number, 'program' is the program used to run the test, and the 'usage' column indicates how a file is used, with i for input and o for output. test program description of test and files file name & usage ---- ------- --------------------------------- ----------------- 1 swprod Odum single station analysis Rhode River St. Pier input data file test1.inp i program output file test1.out o 2 swprod Odum two station analysis Yampa River input data file test2.inp i program output file test2.out o 3 swprod Bella - Odum lake analysis dummy data for testing input data file test3.inp i program output file test3.out o H. CONTACTS Inquiries about this software distribution should be directed to: U.S. Geological Survey Hydrologic Analysis Software Support Team Kathleen M. Flynn e-mail: h2osoft@usgs.gov 437 National Center phone: 703-648-5313 Reston, VA 22092 fax: 703-648-5722