We address the growing need for accurate water temperature predictions in regulated rivers to inform decision support systems and protect aquatic habitats. Although many suitable river temperature models exist, few simultaneously model water temperature dynamics while considering uncertainty of predictions and assimilating observations. Here, we employ a stochastic dynamics approach to water temperature modeling that estimates both the water temperature state and its uncertainty by propagating error through a physically based dynamical system. This method involves converting the governing hydrodynamic and heat transport equations into a state space form and assimilating observations via the Kalman Filter. This model, called the River Assessment for Forecasting Temperature (RAFT), closes the heat budget by tracking heat movement using a robust semi-Lagrangian numerical scheme. RAFT considers key thermodynamic processes, including advection, longitudinal dispersion, atmospheric heat fluxes, lateral inflows, streambed heat exchange, and unsteady nonuniform flow. Inputs include gridded meteorological forecasts from a numerical weather prediction model, bathymetric cross-sectional geometry, and temperature and flow measurements at the upstream boundary and tributaries. We applied RAFT to an ∼100 km portion of the Sacramento River in California, downstream of Keswick Dam (a regulatory dam below Shasta Dam), at a spatial resolution of 2 km and a temporal resolution of 15 min. Model prediction error over a 6 month calibration period was on the order of 0.5°C. When temperature and flow gage data were assimilated, the mean prediction error was significantly less (0.25°C). The model accurately predicts the magnitude and timing of diel temperature fluctuations and can provide 72 h water temperature forecasts when linked with meteorological forecasts and real-time flow/temperature monitoring networks. RAFT is potentially scalable to model and forecast fine-grained one-dimensional temperature dynamics covering a broad extent in a variety of regulated rivers provided that adequate input data are available.
If you can't find a tool you're looking for, please click the link at the top of the page to "Go to old article view". Alternatively, view our Knowledge Base articles for additional help. Your feedback is important to us, so please let us know if you have comments or ideas for improvement.
 In recent years, aquatic ecologists and water managers have shown a renewed interest in the dynamics of river temperatures, because thermal regimes play a key role in structuring freshwater ecosystems [Fausch et al., 2002; Huang et al., 2011; Kaushal et al., 2010; Mccullough et al., 2009; Olden and Naiman, 2010; Poole and Berman, 2001]. Aquatic organisms tend to have characteristic thermal tolerance limits that are governed by temperature sensitivity in the rates of critical physiological processes. In extreme cases, acute short-term exposure to temperatures exceeding tolerance limits may result in severe physiological stress or even mortality, but even less extreme cases can also have important effects on growth and reproductive potential [Boughton et al., 2007; Crozier et al., 2008; Hokanson et al., 1977; Martins et al., 2012]. These effects in turn influence broader ecological processes, such as productivity of fish populations, competitive dominance between similar species, and the spread of disease or invasive species.
 Natural temperature regimes have been altered in many regulated rivers, and management of water temperature is sometimes implemented for the protection of aquatic communities [Carron and Rajaram, 2001; Neumann et al., 2006; Olden and Naiman, 2010; Stanford et al., 1996; Wilby et al., 2010]. Temperature management plans are developed to protect endangered species, sustain economically significant fisheries, and meet public-health criteria. In the rivers of California's Central Valley, for example, dam operations and water withdrawals can dramatically alter thermal regimes and impact the health of endangered salmon populations [Yates et al., 2008; Yoshiyama et al., 1998]. The biological effects of water operations are carefully considered during the relicensing of major water projects, a process that typically requires that water managers maintain suitable thermal habitat in addition to fulfilling agricultural and municipal water needs [Jager and Smith, 2008; Seedang et al., 2008]. During drought years when reservoir levels are low, dam operators may be challenged to meet federally mandated downstream water temperature targets, and the ecological integrity of the river may be compromised.
 Water management agencies typically employ a temperature monitoring framework to inform their operations in regulated rivers. Temperature observations are often made at ecologically significant time scales (subdaily), but the spatial resolution of the observing systems are sometimes too low to capture longitudinal temperature patterns that affect downstream aquatic ecosystems. Fine-grained temperature patterns between monitoring stations must be inferred using model predictions. Decades of research has resulted in a suite of statistically and physically based water temperature models that accurately predict thermal dynamics [Caissie, 2006]. Reliable predictions of water temperatures downstream of reservoirs have proven useful in making informed water release decisions [Gu et al., 1999; Huang et al., 2011; Krajewski et al., 1992; Thomann, 1998]. However, relatively little work has been done to apply such models operationally to forecast the downstream impact of management scenarios in real time.
 This paper is motivated by a specific case study that highlights the need for improved river temperature prediction: the Sacramento River below Shasta Dam in California. In an effort to provide suitable thermal conditions for salmon spawning and rearing habitat, state and federal agencies set temperature criteria for compliance points downstream of the dam during critical times of the year [National Marine Fisheries Service, 2009]. Operators at the Shasta Dam have the ability to control both the flow and temperature of releases, thereby presenting a case where real-time forecasting can directly influence operational decisions. Although the current operations criteria stipulate that some temperature models be employed, the criteria have been criticized for failing to meet biologically relevant temporal and spatial scales. In this paper, we discuss a potential improvement to the current decision support system by linking high-resolution gridded meteorological forecasts (TOPS-WRF) [Nemani et al., 2009] with a physically based water temperature model for real-time river temperature forecasts.
 To accomplish this task, we combine key features of existing models [e.g., Boyd and Kasper, 2003; Bravo et al., 1993; Kim and Chapra, 1997; Sinokrot and Stefan, 1993; Westhoff et al., 2007; Yearsley, 2009] to best suit our goals. These features include the ability to produce optimal temperature hindcasts and real-time forecasts that are accurate, estimate prediction error, have fine temporal resolution (subhourly), and moderate spatial resolution that captures spatial heterogeneity in temperature at the landscape scale (10s to 100s of km). Many of these features are available in existing models, and we will briefly elaborate on their importance to our goals and provide context for their inclusion.
 An important criterion for operations control is the ability to predict temperatures in novel situations, such as alternative management scenarios, unprecedented weather patterns, or altered channel or flow conditions. Ultimately, this demand requires explicit simulation of the underlying physical processes, since statistical inference generally performs poorly for novel (out-of-sample) situations. In river-temperature modeling, this generally implies a heat-budget approach, which tracks downstream movement of heat coupled with temperature fluxes across the air-water and streambed boundary in each channel segment [Evans et al., 1998; Webb and Zhang, 1997]. Stable, accurate, and robust numerical schemes to solve the governing thermal and hydrodynamic transport equations within a one-dimensional framework are readily available in the literature [Holly and Preissmann, 1977; Leonard, 1979; Oliveira and Fortunato, 2002; Wallis, 2007].
 The treatment of error in modeling studies is crucial to assess the accuracy of model predictions and to evaluate risk in management operations; yet, this feature is often neglected in physically based water temperature models [Bartholow, 2003]. Dynamic, physically based models are sensitive to model input data, which can be noisy, incomplete, or uncertain. Furthermore, dynamic models always have some inherent uncertainty in their formulation, which can lead to prediction error. Two closely related concepts that address these concerns are error propagation and data assimilation. Error propagation is the ability to properly assess the net uncertainty of a function based on the relative uncertainty of the component variables. Data assimilation is a suite of methods for combining observations with models of physical processes to optimally estimate states, model parameters, and attendant uncertainties [Hobbs and Ogle, 2011]. Data assimilation techniques assume that the governing dynamic equations are stochastic and subject to error. Recent work [Yearsley, 2009, 2012] has advocated a data assimilation approach to merge physically based water temperature models with statistical estimates of uncertainty. Such methods were also employed by Krajewski et al.  and Bravo et al. , who demonstrated that state space models of water temperature are an effective framework for forecasting states accompanied by confidence envelopes. This approach is well suited for the purposes of real-time water temperature forecasting and optimal control.
 The population dynamics of many aquatic organisms unfold at the landscape scale (100s of km), and therefore it is necessary to have the ability to model rivers at this broad extent. However, fine-grained temperature dynamics are also important for the physiology and behavior of individual organisms. A trade-off typically exists between broad extent and fine resolution. Models that predict temperature at the landscape scale often operate at coarse spatial resolution, and models that cover multiple years operate on a daily or weekly time scale [Ahmadi-Nedushan et al., 2007; Caissie et al., 2001; Flint and Flint, 2008; Huang et al., 2011; Mohseni et al., 1998]. However, there are no significant theoretical or computational constraints to predict water temperature at fine scales across broad domains to capture ecosystem dynamics.
 The one-dimensional model developed in this paper consists of three modules describing thermal hydrodynamics, heat fluxes, and data-assimilation techniques. We refer to these combined modules as the River Assessment for Forecasting Temperature (RAFT) [Danner et al., 2012]. Through the case study, we demonstrate that RAFT is suitable for the Sacramento River in California during the summertime season when water temperatures are managed. Our application addresses the physical processes most important for the Sacramento River, but the modular framework we use allows other components (processes important for other river systems) to be added in a straightforward manner. The approach that we use is general, adaptable, and potentially scalable to other river systems, and should be broadly useful.
