Geologic controls on groundwater salinity reversal in North Coles Levee Oil Field, southern San Joaquin Valley, California, USA

This paper documents a reversal in the groundwater salinity depth gradient in the North Coles Levee Oil Field in the San Joaquin Valley, California. Salinity, measured in mg/L, was mapped with water quality data from groundwater and oil and gas wells and salinity estimated from oil and gas well borehole geophysical logs using Archie's equation. The resulting three-dimensional salinity volume shows groundwater salinity increasing with depth through the Tulare and San Joaquin Formations to about 50,000 mg/L at 1100 m depth, then decreasing to 10,000–31,000 mg/L in the Etchegoin Formation at 1400 m depth. The high salinity zone occurs near the base of the San Joaquin Formation in sand lenses in shales that have been interpreted as representing a mudflat environment. The groundwater and produced water geochemistry show formation waters lie on the seawater dilution line, indicating the salinity structure is largely the result of dilution or evaporation of seawater and not due to water–rock interactions. Instead, changing depositional environments linked to decreasing sea level may be responsible for variably saline water at or near the time of deposition, leading to a salinity reversal preserved in connate waters. The steepness of the salinity reversal varies laterally, possibly due to post-depositional freshwater recharge allowed by thick sands, alternatively, by a change in connate water composition due to a lateral facies change present at the time of deposition. These results illustrate geologic and paleogeographic processes that drive the vertical salinity structure of groundwater in shallow alluvial basins.


