Groundwater flow modelling - Python programming for Hydrology
Exploring California Central Valley Groundwater Quality with Python
-
Upload
walt-mcnab -
Category
Science
-
view
108 -
download
4
Transcript of Exploring California Central Valley Groundwater Quality with Python
![Page 1: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/1.jpg)
Walt McNab, Ph.D.
September 2016
![Page 2: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/2.jpg)
Explore portions of California Groundwater Ambient Monitoring and Assessment (GAMA) data set for Central Valley.
Demonstration of how easy it is to explore a moderately large data set and gain insights with python scripting (pandas, scikit-learn, and scipy; see links on last slide to view script).
QGIS used to view results.
![Page 3: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/3.jpg)
Analytes:
◦ Arsenic
◦ Barium
◦ Bicarbonate alkalinity
◦ Boron
◦ Calcium
◦ Chloride
◦ Chromium
◦ Copper
◦ Magnesium
◦ Manganese
◦ Nitrate
◦ Potassium
◦ Sodium
◦ Sulfate
◦ Zinc
Central Valley alluvium boundary
• Download all as text files from GAMA website.• Use pandas to filter and create pivot tables for analytes.
![Page 4: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/4.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 5: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/5.jpg)
Ayotte et al., 2016. Predicting Arsenic in Drinking Water Wells of the Central Valley, California, Environ. Sci. Tech., 50(14), 7555-7563.
Historic medians provide a useful comparative metric, in spotty data, for the potential for encountering concentrations at a specific value.
Median As in GAMA data set, by quantile, for water supply wells through 2016.
![Page 6: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/6.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 7: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/7.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 8: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/8.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 9: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/9.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 10: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/10.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 11: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/11.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 12: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/12.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 13: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/13.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 14: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/14.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 15: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/15.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 16: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/16.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 17: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/17.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 18: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/18.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 19: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/19.jpg)
Historic median concentrations scaled across 10 quantiles (yellow = lowest; red = highest) using QGIS.
![Page 20: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/20.jpg)
Identify factors in the multi-parameter data set that contribute to variance.
Plot 1st, 2nd, 3rd, etc. principal component values by location to indicate spatial distribution.
Plot loadings of principal components with respect to individual analytes.
Calculations conducted with scikit-learn package.
![Page 21: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/21.jpg)
Valley interior
Principal Component #1
Southern end of valley
West side of valley
Principal Component #2
Principal Component #3
![Page 22: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/22.jpg)
Loadings by Principal Component (axes, colors)
NO3 and Mn reflect 2nd
principal component (opposite effect)
Boron strongly associated with 1st principal component
![Page 23: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/23.jpg)
Delineate multi-dimensional parameter space into clusters.
Plot locations of clusters to see if cluster characteristics exhibit spatial distributions.
Calculations conducted with scikit-learn package.
![Page 24: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/24.jpg)
Cluster 1
Cluster 5
Cluster 7
Cluster 8
![Page 25: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/25.jpg)
1
5
7
8
0.001
0.01
0.1
1
10
100
1000
AS
MN
SO4
CL
Sodium
MG
CA
NO3Cluster 1: (1) low Mn and As, (2) high NO3
Cluster 5: (1) high concentrations of most ions, (2) high Mn and low NO3
Cluster 8: (1) high Mn and As, (2) low NO3
Cluster 7: relatively elevated Na-Cl-SO4 compared to Ca-Mg-HCO3
Conc (mg/L)
Selected Cluster Centroids
![Page 26: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/26.jpg)
Selected clusters appear differentiated on Piper diagram.
Note that other analytes not considered in Piper diagram (trace metals) are also used to delineate K-means clusters.
Cluster 1
Cluster 5
Cluster 7
Cluster 8
![Page 27: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/27.jpg)
Theil-Sen slope calculated for all analytes in all wells meeting certain criteria (at least 10 sample events since 1980).
Temporal trend set is much smaller than median historic concentration data set.
Calculations conducted with scipy.
![Page 28: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/28.jpg)
Fresno Visalia
Bakersfield
Unlike median concentrations, Theil-Sen slopes do not exhibit regional-scale spatial patterns.
Spatial patterns evident on smaller scales.
Variability at small scale likely reflect local sources (for nitrate, etc.) or local hydrologic constraints.
Warm colors indicate increasing trends while cool color denote decreases.
![Page 29: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/29.jpg)
0.00001
0.0001
0.001
0.01
0.1
1
0.00001 0.0001 0.001 0.01 0.1 1
Mg
Co
nce
ntr
atio
n T
ren
d (
mg
L-1d
ay-1
)
Ca Concentration Trend (mg L-1 day-1)
0.00001
0.0001
0.001
0.01
0.1
1
0.00001 0.0001 0.001 0.01 0.1 1
NO
3C
on
cen
trat
ion
Tre
nd
(m
g L-1
day
-1as
NO
3)
Ca Concentration Trend (mg L-1 day-1)
Positive Temporal Trends Subset
Positive Temporal Trends Subset
Temporal trend relationships are stronger between some analytesthan others.
◦ Different source terms
◦ Evaporative effects
◦ Geochemical effects (e.g., carbonate mineral equilibration for Ca and Mg)
Good correlation.
Poor correlation.
![Page 30: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/30.jpg)
Conclusion: separate mechanisms explain rise in nitrate and rise in salt concentrations.
Loadings by Principal Component (axes, colors) for Temporal Trends
![Page 31: Exploring California Central Valley Groundwater Quality with Python](https://reader031.fdocuments.us/reader031/viewer/2022030305/587356661a28ab56378b75dd/html5/thumbnails/31.jpg)
For additional background, see Exploring a Large Groundwater Quality Data Set.
To see the python script used to conduct the analyses, see script.
For questions or comments, please visit https://numericalenvironmental.wordpress.com/contact/