P2S—Coupled Simulation with the Precipitation-Runoff 

Modeling System (PRMS) and the Stream Temperature 

Network (SNTemp) Models

By Steven L. Markstrom

Open-File Report 2012–1116

U.S. Department of the Interior

U.S. Geological Survey
U.S. Department of the Interior

KEN SALAZAR, Secretary

U.S. Geological Survey

Marcia K. McNutt, Director

U.S. Geological Survey, Reston, Virginia: 2012 

For more information on the USGS—the Federal source for science about the Earth,

its natural and living resources, natural hazards, and the environment—visit 

http://www.usgs.gov or call 1–888–ASK–USGS

For an overview of USGS information products, including maps, imagery, and publications,

visit http://www.usgs.gov/pubprod

To order this and other USGS information products, visit http://store.usgs.gov

Suggested citation:

Markstrom, S.L., 2012, P2S—Coupled simulation with the Precipitation-Runoff Modeling System (PRMS) and the 

Stream Temperature Network (SNTemp) Models: U.S. Geological Survey Open-File Report 2012–1116, 19 p.

Any use of trade, product, or firm names is for descriptive purposes only and does not imply 

endorsement by the U.S. Government. 

Although this report is in the public domain, permission must be secured from the individual 

copyright owners to reproduce any copyrighted material contained within this report.
iii

Contents

Abstract ......................................................................................................................................................................... 1

Introduction.................................................................................................................................................................... 1

Purpose and Scope ................................................................................................................................................... 4

Installation Instructions............................................................................................................................................... 4

Design of P2S................................................................................................................................................................ 4

Modifications to SNTemp for P2S.............................................................................................................................. 5

Limitations and Assumptions ..................................................................................................................................... 5

P2S Execution............................................................................................................................................................... 6

Steps for Making the Stream Segment Shapefile .....................................................................................................12

Summary ......................................................................................................................................................................13

References Cited..........................................................................................................................................................13

Appendix 1. Documentation of the Muskingum Module................................................................................................15

Introduction...................................................................................................................................................................15

Styles and Formats ...................................................................................................................................................15

Muskingum Routing Module: muskingum.....................................................................................................................15

References Cited..........................................................................................................................................................19

Figures

Figure 1. Diagram showing the hydrologic components as conceptualized in the Precipitation Runoff Modeling 

System (modified from Leavesley and others, 1983)..................................................................................................... 2

Figure 2. Diagram showing the energy and water components in a stream segment as conceptualized in the 

Stream Network Temperature Model (from Bartholow, 2000)........................................................................................ 3

Figure 3. Diagram showing the information flow between the Precipitation Runoff Modeling System (PRMS), P2S, 

and the Stream Network Temperature Model (SNTemp). The sequence of execution starts on the left with the inputs 

to PRMS, progresses towards the right, through P2S, and finishes with the output files produced by SNTemp. .......... 5

Figure 4. A screen image of an ESRI ArcMap project showing a stream segment network shapefile and the 

associated attribute table............................................................................................................................................... 8

Figure 5. A portion of the Extensible Markup Language (.xml) format file containing Stream Network Temperature 

Model input values....................................................................................................................................................... 10
iv

Tables 

Table 1. Precipitation Runoff Modeling System (PRMS) variables which must be written to the PRMS animation 

file to be used as input by P2S. ..................................................................................................................................... 7

Table 2. Attributes which must be present in the Stream Segement shapefile coverage to describe the topology 

and physical attributes of the stream segement network to P2S. .................................................................................. 9

Table 3. Stream Network Temperature Model (SNTemp) input values which must be present in “p2s.xml” input 

file. These values are described by Theurer and others (1984, p. III-63–III-92)........................................................... 11

Table A1-1.—Input parameters to Streamflow Module: muskingum........................................................................... 16

Table A1-2.—Variables used in Streamflow Module: muskingum.............................................................................. 17
v

Conversion Factors

Inch/Pound to SI

Multiply By To obtain

Length

inch (in.) 2.54 centimeter (cm)

inch (in.) 25.4 millimeter (mm)

Flow rate

cubic foot per second (ft3/s) 0.02832 cubic meter per second 

(m3/s)

SI to Inch/Pound

Multiply By To obtain

Length

centimeter (cm) 0.3937 inch (in.)

millimeter (mm) 0.03937 inch (in.)

meter (m) 3.281 foot (ft) 

Area

square meter (m2) 0.0002471 acre 

Volume

cubic meter (m3) 35.31 cubic foot (ft3)

Flow rate

meter per second (m/s) 3.281 foot per second (ft/s) 

cubic meter per second (m3/s) 35.31 cubic foot per second (ft3/s)

Mass

gram (g) 0.03527 ounce, avoirdupois (oz)

Energy