Introduction
The placement and construction of groundwater wells in the San Joaquin Valley of California has long relied on regionalscale mapping of groundwater quality in shallow freshwater [salinity < 1000 mg per liter (mg/L) total dissolved solids (TDS)] aquifers (Page 1973;Hansen et al. 2018;Kang and Jackson 2016;Kang et al. 2020). Recently, the focus of groundwater mapping has shifted to deeper, more saline aquifers that could supplement water from shallow aquifers.
These regional studies have used aqueous geochemistry from groundwater wells and/or borehole geophysical data from deeper oil and gas wells to identify the volume of brackish (salinity 1000-10,000 mg/L) aquifers (Kang and Jackson 2016) in and around oil and gas fields (Taylor et al. 2014;Gillespie et al. 2017Gillespie et al. , 2019Metzger and Landon 2018;McMahon et al. 2018;Stephens et al. 2019).
Beyond a shallow surface layer influenced by anthropogenic processes (Hansen et al. 2018;Pauloo et al. 2021), groundwater salinity in the San Joaquin Valley generally increases with depth (Kharaka and Thordsen 1992;Gillespie et al. 2017;McMahon et al. 2018;Stephens et al. 2019Stephens et al. , 2021. This is due to a combination of independent regional factors. The general transition from marine to non-marine deposition over time in the San Joaquin Valley resulted in connate water derived from marine brines in older and deeper formations and terrestrial freshwater within younger and shallower formations (Fisher and Boles 1990;Taylor and Soule 1993). This connate water was then modified by 32,000 mg/L below 2.2 km (Gillespie et al. 2017). Deeper units in the Edison Oil Field are fresher (< 5000 mg/L) than the anomalously saline overlying Olcese Sand at 1.1 km depth (> 10,000 mg/L) (Gillespie et al. 2017). Together, these salinity depth profiles show that salinity reversals can be characterized by particularly saline zones within a typical salinity depth trend (like in the Olcese Sand) or by unusually lower salinity zones at depth (such as in the Kettleman North Dome Oil Field).
The previous work documenting salinity reversals has focused on one-dimensional (1-d) salinity depth series (Kharaka and Berry 1974;Gillespie et al. 2017). This approach provides an understanding of the vertical salinity gradient and together with stratigraphy identifies important horizons that control salinity. However, it does not allow an understanding of the spatial distribution of salinity and the effect that lateral facies changes may have in confining salinity reversals.
In the present paper, a three-dimensional (3-d) model of aquifer stratigraphy and salinity was constructed for a salinity reversal in the North Coles Oil Field in the southern San Joaquin Valley (Fig. 1). The stratigraphic model, which focuses on the contacts between three formations, was built from horizons picked using borehole resistivity logs. The salinity model was initially constructed using historical water quality data from shallow groundwater wells and deeper oil and gas wells. The model was then supplemented with salinity calculations made using Archie's equation (Archie 1942) using publicly available borehole geophysical data. A comparison of the 3-d Fig. 1 North Coles Levee Oil Field study area, located in the southern San Joaquin Valley, California. All oil and gas wells and select shallow groundwater wells are shown. Wells with resistivity and porosity log data used in this study are noted. Cross-section A-Aʹ and B-Bʹ are plotted in Fig. 6. Oil and gas wells with produced water geochemistry and shallow groundwater wells with groundwater geo-chemistry data are also noted (California Department of Conservation 2020a, b; Metzger et al. 2020;Gans et al. 2021;Flowers et al. 2022). Base-map imagery from U.S. Geological Survey (2021), well locations and field boundary information from California Department of Conservation (2020a), and inset-map imagery from Stamen Designs (2021) stratigraphy and salinity model was then made to explore geologic and paleogeographic controls on the development and structure of the salinity reversal.

North Coles Levee Oil Field
North Coles Levee Oil Field is in Kern County, California, on the western side of the southern San Joaquin Valley (Fig. 1). The southern San Joaquin Valley lies between the Sierra Nevada to the east, the Temblor Range to the west, and the San Emigdio Mountains to the south. North Coles Levee Oil Field is approximately 25 km southwest of Bakersfield, California and consists primarily of flat topography at elevations of ~ 100 m above sea level. The western edge of the oil field contains some higher topography that continues into the Elk Hills Oil Field reaching elevations up to 395 m.
The San Joaquin Basin began forming during the late Mesozoic as a forearc basin in a convergent margin setting that was open to the Pacific Ocean (Bartow 1991). During the mid-Oligocene, subduction ceased and the San Andreas transform system was initiated. This led to partial closure of the basin to the Pacific Ocean in the Miocene by the northward migration of the topographically high Salinian Block (Bartow 1991). In the Pliocene, uplift of the Temblor Range due to transpression on the San Andreas Fault continued to restrict open circulation with the Pacific Ocean (Bartow 1991;Reid 1995). By the late Pliocene, the basin was completely closed off from the Pacific Ocean and deposition became dominated by non-marine fluvial sedimentation (Reid 1995).
The stratigraphy within the North Coles Levee Oil Field consists primarily of shallow marine and fluvial sediments from the Miocene onward (Fig. 2). These sediments record the transition from marine to non-marine environments as the basin closed off from the Pacific Ocean (Reid 1995). At the base of stratigraphy relevant to this study, the Miocene Monterey Formation is composed of deep marine sediments such as shales and turbidite sands (Reid 1995). The Stevens sand in the Monterey Formation is the primary oil reservoir sand in North Coles Levee Oil Field (Davis 1952;Hardoin 1962;Maher et al. 1975;Clark et al. 1996). The overlying Reef Ridge Shale (~ 200 m thick) is a grayish-black shale that contains some silty-clay sandstones, siliceous beds, and dolomite layers (Hardoin 1962;Maher et al. 1975).
The overlying Pliocene Etchegoin Formation (~ 1000 m thick) represents the beginning of the transition from marine to tidal environment (Reid 1995;Scheirer and Magoon 2007). The Etchegoin Formation is divided into a lower Tupman Shale Member and an upper Carman Sandstone Member (Maher et al. 1975). The Tupman Shale Member (~ 400 m thick) consists of silty shale, some thin carbonate rocks, and thin scattered beds of sandstones and siltstones (Maher et al. 1975). The Carman Sandstone Member (~ 400-600 m thick) contains mostly siltstone with lenticular silty sandstones throughout the interval (Berryman 1973;Maher et al. 1975). Some of the sands in the Carman Sandstone Member produce dry gas in North Coles Levee Oil Field (Gillespie 2004). These those in the Calitroleum, Gusher, Wilhelm, and Mulinia sand zones (Berryman 1973) (Fig. 2). These sands have been interpreted as the beginning of the westward progradation of the Kern River delta (Maher et al. 1975;Gillespie 2004) or alternatively outer shelf facies (Reid 1995).  Maher et al. 1975). The stratigraphic column on the left provides an overview of formations to depths > 2500 m and the right panel is an enlarged view showing SP and short resistivity, formation boundaries (black lines), and sands relevant to this study (Maher et al. 1975;Berryman 1973) 317 Page 4 of 16 The Pliocene San Joaquin Formation (~ 600 m thick) represents mudflat deposition in a tidal environment (Reid 1995;Scheirer and Magoon 2007). It is composed of silty clay with lenticular beds of marine and nonmarine silty sands that generally increase in thickness to the west (Berryman 1973;Reid 1995). Some of these sands produce dry gas at North Coles Levee and Elk Hills Oil Fields and oil in Elk Hills Oil Field (Gillespie 2004). These include the Scalez and Mya sand zones (Berryman 1973). The Scalez sand zone represents large tidal deltas that formed at the mouth of the tidal channel while the overlying Mya sand zone represent at least five episodes of tidal channel deposits formed during eustatic sea level changes (Reid 1995).
The Pliocene-Pleistocene Tulare Formation represents the final transition to a fluvial environment (Reid 1995). The Tulare Formation is composed of sand, clay, silt, and fluvial gravels (Hardoin 1962). Basin wide, several extensive lacustrine clays are present in this unit, including the Amnicola, Tulare, and Corcoran clays; however, only the Amnicola clay is present in North Coles Levee Oil Field (Berryman 1973;Gillespie et al. 2019. In previous studies, the Tulare Formation is divided into an upper and lower interval by the Amnicola clay . The primary structure of North Coles Levee Oil Field is an asymmetrical gently plunging anticline (Hardoin 1962). This anticline is one of several anticlines that is superimposed on the Bakersfield Arch, a subsurface, northeast-trending structural high (Gillespie 2004). The folded structure is buried by sedimentation along the axis of the basin (Hardoin 1962). Shallower structures include northeast-trending listric normal faults which cut the base of the Tulare Formation, San Joaquin Formation, and sole out in the Etchegoin Formation (Hardoin 1962;Jones and Gillespie 1997). These faults are concentrated in the west part of the oil field and have displacements of up to 105 m (Jones and Gillespie 1997). The role of these faults in the hydrological system has not been studied.
North Coles Levee Oil Field has a long history of oil and gas production. Oil production, mostly from the Stevens sands of the Monterey Formation, began in 1938, with dry gas production from the Etchegoin Formation gas zone beginning in 1941 (California Department of Conservation 1998). Production in the Stevens sands was assisted first by gas injection then by water flood to maintain reservoir pressure (Babson 1989).
There are a small number of injection wells in the Tulare, San Joaquin, and Etchegoin Formations (Supplementary Text). Based on available reported injection volumes for 1977-2018, they are not expected to affect salinity in this paper because of the relatively small volume of fluid injected, which amounts to less than 6% of total water and steam injected into the North Coles Levee Oil Field (California Department of Conservation 2018).

Hydrology and hydrogeology
The surface recharge pattern in the North Coles Levee Oil Field has been strongly influenced by anthropogenic activity. The Kern River, which originates in the southern Sierra Nevada, passes through the oil field on its way to the Buena Vista Lake Bed to the south (Fig. 1). Since the construction of the Isabella Dam in 1953, natural flow was restricted; in 1995 flow was further restricted with construction of the Kern Water Bank just north of North Coles Levee Oil Field ( Fig. 1; ICP 2018). As the present study focuses on data before the construction of the Kern Water Bank, it is not expected to affect results.
The main aquifer in the study area is in the Tulare Formation and overlying alluvium ). There is a south-to-north head gradient in this shallow aquifer based on periodic measurements of groundwater level data compiled by the California Department of Water Resources (Supplementary Fig. 1; Stephens et al. 2022). This gradient is generally in line with regional studies that show shallow groundwater flow moving from the valley periphery toward the axis, then northward (Williamson et al. 1989;Wilson et al. 1999).
There is little detailed information on groundwater flow patterns in deeper units. It is generally thought that deep recharge in the San Joaquin Valley is dominantly from the Sierra Nevada along the east side of the San Joaquin Valley (Phillips et al. 2007). The Tulare, San Joaquin, and Etchegoin Formations all transition into the Kern River Formation toward the east side of the San Joaquin Valley, which is then exposed in the Sierra Nevada foothills about 25 km northeast of the North Coles Levee Oil Field (Scheirer and Magoon 2007;Bartow 1984). Regional studies show head gradients indicating groundwater migrates downward, flows laterally toward the center of the valley, and discharged upward at the basin axis prior to groundwater development for irrigation, to wells since development (Williamson et al. 1989;Phillips et al. 2007;Faunt 2009).

