Skip to content

Commit cda8948

Browse files
classify the final FIM result
1 parent 2e38066 commit cda8948

36 files changed

Lines changed: 408 additions & 135 deletions

.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Byte-compiled / cache files
2+
__pycache__/
3+
*.py[cod]
4+
*.so
5+
6+
# Distribution / packaging
7+
build/
8+
*.egg-info/
9+
*.egg
10+
11+
# Virtual environments
12+
.venv/
13+
venv/
14+
env/
15+
16+
# Test / coverage
17+
.pytest_cache/
18+
.coverage
19+
htmlcov/
20+
21+
# Ruff
22+
.ruff_cache/
23+
24+
# Jupyter
25+
.ipynb_checkpoints/
26+
27+
# Environment variables
28+
.env
29+
30+
# Editors / OS
31+
.vscode/
32+
.idea/
33+
.DS_Store

CONTRIBUTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Contributing to FIMserv
2+
3+
Thank you for your interest in contributing to **FIMserv**! This tool is developed and maintained by the Surface Dynamics Modeling Lab (SDML) at The University of Alabama. Contributions of all kinds are welcome — bug reports, feature requests, documentation improvements, and code.
4+
5+
## Getting Started
6+
7+
1. **Fork** the repository on GitHub and clone your fork:
8+
9+
```bash
10+
git clone https://github.com/<your-username>/FIMserv.git
11+
cd FIMserv
12+
```
13+
14+
2. **Create a virtual environment** (recommended) and install the package in editable mode with the development dependencies:
15+
16+
```bash
17+
conda create --name fimserve python==3.10
18+
conda activate fimserve
19+
20+
pip install -e ".[dev]"
21+
```
22+
23+
3. **Create a branch** for your change:
24+
25+
```bash
26+
git checkout -b my-feature
27+
```
28+
29+
## Code Style and Linting
30+
31+
This project uses [Ruff](https://docs.astral.sh/ruff/) for linting and formatting. The configuration lives in `pyproject.toml`.
32+
33+
Before opening a pull request, run:
34+
35+
```bash
36+
# Lint the codebase (auto-fix what is safe to fix)
37+
ruff check src tests --fix
38+
39+
# Format the codebase
40+
ruff format src tests
41+
```
42+
43+
Both commands must pass cleanly for a pull request to be accepted.
44+
45+
## Running Tests
46+
47+
Tests are written with [pytest](https://docs.pytest.org/) and live in the `tests/` directory:
48+
49+
```bash
50+
pytest
51+
```
52+
53+
Please add or update tests for any code you change, and make sure the existing test suite still passes.
54+
55+
## Submitting a Pull Request
56+
57+
1. Keep pull requests focused — one feature or fix per PR.
58+
2. Write a clear description of **what** the change does and **why** it is needed.
59+
3. Make sure `ruff check`, `ruff format --check`, and `pytest` all pass.
60+
4. Reference any related issues (e.g., `Fixes #123`).
61+
62+
## Reporting Issues
63+
64+
Found a bug or have a feature request? Please open an issue at
65+
[github.com/sdmlua/FIMserv/issues](https://github.com/sdmlua/FIMserv/issues) and include:
66+
67+
- A clear description of the problem or request
68+
- Steps to reproduce (for bugs), including the HUC8 ID and date range used
69+
- Your Python version and operating system
70+
71+
## Contact
72+
73+
- Dr. Sagy Cohen (sagy.cohen@ua.edu)
74+
- Dr. Anupal Baruah (abaruah@ua.edu)
75+
- Supath Dhital (sdhital@crimson.ua.edu)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<a href="https://opensource.org/licenses/GPL-3.0"><img src="https://img.shields.io/badge/License-GPLv3-blue.svg" alt="License: GPL v3" /></a><br>
88
<a href="https://badge.fury.io/py/fimserve"><img src="https://badge.fury.io/py/fimserve.svg?icon=si%3Apython" alt="PyPI version" /></a>
99
<a href="https://pepy.tech/projects/fimserve"><img src="https://static.pepy.tech/badge/fimserve" alt="PyPI Downloads" /></a>
10+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff" /></a>
1011
</p>
1112
</div>
1213

@@ -21,7 +22,7 @@
2122
### **Background**
2223
<hr style="border: 1px solid black; margin: 0;">
2324

24-
OWP HAND-FIM is a national-scale operational flood forecasting framework (https://github.com/NOAA-OWP/inundation-mapping). It is a terrain-based fluvial flooding model that uses model-predicted streamflow and reach-averaged Synthetic Rating Curves (SRCs) to generate inundation extent and depth rasters at HUC-8 scale (Hydrologic Unit Code-8). The model can produce FIMs for all order streams within the watershed at a very low computational cost. This notebook streamline the FIM generation process or the OWP HAND-FIM framework on the cloud. It allow users to run over mutiple HUC-8s simultaneously. This model can run using any temporal resolution available from the input streamflow data (hourly, daily, monthly etc). ### **Currently we are hosting the FIM-4.5 and 4.8 version for Inundation Mapping.Based on user's choice HAND rasters from specific version can be called and used in FIM (Please refer to Step-1)**
25+
OWP HAND-FIM is a national-scale operational flood forecasting framework (https://github.com/NOAA-OWP/inundation-mapping). It is a terrain-based fluvial flooding model that uses model-predicted streamflow and reach-averaged Synthetic Rating Curves (SRCs) to generate inundation extent and depth rasters at HUC-8 scale (Hydrologic Unit Code-8). The model can produce FIMs for all order streams within the watershed at a very low computational cost. This notebook streamline the FIM generation process or the OWP HAND-FIM framework on the cloud. It allow users to run over mutiple HUC-8s simultaneously. This model can run using any temporal resolution available from the input streamflow data (hourly, daily, monthly etc). **Currently we are hosting the FIM-4.5 and 4.8 version for Inundation Mapping.** Based on user's choice HAND rasters from specific version can be called and used in FIM (Please refer to Step-1)
2526

2627
### **Package structures**
2728
<hr style="border: 1px solid black; margin: 0;">
88.9 KB
Binary file not shown.

dist/fimserve-0.1.2.tar.gz

83.5 KB
Binary file not shown.

pyproject.toml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "fimserve"
3-
version = "0.1.98"
3+
version = "0.1.2"
44
description = "Framework which is developed with the purpose of quickly generating Flood Inundation Maps (FIM) for emergency response and risk assessment. It is developed under Surface Dynamics Modeling Lab (SDML)."
55
authors = [{ name = "Supath Dhital", email = "sdhital@crimson.ua.edu" }]
66
maintainers = [{ name = "Supath Dhital", email = "sdhital@crimson.ua.edu" }]
@@ -43,7 +43,7 @@ dev = [
4343
"pytest>=8.3,<8.4",
4444
"sphinx<7.0",
4545
"sphinx-autobuild>=2024.10.3",
46-
"black"
46+
"ruff>=0.15"
4747
]
4848

4949
# Install with: pip install "fimserve[sm]"
@@ -73,3 +73,15 @@ exclude = ["tests*"]
7373
minversion = "6.0"
7474
addopts = "-ra -q"
7575
testpaths = ["tests"]
76+
77+
[tool.ruff]
78+
line-length = 88
79+
extend-exclude = ["docs", "GeoGLOWS", "*.ipynb"]
80+
81+
[tool.ruff.lint]
82+
# E402/F403/F405: module-level star imports and late imports are part of the
83+
# package's existing style. F841 fixes are unsafe and left for manual cleanup.
84+
ignore = ["E402", "F403", "F405", "F841"]
85+
86+
[tool.ruff.lint.per-file-ignores]
87+
"__init__.py" = ["F401"]

src/fimserve/FIMsubset/shpsubset.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import os
2-
import glob
32
import rasterio
43
from rasterio.mask import mask
54
from pathlib import Path
65
import geopandas as gpd
76

8-
from ..datadownload import setup_directories
9-
107

118
def checkSHP(input_file):
129
if isinstance(input_file, Path):

src/fimserve/FIMsubset/xycoord.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import glob
33
import geopandas as gpd
44
from shapely.geometry import Point
5-
from pyproj import CRS
65
import rasterio
76
from rasterio.mask import mask
87

src/fimserve/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import warnings
22

3-
from fimserve.fimevaluation.fims_setup import fim_lookup
4-
53
warnings.simplefilter("ignore")
64

75
from .datadownload import DownloadHUC8
@@ -65,7 +63,7 @@ def getpopulation_exposure(*args, **kwargs):
6563

6664
__all__ = [
6765
"DownloadHUC8",
68-
"getNWMRetrospectivedata",
66+
"getNWMretrospectivedata",
6967
"runOWPHANDFIM",
7068
"getNWMForecasteddata",
7169
"getGEOGLOWSstreamflow",

src/fimserve/datadownload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def DownloadHUC8(huc, stream_order=None, version=None):
156156
EnvFile(code_dir)
157157
HUC_dir = os.path.join(output_dir, f"flood_{huc}")
158158
hydrotable_dir = os.path.join(HUC_dir, str(huc), "hydrotable.csv")
159-
featureID_dir = os.path.join(HUC_dir, f"feature_IDs.csv")
159+
featureID_dir = os.path.join(HUC_dir, "feature_IDs.csv")
160160
if stream_order is None:
161161
uniqueFID(hydrotable_dir, featureID_dir)
162162
else:

0 commit comments

Comments
 (0)