joule (J) 0.0000002 kilowatthour (kWh)

Temperature in degrees Celsius (°C) may be converted to degrees Fahrenheit (°F) as follows:

°F=(1.8×°C)+32

The solar radiation unit, Langley, is 1 gram-calorie per square centimeter or 11.622 watt-hours per square meter.
P2S—Coupled Simulation with the Precipitation-Runoff 

Modeling System (PRMS) and the Stream Temperature 

Network (SNTemp) Models

By Steven L. Markstrom

Abstract

A software program, called P2S, has been developed which couples the daily stream temperature 

simulation capabilities of the U.S. Geological Survey Stream Network Temperature model with the 

watershed hydrology simulation capabilities of the U.S. Geological Survey Precipitation-Runoff 

Modeling System. The Precipitation-Runoff Modeling System is a modular, deterministic, distributedparameter, physical-process watershed model that simulates hydrologic response to various 

combinations of climate and land use. Stream Network Temperature was developed to help aquatic 

biologists and engineers predict the effects of changes that hydrology and energy have on water 

temperatures. P2S will allow scientists and watershed managers to evaluate the effects of historical 

climate and projected climate change, landscape evolution, and resource management scenarios on 

watershed hydrology and in-stream water temperature.

Introduction

The importance of effective stream temperature modeling, related to determination of suitability

and management of ecological habitat, has been demonstrated in several studies (for example, Brown, 

1969; Flint and Flint, 2008; and Gaffield and others, 2005; Perry and others, 2011; Sinokrot and Stefan, 

1993). Likewise, watershed hydrology models have been used to project the hydrologic response of 

watersheds to a variety of changing climatic and land-use scenarios (for example, Hay and others, 2011; 

Markstrom and others, 2012). P2S combines these two approaches by coupling the Precipitation-Runoff 

Modeling System (PRMS) and Stream Network Temperature (SNTemp) simulations models. These two 

models are described below.

Markstrom and others (2008, p. 4) describe PRMS as a modular, deterministic, distributedparameter, physical-process watershed model used to simulate and evaluate the effects of various 

combinations of precipitation, climate, and land use on watershed response. Response to normal and 

extreme rainfall and snowmelt can be simulated to evaluate changes in water-balance relations, 

streamflow regimes, soil-water relations, and groundwater recharge. Each hydrologic component used 

to model the generation of streamflow is represented within PRMS by a process algorithm that is based 

on a physical law or empirical relation with measured or estimated characteristics (fig. 1). Because 

PRMS is usually operated in a daily time step, the streamflow time of travel within a watershed should 

be less than 24 hours. However, for larger watersheds that have longer travel times a stream routing 

component can be used. The reader is referred to Leavesley and others (1983), Leavesley and Stannard 

(1995), Leavesley and others (2005), and Markstrom and others (2008) for a complete description of 
2

PRMS. These reports are available at: 

http://wwwbrr.cr.usgs.gov/projects/SW_MoWS/software/oui_and_mms_s/prms.shtml, accessed March 

2012.

Figure 1. Diagram showing the hydrologic components as conceptualized in the Precipitation Runoff Modeling 

System (modified from Leavesley and others, 1983).

Theurer and others (1984, p. I-4) describe SNTemp as a model to predict in-stream water 

temperatures based on hydrological, meteorological, topographic and vegetative shading, and stream 

channel conditions (fig. 2). They describe SNTemp as being “applicable to any size watershed or river 

basin with a stream network of any stream order and complexity;” however, shortcomings have been 

found when applying SNTemp to networks where the travel time is much larger than the simulation 

time step. These limitations with SNTemp have been overcome by improving the streamflow routing 

Plant canopy

interception

Precipitation

Solar

radiation

Air temperature

Surface runoff

to stream

Soil-Zone Rese Impervious-Zone Reservoir rvoir

Snowpack

Transpiration

Evaporation

and

Transpiration Evaporation

Rain Rain

Snowmelt

Evaporation Sublimation

Throughfall

Recharge zone

Lower zone

Subsurface

Reservoir

Subsurface recharge

Ground-water recharge

Ground-water

recharge

Ground-Water

Reservoir Ground-water flow to stream

Ground-water

sink

Interflow or

subsurface

flow to stream
3

algorithms of PRMS (see Appendix, this report). Despite this, SNTemp incorporates several features 

relevant to P2S, including: (1) a heat transport model that predicts the daily-mean water temperature and 

diurnal fluctuations in water temperature as functions of stream distance; (2) a heat-flux model that 

predicts the energy balance between the water and its surrounding environment; and (3) a shade model 

that predicts the solar radiation-weighted shading resulting from both topography and riparian 

vegetation. The reader is referred to Theurer and others (1984) and Bartholow (2000) for a complete 

description of SNTemp. These publications are available at: 