Stratigraphic horizons
The role of clays in confining groundwater salinity has been noted in several oil fields of the San Joaquin Valley While clays are present in the part of the stratigraphy relevant to the present study, they are part of a larger package of the mudstone and lenticular sandstone present in the San Joaquin Formation (Fig. 2). The lower boundary of the unit is marked by a transition from the deltaic sands of the Etchegoin Formation, while the upper boundary of the unit is marked by a transition into the fluvial sands of the Tulare Formation (Fig. 2).
To determine the role of lithology on the salinity structure, the depth of the base of the Tulare Formation (base Tulare Formation) and base of the San Joaquin Formation (base San Joaquin Formation) were interpreted from spontaneous potential and resistivity tracks on oil and gas borehole geophysics logs. These formation picks were based on a published type log (API 02901365 Well CLA 67-29T from Plate 12 of Maher et al. 1975) (Fig. 3).
The contact between stratigraphic units becomes uncertain toward the east side of the oil field because of the increased thickness of sands arriving from the east. This can be seen in the borehole geophysical logs where the San Joaquin Formation changes from discontinuous sand lenses in the west to closely stacked sand beds in the east (Supplementary Fig. 2).
Both formation surfaces on the western side of the field are folded into an anticlinal structure, with decreasing deformation at shallower levels suggesting syn-depositional folding (Hardoin 1962). Normal faults that offset both horizons have been reported to be present in the central and western part of the field (Jones and Gillespie 1997). They were not obvious in the data compiled for this study.

