This repository contains a collection of Python scripts and Jupyter Notebooks used to calculate an assessment of nutrient and sediment pollution for the Delaware River Watershed Initiative (DRWI). These scripts first access data and model results from DRWI-supported system, including: Model My Watershed, Stream Reach Assessment Tool (SRAT) and related systems, and FieldDoc. The scripts then use those data as input for a specific series of calculations designed to quantify how much excess nonpoint source pollution has been reduced by conservation activities and how much is remaining for each DRWI Focus Area.
This work was funded by the William Penn Foundation (WPF).
The files in the [stage1]/(stage1/) folder were used to generate rapid assessment results and figures for DRWI Stage 1 Pollution Assessment Report, submitted to the William Penn Foundation on October 29, 2021 and revised on February 7, 2022.
The files in the [stage2]/(stage2/) folder were used to generate refined assessment results and figures for presentation to WPF by September of 2022.
Follow these steps to install using the conda package manager.
We recommend installing the latest release of Anaconda Individual Edition, which includes the conda, a complete Python (and R) data science stack, and the helpful Anaconda Navigator GUI.
- Follow Anaconda Installation documentation.
A lighter-weight alternative is to install Miniconda.
From this Github page, click on the green "Code" dropdown button near the upper right. Select to either "Open in GitHub Desktop" (i.e. git clone) or "Download ZIP". We recommend using GitHub Desktop, to most easily receive updates.
Place your copy of this repo in any convenient location on your computer.
Although Pollution Assessment can be run from the default base environment created by Anaconda, we recommend creating a custom environment that includes the exact combination of software dependencies that we've used in development and testing.
Create the drwi_pa environment from our environment.yml file, which lists all primary dependencies, using one of these approaches:
- Use the Import button on Anaconda Navigator's Environments tab, or
- Use the following
conda createcommand in your terminal or console, replacingpath/environment.ymlwith the full file pathway to theenvironment.ymlfile in the local cloned repository.
conda env create --file path/environment.ymlTo update your environment, either use Anaconda Navigator, or run the following command:
conda env update --file path/environment.yml --pruneor for a clean re-install:
conda env create --file path/environment.yml --forceOptionally, if you have installed conda-libmamba-solver into your base environment, you can also add the --solver=libmamba option flag to any fo the commands above.
To have access to this repository's modules in your Python environments, it is necessary to save the path to your copy of this repo in Miniconda's or Anaconda's conda.pth file in the environment's site-packages directory (i.e. something like <$HOME>/anaconda/lib/pythonX.X/site-packages/conda.pth or <$HOME>/miniconda3/envs/drwi_pa/lib/python3.11/site-packages/conda.pth or similar), where <$HOME> refers to the full path of the user directory, such as /home/username on Linux/Mac.
-
The easiest way to do this is to use the conda develop command in the console or terminal like this, replacing
/path/to/module/with the full file pathway to the local cloned HSPsquared repository:conda develop /path/to/module/
You should now be able to run the Tutorials and create your own Jupyter Notebooks!