2. Model Formulation
 In the following sections, we describe the formulation of the hydrodynamic and heat flux components, and how they may be adapted into a data-assimilation framework. The hydrodynamic model consists of an advection-dispersion equation describing the downstream movement of heat, coupled to a one-dimensional hydrologic routing model describing the downstream movement of water. The heat flux component describes sources and sinks of heat due to atmospheric conditions, lateral inflows, and heat transfer with the streambed. Data assimilation is the process of making optimal state estimates by informing uncertain model predictions with noisy or incomplete observations, and it is achieved by means of the Kalman Filter. The standard Kalman Filter uses linear algebra and works only on systems of equations represented in matrix notation; in particular, the algebraic form of a state space model [Grewal and Andrews, 2001; Harvey, 1989]. RAFT draws upon previously published methods [Bravo et al., 1993; Georgakakos et al., 1990; Krajewski et al., 1992] to convert the equations governing hydrodynamics and heat movement into their state space form (Figure 1).
 The advection-dispersion equation, derived from principles of continuity and mass conservation, forms the basis of the thermal hydrodynamic component. Advection is a first-order transport process describing the downstream movement of heat with fluid flow, whereas longitudinal dispersion is a second-order spreading process due to vertical and/or lateral variations in stream velocity. The one-dimensional advection-dispersion equation is sufficient to model longitudinal temperature ( ) dynamics as a function of space position ( ) and time ( ) in unsteady nonuniform flow:
