Autonomous in situ measurements of freshwater alkalinity

Total alkalinity (AT) is an important parameter in the study of aquatic biogeochemical cycles, chemical speciation modeling, and many other important fundamental and anthropogenic (e.g., industrial) processes. We know little about its short‐term variability, however, because studies are based on traditional bottle sampling typically with coarse temporal resolution. In this work, an autonomous AT sensor, named the Submersible Autonomous Moored Instrument for Alkalinity (SAMI‐alk), was tested for freshwater applications. A comprehensive evaluation was conducted in the laboratory using freshwater standards. The results demonstrated excellent precision and accuracy (± 0.1%–0.4%) over the AT range from 800 to 3000 μmol L−1. The system had no drift over an 8 d test and also demonstrated limited sensitivity to variations in temperature and ionic strength. Three SAMI‐alks were deployed for 23 d in the Clark Fork River, Montana, with a suite of other sensors. Compared to discrete samples, in situ accuracy for the three instruments were within 10–20 μmol L−1 (0.3–0.6%), indicating good performance considering the challenges of in situ measurements in a high sediment, high biofouling riverine environment with large and rapid changes in temperature. These data reveal the complex AT dynamics that are typically missed by coarse sampling. We observed AT diel cycles as large as 60–80 μmol L−1, as well as a rapid change caused by a runoff event. Significant errors in inorganic carbon system modeling result if these short‐term variations are not considered. This study demonstrates both the feasibility of the technology and importance of high‐resolution AT measurements.