http://www.fort.usgs.gov/products/software/SNTEMP/, accessed March 2012.

Figure 2. Diagram showing the energy and water components in a stream segment as conceptualized in the 

Stream Network Temperature Model (from Bartholow, 2000).
4

Purpose and Scope

This report describes P2S version 1.0 and serves as the user’s manual. This report describes 

where to get P2S and how to install it. The design concepts of P2S are presented. The steps required to 

execute P2S in the correct order are presented. This report is not intended as instruction for application 

development of PRMS or SNTemp, as these models are already documented.

Installation Instructions

The latest version of P2S is available from the P2S Web page 

(http://water.usgs.gov/lookup/get?crresearch/p2s, accessed April 2012) and is distributed as a zip file. 

About 100 megabytes of disk space are required for installation, but large applications will require much 

more disk space for data. This installation includes libraries, source code, startup scripts, and example 

datasets. Unzipping the distribution file is all that is required for installation of P2S.

In addition, P2S requires working installations of the current version of the PRMS software 

(http://water.usgs.gov/lookup/get?crresearch/prms, accessed March 2012) and either the SNTemp 

software (http://www.fort.usgs.gov/products/software/SNTEMP, accessed March 2012), as originally 

distributed, or a modified version, as described in the “Modifications to SNTemp for P2S” section in 

this report.

Design of P2S

P2S is implemented as loosely coupled software (fig. 3). There are three basic steps: (1) the user 

executes PRMS first, simulating daily streamflow, components of flow, solar radiation, and air 

temperature at each stream segment in the stream network; then, (2) the user executes P2S, which reads 

the output files produced by PRMS (in step 1) and creates the SNTemp input files; and finally, (3) the 

user executes SNTemp, with the files created in step 2, which simulates the mean daily and maximum 

daily temperature for each stream segment in the stream network. More details about these steps are 

provided below in the “P2S Execution” section of this report.
5

Mean and Maximum

Daily Water Temperature, 

by stream segment

PRMS

Daily Components of 

Flow, by stream 

segment

Daily Air Temperature, 

solar radiation, by 

stream segment

P2S

Channel

Attributes

SNTemp

SNTemp Daily Input Files:

• Meteorology

• Hydrology

• Shade

• Topology

Climate

Watershed

Attributes

Figure 3. Diagram showing the information flow between the Precipitation Runoff Modeling System (PRMS), P2S, 

and the Stream Network Temperature Model (SNTemp). The sequence of execution starts on the left with the 

inputs to PRMS, progresses towards the right, through P2S, and finishes with the output files produced by 

SNTemp.

Modifications to SNTemp for P2S

The version of SNTemp distributed with P2S is identical to the version available from the 

SNTemp Web site (http://www.fort.usgs.gov/products/software/SNTEMP, accessed March 2012) except 

for two modifications to the Fortran source code. The first modification is that some of the array sizes 

have been increased to accommodate larger stream networks. The second modification allows for mean 

daily and maximum daily in-stream temperature to be printed for every stream segment, for every 

simulated time step, to an output file, in standard PRMS format. Thus, the same analysis and 

visualization tools can be used on PRMS and SNTemp output files. 

Limitations and Assumptions

Anytime existing simulation models are coupled, as they are with P2S, the resulting synthesis 

will exhibit all of the limitations and assumptions of the original simulation models. However, in the 

case of P2S there may be more issues related to differences in how the two models (PRMS and 

SNTemp) are using common information differently. For example, although SNTemp makes adiabatic 

adjustments to the climate input data based on the elevation difference between the climate station and 

each segment, it still uses only a single climate station for the entire river configuration. PRMS, on the 

other hand can use numerous climate stations, and it also makes adiabatic adjustments that can be 

different from the way SNTemp makes adiabatic adjustments. [Pages II-29 and II-30 in Theurer and 

others (1984) contains information about the SNTemp adiabatic adjustments]. 
6

P2S Execution

These are the required steps to run PRMS and SNTemp in a coupled fashion, using P2S:

1. Install the PRMS, SNTemp, and P2S software packages.

2. Develop and calibrate the PRMS model application for the study watershed. This application 

requires the Muskingum module and all of the additional input defined by tables 1 through 3.

3. Make the PRMS simulation which corresponds to the historical, current condition, climate, or 

land-use projection of interest. Make sure that the required output variables, basin_temp (basin 

area-weighted air temperature) and basin_potet (basin area-weighted average of potential 

shortwave solar radiation), are written to the PRMS Statvar File and the PRMS Animation File 

(table 1), respectively. Set the PRMS Control File (described by Markstrom and others, 2008, p. 

134–137) using the MMS Tool graphical editor (Markstrom and Koczot, 2008, p. 19–21).

4. SNTemp requires that all years included in the simulation have the same number of days, so 

remove the leap day data from the files written in step 3. Do this with a text editor or use the 

provided convenience script (“removeLeapDay.bat”). The Streams Editor (sed) is a convenient 

utility for doing this. Sed is freely available from the Gnu Organization web site 

(http://www.gnu.org/software/sed, accessed March 2012).

5. Open the stream segment map that was created for the PRMS model with ArcMap (fig. 4). Add 

the required attributes for SNTemp (table 2). This includes information about stream segment 

topology, geometry, and vegetation. The specific steps required to add the information to the 

map is described below in the “Making the Stream Segment Map” section of this report.

6. Save the stream segment map (from step 5) in Shape File Format.

7. A dBase format (.dbf) file was created in step 6. Open this file with the Excel spreadsheet 

program. Save this content back out in Comma Separated Value (.csv) format.

8. Edit the Extensible Markup Language format (.xml) file “p2s.xml” with a text editor so that the 

paths and file names are correct for the files that were just created in steps 1–7 above (fig. 5). 

There are also many SNTemp input parameter values in this file. These values are described by 

Theurer and others (1984, p. III-63–III-92) and are summarized in table 3. Edit the values in this 

file so that they will be changed when they are written to the SNTemp input file. 

9. Execute the script “p2s.sh.” This script prepares the input and job control file in the SNTemp

directory to prepare the SNTemp model for a model run.

10. Run the SNTemp executable, using the SNTemp job and input files created by step 9.

11. The execution of SNTemp in step 10 will produce all of the standard SNTemp output files as 

described by Theurer and others (1984, p. III-72–III-75). In addition, a PRMS formatted 

Animation File will be produced (Markstrom and others, 2008, p. 97–99).
7

Table 1. Precipitation Runoff Modeling System (PRMS) variables which must be written to the PRMS animation 

file to be used as input by P2S.

[nsegment, number of stream segments in the stream network; nhru, number of hydrologic response units in the basin; ft3/s, 

cubic feet per second; HRU, hydrologic response unit; float, floating point format]

Variable name Description Dimension Units Type

seginc_gwflow lateral groundwater flow to segment nsegment ft3/s float

seginc_sroff lateral surface runoff to segment nsegment ft3/s float

seginc_ssflow lateral subsurface flow to segment nsegment ft3/s float

seg_outflow total streamflow in segment nsegment ft3/s float
8

Figure 4. A screen image of an ESRI ArcMap project showing a stream segment network shapefile and the 

associated attribute table.
9

Table 2. Attributes which must be present in the Stream Segement shapefile coverage to describe the topology 

and physical attributes of the stream segement network to P2S.

[float, floating point format]

Attribute name Description Units Type

FNODE_ Unique identifier of upstream node 

(automatically omes from ArcMap)

none integer

TNODE_ Unique identifier of downstream node 

(automatically comes from ArcMap)

none integer

GRID_CODE Unique identifier of segment, from one 

to the total number of segments

none integer

LENGTH Length of segment meters float

F_ALT Altitude of upstream node meters float

T_ALT Altitude of downstream node meters float

F_LAT Latitude of upstream node radians float

T_LAT Latitude of downstream node radians float

F_X X coordinate of upstream node meters float

F_Y Y coordinate of upstream node meters float

T_X X coordinate of downstream node meters float

T_Y Y coordinate of downstream node meters float

WIDTH Channel width meters float

WIDTH_EXP Exponent in channel width equation 

(usually set to 0.0)

none float

MANNING Manning’s roughness coefficient (n) none float

GRNDTEMP Average annual ground temperature degrees Celsius float

THERMGD Thermal gradient across stream bed Joules/square meter/second/

degrees Celsius

float

ETOPALT East side topological altitude. Angle 

from the centerline of the stream 

segment.

radians float

ECROWN East side crown height meters float

EVEGHT East side vegetation height meters float

EVEGOFF East side vegetation offset meters float

EVDENSUM East side summer vegetation density decimal fraction float

EVDENWIN East side winter vegetation density decimal fraction float

WTOPALT West side topological altitude. Angle 

from the centerline of the stream 

segment.

radians float

WCROWN West side crown height meters float

WVEGHT West side vegetation height meters float

WVEGOFF West side vegetation offset meters float

WVDENSUM West side summer vegetation density decimal fraction float

WVDENWIN West side winter vegetation density decimal fraction float
10

Figure 5. A portion of the Extensible Markup Language (.xml) format file containing Stream Network Temperature 

Model input values.
11

Table 3. Stream Network Temperature Model (SNTemp) input values which must be present in “p2s.xml” input 

file. These values are described by Theurer and others (1984, p. III-63–III-92).

[nsegment, number of stream segments in the stream network; float, floating point format]

Variable name Description Dimension Units Type

basinLatitude latitude of the centroid of the watershed 1 radians float

evapFactor coefficients for stream evaporation 

computations (Theurer and others, 1984, 

II-38) 

4 decimal fraction float

bowenRatio coefficients for convection computations 

(Theurer and others, 1984, p. II-39)

1 decimal fraction float

airTempConstant air temperature calibration factor (Theurer 

and others, 1984, p. II-82)

1 degrees Celsius float

airTempCoef air temperature calibration factor (Theurer 

and others, 1984, p. II-82)

1 decimal fraction float

windConstant wind speed calibration factor (Theurer 

and others, 1984, p. II-82)

1 meters/ second float

windCoef wind speed calibration factor (Theurer 

and others, 1984, p. II-82)

1 decimal fraction float

humidConstant relative humidity calibration factor 

(Theurer and others, 1984, p. II-82)

1 decimal fraction float

humidCoef relative humidity calibration factor 

(Theurer and others, 1984, p. II-82)

1 decimal fraction float

sunshineConstant sunshine calibration factor (Theurer and 

others, 1984, p. II-82)

1 Joules/ square meter/ 

second

float

sunshineCoef sunshine calibration factor (Theurer and 

others, 1984, p. II-82)

1 decimal fraction float

solarConstant solar radiation calibration factor (Theurer 

and others, 1984, p. II-82)

1 decimal fraction float

solarCoef solar radiation calibration factor (Theurer 

and others, 1984, p. II-82)

1 decimal fraction float

windSpeed mean daily wind speed, by month, for the 

watershed

12 meters/ second float

relativeHumidity mean daily relative humidity, by month, 

for the watershed

12 decimal fraction float

fractionSun mean daily solar radiation transmission 

fraction, by month, for the watershed

12 decimal fraction float

dustCoef mean daily solar radiation transmission 

reduction fraction due to dust, by month, 

for the watershed

12 decimal fraction float

groundReflectivity mean daily ground surface albedo, by 

month, for the watershed

12 decimal fraction float

basinLatitude latitude of the centroid of the watershed 1 radians float

evapFactor coefficients for stream evaporation 

computations (Theurer and others, 1984, 

II-38) 

4 decimal fraction float

bowenRatio coefficients for convection computations 

(Theurer and others, 1984, p. II-39)

1 decimal fraction float

airTempConstant air temperature calibration factor (Theurer 

and others, 1984, p. II-82)

1 degrees Celsius float

airTempCoef air temperature calibration factor (Theurer 

and others, 1984, p. II-82)

1 decimal fraction float

windConstant wind speed calibration factor (Theurer 

and others, 1984, p. II-82)

1 meters/second float
12

Steps for Making the Stream Segment Shapefile

These are the steps required to make the stream segment shapefile using ArcMap. This shapefile 

is required for step 5 above in the “P2S Execution” section of this report.

1. Get the stream network shapefile used for the PRMS model.

2. Open the attribute table and sort on GRID_CODE. This is the stream segment identifier (ID). 

The goal is to make these go from one to the total number of segments, one (and only one) row 

for each segment.

3. Move down through the attribute table looking for multiple polylines with the same 

GRID_CODE. Merge these polylines into one poly line with the appropriate GRID_CODE. Pay 

attention to FROM_NODE and TO_NODE, as the network topology (which segments are 

connected together and direction of flow) is important.

4. Click on the Show Directions toggle button in XTools Pro (http://www.xtoolspro.com, accessed 

March 2012) to see which direction the stream segments are going. If segments are going the 

wrong direction, click on Editor->Start Editing. Then double click on the segment to select it. 

Then right click on the mouse and choose Flip from the menu. Click on Editor->Stop Editing.

5. Create two new shapefiles named “from_nodes” and “to_nodes” with XTools Pro. Use Feature 

Conversions->Convert Features to Points. Select Points->End Points->From and set the Output 

Storage (shapefile name) to “from_node.” Select Points->End Points->To and set the Output 

Storage to “to_node.”

6. Use these shapefiles to determine if the stream segments are connected correctly. Fix them if 

they are not.

7. Use the from_nodes and to_nodes shapefiles for the rest of the calculations but keep them 

separate from the original stream segment file.

8. Add the attributes (definitions shown in table 2) to the stream segment shapefile (shapefile used 

in steps 1–4). These are:

1. LENGTH, use Calculate Geometry, Property is Length and Units is meters. 

2. F_ALT, use the Extract Values to Points (Spatial Analyst Tools->Extract Values to Points) 

with the from_nodes shapefile and a digital elevation model map that covers the spatial 

extent of the study watershed and make a temporary map. Join this map to the 

stream_segment shapefile and copy the from_nodes altitudes to the F_ALT attribute with the 

Field Calculator. Remove the Join.

3. T_ALT, repeat step b, but use the to_nodes shapefile.

4. F_LAT, use Data Management Tools->Projections and Transformations->Feature->Project. 

The Input Feature Class is the from_nodes shapefile. The Ouput Coordinate System is 

Select->USGS_Favorites->North American Datum 1983. Add the attribute F_LAT to the 

new map that was just created by the tool. Right click on the label and select Calculate 

Geometry. Choose Y Coordinate of Point as the Property. Join this map to the 

stream_segment map and copy the values over as in step b.

5. T_LAT, as in step d, but use the to_nodes shapefile.

6. F_X, use the Calculate Geometry->X Coordinate of Line Start to fill the values.

7. F_Y, use the Calculate Geometry->Y Coordinate of Line Start to fill the values.
13

8. T_X, use the Calculate Geometry->X Coordinate of Line End to fill the values.

9. T_Y, use the Calculate Geometry->Y Coordinate of Line End to fill the values.

10. WIDTH, estimate channel width from external data sources.

11. WIDTH_EXP, the default value is 0.0.

12. MANNING, estimate channel roughness from external data sources.

13. GRNDTEMP, use the average air temperature over the time period of the study.

14. THERMGD, default value is 1.65. 

15. ETOPALT, estimate the east side topological altitude from external data sources.

16. ECROWN, estimate the east side crown height from external data sources.

17. EVEGHT, estimate the east side vegetation height from external data sources.

18. EVEGOFF, estimate the east side vegetation offset from external data sources.

19. EVDENSUM, estimate the east side summer vegetation density from external data sources.

20. EVDENWIN, estimate the east side winter vegetation density from external data sources.

21. WTOPALT, estimate the west side topological altitude from external data sources.

22. WCROWN, estimate the west side crown height from external data sources.

23. WVEGHT, estimate the west side vegetation height from external data sources.

24. WVEGOFF, estimate the west side vegetation offset from external data sources.

25. WVDENSUM, estimate the west side summer vegetation density from external data sources.

26. WVDENWIN, estimate the west side winter vegetation density from external data sources.

Summary

This report introduces P2S as a software system which couples the daily stream temperature 

simulation capabilities of the U.S. Geological Survey Stream Network Temperature model with the 

watershed hydrology simulation capabilities of the U.S. Geological Survey Precipitation-Runoff 

Modeling System. Instructions are provided for system installation and preparation and manipulation of 

the various inputs which are required. Following the guidelines presented here will result in a successful 

stream temperature model application.

References Cited

Bartholow, J.M., 2000, The stream segment and stream network temperature models: a self-study 

course: U.S. Geological Survey Open-File Report 99-112, 270 p.

Brown, G.W., 1969, Predicting temperatures of small streams: Water Resources Research, v. 5, no. 1, p. 

68–75.

Flint, L.E., and Flint, A.L., 2008, A basin-scale approach to estimating stream temperatures of 

tributaries to the Lower Klamath River, California: Journal of Environmental Quality, no. 37, p. 57–

68.

Gaffield, S.J., Potter, K.W., and Wang, Lizhu, 2005, Prediction the summer temperature of small 

streams in southwestern Wisconsin: Journal of the American Water Resources Association, v. 41, no. 

1, p. 25–36.
14

Hay, L.E., Markstrom, S.L., and Ward-Garrison, C.D., 2011, Watershed-scale response to climate 

change through the twenty-first century for selected basins across the United States: Earth 

Interactions, v. 15, 37 p.

Leavesley, G.H., Lichty, R.W., Troutman, B.M., and Saindon, L.G., 1983, Precipitation-runoff 

modeling system—User's manual: U.S. Geological Survey Water-Resources Investigations Report 83-

4238, 207 p. 

Leavesley, G.H., Markstrom, S.L., Viger, R.J., and Hay, L.E., 2005, USGS Modular Modeling System 

(MMS) —Precipitation-Runoff Modeling System (PRMS) MMS-PRMS, in Singh, V.P., and Frevert, 

D.K., eds., Watershed models: Boca Raton, Fla., CRC Press, p. 159–177.

Leavesley, G.H., and Stannard, L.G., 1995, The precipitation-runoff modeling system—PRMS, in 

Singh, V.P., ed., Computer models of watershed hydrology: Highlands Ranch, Colo., Water 

Resources Publications, p. 281–310.

Markstrom, S.L., Hay, L.E., Ward-Garrison, C.D., Risley, J.C., Battaglin, W.A., Bjerklie, D.M., Chase, 

K.J., Christiansen, D.E. Dudley, R.W., Hunt, R.J., Koczot, K.M., Mastin, M.C., Regan, R.S., Viger, 

R.J., Vining, K.C., and Walker, J.F., 2012, Integrated watershed-scale response to climate change for 

selected basins across the United States: U.S. Geological Survey Scientific Investigations Report 

2011–5077, 153 p.

Markstrom, S.L., and Koczot, K.M., 2008, User’s manual for the object user interface (OUI)—An

environmental resource modeling framework: U.S. Geological Survey Open-File Report 2008-1120, 

39 p.

Markstrom, S.L., Niswonger, R.G., Regan, R.S., Prudic, D.E., and Barlow, P.M., 2008, GSFLOW—

Coupled ground-water and surface-water flow model based on the integration of the PrecipitationRunoff Modeling System (PRMS) and the Modular Ground-Water Flow Model (MODFLOW-2005): 

U.S. Geological Survey Techniques and Methods 6-D1, 240 p.

Perry, R.W., Risley, J.C., Brewer, S.J., Jones, E.C., and Rondorf, D.W., 2011, Simulating daily water 

temperatures of the Klamath River under dam removal and climate change scenarios: U.S. Geological 

Survey Open-File Report 2011-1243, 78 p.

Sinokrot, B.A., and Stefan, H.G., 1993, Stream temperature dynamics—Measurements and modeling: 

Water Resources Research, v. 29, no. 7, p. 2299–2312.

Theurer, F.D., Voos, K.A., and Miller, W.J., 1984, Instream water temperature model: U.S. Fish and 

Wildlife Service Instream Flow Information Paper 16, FWS/OBS-85/15, 316 p.
15

Appendix 1. Documentation of the Muskingum Module 

Introduction

This appendix describes the inputs and outputs, equations, computations, references, 

assumptions, and limitations of the new PRMS modules that were developed for this study. Each 

described module is encoded as a Fortran 90 source code file.

Styles and Formats

The following font styles and formats are used in this Appendix:

• Module variables are identified 12-point, italic, Times font.

• Module parameters and dimensions are identified 12-point, bold, Times font.

• Constants are identified using upper case 12-point, bold, Times font.

• Module names are identified in 12-point, Courier font.

Muskingum Routing Module: muskingum

The muskingum module was originally developed for the Precipitation Runoff Modeling System 

(PRMS) by Mastin and Vaccaro (2002) and developed further by Markstrom and others (2008). This 

module has been modified from past versions to make it more stable for stream network routing in 

watersheds with stream segments with varying travel times. Although this module runs on the same 

daily time step as the rest of the modules in PRMS, it has an internal structure which allows for a 

different computational time step for each segment in the stream network, ensuring that the simulation 

produces stable values. Flow values computed at these finer time steps are aggregated by the 

Muskingum module to provide consistent daily time step values, regardless of the segment length. This 

module should be used for streamflow routing when PRMS is coupled to SNTemp with P2S. The input 

parameters used by the muskingum module to compute flow are defined in table A1-1. The computed 

variables are defined in table A1-2. All equation symbols used in this section are defined in these two 

tables.
16

Table A1-1.—Input parameters to Streamflow Module: muskingum.

[HRU, hydrologic response unit; nhru, number of HRUs; nsegment, number of stream segments]

Parameter

name Description Dimensionvariable Units Type Range Defaultvalue

hru_segment Segment index to which an HRU contributes 

lateral flows (surface runoff, interflow, and 

groundwater discharge)

nhru none integer 0 to 

nsegment

0

k_coef Travel time from one segment to the next 

downstream segment, called the Muskingum 

storage coefficient; enter 0.0 for reservoirs, 

diversions, and segment(s) flowing out of the 

basin

nsegment hours real 0.0 to 

240.0

0.0

obsin_segment Index of measured streamflow station that replaces 

inflow to a segment

nsegment none integer 0 to 

nsegment

0

to_segment Index of downstream segment to which the 

segment streamflow flows, for segments that do 

not flow to another segment enter 0

nsegment none integer 0 to 

nsegment

0

x_coef The amount of attenuation of the hydrograph, 

called the Muskingum routing weighting factor; 

enter 0.0 for reservoirs, diversions, and segment(s) 

flowing out of the basin

nsegment hours real 0.0 to 0.5 0.2
17

Table A1-2.—Variables used in Streamflow Module: muskingum.

[HRU, hydrologic response unit; GWR, groundwater reservoir; nhru, number of HRUs; one, a constant; ngw, number of 

groundwater reservoirs; nobs, number of streamflow-gaging stations; nssr, number of subsurface reservoirs (must be 

specified equal to nhru); nsegment, number of stream segments; ft3

/s, cubic feet per second]

Variable name Description Dimension Units Type

Input variables

basin_gwflow Basin area-weighted average of groundwater flow to the 

stream network

one inches double

basin_sroff Basin area-weighted average of surface runoff to the stream 

network

one inches double

basin_ssflow Basin area-weighted average interflow from gravity and 

preferential-flow reservoirs to the stream network

one inches double

basin_stflow Basin area-weighted average streamflow leaving through 

the stream network

one inches double

gwres_flow Groundwater discharge from each GWR to the stream 

network

ngw inches real

sroff Surface runoff to the stream network for each HRU nhru inches real

ssres_flow Interflow from gravity and preferential-flow reservoir to the 

stream network for each HRU

nssr inches real

streamflow_cfs Streamflow at each measurement station nobs ft3/s real

swrad Shortwave radiation distributed to each HRU nhru langleys real

Output variables

seg_lateral_inflow Lateral inflow entering a segment nsegment ft3/s real

seg_upstream_inflow Sum of inflow from upstream segments nsegment ft3/s real

seg_loss Outflow to outside the stream network from a segment nsegment ft3/s real

seg_gain Inflow from outside the stream network to a segment nsegment ft3/s real

seg_inflow Streamflow entering a segment nsegment ft3/s real

seginc_gwflow Area-weighted average groundwater discharge for each 

segment from HRUs contributing flow to the segment

nsegment ft3/s real

seginc_swrad Area-weighted average solar radiation for each segment 

from HRUs contributing flow to the segment

nsegment langleys real

seg_outflow Streamflow leaving a segment nsegment ft3/s real
18

The Muskingum routing equation assumes a linear relation between storage and the 

characteristics of the inflow ( t

segment seg _ inflow ) and outflow ( t outflowsegment seg _ ). Storage 

( t

segment storage ) in a stream segment, for time step t, is computed as:

( ( ) ) t

segment segment

t

segment segment segment

t storagesegment = k_coef x_coef seg _ inflow + 1. − x_coef seg _ outflow (1)

Assuming that the average flow during a routing period is equal to the average flow at the start and end 

times of the routing period, the continuity equation can be expressed as:

segment

t

segment

t

segment

segment

t

segment

t

segment

t

segment

t

segment

t

segment

t

seg outflow seg outflow

t

seg inflow seg inflow

storage storage storage

∆















 +

∆ − 













 + =

∆ = −

− −

−

2

_ _

2

_ _ 1 1

1

(2)

Substituting equation 1 into equation 2 and solving for the stream segment outflow, for the 

current time step, results in:

( ) ( ) ( ) 1 1 c0 _ c1 _ c2 _

_

− − + +

=

t

segment segment

t

segment segment

t

segment segment

t

segment

seg inflow seg inflow seg outflow

seg outflow

(3)

where

( )

( ) ( ) 2

2 c0

segment

segment segment segment

segment

segment segment

segment t

t

∆ − +

∆ − +

=

k_coef k_coef x_coef

k_coef x_coef

,

( )

( ) ( ) 2

2 c1

segment

segment segment segment

segment

segment segment

segment t

t

∆ − +

∆

+

=

k_coef k_coef x_coef

k_coef x_coef

, and

( ) ( )

( ) ( ) 2 k_coef k_coef x_coef

2 k_coef k_coef x_coef

segment

segment segment segment

segment

segment segment segment

segment t

t

∆ − +

∆ − −

c2 =

.

segment ∆t in equations 2 and 3 is the solution time step, calculated internally by the muskingum module 

for each stream segment according to:

  









































 ∆ =

segment

segment t

k_coef

24

24 (4)
19

which is the travel time (in hours), rounded down to an even divisor of 24 hours (for example 24, 12, 6, 

4, 3, 2, and 1). PRMS is restricted to daily time steps, so segment ∆t can never be more than one day in 

length. This means that the travel time of any segment in the stream network (k_coefsegment ) must be 

less than one day. An implication of equation 4 is that the routed streamflow in each segment is 

computed using different solution time steps. Consequently, streamflow must be aggregated when 

flowing from segments with shorter segment ∆t to segments with longer segment ∆t . Likewise, streamflow 

must be disaggregated when flowing from segments with longer segment ∆t to shorter segment ∆t . In either 

case, flow from upstream segments is averaged and summed to the appropriate value of segment ∆t .

References Cited

Markstrom, S.L., Niswonger, R.G., Regan, R.S., Prudic, D.E., and Barlow, P.M., 2008, GSFLOW—

Coupled ground-water and surface-water flow model based on the integration of the PrecipitationRunoff Modeling System (PRMS) and the Modular Ground-Water Flow Model (MODFLOW-2005): 

U.S. Geological Survey Techniques and Methods 6–D1, 240 p.

Mastin, M.C., and Vaccaro, J.J., 2002, Documentation of Precipitation Runoff Modeling System 

modules for the Modular Modeling System modified for the Watershed and River Systems 

Management Program: U.S. Geological Survey Open-File Report 2002–362, 5 p.