where the parameters are water velocity, , channel cross-sectional area, , and a longitudinal dispersion coefficient . The term represents the sum of heat sources and sinks that affect channel water temperature, and is discussed in section 2.3.
 This equation states that, aside from heat fluxes, S, the rate of temperature change that has an advective component proportional to water velocity and the spatial gradient of temperature, plus a dispersive component proportional to the curvature (second-order derivative) of the longitudinal temperature profile.
 Using a control volume approach, we discretize the partial derivatives (spatial and temporal gradients) into a set of finite difference equations operating on a grid of spatial points and time steps . The quantity represents the average temperature of a grid cell at time step .
 Special care must be taken when discretizing the advection-dispersion equation to ensure an accurate, nonoscillating, stable solution [Oliveira and Fortunato, 2002; Wallis, 2007]. The split-operator, or semi-Lagrangian approach, is a robust approach that discretizes advection and dispersion in distinctly different coordinate systems convenient to their respective properties [Cheng et al., 1984; Neuman, 1981; Spiegelman and Katz, 2006].
 Advection is discretized in Lagrangian (transient) coordinates using the method of characteristics; a common technique for solving first-order partial differential equations:
where the Lagrangian coordinate, , is a point located on the interval whose location is obtained by integrating the velocity field backward through time (i.e., reverse particle tracking):
 The associated temperature at the Lagrangian coordinate, , is then interpolated based on the surrounding grid points via a higher-order polynomial [Holly and Preissmann, 1977] or cubic-spline [Ahmad and Kothyari, 2001].
 Dispersion is discretized using the Crank-Nicolson method; a time- and space-centered approximation of a second-order partial derivative in Eulerian (fixed) coordinates:
where the subscripts denote a forward/backward spatial average between points and . The superscript indicates that the bracketed term is evaluated as an average between time steps and .
 In the semi-Lagrangian framework, the source term, , is evaluated at the Lagrangian coordinate at time and at the Eulerian coordinate at time .
2.2. Hydrologic Routing
 To link the advection-dispersion equation with flow, we first express the channel geometry variables ( ) as power-function relationships with discharge of the form:
where represents a geometry variable, is discharge, and and are rating-curve coefficients and exponents fitted for that particular variable.
 To calculate discharge, , we used a one-dimensional hydrologic routing model based on the Muskingum-Cunge formulation; a computationally efficient, numerically stable, and physically realistic approximation of unsteady, nonuniform flow dynamics [Cunge et al., 1980]. In addition, it is readily adaptable to the state space formulation used for the data-assimilation component [Georgakakos et al., 1990]. Conceptually, the Muskingum-Cunge expresses hydrologic routing as a kinematic wave (i.e., driven by gravity and pressure) and represents flow continuity through a channel as a finite series of moving storage elements. The change in storage between segments can be estimated from flow and geometry characteristics [Todini, 2007].
 In discrete form, the Muskingum-Cunge formulation can be expressed as an explicit finite-difference equation:
where is discharge, and is lateral inflow (or outflow). The averaging coefficients, , can be represented in terms of channel parameters.
 This equation states that the flow at a grid point is a weighted average of the flow at adjacent points in space and time, plus time-averaged inflows. Given initial and boundary conditions (a known discharge at the upstream boundary and an initial longitudinal flow profile), this equation can be solved by recursive substitution to calculate flow at downstream points.
2.3. Heat Fluxes
 The source term, , in the advection-dispersion equation represents the summed heat fluxes into and out of the river water column. Here, it is useful to group the heat fluxes into four general components: heat exchange at the air-water interface, heat exchange at the streambed-water interface, heat inputs from lateral inflows (e.g., tributaries), and heat losses from water withdrawals:
where is channel top-width, is the wetted perimeter, is net heat exchange at the air-water interface, is the net heat exchange with the streambed, and are incoming flow and temperature, and are outgoing flow and temperature, and and are the heat capacity and density of water.
 The first two terms describe net heat movement across the air-water and water-streambed interfaces, respectively. The third and fourth terms describe effects of water inflows and withdrawals, respectively, and simply represent the effect of volumetric mixing or diversion of water.
 Heat transfer between the atmosphere and the water column is modeled as a function of meteorological parameters and water temperature. Following Boyd and Kasper , Evans et al. , and Webb and Zhang , net heat transfer has components due to radiation (solar radiation, incoming longwave radiation, outgoing longwave radiation), and molecular movement at the interface between air and water (latent heat of evaporation and conduction):