A T in running waters is sourced from chemical weathering (Raymond and Cole 2003;Torres et al. 2016) as well as aerobic and anaerobic processes, for example, sulfate reduction and oxidation, nitrification, and denitrification (Raymond et al. 2000;Abril and Frankignoulle 2001;Whitworth et al. 2014). Because of its role in river aquatic chemical equilibria and as an indicator of broader watershed processes, A T is commonly monitored by ecologists and geochemists. Studies have revealed upward trends in riverine A T on a decadal scale, reflecting human-accelerated weathering rates (Raymond and Cole 2003;Raymond and Oh 2009;Kaushal et al. 2013;Stets et al. 2014;Drake et al. 2018). A T is also commonly used in chemical speciation calculations. It is an important input parameter for computer programs such as PHREEQC or MINTEQ that use thermodynamic and kinetic relationships to predict complexation, solubility, and reactivity (Charlton and Parkhurst 2011;Fenter et al. 2007). For example, speciation of heavy metal ions can be predicted with A T and other waterquality parameters to assess aqueous toxicity (Betrie et al. 2016;Halim et al. 2005;Schmidt et al. 2013). When A T is combined with pH, total dissolved inorganic carbon (C T ) and the partial pressure of CO 2 (pCO 2 ) can be estimated (Neal 2002;Butman and Raymond 2011;Hunt et al. 2011). Measurements of this combination make it possible to quantify air-water CO 2 fluxes within aquatic environments from seasonal to decadal time scales (Ran et al. 2015;Müller et al. 2016;Minor et al. 2019). Government agencies such as the U.S. Geological Survey (USGS) also routinely measure A T and pH to assess ecosystem health and potential impacts of anthropogenic activities. These databases have been used to estimate riverine CO 2 fluxes across the conterminous United States (Butman and Raymond 2011;Stets et al. 2017).
In most studies, A T has been measured on a long-term basis and relatively few studies have investigated its short-term patterns. There are, however, numerous examples in the literature that show that A T can change significantly on short time scales. Tobias and Böhlke (2011) observed a $1000 μmol L −1 drawdown of A T from carbonate mineral reactions during the daytime in a small productive stream. Large diel swings in A T were also observed in other rivers due to calcium carbonate (CaCO 3 ) precipitation (Drysdale et al. 2003;De Montety et al. 2011;Tamooh et al. 2013). Cyclic inputs of groundwater caused by evapotranspiration have been suggested as another important mechanism for A T diel cycles (Lundquist and Cayan 2002;Nimick et al. 2011;Hayashi et al. 2012). The varying proportions of groundwater to river flow and resulting A T diel cycles were quantitatively assessed in Wilcock and Chapra (2005). Extreme events, such as floods due to rain or snow melt, may override A T diel cycles as a result of dilution or soil flushing (Evans and Davies 1998). In addition to biogeochemical and hydrological processes, sewage effluent, or other pollution (e.g., acid runoff) can also change A T (Bishop et al. 1990;Buffam et al. 2007). Freshwater CO 2 system and other equilibrium calculations could be in error if short-term variations in A T are not considered. The errors could propagate into ecological parameters, such as Net Ecosystem Production, that rely on inorganic carbon concentration (Pennington et al. 2018). Moreover, from an environmental monitoring perspective, samples collected for A T at one point in a fixed time may not accurately represent water quality that can change over short periods (Nimick et al. 2011). For example, the process of diel carbonate precipitation could induce diel cycles of heavy metals through coprecipitation (Kurz et al. 2013). The extent of these errors with respect to the calculations and models remains unknown. More detailed studies are therefore needed to understand the mechanisms behind short-term A T variability and their importance to ecosystem function and health.
Previous high-temporal resolution studies of riverine A T have been based on traditional sampling followed by subsequent laboratory-based measurements with sampling duration limited by manpower and field logistics. Consequently, most high-temporal resolution A T studies have only covered 1 to 4 d (Wilcock and Chapra 2005). Longer, high-temporal resolution studies are not feasible and therefore infrequent episodic events are unlikely to be observed. Autonomous in situ sensors would be more effective for collecting high-temporal resolution data over long time periods (weeks to months). However, to our knowledge, no autonomous in situ A T sensors have been available to the freshwater research and monitoring communities. We developed an autonomous A T system, the SAMIalk, for seawater A T measurements. Past deployments of the system successfully collected coral reef time series on moorings in Kaneohe Bay, Hawaii (Spaulding et al. 2014) and Hog Reef, Bermuda (Pezner et al. unpubl.). In these studies, the SAMI-alk has revealed diel A T cycling and longer term variability that can be used for calculations for the CO 2 system and biological rates (Peterson 2018).
The SAMI-alk technology is based on the tracer monitored titration (TMT) concept, where an acid-base indicator serves as a tracer to quantify both pH and the amount of acid added. With the TMT, accurate volumetric or mass delivery of solutions is not required, greatly simplifying the titration pump design (Martz et al. 2006). In view of the need for A T sensors to study freshwater environments, in this work we have extended the utility of SAMI-alk by extensively evaluating its performance in freshwater conditions. Ideally, the SAMI-alk could achieve accuracy and precision comparable to the seawater applications (i.e., $5 μmol kg −1 ) (Spaulding et al. 2014). SAMIalk was first evaluated in the laboratory over a broad range of conditions (temperature and ionic strength [IS]). These evaluations found that SAMI-alk accuracy is not significantly affected by these variables. In September 2019, three SAMI-alks were deployed together in the Clark Fork River (CFR), Montana, collecting a 23-d time series. These data revealed significant shortterm A T variability. The overall field accuracy was within 10-20 μmol L −1 (0.3-0.6%). This deployment also provided important insights into the performance of SAMI-alk in riverine environments with high levels of turbidity and biofouling.
Theory SAMI-alk was developed based on the TMT technology (Martz et al. 2006) where a diprotic sulfonephthalein indicator, bromocresol purple (BCP) in this case, is used to spectrophotometrically quantify both pH and the amount of titrant added. BCP was selected because of its optimal pH measurement range (5.0-6.5), where pH change is sensitive to incremental addition of acid titrant. BCP also has higher solubility over bromocresol green, which was once used in the TMT titration apparatus (Martz et al. 2006). The sulfonephthalein indicators exist in three forms, represented as H 2 I, HI − , and I 2− . The fully protonated form of BCP (H 2 I) is not present in significant amounts during a titration because its acid dissociation constant (pK a ) is less than 1. The pK a of the HI − form is 6.49 at zero IS and 25 C (Yao and Byrne 2001). The BCP absorption maxima for HI − and I 2− are at 432 and 589 nm, respectively, but the absorbance peaks of the two forms overlap (Yao and Byrne 2001). Therefore, at the analytical wavelength (λ), the indicator absorbance (A λ ) is the sum of absorbance of the two components: where ε is the molar absorption coefficient of either species at wavelength λ and b is the optical path length in SAMI-alk.
Based on Eq. 2, solving equations at two absorption maxima (432 and 589 nm in this case), provides the concentrations of HI − and I 2− : A 432 ε I,589 −A 589 ε I,432 b ε HI,432 ε I,589 − ε HI,589 ε I,432 ð Þ ð3Þ And therefore, the total concentration of BCP in a titrantsample mixture ([I] T ) is: [I] T is the tracer concentration that is used to quantify the amount of acid/indicator (a/i) solution that is added using the following procedure. During a titration, sample in a fixed volume, magnetically stirred optical flow cell is gradually displaced by acid/indicator titrant. The indicator dilution factor (f a/i ) is defined as the ratio of the volume of added titrant (V a/i ) to the total volume of the sample-titrant mixture (V T ). The sample dilution factor f s is thus 1-f a/i . In SAMI-alk, f a/i is calculated from the ratio of [I] T (Eq. 5) to the prepared total indicator concentration in the titrant As shown in Eq. 6, f a/i is also equivalent to the ratio of the total acid added ([H + ] added ) to the initially prepared acid titrant concentration ([H + ] a/i ). The indicator is thus used as a tracer to determine the amount of titrant added eliminating the need for accurate volumetric delivery of titrant. This method, however, requires very accurate optical absorbances to determine [I] T and pH as discussed below (Eqs. 8-9).
Equation 1 is rearranged and modified by the addition of titrant, which can be expressed by including f a/i and indicator equilibria. [CO 3 2− ] and [HCO 3 − ] are written in terms of distribution functions and C T (Martz et al. 2006): where K w , K 1 , and K 2 are the temperature and IS dependent constants for water self-dissociation and H 2 CO 3 first and second dissociation, respectively, which are all taken from Millero (1995). [H + ] is determined from spectrophotometric pH (Yao and Byrne 2001;French et al. 2002). [I 2− ] is a proton acceptor based on the definition of Dickson (1981) and is included in Eq. 7. This equation applies to the equilibrium after each time the titrant is added, as explained below. The pH, on the free hydrogen ion scale, is determined using BCP following Yao and Byrne (2001): pH = pK a + log R −e 1 e 2 −Re 3 ð8Þ pK a = 5:226 where R is the ratio of absorbances at 589 and 432 nm, and e 1 , e 2 , and e 3 are molar absorption coefficient ratios. The pK a is the second ionization constant for BCP at infinite dilution (zero IS) and T is the temperature in Kelvin. The temperature dependencies of the thermodynamic constants and molar absorption coefficient ratios are critical to SAMI-alk accuracy (see the Assessment section). It should also be noted that the measurements by the SAMI-alk are independent of IS and therefore all thermodynamic constants at infinite dilution conditions are used here. The validity of this assumption is discussed in the Assessment section. In Eq. 7, a set of [H + ] (Eq. 8), f a/i (Eq. 6) and [I 2− ] (Eq. 4) values are calculated from absorbance data, leaving A T and C T as the only two unknown quantities. Equation 7 is then solved by nonlinear leastsquares calculation (NLLS) (Dickson 1981). Namely, A T and C T are iteratively optimized by minimizing the sum of the squares of the residuals in Eq. 7. A custom MATLAB program was written to process these data.

