Skip to main content

Simple soil profile for hydrological modelling (particularily SWAP).

Project description

simplesoilprofile

Release Build status codecov Commit activity License

A Python package for working with soil profile data in hydrological modeling applications, particularly focused on SWAP model integration.

Features

  • Object-oriented representation of soil layers and profiles with Pydantic validation
  • Support for van Genuchten parameters and physical soil properties
  • Integration with the SWAP model input format
  • API integration framework with example implementation for Belgian DOV
  • Visualization tools for soil profile display

Quick Start

Creating a Soil Profile

from simplesoilprofile import SoilLayer, SoilProfile

# Create soil layers
topsoil = SoilLayer(
    name="Topsoil",
    description="Sandy loam topsoil",
    theta_res=0.02,
    theta_sat=0.4,
    alpha=0.02,
    n=1.5,
    k_sat=10.0,
    texture_class="sandy loam",
    clay_content=10.0,
    silt_content=20.0,
    sand_content=70.0,
)

subsoil = SoilLayer(
    name="Subsoil",
    description="Clay loam subsoil",
    theta_res=0.05,
    theta_sat=0.45,
    alpha=0.01,
    n=1.3,
    k_sat=5.0,
    texture_class="clay loam",
    clay_content=30.0,
    silt_content=35.0,
    sand_content=35.0,
)

# Create a profile
profile = SoilProfile(
    name="Test Profile",
    layers=[topsoil, subsoil],
    layer_depths={
        0: (0, 30),    # Topsoil from 0-30 cm
        1: (30, 100),  # Subsoil from 30-100 cm
    },
    x=100.0,
    y=200.0,
    z=5.0,
)

Generating SWAP Input

from simplesoilprofile.models.swap import write_swap_soil_file

# Write to a SWAP soil file
with open("soil.swp", "w") as f:
    write_swap_soil_file(profile, f)

Visualizing a Profile

import matplotlib.pyplot as plt
from simplesoilprofile.plotting import plot_profile

# Create a new figure
fig, ax = plt.subplots(figsize=(8, 12))

# Plot the profile
plot_profile(profile, ax=ax, show_properties=True)
plt.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simplesoilprofile-0.0.6.tar.gz (91.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplesoilprofile-0.0.6-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file simplesoilprofile-0.0.6.tar.gz.

File metadata

  • Download URL: simplesoilprofile-0.0.6.tar.gz
  • Upload date:
  • Size: 91.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for simplesoilprofile-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f31520aeb9812a58fe01d0f795e1a12d33a541348f9ee7cf1386463b46d4f10b
MD5 b7b8cce94a8c1198b5250d16118bfc74
BLAKE2b-256 039fd96dd8c3b5e72dba5f9b68cd873d1e26fb1ee6efbc5d2658006cb0545d18

See more details on using hashes here.

File details

Details for the file simplesoilprofile-0.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for simplesoilprofile-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 84b439221d6fa85a3a0ed807bccab9538c17b09841306bfd8a97fdfd26cb40ef
MD5 912cf0ede7edc335ca5ce69271e3822f
BLAKE2b-256 35c40cddd3fb1ba8e78b4c9bad92cd5afe6a52564772047568ac3b90b6479b79

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page