where is the net heat flux at the air-water interface, is solar (shortwave) radiation attenuated by the water column, is incoming atmospheric (longwave) radiation, is outgoing longwave radiation, is the latent heat of evaporation, and is the heat flux due to conduction.
 Solar radiation attenuated in the water column is a function of the solar radiation at the stream surface ( , a reflection coefficient ( , and an attenuation parameter ( that is dependent on stream depth and properties of the streambed:
 Incoming and outgoing longwave radiations are both based on the blackbody formula, where emitted radiation is proportional to temperature:
where is air temperature, and are the emissivity of air and water, is the Stefan-Boltzmann constant, and is a reflection coefficient.
 Latent heat flux due to evaporation is related to the difference in vapor pressure between a thin layer of air directly at the water surface (at the water temperature) and a saturated layer 2 m above the water surface (at dew point temperature), as well as a function of wind speed .
where is the latent heat of evaporation, is the density of water, and indicates the saturated vapor pressure at temperature .
 Sensible heat flux (conduction) is the molecular transport of heat between the water surface and surrounding air and is based on the Bowen Ratio relating evaporation and conduction. It is proportional to the temperature differential between the water surface and overlying air, as well as the wind function:
where is the psychrometric constant.
 Streambed conduction is driven by the temperature differential between the streambed and the water column:
where B is streambed temperature and is a thermal conductivity coefficient.
 Other minor sources of heat may exist and are readily added to the source term if deemed appropriate.
 Heat exchange between the water column and the streambed may be significant in some rivers, particularly during low-flow periods. Using the formulations given by Boyd and Kasper , the streambed is modeled as a thin zone between the water column and a deeper groundwater reservoir and can be thought of as a transient storage zone for heat. To model this two-way coupling, the bed temperature becomes another state variable that must be explicitly discretized by means of a simple forward difference equation:
where is the temperature of the streambed, is the heat capacity of the streambed, is the density of the streambed, is the depth of the streambed, and is the net heat flux to the streambed.
 In this relatively simple formulation, three physical processes affect the temperature of the streambed: solar radiation penetrating the water column, and conduction driven by the temperature differential between the streambed and both the water column and deeper groundwater reservoir. The net heat flux to the streambed is given as:
where is streambed temperature, is a depth-dependent shortwave radiation attenuation coefficient, is a reflection coefficient, is a thermal conductivity coefficient, is the temperature of alluvial groundwater, and is the depth of the streambed.
2.5. Boundary and Stability Conditions
 Upstream and downstream boundary conditions are required to constrain the solution to the discretized equations. The upstream boundary condition is a known flow and temperature at point . The downstream boundary condition is an assumed spatial gradient in temperature equal to zero. As an initial condition, temperature, flow, and bed temperature must be specified at each grid point for the first time step.
 Two conditions on the spatial and temporal grid spacing must be met to achieve an accurate nonoscillating solution [Chapra, 1997]. First, a spatial grid spacing is chosen to meet the Peclet condition , then a temporal grid spacing is chosen to meet the Courant condition . These two criteria ensure that a fine enough spatial grid size exists to handle the advection terms in the presence of dispersion, and so that the distance a parcel of water travels in a computational time step does not exceed the distance between grid points. In our application, we found that a 2 km spacing at 15 min intervals satisfied both these conditions.
2.6. Data Assimilation
 State space models describe two time-series models evolving simultaneously: a process-model and an observation model [Grewal and Andrews, 2001; Harvey, 1989]. The process model describes the evolution of the state from one time step to the next based on state-transition parameters and model inputs. The second describes how the states produce observations. When both models are subject to error, their formulation becomes stochastic. Error may stem from inadequate modeling, incorrect estimates of parameters, uncertainty in inputs and measurement error.
 Following the methods of Bravo et al. , Georgakakos et al. , Krajewski et al. , and Yearsley , we convert the discretized equations for temperature, flow, and bed temperature into a linearized matrix equation. The linearization procedure involves approximating differentiable nonlinear terms as a first-order Taylor series about reference point. Ultimately, the model formulation is reduced to a general state space form described by two time-dependent stochastic equations of both state evolution and observation:
where is the state vector, is the input vector, is a vector of constants from the linearization procedure, and is the observation vector. Note that the notation here is changed slightly so that the subscript refers to the time step, as spatial dimensions are not applicable.
 The elements of the state vector are the temperature ( ), flow ( ), and bed temperature ( ) at each grid point: . The input vector contains the external inputs that affect model state and includes (1) flow and temperature at the upstream boundary , (2) flow and temperature inputs and outputs at each grid point ( , and (3) the six meteorological variables at each grid point such that . The observation vector, , contains any measurements of flow and temperature.
 Matrices , , and are the state-transition model, the control-input model, and observation model. These matrixes are expressed as time variable, but these may be assumed to be constant throughout the duration of the simulation for computational efficiency. and are square matrices with dimensions of that equal to their respective vectors, and express how the state vector at the previous time step and model inputs are transformed into a new estimate of state. Matrix , with dimensions of the length of the state vector and the number of observations, maps how the state vector relates to observations.
 The error terms, and , are white noise vectors that are assumed to be mutually independent and drawn from separate uncorrelated zero-mean multivariate normal distributions with covariances and , respectively. The constitute elements of diagonal matrices and are the background error variances of the process and observation models.
 The goal of the stochastic model is to combine the system dynamics with the measurement information to optimally estimate the state vector . The Kalman Filter provides a way to obtain an unbiased, least squares estimate of given observations up to time , and knowledge on the distribution of white noise sequences and . Covariance matrices and are sometimes known a priori, but may also be estimated by maximizing a likelihood function [Harvey, 1989]. Here, we specified the diagonal elements of as 0.1°C2 to account for measurement error and uncertainty in location relative to the grid points, and estimated the elements of based on likelihood maximization.
 The Kalman Filter is a two-step predictor-corrected process. First, prior estimates of the mean state vector and error covariance matrix ( are obtained from the state-transition equation, without considering any observations:
where is the error covariance matrix of input vector (containing uncertainty about boundary conditions, inflows and outflows, and meteorological conditions). The error variance terms in for boundary conditions and inflows were specified to be a small value (these were relatively constrained). Meteorological uncertainty was provided by the auxiliary weather forecast model.
 When observations ( ) are available, the following corrections are made to obtain a posterior estimate of the state mean and covariance, and :
where is the Kalman Gain matrix, a weighting term describing the relative contribution of the model prediction and observation to the overall estimate of state. It is computed as the matrix equivalent of the system error covariance relative to the total residual covariance:
 In the case where observation error is very small compared to the process error, the Kalman Filter updates the state at observed locations to a value that is very close to the measured value. Furthermore, filtered state estimates at locations near gages are also updated, thus updating the entire profile. For forecasts, we only use the prediction equations, as no observations are available to assimilate.
3. Example Application of RAFT
 We applied the RAFT model to a 100 km stretch of the Sacramento River in Northern California, from Keswick Dam (below Shasta Dam) to Red Bluff Diversion Dam (Figure 2). This area was chosen because (1) it is critical spawning and rearing habitat for endangered salmonids, (2) state and federal agencies have established temperature compliance standards, (3) dam operators have control over outflow discharge and temperature, and (4) it is well monitored and surveyed, ensuring that the necessary inputs and validation data for the model are available.
3.1. Study Area
 Shasta Dam is a large hydroelectric power-producing dam owned and operated by the Bureau of Reclamation. In the late 1990s, the dam was retrofitted with a temperature control device, allowing for the controlled release of cold water from the hypolimnion of the thermally stratified Shasta Reservoir. Provided that the reservoir contains adequate cold-water storage, dam operators can discharge cold water during critical times of the year to meet temperature requirements downstream.
 Keswick Dam, a smaller flood-controlling dam approximately 15 km downstream, works in tandem with Shasta Dam. The forebay, Keswick Reservoir, accumulates releases from Shasta Dam as well as augmented flows transferred from the neighboring Trinity River basin. Operators at Keswick Dam schedule flow releases to maximize hydroelectric power production and also to mitigate flooding downstream. Keswick Dam is the barrier to migration for anadromous fish and is considered the upstream boundary for the model. We assume that the water temperature at Keswick Dam is controllable, since it is a combination of deliberately managed thermal inflows.
 Red Bluff Diversion Dam marks the downstream boundary of the study area. It can divert water from the Sacramento River to a network of agricultural canals by closing a series of gates. The gates are often closed during the summer months for agricultural purposes, altering the thermal regime in the vicinity of the dam by impeding flow and buffering heat transfer.
 Several small tributaries flow into the main stem of the Sacramento River within the study area. One of these tributaries—Clear Creek—is regulated and governed by outflows from Whiskeytown Reservoir, whereas the other tributaries are free flowing. The combined inflow of these tributaries is generally minor relative to the main stem, but these accretions may be significant during storms and are therefore included in the model.
 We tested the accuracy of the RAFT model for the period of May through October 2010. A uniform grid spacing of 2 km was used at a 15 min time interval.
3.2. Weather Data
 Weather hindcasts and forecasts were modeled separately and provided as inputs to RAFT. The Terrestrial Observation and Prediction System (TOPS) is a modeling framework that integrates satellite data, ground-based monitoring data, microclimate mapping, and physical simulation models [Nemani et al., 2009]. TOPS was used to parameterize the Weather Research and Forecasting (WRF) model, an industry-standard three-dimensional numerical weather prediction model. Specifically, TOPS refines estimates of soil moisture (a highly sensitive boundary condition in WRF) using a biogeochemical cycle model that assimilates satellite observations of land surface conditions to improve meteorological predictions. The resulting output of the coupled TOPS-WRF model is an array of estimated meteorological conditions on nested spatial grid, with a spatial resolution as fine as 1 km, and a temporal resolution of 1 h. Using high-end computing resources provided by the NASA Earth Exchange [Nemani et al., 2011], TOPS-WRF has the ability to hindcast over periods of 10 years or more. Additionally, TOPS-WRF can be run in near real time to produce forecasts up to 96 h into the future. To estimate heat fluxes, RAFT uses the TOPS-WRF predictions of incoming solar radiation, incoming longwave radiation, air temperature, wind speed, and relative humidity. Hourly hindcasts and forecasts were interpolated to a 15 min time step prior to use as inputs into RAFT.
3.3. Channel Geometry
 The channel geometry is characterized by a series of channel cross-sections, spaced ∼500 m on average, throughout the study area. Cross-sections were surveyed by the California Department of Water Resources in a comprehensive study conducted in the early 2000s. Using the Hydrologic Engineering Center's River Assessment System (HEC-RAS), we performed a suite of steady flow simulations to compute channel geometry characteristics at each cross-section at varying flow rates. We then fit rating curves for each geometric variable and interpolated the results to the model grid.
3.4. Flow and Temperature Observations
 Water temperature and discharge are monitored at Keswick Dam. Four additional water temperature gages and one flow gage are located at “compliance points” along the main stem within the study area. These include Balls Ferry (BSF, 41 km downstream), Jellys Ferry (JLF 56 km), Bend Bridge (BND, 72 km), and Red Bluff (RDB, 94 km) (Figure 2). The one flow gage is located at Bend Bridge. Gages are operated by the United States Geological Survey (USGS), with observations collected at 15 min to hourly intervals. Data are made available in near real time through the California Data Exchange Center (CDEC). Additionally, flow and temperature are monitored along the four main tributaries by various agencies, and outflows are monitored by several irrigation and municipal districts.
 We assessed the accuracy of the process model (with no data assimilation) by comparing in-stream temperature and flow measurements against model predictions. We considered several indices of prediction deviation; the root mean square error (RMSE) to assess overall predictive power, the mean of the residual to indicate model bias, and the variance of the residuals as a measure of model precision.
 The RAFT model captured the river temperature dynamics at the four compliance points with RMSE of the deterministic predictions ranging from 0.57°C to 0.72°C for the May–November 2010 test period (Table 1). River temperature during this time period ranged from 9.5 to 16.6°C. Model bias (prediction-observed) ranged from −0.10 at BSF to −0.41°C at RDB, such that the model underpredicted temperature, with the degree of underprediction increasing downstream. The model performance varies between months, where the RMSE of model predictions was greater in the first and last months (May and October) than in the intervening months (Table 2). Similarly, the hydrologic routing component of RAFT predicted discharge at the one flow gage (BSF) with an RMSE of 12.4 m3 s−1, or an approximate error of 4%, over a flow ranging from ∼180 to 520 m3 s−1. On average, RAFT slightly underpredicted discharge, with a model bias of −0.5 m3 s−1.
Table 1. Error Statistics of the Deterministic Predictions (May–October 2010)
Residual Mean (°C)
Table 2. Root Mean Squared Error (RMSE, °C) of the Deterministic Predictions by Month
 A graphical comparison of predicted versus measured water temperatures at the four compliance points over the span of one typical autumnal month (September 2010) shows that model predictions accurately reproduced both the magnitude of diel variation and the timing of the minimum and maximum temperatures (Figure 3a). The least accurate model predictions occurred at RDB, as the gates were closed at Red Bluff Diversion Dam during this month, creating unique thermal conditions that were difficult to replicate.
 The resolution of RAFT allows for the detection of substantial variation in water temperature both in time and space (Figure 3b). Temperature is represented as a filled contour plot on time and longitudinal distance axes, which we refer to as a “temperature landscape.” A horizontal line represents a time series of temperature as a single location, and a vertical line represents a longitudinal temperature profile at one point in time. Several patterns are evident. First, water temperature generally increased with distance downstream from Keswick Dam, varying from a longitudinal range of 1.8°C to as much as 5.7°C depending on the weather and flow conditions. Average water temperature increases monotonically downstream (Figure 3c). Second, the diel temperature range varies by location. Upstream releases from Keswick Dam are approximately a constant temperature over time, with an average diel range of 0.2°C. Average diel range increases to a maximum of 1.2°C around 45 km, coinciding with 12 h travel time. These minima and maxima in temperature range (Figure 3c) are referred to as “nodes” and “anti-nodes” and are discussed later. However, the formulation of this unique pattern demonstrates the accuracy of model predictions.
 Model predictions were substantially improved by the application of the Kalman Filter and assimilation of gage data (Figure 4a). When gage data were assimilated, error variance approached 0.1°C2 (the specified measurement error) near each compliance point; essentially equal to the minimal observation error. The location of maximum prediction variance (0.35°C2) occurred at the midpoint or directly upstream from compliance points. In contrast, when error was propagated through the system dynamics without assimilating data, the state error variance increased nearly monotonically downstream, with a maximum prediction variance of 0.65°C.
 The error variance of model predictions increased with lead time (Figure 4b). With a lead time of 15 min (one-step), the prediction error ranged from 0.08 to 0.15°C. As the lead time increased to 24 h, the prediction error approached that of the purely deterministic model, because this was the travel time of water from the upstream to downstream boundaries. After 24 h, none of the observations that were available when the forecast was initiated continued to inform temperature estimates.
 The contribution of the individual model components varied in both space and time. The total change in temperature with respect to time displays a pattern of daytime heating and nighttime cooling (Figure 5). Heat inputs from the atmosphere and bed are responsible for the bulk of daytime heating, whereas advection accounts for nighttime heat losses. These two processes contributed most to the overall change in temperature. The influence of longitudinal dispersion and tributary inputs were almost an order of magnitude less.
 Advective heat losses display a slanted pattern on time and distance axes, where the slope of the bands is equal to the velocity of the river. During the nighttime, cold water releases from the upstream boundary move downstream with the flow of the river. In contact, heat flux inputs display vertical bands, indicating that they vary more in time than in space. Significant heat transfer due to longitudinal dispersion was confined to localized regions in space and time, coincident with longitudinal changes in channel geometry (i.e., widening) or steep changes in the temperature gradient. Tributary heat inputs were either positive (when the incoming creek was warmer) or negative (when incoming water was cooler), and the magnitude depended upon the relative thermal mass entering the river.
 We applied RAFT to the management problem of maintaining water temperatures below a target threshold (13.3°C) at a downstream compliance point. We issued 72 h forecasts during a challenging management period (late September), where a combination of warm weather and depleted cold-water resources in the Shasta/Keswick reservoirs contributed to the potential for elevated downstream temperatures and compliance exceedance. Figure 6 shows the effect of nine potential management scenarios on water temperatures at the primary compliance point at Balls Ferry. Each scenario used a different combination of reservoir release temperature (10.0, 11.1, and 12.2°C) and discharge (140, 280, and 420 m3 s−1) as input, while holding the other variables (meteorological forecasts and tributary inflows) constant. Changes in both flow and temperature influenced downstream temperatures, with some scenarios meeting, and some exceeding compliance. Higher release flows (by up to a factor of 3 in this example) decreased the temperature at Balls Ferry by approximately 0.5 to 1°C. Altered release temperatures had a more pronounced influence on compliance point temperatures, where an increase in 2°C could change downstream temperatures by almost 1.5°C. Temperature forecasts were accompanied by 95% confidence bands, taking into account uncertainty in the meteorological forecast, the process-model, and the ability to meet prescribed reservoir releases.
5. Discussion and Summary
 The RAFT framework effectively modeled river water temperature in the longitudinal direction by merging desirable features of previous models into a more comprehensive framework. It links flow, water temperature, weather, and bed temperature dynamics within a state space framework that efficiently propagates error and optimizes the estimate of state. Our application of RAFT to the study area on the Sacramento River demonstrates how the model addresses the desired features outlined in the introduction. Below, we summarize key lessons from our example and discuss issues regarding using RAFT as a management tool, and the adaptability of RAFT to other river systems.
 The RAFT model performed well (max of 0.72°C RMSE) across a broad spatial extent (100 km of river), at fine-grained temporal resolution (subhourly intervals), and over a relatively long time scale (6 months). In the purely deterministic formulation (without data assimilation), a comparison between model predictions and water temperature measurements at multiple locations indicated a minor downstream increase in model bias, such that the model slightly overpredicted water temperature at reaches near the dam and underpredicted temperatures further downstream. Although model bias is inevitable, the trend in the bias suggested that some heat fluxes may have been improperly formulated, or that unobserved sources of heat existed that we were unable to quantify. However, the variance of the residuals ranged from 0.22 to 0.35°C, suggesting relatively high precision in predictions despite an apparent bias.
 Furthermore, the model captured a longitudinal pattern of diel variation that is exhibited by the river, where the maximum range of daily temperatures occurs at 12 h downstream from the dam, and a minimum range occurs at 24 h downstream. Referred to as “nodes” and “antinodes” [Deas et al., 1997], this pattern occurs only in regulated rivers where the temperature of water at an upstream release is relatively constant [Carron and Rajaram, 2001; Lowney, 2000]. This pattern is explained in terms of tracking parcels of water through daytime heating and nighttime cooling cycles. RAFT is able to simulate these dynamics, even without the data assimilation component, which is something only possible by modeling physical processes.
 The model inferred a detailed and precise “temperature landscape” (Figure 3b), which provided substantial information about the thermal dynamics of the river, including delineation of the contributing heat sources and sinks (Figure 5). A comparison of heat flows showed that the bulk of heat transfer is dominated by downstream advection and heat-exchange with the atmosphere. Longitudinal dispersion of heat was relatively minor in our application, but may play a larger role in rivers that experience sharp spatial gradients in temperature or are very slow moving. Tributary inflows played a minor role in influencing the temperature, at least in the study area, mainly because of their relatively small flow. However, tributary effects are expected to become more significant the closer the two rivers are in size, and must certainly be considered when expanding the model formulation to a river network. For networks with many regulated tributaries, the RAFT framework could be used to coordinate releases across the system to maximum desired management effect.
 The accuracy and precision of model predictions were limited by the quality of model inputs, and by the realism of the modeled processes. For example, formulations of heat exchange at the air-water interface, as well as thermal advection and dispersion, are well established. Regarding the magnitude of heat sources, our results agree with many previous studies [Evans et al., 1998; Webb and Zhang, 1997]. We note that solar radiation constitutes the greatest net influx of heat, but during the nighttime, longwave radiation, evaporative heat-loss, and advection contribute most to heat losses/gains. In contrast, bed-temperature estimation is an area that warrants further research. In our simulations, the magnitude of streambed-water column coupling through conduction was not as large as other heat sources, but we found it was still significant enough to warrant its inclusion. The main effect of this water-streambed coupling was diel amplitude modulation and phase adjustment of the water temperature. This effect is difficult to verify without actual bed temperature measurements and can only be inferred based on its interaction with observed water temperature. Some research suggests that this coupling can safely be excluded in larger and deeper rivers [Bravo et al., 1993; Sinokrot and Stefan, 1994]. However, the effect is likely to become more prominent in smaller, shallower rivers, such as midsized rivers in California during the summertime low-flow period. The assumption that the bed effect may be omitted may not always be warranted, and would tend to have the effect of eliciting larger water releases than necessary to maintain a given maximum daily temperature.
 The data assimilation component in RAFT has many advantages over a purely deterministic formulation, namely optimal state estimation and propagation of error. These features are crucial for optimal control, risk management, and water management decision making. In real-time forecasting, it is important to have an “up-to-the-minute” estimate of the model states. The Kalman Filter allowed RAFT to incorporate all available observations up to the current time step to optimize state predictions and correct for model bias. When a forecast is issued, the attendant uncertainties of each of the state parameters and input variables (i.e., meteorological variables) are routed through the system dynamics to assess the total uncertainty of predictions. As with any forecast, uncertainty increases with time and is related to the quality of the meteorological forecasts and consistency of the boundary conditions (discharge volume and temperature).
 RAFT can be used to inform decisions for managed rivers where water agencies control the flow and/or temperature releases from dams. In the Sacramento River example, both of these control “knobs” are tunable. However, even when temperatures are monitored at a compliance point, real-time feedback control is limited by the time lag—on the order of hours to days—from the time that a parcel of water is released at the upstream boundary to its arrival at the compliance point. Forecasting ability can mitigate this lag by informing managers how present and future water releases will affect the future temperature downstream, given an accurate weather forecast. By using RAFT to evaluate different flow and temperature scenarios, managers can learn which range of releases would ensure compliance. In addition, managers can choose an optimized flow/temperature release scenario to simultaneously meet operational requirements and compliance standards. The model can be applied beyond rivers regulated by dams, such as examining the effect of water withdrawals on main stem temperatures, and can also be used to consider the downstream effects of thermal effluent from industrial operations and power plants.
 The accuracy of the RAFT heat-budget module is driven by meteorological forecasts. For near-term water temperature forecasts, high-quality gridded meteorological forecasts are an essential component of RAFT. In this study, we used TOPS-WRF to provide 72 h forecasts as proof of concept that such meteorological data set can be integrated into water temperature forecasts. However, TOPS-WRF is not currently an operational modeling framework supported by any agency. Operational gridded meteorological forecasts based partially on WRF are available in near real-time through the United States from the National Weather Service (NWS). In comparison with the 15 min TOPS-WRF forecasts, the NWS forecasts are at 3 h intervals and require temporal interpolation before being incorporated into the RAFT model. However, the NWS forecasts currently extend out to 7 days and their inclusion in RAFT could lead to reliable and extended water temperature forecasts.
 Longer term forecasts (on the order of months) would be valuable for seasonal planning. For example, Shasta Reservoir has a fixed amount of cold water that must be conserved to last through an entire temperature critical season for salmon (late spring-late fall). Weather generation simulations based on climate projections can be used to inform water managers of the probability that certain weather events of interest will occur within this time frame. A proposed extension of RAFT is to link the water temperature model with seasonal ensemble weather predictions. The result would be a probabilistic forecast of water temperatures given the likely climate and water demands up to 6 months ahead.
 Because the RAFT framework uses discretized models of physical processes and operates over large areas, it should be highly scalable and readily adaptable to a wide variety of river systems. How well the model will function in these systems will be driven, in part, by the quality of the input data. The required data are upstream flow and temperature observations (boundary conditions), river bathymetric cross-sections, meteorological observations/predictions, and inflows/outflows. The boundary conditions are often available for regulated rivers where water agencies monitor flow and temperature at dams, power plants, and other structures. The quality and resolution of river bathymetry and meteorological data can be highly variable, which could significantly impact temperature and flow predictions. High-resolution bathymetric data are available for many major rivers, but they are expensive data sets and are not widespread for minor rivers. In lieu of detailed cross sections, regional downstream hydraulic geometry relationships can be substituted, but with a potential decrease in accuracy that would be hard to quantify. Flow and temperature observations at tributary junctions and water-withdrawal facilities are not always available. In the case where flow and temperature at tributaries are unobserved, additional models may be constructed to estimate these inflows (outside the scope of this paper). However, temperature monitoring networks are expanding due to the decreasing cost of instruments, and such data can be readily incorporated into RAFT for assimilation, validation, and calibration.
 Adaptation of RAFT to physiographically different stream and river systems may require modification of existing processes and/or the addition of new processes. This is straightforward in RAFT because of the additive nature of the source terms. Potential extensions could consider riparian and topographic shading, snowmelt, and/or hyporheic flow [Bogan et al., 2004; Evans and Petts, 1997; Johnson, 2004]. As one immediately useful extension to our application, RAFT may benefit from a linkage with a distributed rainfall/runoff model [e.g., Yearsley, 2012] to account for accretions of flow and additional heat advected from runoff. For this extension, the time scale of the model simulation may need to be adjusted near peak flows so that the stability criteria are not exceeded. RAFT relies on semi-Lagrangian algorithms to handle advection and dispersion processes in their natural coordinates, which provides robustness and minimized numerical artifacts. But these algorithms also imply specific mathematical constraints on the combination of temporal and spatial resolution the model can achieve.
 In general, to achieve finer spatial resolution in model outputs requires finer temporal resolution as well. For our application, a spatial and temporal resolution of 2 km and 15 min was sufficient to capture downstream temperature dynamics at an ecologically relevant scale. Finer spatial resolution may be more appropriate for smaller rivers to evaluate spatial heterogeneity, but is less critical in our application because small habitat patches do not hold the same importance as short-term thermal extremes. One fundamental trade-off appears to be that, in order to have a 1-D model that is computationally suitable for forecasting, the model will not capture thermal heterogeneity caused by incomplete mixing at small tributary or groundwater inputs, or in deep pools, which in our application limits spatial resolution to ∼1 km. However, smaller scale (10–100 m) thermal heterogeneity may be difficult to reproduce if that heterogeneity is due to a process that is not explicitly modeled and difficult to measure (i.e., losing/gaining reaches due to hyporheic flow). In these cases, finer levels of spatial resolution may be better addressed through two- and three-dimensional models.
 In summary, the RAFT model has several qualities that make it useful for assessing managed rivers. It generates accurate predictions and estimated error, in real-time, at fine spatial and temporal resolutions over large area, and can predict novel management scenarios. These predictions are based on distinct processes, allowing the contribution of each process to be quantified. The model incorporates forecasting, which allows managers to predict the effects of their actions in real time.