Materials
Indicator grade BCP sodium salt (lot# MKBQ3276V) was purchased from Sigma-Aldrich (St. Louis, Missouri) and was used without further purification. ACS primary standard grade sodium carbonate (Na 2 CO 3 ) was purchased from Alfa Aesar (purity 99.95-100.05%, dried basis). Certified 0.1 N hydrochloric acid solution (HCl, 0.0998-1.002 N) and certified ACS grade sodium chloride (NaCl, purity 99.7%) were purchased from Fisher Scientific (Pittsburgh, Pennsylvania). Nanopure water (17.9 MΩÁcm specific resistance), obtained from a Barnstead water purification system (Thermo Scientific, Waltham, Massachusetts), was used to prepare all solutions.
The titrant solution contained $5.5 × 10 −5 mol L −1 BCP and $8.0 × 10 −4 mol L −1 HCl, prepared from $1.5 × 10 −3 mol L −1 BCP and 0.1 N HCl stock solutions, respectively. Freshwater A T standards for lab testing were prepared with Na 2 CO 3 and 0.1 N HCl with A T ranging from $800 to 3000 μmol L −1 . Standards used in the field study were prepared in the same way but were typically close to the expected river A T (3008.9 μmol L −1 for the deployment shown below).
In the experiments to investigate the possible effect of IS on the A T measurement, different amounts of NaCl were added to A T standard solutions. The NaCl and Na 2 CO 3 salts were dried overnight at 200 C and cooled to room temperature in a desiccator before use. All solutions were stored in gas-impermeable bags in both laboratory and field studies.

SAMI freshwater optimization
In this study, the SAMI-alk operating sequence and calibration routine were optimized for freshwater analysis. Freshwater samples have low IS, resulting in a higher apparent pK a for BCP, that is, from 6.49 to 5.94 for salinity from 0 to 35, respectively (Yao and Byrne 2001;Spaulding et al. 2014). Thus, the pH range used for data collection needs to be adjusted for freshwater analysis. Because the SAMI-alk draws in water for analysis, high particulate concentrations pose another potential difficulty compared with seawater analysis, as discussed below.

SAMI-alk operation and calibration
The SAMI-alk used here has essentially the same design that was previously reported by Spaulding et al. (2014) for seawater analysis. A schematic diagram is shown in the Supporting Information (Fig. S1). SAMI-alk is 96.5 cm in length and 16.5 cm in diameter. It is powered by 18 alkaline D-cell batteries. The SAMI-alk optical flow cell design consists of a 3 mL stirred cell with 1000 μm diameter optical fibers and a 1 cm optical path length. These dimensions vary slightly (but significantly) among instruments due to mechanical tolerances. The electro-optic board consists of 435 and 588 nm LEDs (Roithner Lasertechnik) narrowed to 435.8 and 590 nm, respectively, with 10 nm bandpass filters (Intor). Light from these two alternatively pulsed LEDs passes through a 50 : 50 beam-splitter (Edmond Optics). Roughly 50% of the light is carried to the optical cell through an optical fiber, and the transmitted light is returned via another fiber and detected with a silicon photodiode (Hamamatsu). The other 50% of the light is sent to a reference photodiode, which is used to monitor the LED output and correct for source fluctuations in real time. The absorbance during a titration is calculated using the following equation: where I λ and I λ0 are the light intensities that pass through the indicator and blank solutions (100% transmittance), respectively, and I λref and I λ0ref are the corresponding reference intensities. As noted by Martz et al. (2006), ± 0.0005 absorbance unit precision translates to 0.1% A T precision. An approximately ± 0.0001 absorbance unit precision is obtained by this design based on blanks in the lab; therefore, A T measurement imprecision due to optical noise should be theoretically small. In the field, in addition to manually collected samples to verify instrument stability, the SAMI-alk also periodically analyzed bagged standards, which was achieved by plumbing a three-way solenoid valve to the sample inlet (Fig. S1). For a titration cycle, the optical cell is first flushed with $40 mL sample or standard by activation of a diaphragm pump (NF1.5, KNF Neuberger) (Fig. S1). The dark signals are recorded at both wavelengths before LEDs are turned on. The blank signals and reference signals are recorded subsequently at each wavelength. Then, the titrant solution, selected via another three-way solenoid valve (The Lee Company), is pumped into the optical cell with 15-20 pump strokes from a 250-μL/pulse solenoid pump (Bio-Chem Fluidics). The cell is stirred for 5-9 s after each pump stroke, depending on the ambient temperature (see the Assessment section). After stirring and a 2 s wait, light signals, reference signals, and temperature are recorded, and pH is calculated from Eqs. 8 and 9. When the pH of the mixed solution drops to 6.0 based on real-time calculation of pH by the SAMI-alk, pumping of titrant solution switches to a 20 μL/stroke solenoid pump (Bio-Chem Fluidics), followed by the same stirring and light signal recording steps. When the pH of the mixed solution reaches $5.0, the titration is terminated. This pH range corresponds to the optimal signalto-noise range for absorbances. For Eq. 7 calculations, absorbance values between $ 0.1 and 1.1, which are obtained in the pH range 5.0-6.0, are used. At that point, the optical cell is again flushed with $ 40 mL sample or standard. Both pre-and post-flushing are necessary to remove any residual indicator in the cell, which, as shown below, is critical to the accuracy of the optical signals and titrations. One entire titration cycle takes $ 12 min, $ 4.5 mL of titrant and 80 mL of sample or standard. Data are stored as 16-bit voltages on a data logger (TFX-11, Onset Corp.). The MATLAB program used to process the raw data automatically removes points from the NLLS if the squared residual exceeds 1 × 10 −11 (units in [mol L −1 ] 2 ), resulting in $ 20 points out of $ 25 points collected for a typical titration. Because of measurement errors from several possible sources, as discussed in the Assessment section, a calibration scale factor α is applied. This means, in Eq. 7, f a/i is multiplied by the calibration scale factor α before performing the NLLS.

Characterization of SAMI-alk for freshwater
Determination of molar absorption coefficients The optical system of SAMI-alk was characterized first before running any titrations. Because the optical bandpass and center wavelengths of the SAMI-alk are slightly different from those used by Yao and Byrne (2001), εs need to be measured. The ε values are also affected by indicator content and purity. Moreover, the fiber optics that define the path length (b in Eqs. 3 and 4) cannot be set to better than $ 5% uncertainty (0.5 mm), therefore the εs and path length are measured together (Martz et al. 2006). This combined form (εb) can be calculated directly from absorbances and prepared indicator solution information, that then allows for calculations of [HI − ] (Eq. 3) and [I 2− ] (Eq. 4) without actual knowledge of b values. Solutions for the εb measurements were prepared similar to those in Lai et al. (2016) for other indicators. Four different concentrations, corresponding to four different εs, were adjusted to high or low pH to isolate one form of BCP ([I 2− ] or [HI − ]). The solution absorbances were measured by pumping the solutions into the optical cell of the SAMI-alk, with five replicates each at 5 C, 10 C, 15 C, 20 C, and 25 C, to determine the εb values and their temperature dependence.
The εb values must be redetermined if the flow cell is disassembled and reassembled, which changes the positioning of the fiber optics and path length b. An example of εb values and their temperature dependence is shown in the Supporting Information (Fig. S2).

Determination of precision and accuracy
In order to evaluate the accuracy and precision of SAMI-alk for freshwater samples, five different freshwater A T standards were prepared, roughly encompassing values in the world's major rivers, for example, 800-3000 μmol L −1 (Cai et al. 2008). These standards were also measured by automated potentiometric Gran titration to an end point pH of 3.0 (Gran 1952). Good agreement (2.1 ± 3.2 μmol L −1 , n = 10) was observed between prepared and Gran titration values with no adjustment for acid titrant concentration. Separate trials were performed on these standards, with each trial containing 15 consecutive hourly measurements. The 12 trials in total were conducted on 12 different days over a period of 3 weeks. The SAMI-alk was not operating during the temporal gap between trials. Precision was assessed based on one standard deviation (SD) of replicate measurements. Accuracy was assessed based on the difference of the averaged SAMI-alk A T and Gran titration A T .

Temperature and IS dependence
To assess SAMI-alk temperature response, a carbonate standard was prepared and measured at four different temperatures (3 C, 10 C, 17 C, and 24 C) by submerging a SAMI-alk in a temperature-controlled tank.
To assess SAMI-alk IS dependence, measurements by both SAMI-alk and Gran titration were carried out on solutions with identical A T , but with different IS background by addition of different amounts of NaCl. The standard stock solution has low IS (1.6 mM), IS of the other four solutions were increased to 5.0, 10.0, 15.0 and 20.1 mM. Trace protolytic impurities in the high purity NaCl salt are negligible at this level. IS for the CFR is estimated to range between 1.8 and 8.8 mM (Nagorski 2001;Lynch 2007). Therefore, solutions used in this study would serve as a good test of freshwater IS effects.
Determination of instrument stability/drift SAMI-alk stability was evaluated by monitoring A T of a bagged standard solution under controlled temperature (25.03 C ± 0.15 C) over 8 d. SAMI-alk measurements were performed every 6 h. In addition, every 48 h during these tests, some standard solution was removed from the standard bag with a syringe, and then measured by Gran titration, to track any possible changes in the standard solution.

Deployment in the CFR
The CFR is a productive, high-gradient, cobble-bed river. It extends 563 km in length and drains an area of 57,400 km 2 . The Gold Creek site (USGS station,62.77 N,149.69 W) where the SAMI-alks were deployed is 89.2 km from the confluence of two streams where the CFR is formed. Mean annual discharge at the site is $ 20 m 3 s −1 . The river chemistry is influenced by numerous tributaries, ephemeral gulches, and groundwater inflow (Lauer and Parker 2008). Three identically designed SAMI-alks (serial numbers SAMI00, SAMI02, and SAMI03) were deployed at this site from 19 September to 11 October 2019. Deployment of three instruments provided an excellent opportunity to assess instrument performance through inter-comparisons. As shown in Fig. 1a, plastic tubes were used for protection of standards and titrants. The SAMIalks were held upright by two post anchors on the river bottom (Fig. 1b).
SAMI-alks were programmed to measure A T every 2 h and in situ standards once daily. Bottle samples were also taken periodically, transported to the laboratory, and measured by Gran titration for comparison. Two replicate samples were collected in 250 mL borosilicate ground-glass bottles, and each bottle was analyzed twice, yielding a total of four measurements. Samples were stored in a refrigerator and analyzed within 10 d after collection. Samples were not preserved with mercuric chloride because it can alter the pH and A T of freshwater samples. Average precision of the bottle samples collected during 10 different field visits was ± 2.3 μmol L −1 (n = 10). River debris and algae were intentionally avoided during sampling but samples were not filtered. Particulate organic material has the potential to influence A T (Kim et al. 2006) but does not appear to be significant in this study (see Supporting Information Table S1). For the SAMI-alk, a 10 μm filter was attached to the sample inlet to prevent particles from entering the optical cell. The filter was replaced every $ 8 d during the deployment. Some of the bottle samples were not collected exactly at the time when SAMI-alk was running (30 or 45 min off), so data from SAMI-alk were linearly interpolated for comparison.
Sensors were used to record conductivity, temperature, and depth (Onset HOBO U24-001, U20L-01) every 15 min. A SAMI-CO 2 sensor (Sunburst Sensors) was also deployed and operated at the same 15-min measurement frequency (DeGrandpre et al. 1999). The pCO 2 can be combined with A T to calculate other CO 2 parameters (pH and C T ) through CO2SYS "Freshwater" option (salinity = 0) (Pierrot et al. 2006;Lynch et al. 2010). Local barometric pressure and precipitation were downloaded from National Centers for Environmental Information (www.ncdc.noaa.gov). River discharge measured every 15 min was obtained from USGS gauging Sta. 12324680 located at the SAMI deployment site. A 2-h low band pass filter was applied to river discharge and depth to reduce high-frequency noise.

SAMI-alk titration data
To illustrate the SAMI-alk operation principles, an example of titration data with A T = 2182 μmol L −1 is shown in Fig. 2. As the titrant is added (increased f a/i , Eq. 7), pH of the mixed solution in the cell is lowered, represented by higher absorbance at 432 nm and lower absorbance at 589 nm, corresponding to indicator species [HI − ] and [I 2− ], respectively (Fig. 2b). The pH does not quite reach 5.0 because data at this pH have absorbance units at 590 nm less than 0.1 and are therefore not included in the NLLS analysis. In this case, the [I] a/i could be adjusted slightly to maximize the number of data points with optimal absorbance units (0.1-1.1). As for inorganic carbon species (Fig. 2b, left  The range of f a/i depends on sample A T and titrant [H + ] a/i . For titrations with higher A T or lower [H + ] a/i , a greater amount of titrant is required to bring the pH down to 5, resulting in higher f a/i . In this example, f a/i ranges from 0.66 to 0.73, covering a total of 26 data points. With these points, A T is solved by Eq. 7, which links indicator species and carbon species equilibria. Some of them are typically removed for NLLS as a result of large residuals (squared residual > 1 × 10 −11 units), possibly caused by occasional bubbles, particles, or optical noise. This step typically leads to $ 20 points for final analysis under lab conditions.   Table 1 summarizes the results for the lab accuracy and precision tests. At the beginning of each trial, $ 2 measurements were normally discarded as a result of carryover from the large changes in A T and instrumental conditioning (Table 1), leading to $ 10% data loss for this entire test. A calibration scale factor α of 0.996 was used for all standards measured in the lab study. The α of 0.996 accounted for a $ 2% error in measured A T in this test. The magnitude of α is related to the accuracies of titrant compositions ([H + ] a/i and [I] a/i ), indicator thermodynamic constant, path length, molar absorption coefficients, absorbance accuracy (linearity and blank accuracy), and the accuracy of standards (Martz et al. 2006). In principle, with accurate knowledge of the parameters above, A T can be accurately determined with no adjustment, but the results suggest that errors in one or more of these parameters still exist. Although errors from different sources may offset each other, parameter sensitivities were examined by applying a relative systematic error to each of the parameters, as shown in Table 2. The pK a for BCP (Eq. 9) was determined for impure BCP (Yao and Byrne 2001) and might differ from batch to batch. Lai et al. (2016) showed $ 0.03 offset in pK a between unpurified and purified phenol red, for example. The resulting error in A T is 0.3% if the same offset in pK a is applied to BCP. Any possible photodegradation or precipitation of the BCP stock solutions may change BCP concentrations, causing errors in [I] a/i (Eq. 6) and ε measurements, which then propagate proportionally into [I] T and f a/i (Eqs. 3-6). A T is highly sensitive to errors in f a/i . A 0.4% error in f a/i corresponds to 1.6% error in A T (Table 2). This implies that to achieve an ideal level of accuracy, that is, $ 0.2% mean error obtained in the lab, f a/i requires absorbance accuracy to be within 0.04%. Other errors, such as [H + ] a/i and standard A T due to preparation, are expected to be small (< 0.1%) ( Table 2). In summary, absorbance accuracy and precision are critically important in the determination of A T , due to absorbances used to compute εb and, during a titration, the values of pH, [I] T , and f a/i .

Laboratory accuracy and precision
Notably, different trials were conducted on 12 different days over a period of 3 weeks, giving both intra-and inter-day precision and accuracy. Precision (SDs) for all five standards are within ± 5 μmol L −1 (Table 1), with slightly higher values for high A T standards. No difference was observed among different trials for one single standard, indicating good reproducibility among different days. As for accuracy, results from SAMI-alk and Gran titration are in excellent agreement with each other as the least squares fit gives a slope of almost unity and an intercept close to zero (A T (SAMI) = 1.0011ÁA T (Gran) -1.7493, r 2 = 1.0000, not shown). Moreover, with one single calibration factor (α = 0.996), the A T accuracy are within 5.0 μmol L −1 . Relative errors (%) are between −0.37 and 0.28. These results also demonstrate good linearity and no systematic, concentration-dependent errors. The use of α to calibrate f a/i is necessary because a concentration-dependent error would result if A T is multiplied by α directly. As the USGS commonly reports A T to only three significant figures (Fishman and Friedman 1989), SAMI-alk has considerably better performance than that obtained in conventional field programs, making it possible to resolve small (e.g., diel) changes, as presented below.

IS effects
IS affects the dissociation of ionic species in water, but not, in principle, A T . The thermodynamic constants used in Eqs. 7 and 9 are dependent on IS. However, thermodynamic constants at infinite dilution conditions are consistently used. The A T measured with both SAMI-alk and Gran titration for different IS samples are shown in Fig. 3. The A T results from different IS are identical to each other within measurement errors and do not show any trend with IS. These results validate the use of pK a at infinite dilution for Equations 7 and 9 calculations.

Temperature effects
In order to illustrate the relative importance of the εs and pK a temperature dependencies, SAMI-alk data collected at different temperatures were processed in three different ways: Normal calculations, which consider pK a and εs temperature dependence, calculations with constant pK a , and calculations with constant ε values. The resulting A T at 17 C was set as a reference for comparison (Fig. 4).
For normal calculations, the differences measured relative to A T at 17 C is 4.7 ± 6.3 μmol L −1 (n = 15) (Fig. 4). Keeping pK a constant does not significantly affect the performance (4.7 ± 9.9 μmol L −1 ). Much larger errors are generated if εs are held constant, however (differences = 41 ± 89 μmol L −1 ) (Fig. 4). These results are consistent with the seawater study (Spaulding et al. 2014), where ε accounted for the majority of the temperature sensitivity. This occurs because ε is used to calculate f a/i (Eqs. 3 and 4), and small changes in f a/i propagate into larger errors in A T as explained above. In addition, during these experiments, we initially found large errors at temperatures below $ 15 C. Through considerable effort in testing various hypotheses for this problem, it was finally discovered that mixing was not adequate at lower temperatures. Therefore, stirring time was increased from 3 s (used for temperatures > 15 C) to 9 s between titrant additions and signal recordings, greatly reducing systematic errors. Stirring time could be easily adjusted based on water temperatures during deployments to optimize power consumption. The slower mixing could be partly explained by the higher viscosity of water at low temperatures. Viscosity increases by 43% when temperature decreases from 15 C to 3 C (Korson et al. 1969), potentially impeding mixing. Another possible reason could be the CO 2 hydration-dehydration rate, which is four times higher at 18 C than that at 0 C (Soli and Byrne 2002). A longer stir time would allow the hydration reaction to come to completion. Future studies will include experiments to distinguish these physical and chemical possibilities, for example, titrating NaOH samples with minimal dissolved CO 2 .

Instrument stability
In this experiment a SAMI-alk was operated over 8 d without any interruptions, except for data downloading every 2 d. As shown in Fig. 5, A T data from SAMI-alk ranged from 1624.3 to 1635.4 μmol L −1 with a mean of 1629.6 μmol L −1 and a SD of ± 2.6 μmol L −1 (n = 30) (dashed lines). There was no detectable drift (p > 0.05, r 2 = 0.003). Moreover, A T measured by Gran titration over this period was 1627.7 ± 1.4 μmol L −1 (n = 19), indicating that A T was stable in the bag. Further studies are required to test stability over longer periods, but field experiments (described below) show no drift over a $ 3 week period.

Evaluation and quality control of SAMI-alk field data
The 23 d time series and other supporting data are shown in Fig. 6. A total of 264 measurements were made by each SAMI-alk over this 23-d period, including 24 standards. One of the advantages of this study is that three SAMI-alks were deployed together, allowing an inter-comparison of raw data to help understand sources of problems. In the following paragraphs, evaluation of the SAMI-alk performance and data quality control will be presented.
Initially, calibration scale factors (α) of 1.011, 0.997, and 0.992 were used for SAMI00, 02 and 03, respectively, based on comparisons with in situ standards (3008.9 μmol L −1 ). However, with these α, all three SAMI-alk data had a $ −50 μmol L −1 offset compared to bottle sample A T . This offset, which could not initially be explained, was finally attributed to the presence of colored dissolved organic carbon (CDOM) in the river water. We found that CDOM alters blank intensities at 432 nm, which then changed during a titration by addition of titrant. Consequently, the river water has a different background absorbance than sample-titrant mixtures and in situ standards, making 432 nm absorbances subject to f a/idependent errors. CDOM absorbance was estimated to be $ 0.004 during the deployment by comparing SAMI-alk blank intensities for river water and in situ standards made from pure water. The A T offset was eliminated by compensating for a dilution factor dependent absorbance offset (0.004 × f a/i ) for the original 432 nm absorbances, supporting this explanation. Alternatively, SAMI-alk can be calibrated by setting α to match the first bottle sample. All river sample data reported here were calibrated in this way with α equal to 1.007, 0.993, and 0.988

Fig 4.
Effects of temperature on A T measurements with SAMI-alk. Three different calculations were used to assess relative importance of different parameters: Normal calculations, which consider both pK a and εs temperature dependence; calculations with constant pK a and calculations with constant ε values. The resulting A T at 17 C (2164.7 μmol L −1 ) was set as a reference for comparison.
for SAMI00, 02, and 03, respectively. In situ standards are only used to assess instrument stability, as discussed below.
Because riverine environments are turbulent and particlerich, one concern is the increased likelihood of air bubbles and particles affecting both blanks and sample light intensities within a titration. Bad blanks and noisy optical signals degrade precision and accuracy by producing titration points deviating from the ideal titration curve. Such bad titrations can result in A T with errors > 10%. Data points with squared residuals greater than 1 × 10 −11 (mol L −1 ) 2 units are necessarily and automatically removed (Spaulding et al. 2014), decreasing the total number of data points for the final NLLS analysis. The number of data points available thus serves as an important indicator of the titration's quality. In the river deployment, some titrations did not have sufficient data points, which rarely occurred in lab conditions. The average number of titration points for SAMI02 and SAMI03 were both 21, but only 17 for SAMI00. We found that removal of titrations with less than eight titration points eliminated nearly all A T spikes and some of the noisy data in the three A T time series (not shown in Fig. 6). Filtering with a higher titration point cutoff value (> 8) appeared to remove good data. The different data rejection rates, which ranged from 0% to 20% (Table 3), provide insights into data problems, examined in detail below.
Blank stability is another important aspect of SAMI-alk performance (Spaulding et al. 2014). Errors in blanks propagate into errors in absorbances and f a/i (Eqs. 3, 4, and 6). Data from SAMI02 are shown as an example in Fig. 7. Blank intensities at 589 nm are sensitive to temperature changes, while those at 432 nm are less temperature-dependent due to the different sensitivities of the LED semiconductor material (Lee et al. 2010). By comparing blank intensities between SAMIs, it was discovered that 589 nm blanks started to drift downward later in the SAMI02 time series until a new inlet filter was replaced. The dashed vertical lines in Fig. 7c indicate the time when filters were replaced. These blanks, termed as "unstable blanks," deviated from the linear relationship between the temperature and "stable blanks" at 589 nm, as shown in Fig. 7a. The same phenomenon was not clearly observed for 432 nm blanks (Fig. 7b). We believe that particles gradually plugged the filter, lowering the flow rate and impeding flushing of the optical cell. While the programmed flush volume is more than adequate (25 times higher than the cell volume), it may be insufficient if the filter is obstructed. Moreover, BCP is difficult to flush completely because of its low solubility. It can adhere to the optical fiber tips, and be trapped within the pumps, valves, and corners of the cell (Spaulding et al. 2014). During blank flushing, trace amounts of BCP would be in the base form (I 2− ) in the untitrated (pH $ 8) sample, which likely caused the erroneous 589 nm blanks, while 432 nm blanks were not affected. As shown in Fig. 7c, gray points (raw A T ) systematically decreased during the period of unstable blanks. This systematic decrease in A T was not observed for bagged standards, which are pumped into the titration cell via a three-way valve (see Fig. S1 and SAMI-alk operation and calibration section). To  correct for this, the linear relationship between stable (temperature correlated) blanks and temperature was derived first, and this relationship was then used to calculate 589 nm blanks for all titrations resulting in the adjusted A T in Fig. 7c. This adjustment of 589 nm blanks relies on the assumption that the presence of low concentrations of I 2− only alters optical blank intensities, but not sample A T in a great amount. The residual indicator (I 2− ) is quantified by replacing with good blanks (Fig. 7a), and do not affect A T obtained by fitting the titration curves from pH 5.0-6.0. For the other two SAMIs (00 and 03), their measurements degraded before the first replacement of filters (shown in Fig. S3), while SAMI02 did not (Fig. 7c), and this degradation occurred at different times for different SAMIs, possibly caused by individual differences among filters. After the 589 nm blank adjustments, results for inter-comparison among the SAMIs, as well as bottle sample A T , support the validity of this data treatment (Fig. 6). It should be noted that slopes between 590 nm blank intensity and temperature vary among SAMIs due to slight differences in electronics and LEDs (relative intensities/ C are 368, 701, and 496 for SAMI00, 02 and 03, respectively). Although data were recovered in this way, this additional data processing step needs to be avoided in future studies. Replacement of the filter less than every 5 d is necessary in these high suspended sediment conditions. A schematic diagram is included in the Supporting Information that summarizes the issues and strategies discussed above (Fig. S4).
A summary of SAMI-alk performance is shown in Table 3, including field accuracy and data rejection rate. There was no Table 3. A summary of SAMI-alk field performance.
238 10 * Based on a comparison of Gran titration A T (μmol L −1 ). † Reported as the mean ± 1 × SD (μmol L −1 ). ‡ The number of measurements after data filtering (total of 264 possible).

Fig 7.
Examination of SAMI02 raw intensity data, as well as the SAMI02 A T time series before and after blank adjustment. (a) Intensity at 589 nm plotted against temperature. The data were grouped as stable blanks (red circles) and unstable blanks (gray circles). (b) Intensity at 432 nm. (c) A T time series before (gray circles in shaded areas) and after blank adjustment (red circles, Fig. 6 data). Vertical dashed lines indicate the dates for filter replacement. The blank adjusted data are also shown in Fig. 6. X-axis is Universal Time.
detectable drift based on the SAMI-alk accuracy and stability of the in situ standard measurements (p > 0.05, r 2 = 0.008). Figure 8 compares A T values between SAMI00 and SAMI02. The difference was −1 ± 14 μmol L −1 (n = 190), and compares well with the 1:1 line (slope = 0.9780). The difference between SAMI03 and SAMI02 was −8 ± 19 μmol L −1 (n = 214, not shown, slope = 0.9925). In addition, no A T dependent differences were observed (Fig. 8b). These statistical data suggest that no inherent differences existed among the three SAMIs. Rather, differences between the three SAMIs are more likely to originate from individual noise and periodic blank errors. It should be pointed out that this comparison relies on proper calibrations of SAMI-alks with three different αs being used, indicating differences in solution preparation and instrument characterization. This highlights the critical importance of in situ standards and bottle samples for data quality control.
Short-term alkalinity dynamics in the CFR SAMI-alk clearly captured short-term A T dynamics (Fig. 6a). A T ranged from 2862 to 3195 μmol L −1 , revealing clear diel cycles and other short-term events. Diel amplitude was as large as 60-80 μmol L −1 with higher A T values during the night. The pCO 2 decreased during the day and increased at night with a diel range from 220 to 880 μatm (Fig. 6b). Temperature ranged from 1.8 C to 15.8 C (Fig. 6c). The effects of a runoff event is evident in the discharge record (Fig. 6d), which increased from 9.9 to 16.1 m 3 s −1 , corresponding to a 250 μmol L −1 decrease in A T .
Net ecosystem production (NEP) with nitrate assimilation could change the A T based on the equation below (Stumm and Morgan 1996): For the photosynthesis occurring during the daytime (forward direction), A T increases from an uptake of 18 mol of H + per 106 mol of CO 2 assimilated, while respiration at night results in a release of H + and decrease of A T with the same stoichiometry. The pCO 2 and A T together can be used to calculate C T using CO2sys. This calculation estimates a mean C T diel cycle of 140 μmol L −1 . Using Eq. 11, stoichiometry predicts a daytime A T increase of 24 μmol L −1 , suggesting that the effect of NEP on A T variability is potentially not negligible, as widely assumed (Brewer and Goldman 1976;Prins and Elzenga 1989;Wilcock and Chapra 2005). However, A T changes caused by NEP are in the opposite direction of the A T diel trends in Fig. 6, indicating this effect might be overcome by other processes, such as evapotranspiration and carbonate mineral reactions, as discussed below.
Evapotranspiration is a possible mechanism for A T and conductivity diel cycles because it induces cyclic inputs of groundwater (Wilcock and Chapra 2005). It is potentially strong during the daytime, decreasing the proportion of groundwater flow to surface flow and altering the A T . Assuming groundwater has higher A T and conductivity, this process results in higher riverine A T and conductivity at night in agreement with the observations. While this may have occurred during this study, river depth (not shown) and discharge data (Fig. 6d) did not have clear diel cycles, making it difficult to conclusively identify this process.
Calcite precipitation and dissolution would be a more common argument (Drysdale et al. 2003;Wilcock and Chapra 2005;Liu et al. 2008;De Montety et al. 2011;Tobias and Böhlke 2011;Hayashi et al. 2012). The calcite saturation state (Ω) is: where {Ca 2+ } and {CO 3 2− } represent the chemical activities of the calcium and carbonate ions, and K sp is the solubility product of calcite at the ambient temperature (Neal 2002). During Difference between SAMI00 and SAMI02 A T plotted against A T (SAMI02  (Nagorski 2001). Activity coefficients of calcium and carbonate ion were estimated using the Davies equation (Stumm and Morgan 1996). With these data and K sp , calculations of Ω show that the river water was supersaturated (4.7-30.5) with respect to calcite at all times. The Ω is in a similar range as previously reported by Lynch (2007) in the CFR. The higher A T during nighttime could be due to the slowdown or stopping of calcite precipitation as pH dropped. Periodic sampling for [Ca 2+ ] or C isotopic analysis between dusk and dawn would provide more insights into the likely processes, differentiating between hydrological and biogeochemical control of A T diel cycles (Wilcock and Chapra 2005;De Montety et al. 2011).
Although the diel cycle of A T is clearly shown, it has often been neglected when studying freshwater carbon cycling. Regardless of the mechanisms, these changes might be important when quantifying sources and sinks of CO 2 in riverine and other aquatic systems. Simple calculations can be made to quantify the associated errors. Data from 9/21 to 9/29 were selected when diel cycles are clearest. In situ A T from SAMI02, combined with pCO 2 and temperature in CO2SYS, yielded both pH and C T . Similar calculations can be made with a constant A T (in this case we used the averaged A T within this period for all three SAMIs, 3094.6 μmol L −1 ). The pH differences calculated from in situ A T and constant A T were insignificant (less than 0.008 pH units, not shown) considering the large pH diel amplitude, for example, 0.6-0.7 pH units in the CFR (Yuan and DeGrandpre 2008). However, ignoring A T diel cycles, the C T diel range can be underestimated by almost a third ($ 50 μmol L −1 ) (Fig. 9). In the context of freshwater carbon cycling, processes such as groundwater input (Tobias and Böhlke 2011) and NEP (Lynch et al. 2010;Pu et al. 2017) would have similar errors (30%), seriously compromising the utility of these data.
A series of rain, snow, and subsequent melt events (Fig. 6d) not only caused a 250 μmol L −1 decrease in A T , but significantly depressed temperature and pCO 2 (Fig. 6b,c) and increased river discharge (Fig. 6d). It is commonly believed that A T is linked to conductivity, in that bicarbonate and calcium are the major ions dominating the conductivity (Neal 2002;Wilcock and Chapra 2005;Hayashi et al. 2012). A T is plotted against conductivity and colored with river discharge (Fig. 10). As can be seen, A T is linear with conductivity in most periods, except for the data points with $ 13 m 3 s −1 discharge, matching the short period of the runoff event. We hypothesize that this episodic event temporarily altered river end member sources. That is, each contributor to the total discharge (i.e., surface water, soil water, and groundwater) has a distinct chemical composition (Evans and Davies 1998). The river chemistry was modified because each end member's contribution was changed by the episodic flushing, with increased proportions of soil water and surface water during the runoff event. Pearson's correlation coefficients for A T and conductivity are 0.36 for the entire dataset, and 0.87 excluding the data when heavily influenced by the runoff (9/27-10/1). The A Tconductivity relationship was not consistent in this short period (Fig. 10).

Comments and recommendations
In this study, SAMI-alk was successfully used for in situ freshwater A T measurements. A 23-d time series in a Montana   Fig 9. Calculated total dissolved inorganic carbon (C T ) time series for a section of the data shown in Fig. 6. C T was calculated in two ways: using pCO 2 and SAMI-alk in situ A T (red line), and pCO 2 and averaged A T within this period (blue line). X-axis is Universal Time .   Fig 10. Relationship between A T and conductivity (Fig. 6 data). Data colored with river discharge can be classified as three groups: pre-event, during-event, and post-event. Except for points during the transient runoff event (during-event), A T is generally linear with conductivity (R 2 = 0.87). river was presented and discussed. Results for precision and accuracy determined through SAMI inter-comparisons and in situ standards all lay around the same range ($ 10-20 μmol L −1 ) and all are worse than data obtained in laboratory-based studies, reflecting the challenges of using in situ sensors and analyzers in a riverine environment. There were large amounts of suspended sediments present in the river, extensively fouling the instruments over the 23 d deployment. The 10-μm filter may pass small particles, but a smaller pore size filter could plug more easily and requires future testing. Particles in the cell can also form organic films and absorb the indicator, thereby affecting the precision and accuracy by altering f a/i . Variability in 432 nm blanks also contribute to the A T noise due to variable CDOM, poor flushing, and particle scattering in the cell although they do not have large deviations like 589 nm. Blank variability can be expressed as the relative SD, which is $ 0.9% in 432 nm and three times as high as the value in the Hawaii and Bermuda deployments (seawater) (Pezner et al. unpubl.;Spaulding et al. 2014). One alternative indicator for SAMI-alk is Chlorophenol Red (CPR), which has a similar pH measurement range (pK a ), but is much more soluble than BCP. CPR could improve the blank reproducibility by more readily being flushed from the cell. Future studies will include comparisons between these two indicators. The A T noise may also be due to rapid temperature changes; in such situations, optics and electronics inside the SAMI housing have slightly different temperatures from that of surrounding waters. Optical noise and drift are increased because of this disequilibrium.
Commercial indicators contain impurities, which absorb light near 432 nm (Yao et al. 2007). These impurities vary between individual lot numbers. Molar absorption coefficients of BCP measured on SAMI-alk are therefore affected by different lot numbers. These impurities could also lead to inaccurate determination of pK a and its dependence on temperature (Lai et al. 2016). Purification and characterization of these indicators should be conducted to obtain consistent and accurate thermodynamic constants, as well as optical properties.
Pumps and valves are major power-consuming components. In the latest SAMI-alk design, the size of the cell was reduced from 3 to 1 mL for lower flushing volume and less regent consumption. The redesigned flow path uses two solenoid pumps and two valves to regulate fluid, removing the diaphragm pump as in the previous design (Fig. S1). The battery packs support $ 2400 measurements with this new design. The length of deployment is limited, however, by consumption of reagent. A 2 L reagent bag is good for $ 700 measurements.
Besides the level of noise, indicator purity and solubility issues discussed above, future development will also examine the accuracy and precision of C T derived directly from SAMIalk titration curves. C T is affected by potential gas exchange in the titration cell (i.e., degassing). Our lab data show that C T is significantly noisier than A T ($ 0.8%) while its accuracy has not been evaluated. Furthermore, accuracy tests are needed for deployments of the SAMI-alk in systems with A T outside of the range investigated here (800-3000 μmol L −1 ). Other aspects include optimizing the time for stirring and wait between two titration points and better understanding of the physical and kinetic processes within one titration. We also believe that SAMI-alk could be further miniaturized from the current design to reduce the reagent limitation.
The A T balance equation (Eq. 1) assumes that contributions from other minor protolytic species such as phosphate, silicate, or organic acids are negligible. For these species, any proton transfer reactions occurring in the pH range 5.0-6.0, where SAMI-alk titration data are obtained, would affect the NLLS and accuracy. The effect of each species can be evaluated by using its acid dissociation constant (pK a ) and concentration (Dickson 1981). The primary concern is organic acids, whose pK a have a large range and are poorly defined but are known to contribute to riverine A T (Cai et al. 1998;Wang et al. 2013;Abril et al. 2015). Caution should be taken for organic-rich, low IS water bodies. During the deployment period, the CFR had a dissolved organic carbon concentration of $ 185 μmol L −1 (Young et al., unpubl.). The total organic anion binding sites were estimated to be 22 μmol L −1 by the model of Oliver et al. (1983) that assumes 10 μmol total binding sites for every 83 μmol of organic carbon. A portion of them may be protonated in the pH range 5.0-6.0. While based on this calculation organic anions may have contributed to A T , this possibility does not change the conclusions of this study. It would, for example, increase the absolute value of C T by a nearly equal amount, but the relative differences in Fig. 9 comparison would remain the same.
This work demonstrates the utility of SAMI-alk in freshwater environments. The time series duration and frequency reported here would not be easily achieved by conventional sampling strategies. Since short-term (weeks to months) A T dynamics in freshwater have been less studied, or even ignored, SAMI-alk will be a useful tool to collect A T time series data to better understand these processes.