watershed-delineation


Namewatershed-delineation JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryA Python package for delineating watersheds from a DEM and pour point.
upload_time2025-08-24 07:52:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords hydrology watershed gis geospatial whitebox-tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Watershed Delineation

A Python package for automatic watershed delineation from a Digital Elevation Model (DEM) and a pour point (longitude & latitude).  
It uses [WhiteboxTools](https://github.com/jblindsay/whitebox-tools), [GeoPandas](https://geopandas.org/), and [Rasterio](https://rasterio.readthedocs.io/) to perform hydrologic analysis and export shapefiles with watershed attributes.

---

## 📦 Installation

```bash
pip install watershed-delineation
```

Requirements: Python 3.9 or later. Dependencies like `rasterio` and `geopandas` ship wheels for most platforms, but a recent `pip` is recommended.

---

## 🚀 Usage

### From Python

```python
from watershed_delineation.core import delineate_watershed

# Input parameters
dem_path = r"F:\data\dem.tif"
pour_lon = 32.561170
pour_lat = 39.835840
output_dir = r"C:\results"
watershed_name = "my_basin"

# Run delineation
result_path = delineate_watershed(
    dem_path=dem_path,
    pour_lon=pour_lon,
    pour_lat=pour_lat,
    output_dir=output_dir,
    name=watershed_name,
    export_lfp=True   # also export Longest Flow Path
)

print("Watershed shapefile saved at:", result_path)
```

---

### From the Command Line

After installation, run:

```bash
delineate_watershed "F:\data\dem.tif" 32.561170 39.835840 -o "C:\results" -n "my_basin" --export-lfp
```

Arguments:

- `dem_file` → Path to DEM raster (`.tif`)
- `pour_lon` → Longitude of pour point
- `pour_lat` → Latitude of pour point
- `-o`, `--output` → Output directory (default: current dir)
- `-n`, `--name` → Base name of shapefile (default: watershed_lat_lon)
- `--export-lfp` → Export Longest Flow Path shapefile

---

## 📂 Output

- **`my_basin.shp`** → Watershed polygon shapefile with attributes:
  - Area, perimeter
  - Longest flow path length
  - Form factor, circularity ratio
  - Elevation statistics (min, max, mean)
  - Mean slope
  - Drainage density
  - Pour point coordinates

- **`my_basin_lfp.shp`** *(optional)* → Longest flow path polyline shapefile

---

## 🛠 Development

Clone and install in editable mode:

```bash
git clone https://github.com/fyec/watershed-delineation.git
cd watershed-delineation
pip install -e .
```

Rebuild after code changes with:

```bash
python -m build
```

---

## 📌 Project Links

- [Homepage](https://github.com/fyec/watershed-delineation)  
- [Bug Tracker](https://github.com/fyec/watershed-delineation/issues)

---

## 👤 Author

Developed by **FYEC**  
Date: August 2025  
License: MIT

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "watershed-delineation",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "hydrology, watershed, gis, geospatial, whitebox-tools",
    "author": null,
    "author_email": "FYEC <f.yunusemre@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/da/a4/d953a079d62010e4b34a7b8e966e78a3bb91ed8af9e4561fc8e7e1a0e8b0/watershed_delineation-0.1.1.tar.gz",
    "platform": null,
    "description": "# Watershed Delineation\r\n\r\nA Python package for automatic watershed delineation from a Digital Elevation Model (DEM) and a pour point (longitude & latitude).  \r\nIt uses [WhiteboxTools](https://github.com/jblindsay/whitebox-tools), [GeoPandas](https://geopandas.org/), and [Rasterio](https://rasterio.readthedocs.io/) to perform hydrologic analysis and export shapefiles with watershed attributes.\r\n\r\n---\r\n\r\n## \ud83d\udce6 Installation\r\n\r\n```bash\r\npip install watershed-delineation\r\n```\r\n\r\nRequirements: Python 3.9 or later. Dependencies like `rasterio` and `geopandas` ship wheels for most platforms, but a recent `pip` is recommended.\r\n\r\n---\r\n\r\n## \ud83d\ude80 Usage\r\n\r\n### From Python\r\n\r\n```python\r\nfrom watershed_delineation.core import delineate_watershed\r\n\r\n# Input parameters\r\ndem_path = r\"F:\\data\\dem.tif\"\r\npour_lon = 32.561170\r\npour_lat = 39.835840\r\noutput_dir = r\"C:\\results\"\r\nwatershed_name = \"my_basin\"\r\n\r\n# Run delineation\r\nresult_path = delineate_watershed(\r\n    dem_path=dem_path,\r\n    pour_lon=pour_lon,\r\n    pour_lat=pour_lat,\r\n    output_dir=output_dir,\r\n    name=watershed_name,\r\n    export_lfp=True   # also export Longest Flow Path\r\n)\r\n\r\nprint(\"Watershed shapefile saved at:\", result_path)\r\n```\r\n\r\n---\r\n\r\n### From the Command Line\r\n\r\nAfter installation, run:\r\n\r\n```bash\r\ndelineate_watershed \"F:\\data\\dem.tif\" 32.561170 39.835840 -o \"C:\\results\" -n \"my_basin\" --export-lfp\r\n```\r\n\r\nArguments:\r\n\r\n- `dem_file` \u2192 Path to DEM raster (`.tif`)\r\n- `pour_lon` \u2192 Longitude of pour point\r\n- `pour_lat` \u2192 Latitude of pour point\r\n- `-o`, `--output` \u2192 Output directory (default: current dir)\r\n- `-n`, `--name` \u2192 Base name of shapefile (default: watershed_lat_lon)\r\n- `--export-lfp` \u2192 Export Longest Flow Path shapefile\r\n\r\n---\r\n\r\n## \ud83d\udcc2 Output\r\n\r\n- **`my_basin.shp`** \u2192 Watershed polygon shapefile with attributes:\r\n  - Area, perimeter\r\n  - Longest flow path length\r\n  - Form factor, circularity ratio\r\n  - Elevation statistics (min, max, mean)\r\n  - Mean slope\r\n  - Drainage density\r\n  - Pour point coordinates\r\n\r\n- **`my_basin_lfp.shp`** *(optional)* \u2192 Longest flow path polyline shapefile\r\n\r\n---\r\n\r\n## \ud83d\udee0 Development\r\n\r\nClone and install in editable mode:\r\n\r\n```bash\r\ngit clone https://github.com/fyec/watershed-delineation.git\r\ncd watershed-delineation\r\npip install -e .\r\n```\r\n\r\nRebuild after code changes with:\r\n\r\n```bash\r\npython -m build\r\n```\r\n\r\n---\r\n\r\n## \ud83d\udccc Project Links\r\n\r\n- [Homepage](https://github.com/fyec/watershed-delineation)  \r\n- [Bug Tracker](https://github.com/fyec/watershed-delineation/issues)\r\n\r\n---\r\n\r\n## \ud83d\udc64 Author\r\n\r\nDeveloped by **FYEC**  \r\nDate: August 2025  \r\nLicense: MIT\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package for delineating watersheds from a DEM and pour point.",
    "version": "0.1.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/fyec/watershed-delineation/issues",
        "Homepage": "https://github.com/fyec/watershed-delineation"
    },
    "split_keywords": [
        "hydrology",
        " watershed",
        " gis",
        " geospatial",
        " whitebox-tools"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b0027ce5914cf203352f65810302cf2be2ef03b3f969ad2fd0c476256dfc114a",
                "md5": "4b28df9a2f29222643fcaff5e3615e11",
                "sha256": "c3d22f6da85fd8dd0999a81651d9cf63795b085999b0384fc63d2f58bb3a04a5"
            },
            "downloads": -1,
            "filename": "watershed_delineation-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4b28df9a2f29222643fcaff5e3615e11",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8159,
            "upload_time": "2025-08-24T07:52:13",
            "upload_time_iso_8601": "2025-08-24T07:52:13.992250Z",
            "url": "https://files.pythonhosted.org/packages/b0/02/7ce5914cf203352f65810302cf2be2ef03b3f969ad2fd0c476256dfc114a/watershed_delineation-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "daa4d953a079d62010e4b34a7b8e966e78a3bb91ed8af9e4561fc8e7e1a0e8b0",
                "md5": "382054e657de827a5239b7bb7a6943a1",
                "sha256": "80634f761fb5abbea575c45080812c40513b7accc49d555a5b6d87aa8d2187c8"
            },
            "downloads": -1,
            "filename": "watershed_delineation-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "382054e657de827a5239b7bb7a6943a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8776,
            "upload_time": "2025-08-24T07:52:14",
            "upload_time_iso_8601": "2025-08-24T07:52:14.829046Z",
            "url": "https://files.pythonhosted.org/packages/da/a4/d953a079d62010e4b34a7b8e966e78a3bb91ed8af9e4561fc8e7e1a0e8b0/watershed_delineation-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-24 07:52:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "fyec",
    "github_project": "watershed-delineation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "watershed-delineation"
}
        
Elapsed time: 0.96264s