Skip to main content
Testing of source code Functional Testing Test Coverage Linting Build and release package
Testing of examples Testing of examples Coverage by examples
Package PyPI - Python Version PyPI - Version GitHub commits since latest release

Overview

gwtransport1d is a Python package for modeling the transport of temperature and contaminants in groundwater flow systems. It provides practical tools for analyzing advection, diffusion, deposition processes, and calculating residence time distributions in aquifer systems.

Aquifer Pore Volume Distribution

The aquifer pore volume distribution is a probability density curve that holds the fraction of flow that passes a certain pore volume between infiltration and extraction. This package relies on the estimating this distribution and uses it to compute many different transport processes related to residence time. In the examples here, the aquifer pore volume distribution is approximated by a Gamma distribution of which the two parameters are estimated from the flow rate, the temperature of the infiltration and extracted water. Alternatively, you can derive the aquifer pore volume distribution from the streamlines of your groundwater model. In all examples the assumption is made that the aquifer pore volume distribution is constant over time.

Calibration of the aquifer pore volume distribution (Example 1)

An practical approach to calibrate the two parameters of the Gamma distribution is to use the temperature response of the aquifer. This requires the following measurements over a limited time period:

  • Infiltration and extraction temperature,
  • Extraction rate or a quantity that is proportional to the extraction rate, such as the head gradient.

See: Example 1.

Examples that make use of the aquifer pore volume distribution

The aquifer pore volume distribution can be used to compute:

Installation

pip install gwtransport1d

Usage Examples

Example 1: Estimate Aquifer Pore Volume from Temperature Response

This example demonstrates how to use temperature data to estimate the aquifer pore volume distribution:

from scipy.optimize import curve_fit
from gwtransport1d import advection

# Load your temperature and flow data
# ...

# Define objective function for curve fitting
def objective(time, mean, std):
    cout = advection.gamma_forward(
        cin=temperature_data,
        flow=flow_data,
        mean=mean,
        std=std,
        n_bins=200,
        retardation_factor=2.0
    )
    return cout.values

# Perform curve fitting
(apv_gamma_mean, apv_gamma_std), pcov = curve_fit(
    objective,
    temperature_data.index,
    extracted_temperature_data,
    p0=(7000.0, 500.0),
)

# Print the fitted parameters
print(
  f"Fitted Gamma distribution for the aquifer pore volume has a mean of: {apv_gamma_mean:.1f} m³ and ",
  f"a standard deviation of: {apv_gamma_std:.1f} m³")

Example 2: Estimate Residence Time Distribution

Once you've characterized your aquifer, you can calculate residence time distributions:

import pandas as pd
from gwtransport1d import advection, gamma

# Set up your parameters
mean = 8000.0  # m3
std = 400.0  # m3
retardation_factor = 1.0
flow_data = pd.Series(...)  # Your flow data

# Calculate residence time
alpha, beta = gamma.mean_std_to_alpha_beta(mean, std)
bins = gamma.bins(alpha, beta, n_bins=1000)

# Calculate forward residence time (infiltration to extraction)
rt_forward = advection.residence_time(
    flow_data,
    bins["expected_value"],
    retardation_factor=1.0,
    direction="infiltration"
)

Example 3: Log Removal of Pathogens

Calculate the log removal of pathogens based on residence time:

import numpy as np
from gwtransport1d import logremoval

# Calculate log-removal of the extracted water
rt_alpha = 2.0  # Shape parameter of the gamma distribution for the residence time
rt_beta = 10.0  # Scale parameter of the gamma distribution for the residence time
log_removal_rate = 0.5  # Log-removal rate [1/day]
mean_removal = logremoval.gamma_mean(rt_alpha, rt_beta, log_removal_rate)
print(f"Mean log removal: {mean_removal:.2f}")

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.

Metadata

Release files for gwtransport1d 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gwtransport1d 0.8.0
File Size Uploaded
gwtransport1d-0.8.0.tar.gz 65.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gwtransport1d 0.8.0
File Interpreter ABI Platform
gwtransport1d-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 112.2 kB

Release files / gwtransport1d-0.8.0.tar.gz

Download URL gwtransport1d-0.8.0.tar.gz
Size 65.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7a7d47483b9d6841db4bc71ed032a9f156f237b0dce95f14389d4634b93aa944
BLAKE2b-256 checksum
How to use checksums
5b254ef7a54af6d8ee2c09ecd4786a73ad31b0b33827ce58fab1557f1b73d36b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2025.

Transparency log

Release files / gwtransport1d-0.8.0-py3-none-any.whl

Download URL gwtransport1d-0.8.0-py3-none-any.whl
Size 46.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
778bb331ec3e97bb46e2f25a9974e86304fd6ad493992c69228954c8c6f5d005
BLAKE2b-256 checksum
How to use checksums
cac7ddde65c3510ac4aa0a2e6a80164125b8c6f030828eb45fba95a80fd03010
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 12, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.5.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page