Skip to main content

a package for hydrological methods in civil and enviromental engineering

Project description

hydrocivil: a package for hydrological methods in civil and enviromental engineering

Typical tasks related to water resources and engineering require quick calculations of hydrological phenomena such as: storm hyetographs, soil infiltration, flood hydrographs, flood routing through channels or reservoirs, etc. With this purpose in mind, the package is presented as an alternative to perform calculations that are usually done in tedious spreadsheets in a fast pythonic way. The purpose is to give tools to the engineer to calculate hydrologic processes with methods and techniques he/she deems convenient, such as different varieties of synthetic unit hydrographs, synthetic storms or basin geomorphometric parameters. The package isnt intended to be a replacement of larger hydrological models (e.g. HEC-HMS), but rather a fast customizable and automatic alternative for multi-basin calculations.

The package is largely oriented to Chilean national standards, however many methods originally come from the USA NCRS National Engineering Handbook.

Dependencies

Before installing, check your environment for the following packages:

  • numpy, pandas, scipy, matplotlib
  • xarray, rasterio, rioxarray
  • shapely, geopandas
  • networkx
  • whitebox_workflows (optional)

Installation

Currently the package can only be installed via pip:

pip install --force-reinstall --no-deps hydrocivil

Example Use

from hydrocivil.misc import load_example_data
from hydrocivil.watersheds import RiverBasin
from hydrocivil.rain import RainStorm

Compute basin properties

# ---------------------- Load example data (or your own) --------------------- #

# dem = rxr.open_rasterio('/path/to/dem.tif')
# curvenumber = rxr.open_rasterio('path/to/cn.tif')
# rivernetwork = gpd.read_file('path/to/rivers.shp')
# basin_polygon = gpd.read_file('path/to/basin.shp')
basin, rnetwork, dem, cn = load_example_data()

# Create RiverBasin object and compute properties
wshed = RiverBasin('Example', basin, rnetwork, dem, cn, amc='wet')
wshed = wshed.compute_params()  # <- compute geomorphological parameters (SI units)
wshed.plot() # Check results (e.g basin polygon, identified main river, etc)
<Axes: title={'left': 'Example'}>

png

Create an hypothetical storm

# Create a 100 milimeter, 24 hours duration, SCS type I storm with pulses every 30 minutes
storm = RainStorm('SCS_I24')
storm = storm.compute(timestep=0.5, duration=24, rainfall=100)
# Use SCS method for abstractions with the watershed average curve number
storm = storm.infiltrate(method='SCS', cn=wshed.params.loc['curvenumber'].item())

storm.pr.to_series().plot(kind='bar', width=1, ec='k')
storm.losses.to_series().plot(kind='bar', width=1, color='tab:purple', ec='k')
<Axes: >

png

Estimate the basin response (flood hydrograph)

# Compute the basin SCS unit hydrograph for the storm (UH related to the storm timestep)
wshed = wshed.SynthUnitHydro(method='SCS', timestep=storm.timestep) # By default this uses the 484 SCS unit hydrograph. 

# Compute the flood hydrograph as the convolution of the design storm with the unit hydrograph
wshed.UnitHydro.convolve(storm.Effective_Hyetograph).plot()
<Axes: >

png

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

hydrocivil-1.0.0.tar.gz (13.5 MB view details)

Uploaded Source

Built Distribution

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

hydrocivil-1.0.0-py3-none-any.whl (13.5 MB view details)

Uploaded Python 3

File details

Details for the file hydrocivil-1.0.0.tar.gz.

File metadata

  • Download URL: hydrocivil-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for hydrocivil-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e9f5894ae44fd3cbea53008216a83faac4593901b0e1166ec9cca247f3084677
MD5 5f185bb0c5488db482daef975be6a9f7
BLAKE2b-256 31c1478ad0c209be89b2a81edc6b83e18406c6e5b539a1532603abbac8817ff4

See more details on using hashes here.

File details

Details for the file hydrocivil-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hydrocivil-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for hydrocivil-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ddf6c647467784f3e31a39aef309da4e99ce8f9c8ebe221b7bf915c5bb6853c
MD5 60899ff64cee3b28ff79e465a138aa6f
BLAKE2b-256 be96291d0b000131fe76897f8edd20842bd7b0987b735c3f88b8b76da980b140

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