Skip to main content

cnkit

CI PyPI Python License: MIT

Curve number hydrology with Earth Observation. cnkit implements NRCS runoff relations, initial-abstraction conversions, NLCD and hydrologic-soil-group lookups, storm-event and baseflow separation, asymptotic curve-number estimation, antecedent-moisture conventions, watershed delineation and optional Google Earth Engine reductions.

The library returns disagreements rather than hiding them. Where a quantity has more than one defensible definition, cnkit computes each one and exposes the spread for the analyst to evaluate.

Install

pip install cnkit

The core science needs only NumPy, pandas and SciPy. Install optional network or Earth Engine features as needed:

pip install "cnkit[data]"
pip install "cnkit[gee]"
pip install "cnkit[all]"

Python 3.9 or newer is supported.

Quick start

from cnkit import composite_runoff, runoff

round(float(runoff(3.0, 75)), 4)
# 0.9608

# 60% impervious at CN 98, 40% woods at CN 55, 1-inch storm.
distributed, weighted_cn, weighted_storage = composite_runoff(
    1.0, [98, 55], [0.6, 0.4]
)
[round(x, 4) for x in (distributed, weighted_cn, weighted_storage)]
# [0.4745, 0.0949, 0.0277]

The three answers use distributed runoff, a weighted curve number and weighted retention respectively. Their spread is a real modeling decision, not a rounding error.

Main modules

  • cnkit.core: retention, runoff, curve-number conversion and composite runoff.
  • cnkit.lookup: NLCD crossed with hydrologic soil group.
  • cnkit.events: storm-event and baseflow separation.
  • cnkit.asymptotic: asymptotic and competing curve-number estimators.
  • cnkit.antecedent: rainfall and satellite-soil-moisture conventions.
  • cnkit.data: USGS NWIS, USDA Soil Data Access and EPA StreamCat fetchers.
  • cnkit.delineate: USGS NLDI, SS-Delineate and opt-in mghydro watersheds.
  • cnkit.gee: optional Earth Engine basin reductions and time series.
  • cnkit.workflows: end-to-end curve-number trajectories with provenance.

Earth Engine in Jupyter or Colab

%pip install -q "cnkit[gee]"

import os
from getpass import getpass
from cnkit.gee import initialise

project = os.environ.get("CNKIT_EE_PROJECT") or getpass("Earth Engine project id: ")
initialise(project=project)

The project id is supplied at runtime. cnkit does not bundle credentials, write to Earth Engine assets or record the project id. Use soils="sda" for CONUS work; soils="hihydrosoil" is experimental. The CSRL community raster passed its live Virginia coverage and complete-reduction tests but remains disabled for 1.1 by owner decision because of its 800 m resolution, missing embedded class metadata and community-asset risk.

Runnable notebooks work in JupyterLab and Colab without cloning the repository.

Scope and units

Rainfall, runoff and storage depths are in inches unless a function documents otherwise. Curve numbers are dimensionless. cnkit computes runoff volume; it does not compute peak discharge, time of concentration, hydrographs or routing.

The NRCS tables are not defined below CN 30, and computed runoff below roughly 0.5 inches carries large relative uncertainty. The code does not enforce those engineering judgment limits.

Links

cnkit is released under the MIT License. Verify results before using them in design work.

Metadata

Release files for cnkit 1.1.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 cnkit 1.1.0
File Size Uploaded
cnkit-1.1.0.tar.gz 944.6 kB Details

Built distribution (wheel)

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

Total release size: 1.1 MB

Release files / cnkit-1.1.0.tar.gz

Download URL cnkit-1.1.0.tar.gz
Size 944.6 kB
Tags Source
SHA-256 checksum
How to use checksums
56a9eec8447b76fae5f5f0ca57db3399915de6283d44c5afe9b800d8da7aefcb
BLAKE2b-256 checksum
How to use checksums
912b0b3f02fc284eb0eda7fbff34b2906d90a79311ea0e0c0b141c430512c566
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

Release files / cnkit-1.1.0-py3-none-any.whl

Download URL cnkit-1.1.0-py3-none-any.whl
Size 145.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
516654677c12657a274c9418874205c0d2e61da0176ca9a9d4d79d1d49fc23b3
BLAKE2b-256 checksum
How to use checksums
3c557ee65ca5e3aafd0d1e46f13c884b7c5f0d0d7c0312bea623e38c1d1da0e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.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