Mapping salinity with historical geochemistry and borehole geophysics
Spatial variations of salinity within the North Coles Levee Oil Field were mapped using two approaches. First, salinity was mapped using historical salinity measurements in samples of produced water from oil and gas wells and groundwater from shallower water wells. Second, salinity was calculated using Archie's equation using deep-reading borehole resistivity, porosity, and temperature data extracted from borehole geophysical logs. This Archie's-based approach follows that taken in studies of other parts of the San Joaquin Valley that emphasize three-dimensional mapping of salinity (Stephens et al. , 2021. All data analyzed in the study are provided in the data release of Flowers et al. (2022).

Produced water geochemistry
Geochemistry data were compiled from scans of laboratory analyses of North Coles Levee Oil Field produced water samples from the Monterey, Etchegoin, San Joaquin, and Tulare Formations archived by the California Geologic Energy Management Division (CalGEM) (Gans et al. 2021). Geochemical analyses reported in the dataset include TDS, major ions, some minor ions, some trace elements, resistivity, and conductivity. Well name, sample date, the method of analysis, and the depth of the sample were recorded when available. Samples were collected between 1956 and 1990 from 25 wells having top of perforation depths between 427 and 2916 m. Well perforation depths were determined from CalGEM well engineering records (California Department of Conservation 2020a). Samples that are not representative of formation waters due to potential dilution, mixing with other fluids, or laboratory constraints were removed using the criteria discussed in the Supplementary Text. Multiple samples from the same well and depth were included in the 1-d analysis of salinity and depth, but only the most recent samples were used to determine spatial salinity trends because they are less likely to be influenced by drilling mud introduced into the formation during drilling of the well (Gillespie et al. 2017).

Groundwater geochemistry
Previously published groundwater geochemistry data for samples from groundwater wells in select oil fields in the southwestern San Joaquin Valley were also used (Metzger et al. 2020). The dataset includes basic information about the individual wells, number of samples collected, and reports of geochemical data, including TDS, major and minor ions, nutrients, and trace elements. There are 698 measurements from 17 wells in this dataset from North Coles Levee Oil Field. Top perforation for these wells range between depths of 50 and 640 m. These samples were collected from 1955 to 2017, with 8 wells sampled multiple times. Most of these wells are located near the northern edge of the field, but some are near oil and gas wells (Fig. 1).
Of the 698 samples only 61 had sufficient data for a charge balance error to be computed and met the criteria of less than 5%; incomplete analyses were excluded. Finally, only 52 of the 61 samples had depth of top perforation data.

Combined data
Together, the two sources of water quality data show a wide range of groundwater salinities between 50 and 2,916 m depth (Fig. 4). Groundwater in the upper Tulare Formation sands is the freshest, with salinity values between 91 and 5500 mg/L with a mean of 687 mg/L. Salinity is much higher in the lower Tulare Formation sands, with a mean of 13,774 mg/L. The water in the San Joaquin Formation contains the highest measured salinity, with values between 19,872 and 45,602 mg/L, and a mean of 35,186 mg/L. Groundwater in the Etchegoin Formation has a mean of 29,908 mg/L. Water in the Monterey Formation also has a wide range of salinity, with salinity between 19,550 and 33,475 mg/L, and a mean of 26,118 mg/L.
The groundwater salinity data increases from 91 mg/L near the surface to 45,602 mg/L at 1114 m depth in the San Joaquin Formation. Salinity decreases by approximately 5000 mg/L at about 1200 m depth near the San Joaquin and Etchegoin Formation boundary, indicating a salinity reversal with depth. However due to the variability in values, it is not clear if the salinity reversal is real or an artifact of a small sample size. In deeper units, salinity slightly decreases approximately 3000 mg/L through the Etchegoin Formation and into the Monterey Formation. These values provide an initial idea of the field-wide salinity gradient, but this understanding is limited due to the sparsity of data. To understand the distribution of salinity at a higher spatial and depth resolution, a 3-dimensional model of the salinity structure was constructed using borehole geophysical data.

Salinity calculations from borehole geophysical logs
In North Coles Levee Oil Field, borehole geophysics can provide a high-resolution depiction of the groundwater salinity structure because of the tight spacing of wells and length of available logs (logged depths range from 169 to 1606 m). Data from borehole geophysical logs can be used to calculate groundwater salinity using a series of petrophysical equations that relate formation resistivity to groundwater salinity (Archie 1942;Bateman and Konen 1977;Schlumberger 2009). The fundamental equation comes from Archie (1942), which relates the resistivity of a 100% water-saturated (i.e., no hydrocarbons) rock formation (R o ) to the resistivity of formation water (R w ): where F is the formation factor, a is the tortuosity factor, m is the cementation factor, is the porosity (dimensionless), R 0 is the formation resistivity of 100% water-saturated rock (ohm-m), and R w is the resistivity of water (ohm-m).
Equation 1 can be rearranged to Tortuosity (a) and cementation factor (m) are empirically determined constants determined by rock properties.
(1) Fig. 4 Salinity, measured mg/L total dissolved solids (TDS), versus depth for historical produced water and groundwater from the North Coles Levee Oil Field. Blue circle: produced water sample that met all filtering criteria and is representative of formation water (Gans et al. 2021). Gray circle: produced water samples discarded due to high charge balance, origin from central gathering tanks, or possible dilution in gas well separator. Red cross: groundwater samples (Metzger et al. 2020). Dashed lines are approximate formation boundaries.
In the original presentation of the equation, a was functionally equal to 1, and the equation applied only "clean" sands, meaning no clays were present (Archie 1942). Later, other values for the a and m parameters were used to account for other rock types, including for sands with small amounts of clay (Lyle 1988). Here, the "Humble" parameters of a = 0.62 and m = 2.15 from Winsauer et al. (1952) were used. These values are representative of poorly consolidated sediments that have porosity values between 13 and 35% (Winsauer et al. 1952) and have been shown to work well in similar shallow units in San Joaquin Valley oil fields (Gillespie et al. 2017).
To solve Eq. 2, measurements of formation resistivity were extracted from resistivity logs and porosity was estimated using porosity logs. This process is discussed later.
Since resistivity is temperature dependent, R w was converted from the temperature at which it was measured to an equivalent resistivity at 75 °F (Asquith and Krygowski 2004): where T is the measurement temperature (°F), and R w75 is the resistivity of water at 75°F (ohm-m).
TDS was then calculated from R w75 (Bateman and Konen 1977;Schlumberger, 2009): where TDS is the salinity measured in parts per million total dissolved solids.
If formation water has significant concentrations of ions other than Na and Cl, a further correction must be made to account for the different ionic strengths affecting resistivity (Schlumberger 2009). For North Coles Levee Oil Field, no corrections were necessary since produced water and groundwater samples from depths overlapping with geophysical logs are NaCl type water ( Supplementary  Fig. 3). Notably, groundwater samples with top perforation depths < 69 m have higher bicarbonate concentrations, which may require further corrections for shallow TDS calculations due to differences in ionic strength of bicarbonates; however, the shallowest TDS calculation is at 169 m and groundwater samples at this depth are all NaCl type water.
Calculation of salinity from borehole geophysics requires knowledge of (1) formation resistivity, (2) porosity, and (3) temperature measurements at a specific location. The following sections describe how these quantities were estimated from borehole geophysical logs.

Formation resistivity
Resistivity logs recorded from oil and gas borehole measurements are publicly available (California Department of Conservation 2020a). The resistivity logs record continuous depth series of shallow and deep resistivity. Shallow resistivity measures the drilling mud invaded zone near the borehole wall, while deep resistivity measures the surrounding uninvaded rock and formation fluids and is therefore used in Archie calculations (Asquith and Krygowski 2004;Ellis and Singer 2007).
Resistivity measurements must be taken from clean, wet sands, because Eq. 2 assumes that the sands are 100% saturated with water (Archie 1942). To identify clean sands, only sand beds greater than 3.04 m (10 ft) thick with significant differences between deep and shallow resistivity were used (Ellis and Singer 2007). To ensure that they are water-wet, porosity logs, driller logs, and mud logs were checked for evidence of hydrocarbons or unsaturated zones. Resistivity values stratigraphically and spatially near gas sands were not used.
All the resistivity data used in analysis were from logs that used various types of induction tools. Many of the older wells (pre-1960) in North Coles Levee Oil Field contain resistivity logs that were measured with lateral devices. These older logs are unreliable for deep resistivity measurements because the lateral sonde for these logs is sensitive to bed thickness and measurement can be affected by drilling mud invasion near the borehole wall (Ellis and Singer 2007). Altogether, 597 resistivity measurements from 44 wells were used in the analysis (Fig. 1).

Formation porosity
Neutron and density porosity measurements from borehole geophysical logs were used to estimate formation porosity. As hydrocarbons, clay-bound water, and clay content cause a divergence between measured neutron and density porosity (Asquith and Krygowski 2004;Ellis and Singer 2007), measurements were only extracted from logs where the difference between neutron and density porosity tools is less than 3% and neutron porosity is greater than density porosity. Resistivity and nearby mud logs were also used to identify clean wet sands when available. In total, 45 porosity data points were extracted from clean sands from 7 borehole porosity logs.
Neutron and density porosity measurements are individually impacted by pore-fluid composition and lithology. Because of this, bulk porosity at specific locations can be estimated by taking the root mean square of porosity from neutron and density logs in clean sands (Asquith and Krygowski 2004): where N is the neutron porosity (dimensionless), and D is the density porosity (dimensionless).
The composite porosity estimates, N−D , with depth were fit with a linear regression to construct a depth-dependent porosity model. The model was used to predict porosity at the clean sand locations where resistivity was collected throughout the field (Fig. 5).

Bottom hole temperatures
Temperature data were compiled by extracting bottom-hole temperature and the corresponding depth from the geophysical logs that were used to determine clay horizons and resistivity. In wells with multiple logging runs, a bottom-hole temperature was measured at the base of each run. In total, 104 bottom-hole temperatures were extracted from 78 different wells. As temperature is only recorded at the bottom of the borehole, data are sparse above the main production zone. Temperature was fit with a linear regression with an intercept of 18.5 °C at the surface, the average annual temperature of the nearby city of Bakersfield (NOAA 2008; Fig. 5b). The resultant geothermal gradient of 24.6 °C/km is similar to previously reported value of 25 °C/km (Wilson et al. 1999). Formation temperature is then estimated at the depth of each clean sand resistivity determination.

TDS model using borehole geophysics
The resistivity, modeled porosity, and modeled temperature values were then used with Eqs. 2-4 to calculate salinity in a 3-d framework for sands between the upper Tulare and upper Etchegoin Formations that range between − 50 and − 1505 m elevation relative to sea level. TDS was not calculated in the Calitroleum and lower Gusher sand zones because both sands are known to contain hydrocarbons (Hardoin 1962). Gas pockets are also present in some of the shallower sands, so nearby porosity and mud logs were checked to avoid sands with hydrocarbons. Two west-east cross-sections were selected visualize salinity patterns (Figs. 1, 6). The cross-sections were made by projecting all calculated TDS data, produced water geochemistry, and modeled formation surfaces that were within 650 m orthogonally onto cross-section line.

TDS calculations and produced water chemistry
The salinity estimates using borehole geophysics are similar to the produced water salinity, but with denser vertical resolution and better spatial coverage (Fig. 6). Data are densest in the center part of the field, where the well density is the highest. Toward the east, data are sparse because of fewer wells with usable data, while toward the west, data are less dense due to a combination of fewer wells, the presence of oil, and an increase in shale content (Fig. 1.) Two notable discrepancies between the salinity indicated by produced water samples and log calculations are present Fig. 5 Field-wide porosity and temperature models. A best-fit line was fit to a porosity and b bottom-hole temperature (BHT) data to provide porosity and temperature estimates where measurements are not available. The 45 porosity data points were extracted from 7 neutron and density porosity logs throughout the study area (Flowers et al. 2022). The 91 temperature data points were extracted from 78 well log headers (Flowers et al. 2022). in (1) the upper San Joaquin Formation at -723 m elevation and 3532 m along B-Bʹ (Fig. 6c, location I) and (2) the Etchegoin Formation at − 1443 m elevation and 2929 m along B-B′ (Fig. 6c, location II). The first discrepancy is that logderived salinity (16,478 mg/L) is lower than sample salinity (34,702 mg/L) in the San Joaquin Formation Mya sand zone by ~ 18,000 mg/L. However, this sample was sourced from a perforation interval that extends to deeper sands, which may have resulted in mixing of fluids from a large depth range. Furthermore, an older sample from the same well and approximately same depth taken via a drill-stem test, which can underestimate salinity, is only 2444 mg/L lower than the log-derived salinity. Overall, there is not enough information to determine the reason for the discrepancy due to the lack of documentation and missing well history in this well (API:02915312; Gans et al. 2021). The second discrepancy, located in the Etchegoin Formation, is that log-derived salinity (18,472 mg/L) is ~ 12,000 mg/L lower than in a produced water sample 100 m deeper (30,149 mg/L). This apparent discrepancy is because the produced water sample is from a well Fig. 6 TDS cross-sections and elevation profiles. Cross-sections A-Aʹ (a) and B-Bʹ (c) plot calculated salinity, produced water sample salinity, and interpolated formation boundaries (Fig. 3) that have been orthogonally projected onto the cross-section lines (Fig. 1). Each cross-section captures data points within 650 m from the cross-section lines to display all relevant data points. Salinity elevation profile for the A-Aʹ (b) and B-Bʹ (d) cross-sections colored by distance along crosssection. Locations I and II are discussed in text. Cross-section lines for A-Aʹ and B-Bʹ are shown in Fig. 1. Produced water samples have a black outline. Short borehole resistivity logs from select wells are shown in gray; well numbers can be found in Supplementary Fig. 2. that includes a deeper perforation interval between the lower Gusher and Calitroleum sand zones, which are stratigraphically separated from overlying sands by a thick confining clay.

Discussion of salinity structure
In the center of the field, salinity calculated from the borehole geophysics confirms the basic salinity structure and salinity reversal that was indicated by limited water sample data in the 1-d salinity graph (Figs. 4, 6). Salinity increases from the surface through the Tulare Formation and into the San Joaquin Formation eventually reaching values between 20,000 and 30,000 mg/L in the Mya sand zone (~ − 400 to − 900 m) and greater than 40,000 mg/L in the Scalez sand zone. Salinity then decreases in the Etchegoin Formation sands to between 13,000 and 24,000 mg/L with isolated lenses of sands that contain higher salinity of around 30,000 mg/L. The salinity reversal takes place in the upper Etchegoin Formation between − 1050 and − 1150 m elevation, where salinity decreases from > 40,000 mg/L-higher than seawater concentrations-to around 20,000 mg/L. This salinity structure is spatially variable. The base of 10,000 mg/L waters deepens to the east, roughly paralleling shallowly dipping stratigraphy, consistent with observations from lower-resolution regional studies (Gillespie et al. 2017 (Fig. 6). Higher salinity waters display a different pattern, with the base of 20,000 mg/L waters present as shallow as − 550 m elevation in the center of the field (2500-3700 m along cross-section) but generally not until about − 1000 m elevation in the east side of the field. This increase in depth of the 20,000 mg/L contour is greater than the structural relief due to the dip of stratigraphy, and indicates lower salinity water present in the San Joaquin Formation in the east side of the field.
The vertical salinity gradient also changes laterally. In the west side of the field, there is a sharp increase in salinity across the base of the Tulare Formation while in the east side of the field, the salinity gradient across this boundary is constant (Fig. 6b, d). In the central part of the field, there is a sharp decrease in salinity across the base of the San Joaquin Formation. This gradient is less pronounced in the east side of the field because of the lower salinity water present in the San Joaquin Formation.

Origins of salinity inversion
The salinity inversion is characterized by high salinity in the Mya and Scalez sand zones of the San Joaquin Formation overlying lower salinity in Etchegoin Formation sands (Fig. 6). Previous studies have highlighted the role of clay diagenesis and clay membrane filtration in establishing salinity inversions in the San Joaquin Valley (Fisher and Boles 1990;Kharaka and Hanor 2003). Here, clay diagenesis seems unlikely because the salinity inversion takes place at a depth of 1300 m and a temperature of about 40 °C which is much lower than required temperatures (90-100 °C) for the smectite-illite transition (Ramseyer and Boles 1986). Clay membrane filtration takes place where hydraulic head drives fluids from a permeable unit through a clay or shale unit (Kharaka and Berry 1974). Saline water in the San Joaquin Formation is in thin sand units surrounded by a thick package of shale ( Supplementary Fig. 2) and there is little topography to establish a strong hydraulic gradient, making it unlikely that fluids would have been able to move through the shales. Here, the absence of conditions usually invoked to explain salinity inversions requires another explanatory mechanism.

Evidence for origin of produced water as seawater
While a broad suite of isotopic and chemical tracers can be used to understand the origin of saline fluids, the analysis here in North Coles Levee Oil Field is limited by the availability of reported constituents from produced water (Gans et al. 2021). None of the Tulare, San Joaquin, or Etchegoin Formation produced water samples has hydrogen or oxygen isotope measurements and only a limited suite of major ions are reported. Because of that the discussion will be limited to the reported constituents Na, Cl, Br, and SO 4 , which potentially allow for testing of water-rock interactions and influences from evaporative or dilutive processes (Kharaka and Hanor 2003;McMahon et al. 2018).
Na/Cl for samples and seawater can be plotted against the seawater dilution-evaporation line of Na/Cl = 0.86 (Keene et al. 1986; Department of Energy 1994) (Fig. 7b). Tulare, San Joaquin, and Etchegoin Formation samples are generally spread along the seawater dilution line while Monterey Formation samples lie above the line. This interpretation is generally consistent with studies from several oil fields in the southern San Joaquin Valley that indicate produced water from marine sediments within those fields originated as seawater (Fisher and Boles 1990;McMahon et al. 2018).
The Tulare and Etchegoin Formation samples are brackish to highly saline, with Cl and Na concentrations lower than seawater. For the Tulare Formation, a fluvial unit, both connate and meteoric recharge waters would be expected to be fresh, requiring saline fluids to have migrated from underlying units of marine origin. In the case of the Etchegoin Formation, which was deposited in a deltaic or outer shelf environment, the waters may be seawater diluted with meteoric water, either near the time of sediment deposition or later by groundwater flow.
In contrast, the San Joaquin Formation samples have higher Cl and Na than seawater. This, along with the fact that the San Joaquin Formation samples lie on the seawater dilution-evaporation line and the lack of reports of halite in the San Joaquin Valley stratigraphy suggest that the high salinity may be a relic of the original depositional environment, perhaps formed by evaporation of seawater.
Unlike samples in the Tulare, San Joaquin, and Etchegoin Formations, samples in the Monterey Formation have low normalized Cl concentration (Fig. 7a) and high Na/Cl ratios (Fig. 7b), which placing them above the seawater dilution line. The low Cl concentrations indicate that these waters have been diluted, while the high Na/Cl ratios (~ 1.0) are what would be expected of seawater that has undergone water-rock interactions (Kharaka and Hanor 2003). These values agree with the understanding that the water in the Monterey Formation in North Coles Levee Oil Field originated as seawater that was later influenced by clay diagenesis or ion exchange (Fisher and Boles 1990). Based on bottom-hole temperature, the rocks in the Monterey exceed 100 °C, which allow for clay diagenesis (Ramseyer and Boles 1986).
The possible origin of San Joaquin and Etchegoin Formation as evaporative brines can be tested with Br and SO 4 , both of which are expected to be concentrated in brines formed by seawater. However, in both cases, the presence of hydrocarbons in the system limit their use.
The generally conservative behavior of Br makes it useful for tracing evaporative concentration or dilution of seawater (Carpenter 1978;McCaffrey et al. 1987). For the two samples from the San Joaquin Formation having Br data available (Gans et al. 2021), Br/Cl molar ratios of 0.00179 and 0.00268 indicate enrichment in Br relative to the seawater Br/Cl molar ratio of about 0.00154 (Supplementary Fig. 4; Department of Energy 1994). Enriched Br concentrations in some marine sediment porewaters and subsurface brines have been attributed to release of Br from decomposing organic matter (Means and Hubbard 1987;Martin et al. 1993;Whittemore 1995;Edmunds 1996). Excess Br concentrations in the two San Joaquin Formation samples are 0.17 and 0.73 mM (13 and 58 ppm). Excess Br concentrations of similar magnitudes are thought to have an organic source in saline waters from San Joaquin Valley oil fields (Fisher and Boles 1990).
While it is expected that SO 4 would be concentrated in brines formed by evaporating seawater (Fontes and Matray 1993;McCaffrey et al. 1987;Kharaka and Hanor 2003), SO 4 from the produced water samples has concentrations a b below that of seawater. Of the 8 reported values, 5 are below the detection limit of 5 ppm, while the other two are 10 and 11 ppm (Gans et al. 2021). These low values could be explained by a number of processes (Kharaka and Hanor 2003); here, removal by bacterial sulfate reduction, common in the presence of hydrocarbons, seems likely (Aitken et al. 2004;Chapelle et al. 1995;Kharaka and Hanor 2003;Gavrieli et al. 1995Gavrieli et al. , 2001, and is consistent with excess Br resulting from decomposition of organic matter. Overall, produced water geochemistry in the Tulare, San Joaquin, and Etchegoin Formations suggests that the salinity is largely controlled by dilution and evaporation of seawater. For units with lower salinity, such as the Tulare and Etchegoin Formations, mixing of connate and meteoric water may have occurred at the time of deposition or later from mixing with fresher groundwater recharge (Wilson et al. 1999). For the San Joaquin Formation, which has pore water with salinity higher than seawater, an evaporative process likely occurred. As evaporative processes generally occur in subaerial conditions (Hanor 2001), this implies high salinity may have been established in the San Joaquin Formation at the time of deposition.

Paleogeographic origin of TDS
The depositional history of the North Coles Levee Oil Field area may provide an explanation for San Joaquin Formation salinity that is up to 50% higher than seawater and the salinity inversion between the San Joaquin and Etchegoin Formations. During this period, sea level changes were the primary controls on the depositional environment (Reid 1995;Gillespie 2004).
The deepest sands in the upper Etchegoin Formation is the Calitroleum sand zone, which is interpreted as either the beginning of a delta front cycle (Maher et al. 1975;Gillespie 2004) or outer shelf facies (Reid 1995). Connate water in this environment should originate as seawater, which is reflected in the Na/Cl ratios of the Etchegoin Formation samples (Fig. 7). During the deposition of the overlying Gusher sand zone in the Etchegoin Formation, sea level dropped, and the westward progradation of the Kern River delta began (Gillespie 2004). This transition from a shallow marine to deltaic/tidal environment may have led to an increase in highly saline water in the system. These changing water conditions are reflected in the lower salinity content in sandstones of the upper Carman Sandstone Member of the Etchegoin Formation (Fig. 6).
The San Joaquin Formation was then deposited in an environment which represents the transition into a tidal mudflat environment, which includes the Scalez and Mya sand zones (Reid 1995). The Scalez sand zone was first deposited as a tidal delta which drained water from the tidal flat to the south; this was followed by the deposition of Mya sand zone as five episodes of tidal channels due to eustatic sea level fluctuations (Reid 1995). While tidal channels are normally brackish to freshwater, conditions can exist in which evaporative processes dominate over freshwater input, leading to development of brine-forming conditions (Hughes et al. 1998), similar to modern salt marshes (Frey and Basan 1985;Shen et al. 2018). Local salinity in salt marshes is driven by a complex mix of factors of tidal supply of saline water, evapotranspiration, and freshwater recharge (Frey and Basan 1985). These brine-forming conditions can occur without producing evaporite deposits, as calcium carbonate and gypsum do not begin precipitating from seawater until it has been concentrated to a salinity of at least 1.8 times seawater (McCaffrey et al. 1987;Fontes and Matray 1993). While fossils in the Scalez and Mya sand zones have been interpreted to indicate that brackish-water conditions dominated during deposition (Maher et al. 1975), they are also consistent with the presence of surface brines, as shown by Mya fossils reported from a range of conditions, including waters more saline than the ocean (Strasser 1999).
After the Pliocene, the basin closed off from the Pacific Ocean and there was a transition from tidal to fluvial deposition (Reid 1995). This cut off the input of seawater into the system and led to an increase of freshwater from the Kern River (Woodring et al. 1932).
As a whole, the Pliocene-Pleistocene paleogeography of the North Coles Levee Oil Field study area is one that transitions between deltaic, tidal mudflat, and fluvial environments due to a marine regression (Reid 1995). This resulted in waters entrapped at the time of deposition that changed composition from brackish, to brine, and finally to fresh, resulting in connate waters exhibiting a salinity reversal with depth. Because this is a sedimentary facies-controlled feature, it is speculated here that shallow brines and salinity reversal may be present elsewhere in the Pliocene-Pleistocene sediments of the southern San Joaquin Valley.

Role of stratigraphy in preserving and modifying salinity gradient
As noted in "Discussion of salinity structure" the steepness of the salinity gradient decreases to the east. This is coincident with an increase in sand within the San Joaquin Formation in the eastern part of the oil field (Sect. 3; Supplementary Fig. 2). This change in stratigraphy is due increased sand supply from the Kern River delta to the east (Reid 1995).
Here, two non-mutually exclusive explanations are proposed for the relationship of the lateral change in salinity gradient with changes in stratigraphy. First, the increase in sands in the east side of the field may point to a lateral facies change between mudflat and fluvial environments. In the west side of the field, restricted hydrological circulation allowed for the formation of surface brines, while in the east side of the field, open hydrological circulation allowed for fresh water exchange and surface brines never developed. In this case, the salinity gradient present in surface waters during the Miocene was preserved as connate waters.
A second explanation for the lateral change in salinity gradient is that the increased thickness of sands in the east allows for freshwater recharge from meteoritic waters. These waters, originating in the Sierra Nevada to the east, or from recharge from the Kern River, may be driven by head gradients toward the axis of the San Joaquin Valley (Williamson et al. 1989;Phillips et al. 2007). This groundwater would be able to travel through thickly stacked San Joaquin Formation sands in the east side of the field before being stopped by the shale hosting lenticular sand beds in the west side of the field (Fig. 6a, b; Supplementary  Fig. 2). This would allow recharge to mix with connate fluids in the east side of the field while preserving original connate water in the west side of the field. While the role of discrete clays in controlling meteoritic recharge in oil fields has been noted Stephens et al. 2019Stephens et al. , 2021, the role of lateral changes between lenticular and thickly stacked sands are harder to quantify and less understood.
Both factors may have worked in tandem. Initially restricted depositional conditions that produced brines may have produced stratigraphy that is more likely to preserve those brines as connate waters. This may create "pockets" of brines in lenticular sands. However, the limited constituent analyzed for in available water samples are insufficient for distinguishing between these two hypotheses.

Conclusion
In this paper, historical geochemistry from both shallow groundwater wells and deeper oil and gas wells, along with oil and gas borehole geophysical logs, were used to document a salinity inversion in North Coles Levee Oil Field at about − 1100 m elevation where salinity decreases from ~ 30,000 mg/L in the San Joaquin Formation to a range of 13,000 to 24,000 mg/L in the underlying Etchegoin Formation. The vertical structure of this salinity inversion is due to connate water preserved from the original sedimentary environments, transitioning between a lower salinity deltaic environment in the Etchegoin Formation to a higher salinity restricted mudflat environment in the San Joaquin Formation (Reid 1995). The lateral structure of the salinity inversion, with fresher waters to the east, may be related to both an increase in freshwater depositional environments to the east and an increase in sands to the east that allow meteoric recharge from higher topography.
The presence of salinity reversals in groundwater basins may be important for water resource managers, such as in California, where protection of groundwater resources often focuses in mapping the base of waters with salinity less than 10,000 mg/L (Taylor et al. 2014;Gillespie et al. 2017Gillespie et al. , 2019. The presence of salinity reversals may indicate the presence of less-saline waters beneath shallower saline waters. In addition, lateral sedimentary facies changes may influence the initial salinity of connate water and meteoric recharge pathways, causing large lateral changes in groundwater salinity.