This repository contains R scripts and tools for processing point source (PS) discharge data—such as wastewater treatment plant outputs—to prepare inputs for the SWAT (Soil and Water Assessment Tool) model, specifically tailored for Lithuania's river modeling system (LRMS). The workflow focuses on data validation, pollutant load calculation, and risk assessment for water bodies.
The purpose of this toolbox is to automate the integration of point source pollution data into the LT SWAT modeling framework and to support the assessment of the impacts of point sources on water bodies. This is part of the broader LIFE22-IPE-LT-LIFE-SIP-Vanduo project, which aims to enhance integrated water management in Lithuania.
- Created on: 2025-06-05
- Last Modified: 2026-04-16
- Author: Svajunas Plunge
- Email: svajunas_plunge@sggw.edu.pl
- Quality Assurance (QA): The
ps_qa.Rscript is used for data validation and integrity checks to ensure point source datasets are correctly represented in LRMS. - Impact Analysis:
ps_impacts.Rcalculates pollutant loads and evaluates their specific impacts on the water bodies (WB). - Risk Assessment:
ps_risk_wb.Ridentifies risk WBs by comparing base and change scenarios. - Point Source Assessment:
ps_assess.R(and related updates in ps_risk_wb.R) provides capabilities to calculate the contribution of each point source to pollutant loading in all downstream water bodies. - Interactive App: The
ps_assess_app/directory contains a dedicated application for the interactive assessment of point source impacts. - Modular Functions: : Core logic, shared utilities, and features like date filtering are maintained in
function.Rto ensure consistency across the toolbox.
LT-SWAT-PS-Processing/
├── Data/ # Directory for storing raw and processed datasets
├── ps_assess.R # Script for calculating point source contributions to water bodies
├── ps_assess_app/ # Source code for the interactive assessment application
├── function.R # Collection of custom R functions used across scripts
├── ps_impacts.R # Script for assessing environmental impacts of point sources
├── ps_qa.R # Quality assurance and data cleaning for point source datasets
├── ps_risk_wb.R # Water body risk assessment based on point source loads
├── update_small.R # Utility script for updating small point source datasets
├── .Renviron # Environment variables configuration (e.g., Postgres database connection)
├── ps_in_ltswat.Rproj # RStudio project file for the LT-SWAT PS processing workflow
└── README.md # Project documentation and usage instructions
- R (100% of the project is written in R).
- RStudio is recommended for managing the
.Rprojenvironment.
- Point source discharge datasets as required by the analysis scripts.
- A properly configured
.Renvironfile to define local data directories and environment settings. - Access to a PostGres database if required for data storage and retrieval.
- LRMS (Lithuanian River Modeling System) data for integrating point source information.
- Clone the Repository: Download or clone the
ps_in_ltswatrepository from GitHub. - Initialize Project: Open
ps_in_ltswat.Rprojin RStudio to set the working directory. - Configure Environment: Edit the
.Renvironfile to specify your local file paths. - Load Functions: Source
function.Rto load the necessary utilities for the project. - Run Scripts:
- Execute
ps_qa.Rto validate your data. - Use
ps_assess.Ror theps_assess_app/for data assessment. - Execute
ps_impacts.Rorps_risk_wb.Rto generate model inputs and risk reports.
- Execute
This work was carried out within the LIFE22-IPE-LT-LIFE-SIP-Vanduo project (Integrated water management in Lithuania, ref: LIFE22-IPE-LT-LIFE-SIP-Vanduo/101104645), funded by the European Union LIFE program under the grant agreement No 101104645.
