A web application and Python toolkit for marine spatial data analytics, built for the Mistra C2B2 Hackathon. This project simplifies the analysis of geospatial raster data (GeoTIFFs) from the Symphony ecosystem model.
Our tool allows users to perform two key analyses:
-
Compare Layers: Directly measure the statistical relationship between any two layers. For example, you can quantify how shipping noise correlates with porpoise density.
-
Predict Ecological Impact: Use machine learning to predict an ecosystem layer from multiple human pressure and environmental drivers. For instance, you can model fish populations based on factors like water temperature, nutrient levels, and fishing intensity.
These powerful tools are accessible through both a simple, user-friendly web interface and advanced command-line scripts.
- Web Application: A user-friendly web interface to run "Compare" and "Predict" analyses without using the command line.
- symph-compare: A command-line tool to compute pairwise Pearson/Spearman correlations between any two raster layers, generating an interactive scatter plot and a correlation heatmap.
- symph-predict: A command-line tool to predict a target raster from multiple predictor layers using a suite of high-performance models (Random Forest, GBM, XGBoost, Neural Networks).
Comprehensive model evaluation metrics including RΒ², RMSE, and MAE for multiple algorithms
Predicted vs. actual values visualization showing model accuracy across the full range of data
Feature correlation matrix and target variable distribution for understanding data relationships
git clone https://github.com/SuyashMullick/layer-correlation-symphony
cd layer-correlation-symphonypython -m venv .venv
source .venv/bin/activate # On macOS/Linux
# OR
.venv\Scripts\activate # On Windowspip install -r requirements.txtThe web application is pre-loaded with sample data. To use your own data, follow these steps.
Download the 2018 Symphony ecosystem and pressure layers from the Swedish Agency for Marine and Water Management:
Unzip these files into data/aligned/ (or any other folder). The web application will automatically find and list all .tif files located in the data/aligned directory.
π‘ Note: The scripts assume all input rasters are aligned to the same grid (CRS, transform, and dimensions). You may need to pre-process your data using GIS software like QGIS or GDAL.
This is the simplest way to run analyses. The web application provides a graphical user interface for the compare and predict tools.
From the root directory of the project, run:
python app.pyOpen your web browser and navigate to http://127.0.0.1:5000.
The Home Page
The main page provides two choices: "Compare Layers" for simple two-layer correlation, and "Predict Ecological Impact" for more complex predictive modeling.
The Compare Page
This page is for a direct, one-to-one comparison between two raster layers. You can either select pre-loaded files from the dropdown menus or upload your own GeoTIFF files. Once you have selected two layers, click the "Compare Layers" button to start the analysis.
The Predict Page
This page allows you to predict a target variable using multiple predictor (or "driver") layers. Upload one target file and one or more predictor files. You can add more predictor file slots by clicking the "+ Add Another Predictor" button. Once your files are selected, click "Run Prediction" to train the models and generate results.
Viewing Results
After submitting a job from either the Compare or Predict page, a loading screen will appear. Once the analysis is complete, you will be redirected to the results page, which displays key metrics in a table and shows detailed, interactive diagnostic plots.
For batch processing or more advanced control, you can use the command-line scripts directly.
Compare two raster layers pixel-wise to measure linear (Pearson) and rank (Spearman) correlations.
Usage
python -m cli.symph-compare
--a <path_to_layer_a.tif>
--b <path_to_layer_b.tif>
--out <output_folder>
[--nodata <nodata_values>]Example
python -m cli.symph-compare
--a data/aligned/naturvarden-.och-belastningar-ostersjon-2018/National_eco_E_2018/01Porpoise_Baltic.tif
--b data/aligned/naturvarden-.och-belastningar-ostersjon-2018/National_press_E_2018/32Nitrogen_Background.tif
--out out/compare/porpoise_vs_nitrogen
--nodata "-9999"Outputs
out/compare/porpoise_vs_nitrogen/
ββ metrics.csv # Pearson r, Spearman rho, and pixel count
ββ metrics.json # Metrics in JSON format
ββ scatter.html # Interactive scatter plot
ββ predictor_heatmap.png # Correlation heatmap image
π‘ For a full list of options, run python -m cli.symph-compare -h
Train a model to predict one target raster from several predictor rasters.
Usage
python -m cli.symph-predict
--target <target.tif>
--predictors <x1.tif> <x2.tif> ...
--out <output_dir>
[--sample <n>] [--test_size <ratio>]
[--model {rf,gbm,xgb,nn,auto}]
[--remove_outliers] [--transform_y {none,log1p}]Example
export BASE="data/aligned/naturvarden-och-belastningar-bottniska-viken-2018" # On macOS/Linux
# OR
$BASE = "data/aligned/naturvarden-och-belastningar-bottniska-viken-2018" # On Windows
python -m cli.symph-predict
--target "$BASE/National_eco_N_2018/01Porpoise_Baltic.tif"
--predictors
"$BASE/National_eco_N_2018/20sill_lognorm_v2.tif"
"$BASE/National_eco_N_2018/21skarpsill_lognorm_v2.tif"
"$BASE/National_eco_N_2018/19torsk_lognorm_v2.tif"
"$BASE/National_press_N_2018/17Noise_2000Hz_Shipping_20181122.tif"
"$BASE/National_press_N_2018/18Boating.tif"
--out "out/predict/N_porpoise_prey_noise_boating"
--sample 200000
--transform_y log1p
--model rfOutputs
out/predict/<name>/
βββ feature_importance.csv
βββ metrics.csv
βββ parity.html
βββ parity.png
βββ predictor_heatmap.png
βββ residuals.html
βββ residuals.png
π‘ For a full list of options, run
python -m cli.symph-predict -h
layer-correlation-symphony/
ββ app.py # Main Flask web application
ββ cli/
β ββ symph-compare.py # CLI for correlation analysis
β ββ symph-predict.py # CLI for predictive mapping
ββ src/ # Core analytics and visualization modules
β ββ analysis/
β ββ geo/
β ββ viz/
ββ static/ # CSS and generated result files
ββ templates/ # HTML templates for the web app
ββ data/
β ββ aligned/ # Location for input GeoTIFF layers
ββ out/ # Default folder for CLI outputs
ββ screenshots/ # Application screenshots
ββ requirements.txt # Dependencies
Developed for the Mistra C2B2 Hackathon #1 (2025) by:
- Younus Mashoor - younusmashoor@gmail.com
- Suyash Mullick - suyash.mullick@gmail.com
- Hamza Zia - hamza.zia@lnu.se
- Abdullah Saeed - as228aw@student.lnu.se
- Amilcar Soares Junior
- Rafael Messias Martins
For their guidance and support throughout the project.
MIT License β free to use, modify, and extend with attribution.