Version: 1.0
This professional tool specializes in groundwater hydrochemical type determination. Developed in Python, it implements triangular diagram visualization for Na-K-Mg ion concentration analysis, featuring intelligent water type classification based on industry standards.
- CSV data parsing & standardization
- Automatic ion equivalent conversion
- Dynamic ternary diagram plotting
- Smart hydrochemical classification
- PDF report export
- Scientific visualization with matplotlib
- Data processing using pandas
- Cross-platform GUI built with PySide6
- Windows/Linux/macOS compatibility
- Python 3.11+
- Dependencies: PySide6, matplotlib, pandas, numpy
- Load water sample data files in CSV or Excel format
- Automatically plot Na-K-Mg ternary diagrams with geothermometers (Giggenbach, Arnorsson, Tonani, Fournier, Truesdell) and equilibrium lines
- Export images in multiple formats (PNG, JPG, SVG, PDF)
- Export classification results as CSV files
- User-friendly graphical interface
- Python 3.11+
- PySide6
- matplotlib
- pandas
- numpy
Install dependencies with:
pip install PySide6 matplotlib pandas numpy
- Run main program:
git clone https://github.com/GeoPyTool/Na-K-Mg-plotter.git
cd Na-K-Mg-plotter
python triangle_gui.py
- Select "Load File and Plot" from menu to load water sample data (supports CSV, Excel files)
- The ternary diagram will be automatically plotted after loading
- Select image format from menu and click "Save Plot" to export
- Click "Export Classification CSV" to export sample classification results
Data files must contain these columns:
Na
: Sodium ion concentrationK
: Potassium ion concentrationMg
: Magnesium ion concentration- (Optional)
Station ID
: Sample ID or name
triangle_gui.py
: Main program and interface logicwater_sample.csv
: Sample data fileresult.png
,result.svg
: Sample output imagesresult.csv
: Sample classification results
- Liu Yang, Zhang Huamei, Li Dongya. Matlab Implementation of Na-K-Mg Ternary Diagram - Case Study of Hainan Island Hot Spring Data[J]. Seismological and Geomagnetic Observation and Research, 2022, 43(5):111-119.
- Giggenbach, W.F. (1988). Geothermal solute equilibria. Derivation of Na-K-Mg-Ca geoindicators. Geochimica et Cosmochimica Acta, 52(12), 2749-2765.
- Arnórsson, S., et al. (1983). The chemistry of geothermal waters in Iceland. III. Chemical geothermometry in geothermal investigations. Geochimica et Cosmochimica Acta, 47(3), 567-577.
This software is licensed under GPLv3. Academic research and commercial use permitted. Open-source compliance required for derivative works. See LICENSE file for details.