Python package for computing ATSI and RS-ATSI using CHL, SAL, and Sentinel-3 OLCI-style data.
Project description
ATSIModel
Assessment of Trophic Status Index (ATSI) and RS-ATSI Python Package
ATSIModel is an open-source Python package for computing:
- ATSI from in-situ chlorophyll-a (CHL) and salinity (SAL) data.
- RS-ATSI from Sentinel-3 OLCI-style remote sensing reflectance inputs using Rhow_1 to Rhow_11, with machine-learning-based CHL prediction, ATSI derivation, structured validation, and multi-format export.
The package is designed for transitional, estuarine, and coastal waters, and supports both:
- standard ATSI computation from field observations
- remote-sensing based ATSI workflows for scientific research and operational platform development
Author
Dr Md Galal Uddin
School of Engineering, University of Galway, Ireland
Email: jalaluddinbd1987@gmail.com
Research Profiles
- Google Scholar: https://scholar.google.com/citations?user=g6xaAOkAAAAJ&hl=en
- University of Galway / EHIRG: EcoHydroInformatics Research Group
Scientific Background
Assessing trophic status and eutrophication in marine, coastal, and transitional waters is scientifically important for:
- ecosystem health assessment
- eutrophication monitoring
- ecological status evaluation
- environmental management and policy support
- marine water quality surveillance
The Assessment of Trophic Status Index (ATSI) was developed as a data-driven trophic assessment framework tailored for transitional and coastal waters. The published ATSI framework emphasizes:
- chlorophyll-a (CHL) as the core trophic-response variable
- salinity (SAL) as a threshold-conditioning variable
- a novel linear rescaling interpolation function
- a new classification scheme for trophic ranking in transitional and coastal waters
This package operationalizes that concept into a reproducible Python workflow for both in-situ ATSI and remote sensing RS-ATSI applications.
Recommended scientific citation
If you use this package in academic work, please cite the ATSI paper:
Uddin, M. G., Nash, S., Rahman, A., Dabrowski, T., & Olbert, A. I. (2024). Data-driven modelling for assessing trophic status in marine ecosystems using machine learning approaches. Environmental Research, 242, 117755. https://doi.org/10.1016/j.envres.2023.117755
Package Scope
This package includes two main workflows:
1) Standard ATSI workflow
Use CHL + SAL to compute:
- ATSI score
- threshold-adjusted trophic status
- ATSI class
2) RS-ATSI workflow
Use:
Rhow_1toRhow_11SALCHL(for training / validation)
to compute:
- predicted chlorophyll-a (
CHL_RS) - ATSI from in-situ CHL (
ATSI_INSITU) - ATSI from remote sensing predicted CHL (
ATSI_RS) - trophic classification
- validation outputs
- exported result tables
Package Structure
ATSIModel_RS/
│
├── atsimodel/
│ ├── __init__.py
│ ├── core.py
│ ├── rs_core.py
│ ├── io.py
│ ├── preprocessing.py
│ ├── thresholds.py
│ ├── atsifunction.py
│ ├── classification.py
│ ├── olci_features.py
│ ├── chl_models.py
│ ├── validation.py
│ ├── metrics.py
│ ├── plotting.py
│ └── utils.py
│
├── examples/
│ ├── sample_atsi_input.xlsx
│ ├── sample_rs_atsi_input.xlsx
│ ├── sample_rs_atsi_input.csv
│ ├── sample_rs_atsi_input.txt
│ ├── sample_rs_atsi_rhow_input.xlsx
│ ├── sample_rs_atsi_rhow_input.csv
│ └── sample_rs_atsi_rhow_input.txt
│
├── README.md
├── requirements.txt
├── pyproject.toml
├── setup.py
├── MANIFEST.in
├── LICENSE
└── main.py
Installation
From local folder
pip install .
From PyPI (after release)
pip install ATSIModel
Python Version
- Recommended: Python 3.9+
Dependencies
Main dependencies:
- pandas
- numpy
- matplotlib
- openpyxl
- scikit-learn
PART I — STANDARD ATSI WORKFLOW
Required Input Columns
The standard ATSI workflow requires only two variables:
| Column | Description | Unit |
|---|---|---|
CHL |
Chlorophyll-a concentration | µg/L |
SAL |
Salinity | PSU |
Example input table
| Site | Date | CHL | SAL |
|---|---|---|---|
| Site_01 | 2024-01-01 | 8.5 | 31.2 |
| Site_02 | 2024-01-15 | 15.1 | 28.7 |
| Site_03 | 2024-02-01 | 4.3 | 33.1 |
| Site_04 | 2024-02-15 | 22.0 | 20.0 |
Only CHL and SAL are required.
Supported Input Formats
The package reads:
- Excel (
.xlsx,.xls) - CSV (
.csv) - TXT / TSV (
.txt,.tsv)
Standard ATSI Example — Basic Use
from atsimodel.core import run_atsi
df = run_atsi("examples/sample_atsi_input.xlsx")
print(df.head())
Expected output columns
After ATSI computation, the dataframe includes:
CHLSALSAL_BINCHL_TLCHL_TUATSIATSI_Class
Standard ATSI Example — Export Results
from atsimodel.core import run_atsi
from atsimodel.utils import export_single
df = run_atsi("examples/sample_atsi_input.xlsx")
export_single(
df,
out_base="outputs/ATSI_results",
formats=("xlsx", "csv", "txt", "json")
)
Exported files
This creates:
ATSI_results.xlsxATSI_results.csvATSI_results.txtATSI_results.json
Standard ATSI Example — Plotting
from atsimodel.core import run_atsi
from atsimodel.plotting import plot_atsi_distribution, plot_chl_vs_atsi
df = run_atsi("examples/sample_atsi_input.xlsx")
plot_atsi_distribution(df)
plot_chl_vs_atsi(df)
Current built-in plots
The package currently supports:
- ATSI distribution histogram
- CHL vs ATSI scatter plot
These are useful for quick exploratory analysis and sanity checking.
ATSI Scientific Logic
The ATSI framework is implemented as:
- CHL-driven trophic scoring
- SAL-conditioned threshold assignment
- linear rescaling interpolation
- score clipping to 0–100
- classification translation
Threshold logic
ATSIModel does not use one fixed CHL threshold for all waters.
Instead, it uses salinity-dependent moving CHL thresholds, because trophic expectations vary across the salinity continuum.
The package determines:
SAL_BINCHL_TL(lower CHL threshold)CHL_TU(upper CHL threshold)
and computes ATSI accordingly.
PART II — RS-ATSI WORKFLOW
RS-ATSI Concept
RS-ATSI is implemented as a two-stage workflow:
Stage 1 — Remote sensing CHL prediction
Sentinel-3 OLCI style reflectance inputs are used to estimate:
CHL_RS
Stage 2 — ATSI derivation
The predicted CHL is then combined with salinity to compute:
ATSI_RS
This preserves the ATSI scientific philosophy:
- ATSI remains CHL-driven
- SAL remains the threshold-conditioning variable
RS-ATSI Required Inputs
Mandatory columns
The RS-ATSI workflow requires:
CHLSALRhow_1Rhow_2Rhow_3Rhow_4Rhow_5Rhow_6Rhow_7Rhow_8Rhow_9Rhow_10Rhow_11
Optional but strongly recommended columns
SITESEASONZONESPLIT
Meaning of optional metadata columns
SITE
Used for:
- site-wise CHL validation
- site-wise ATSI validation
- station-level comparison
SEASON
Used for:
- seasonal ATSI agreement
- station-season diagnostics
ZONE
Used for:
- spatial realism evaluation
- upper / middle / lower estuary comparison
- hotspot consistency analysis
SPLIT
Used to define data subsets:
TRAINTESTINDEPENDENT
If SPLIT is not provided, the package automatically creates a train/test split, but independent validation will not exist.
Example RS Input Table
| SITE | SEASON | ZONE | SPLIT | CHL | SAL | Rhow_1 | Rhow_2 | Rhow_3 | Rhow_4 | Rhow_5 | Rhow_6 | Rhow_7 | Rhow_8 | Rhow_9 | Rhow_10 | Rhow_11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| S1 | Winter | Upper | TRAIN | 8.0 | 31.0 | 0.011 | 0.012 | 0.013 | 0.014 | 0.015 | 0.016 | 0.017 | 0.018 | 0.019 | 0.020 | 0.021 |
| S2 | Spring | Middle | TEST | 15.0 | 28.5 | 0.010 | 0.011 | 0.012 | 0.013 | 0.014 | 0.016 | 0.017 | 0.018 | 0.019 | 0.020 | 0.022 |
| S3 | Summer | Lower | INDEPENDENT | 5.2 | 33.0 | 0.009 | 0.010 | 0.011 | 0.012 | 0.013 | 0.015 | 0.016 | 0.017 | 0.018 | 0.019 | 0.020 |
RS-ATSI Example — Basic Run
from atsimodel.rs_core import run_rs_atsi_pipeline
results = run_rs_atsi_pipeline(
input_file="examples/sample_rs_atsi_rhow_input.xlsx",
output_dir="outputs/RS_ATSI_demo"
)
print(results["chl_validation_overall"])
print(results["atsi_validation_overall"])
RS-ATSI Example — CSV Input
from atsimodel.rs_core import run_rs_atsi_pipeline
results = run_rs_atsi_pipeline(
input_file="examples/sample_rs_atsi_rhow_input.csv",
output_dir="outputs/RS_ATSI_demo_csv"
)
RS-ATSI Example — TXT Input
from atsimodel.rs_core import run_rs_atsi_pipeline
results = run_rs_atsi_pipeline(
input_file="examples/sample_rs_atsi_rhow_input.txt",
output_dir="outputs/RS_ATSI_demo_txt"
)
What the RS Pipeline Does Automatically
When you run the RS-ATSI pipeline, it performs the following steps:
Step 1 — Read the input file
Reads Excel / CSV / TXT input.
Step 2 — Standardize columns
Automatically converts names like:
Rhow_1rhow_1RHOW_1
into a consistent internal structure.
Step 3 — Engineer spectral features
The package automatically generates derived features from Rhow_1 to Rhow_11, including:
- band ratios
- normalized differences
- adjacent band differences
- log-transformed spectral features
Step 4 — Split the dataset
Uses:
- explicit
SPLITcolumn if available, or - automatic train/test split
Step 5 — Train CHL model
Trains the default machine-learning model for CHL prediction.
Step 6 — Predict CHL
Generates:
CHL_RS
Step 7 — Compute ATSI
Computes both:
ATSI_INSITUfrom measured CHLATSI_RSfrom predicted CHL
Step 8 — Validate outputs
Performs structured validation.
Step 9 — Export results
Exports all major outputs.
Validation Design
This package implements a structured validation framework suitable for serious RS-ATSI research papers and prototype platforms.
1) CHL Validation
The package evaluates predicted chlorophyll-a (CHL_RS) against measured CHL using:
- R²
- RMSE
- MAE
- Bias
across:
- training data
- testing data
- independent validation data (if supplied)
Exported CHL validation outputs
chl_validation_overallchl_validation_by_site_testchl_validation_by_site_independent(if available)chl_model_metrics_summary
2) ATSI Validation
The package compares:
- RS-ATSI vs
- in-situ ATSI
using:
- R²
- RMSE
- MAE
- Bias
across:
- train
- test
- independent validation
Exported ATSI validation outputs
atsi_validation_overallatsi_validation_by_site_testatsi_validation_by_site_independent
3) ATSI Classification Validation
The package compares trophic classes derived from:
ATSI_INSITUATSI_RS
using:
- confusion matrix
- agreement rate
Exported classification outputs
atsi_class_summary_testatsi_confusion_matrix_testatsi_class_summary_independentatsi_confusion_matrix_independent
4) Station–Season Agreement Validation
The package evaluates agreement by:
- station (
SITE) - season (
SEASON)
This helps assess whether the model behaves consistently across:
- different monitoring locations
- different seasonal conditions
Exported station-season outputs
station_season_agreement_teststation_season_agreement_independent
5) Spatial Validation
The package includes a practical spatial validation layer through the ZONE column to support:
- hotspot consistency
- estuarine gradient realism
- upper / middle / lower estuary comparison
Recommended ZONE labels
UpperMiddleLower
Exported spatial outputs
spatial_zone_summary_testspatial_zone_summary_independent
Exported RS Results
The RS workflow exports a full bundle of outputs.
Main prediction table
predictions_all
This includes:
- observed
CHL - predicted
CHL_RS - threshold columns
- ATSI values
- ATSI classes
- dataset labels
Typical output columns
| Column | Description |
|---|---|
CHL |
observed in-situ chlorophyll-a |
CHL_RS |
model-predicted chlorophyll-a |
SAL |
salinity |
SAL_BIN |
salinity bin |
CHL_TL |
lower CHL threshold |
CHL_TU |
upper CHL threshold |
ATSI_INSITU |
ATSI from measured CHL |
ATSI_RS |
ATSI from predicted CHL |
ATSI_INSITU_CLASS |
trophic class from measured ATSI |
ATSI_RS_CLASS |
trophic class from RS-ATSI |
DATASET |
Train / Test / Independent |
Export Formats
The package exports results to:
- Excel
- CSV
- TXT
- JSON
Excel bundle
All result tables are also written into a single workbook:
RS_ATSI_results_bundle.xlsx
RS-ATSI Example — End-to-End Run
from atsimodel.rs_core import run_rs_atsi_pipeline
results = run_rs_atsi_pipeline(
input_file="examples/sample_rs_atsi_rhow_input.xlsx",
output_dir="outputs/RS_ATSI_case_study",
target_col="CHL",
sal_col="SAL",
site_col="SITE",
season_col="SEASON",
zone_col="ZONE"
)
print(results["predictions_all"].head())
print(results["chl_validation_overall"])
print(results["atsi_validation_overall"])
print(results["atsi_confusion_matrix_test"])
Plotting
The current release includes simple plotting utilities in:
atsimodel.plotting
Built-in plotting functions
1. ATSI distribution
from atsimodel.plotting import plot_atsi_distribution
plot_atsi_distribution(df)
2. CHL vs ATSI
from atsimodel.plotting import plot_chl_vs_atsi
plot_chl_vs_atsi(df)
Suggested RS plotting workflow
For RS-ATSI studies, you can additionally create:
- observed vs predicted CHL plots
- ATSI_INSITU vs ATSI_RS plots
- site-wise error boxplots
- seasonal agreement heatmaps
- zone-wise performance bar charts
- confusion matrix heatmaps
These are not fully automated yet in this release, but the exported tables are structured to support them easily.
Scientific Notes
1. ATSI remains CHL-driven
The ATSI philosophy is preserved. Even in RS-ATSI, the final trophic score is derived from CHL.
2. SAL is not directly aggregated
SAL is used to determine the correct threshold context, not directly scored as trophic response.
3. RS-ATSI requires proper collocation
Scientific performance depends strongly on the quality of:
- spectral inputs
- in-situ CHL
- in-situ or matched SAL
- spatial and temporal collocation
4. Spatial validation matters
High overall accuracy can still hide local failures. This is why the package includes:
- site-wise validation
- station-season agreement
- zone-level spatial realism summaries
5. Score control
All ATSI scores are clipped to:
- minimum = 0
- maximum = 100
This prevents physically or methodologically invalid values.
Current ATSI Classification
The current release includes an operational 4-class translation:
UnpollutedModerateEutrophicHypertrophic
If you want to apply exact final paper-based class boundaries, update:
atsimodel/classification.py
Limitations
This release is a strong operational and research prototype, but it does not yet include:
- uncertainty quantification
- prediction intervals
- SHAP explainability
- multi-model comparison
- raster-based Sentinel-3 ingestion
- atmospheric correction workflow
- geospatial map production
- kriging / hotspot surface interpolation
- automated figure export suite
Recommended Future Upgrades
Suggested next upgrades for a journal-grade RS-ATSI platform:
- multi-model CHL prediction
- best-model auto-selection
- uncertainty-aware RS-ATSI
- SHAP feature importance
- raster image support
- map generation
- station-level diagnostic plotting
- PDF report generation
Citation
If you use this package in academic work, please cite:
Uddin, M. G., Nash, S., Rahman, A., Dabrowski, T., & Olbert, A. I. (2024). Data-driven modelling for assessing trophic status in marine ecosystems using machine learning approaches. Environmental Research, 242, 117755. https://doi.org/10.1016/j.envres.2023.117755
Suggested software citation
Uddin, M. G. (2026). ATSIModel: Python package for computing ATSI and RS-ATSI for transitional and coastal waters.
Contact
For scientific collaboration, package development, or method-related questions:
Dr Md Galal Uddin
School of Engineering, University of Galway, Ireland
Email: jalaluddinbd1987@gmail.com
License
This project is distributed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rsatsimodel-2.5.1.tar.gz.
File metadata
- Download URL: rsatsimodel-2.5.1.tar.gz
- Upload date:
- Size: 29.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae7645e1894009fdcfebc2af5d18f68fc121c6b956002ae02da4d8856cb60f06
|
|
| MD5 |
83e15bc235ce22326229393cbb580c6f
|
|
| BLAKE2b-256 |
bd99e8f458b49ad9ffe63d427e5996fbb74cf4f72e41f75f3e214c08d770b20b
|
File details
Details for the file rsatsimodel-2.5.1-py3-none-any.whl.
File metadata
- Download URL: rsatsimodel-2.5.1-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f94bfb5f1bd9d6f6ed04741236011a1485f35107c5cb3b719993390a1369b245
|
|
| MD5 |
a7b57a5583c90f9d4276ea19ac77141f
|
|
| BLAKE2b-256 |
9d91fdeaa5e13c8eceb37f7fcb3705c87feba37d1ac1d0526c6522a67b288368
|