Skip to content

Commit 0f7ac59

Browse files
Merge pull request #11 from supathdhitalGEO/main
adding workflows to build and test the code for packaging
2 parents 6e23937 + 9daf6ac commit 0f7ac59

File tree

7 files changed

+226
-171
lines changed

7 files changed

+226
-171
lines changed

.github/workflows/python-publish.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# GitHub Actions workflow to build, test, and upload a Python package to PyPI
2+
3+
name: Package Build and Test
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
release-build:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Build release distributions
25+
run: |
26+
python -m pip install build
27+
python -m build
28+
29+
- name: Upload distributions
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: release-dists
33+
path: dist/
34+
35+
# pypi-publish:
36+
# runs-on: ubuntu-latest
37+
# # needs: test-build
38+
39+
# permissions:
40+
# id-token: write
41+
42+
# steps:
43+
# - name: Retrieve built distributions
44+
# uses: actions/download-artifact@v4
45+
# with:
46+
# name: release-dists
47+
# path: dist/
48+
49+
# - name: Publish package to PyPI
50+
# uses: pypa/gh-action-pypi-publish@release/v1
51+
# with:
52+
# packages-dir: dist/

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fsdmlua%2FFIMserv&count_bg=%231A93AE&title_bg=%23E48A8A&icon=clyp.svg&icon_color=%23E7E7E7&title=Views&edge_flat=false)](https://hits.seeyoufarm.com)
88
[![PyPI version](https://badge.fury.io/py/fimserve.svg?icon=si%3Apython)](https://badge.fury.io/py/fimserve)
99
[![PyPI Downloads](https://static.pepy.tech/badge/fimserve)](https://pepy.tech/projects/fimserve)
10+
[![Publish Status](https://github.com/sdmlua/FIMserv/actions/workflows/python-publish.yml/badge.svg)](https://github.com/sdmlua/FIMserv/actions/workflows/python-publish.yml)
1011

1112

1213

dist/fimserve-0.1.72-py3-none-any.whl

37.8 KB
Binary file not shown.

dist/fimserve-0.1.72.tar.gz

34.3 KB
Binary file not shown.

poetry.lock

+169-167
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "fimserve"
3-
version = "0.1.71"
3+
version = "0.1.72"
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 = ["Supath Dhital <[email protected]>"]
66
license = "GPL-3.0"

src/fimserve/streamflowdata/forecasteddata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def processnetCDF(netcdf_file_path, filter_df, output_folder_path):
121121
merged_df.to_csv(output_csv_file_path, index=False)
122122

123123

124-
def ProcessForecasts(CSVFILES, forecast_date, hour, forecast_range, sort_by, data_dir):
124+
def ProcessForecasts(CSVFILES, forecast_date, hour, forecast_range, sort_by, data_dir, huc):
125125
merge_folder = os.path.join(CSVFILES, "mergedAndSorted")
126126
os.makedirs(merge_folder, exist_ok=True)
127127

@@ -173,7 +173,7 @@ def ProcessForecasts(CSVFILES, forecast_date, hour, forecast_range, sort_by, dat
173173
"%Y%m%d"
174174
)
175175

176-
sorted_file_name = f"{forecast_range}_{adjusted_date}_{adjusted_forecast_hour:02d}UTC.csv"
176+
sorted_file_name = f"{forecast_range}_{huc}_{adjusted_date}_{adjusted_forecast_hour:02d}UTC.csv"
177177
sorted_file_path = os.path.join(data_dir, sorted_file_name)
178178
original_file_path = os.path.join(CSVFILES, csv_file)
179179
os.rename(original_file_path, sorted_file_path)
@@ -288,7 +288,7 @@ def main(
288288
or forecast_range == "shortrange"
289289
):
290290
ProcessForecasts(
291-
CSVFILES, forecast_date, hour, forecast_range, sort_by, data_dir
291+
CSVFILES, forecast_date, hour, forecast_range, sort_by, data_dir, HUC
292292
)
293293
print(f"The final discharge values saved to {data_dir}")
294294
try:

0 commit comments

Comments
 (0)