Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Streamflow outputs that cause a NaN #12

Merged
merged 4 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/marquette.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Marquette
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Python](https://img.shields.io/pypi/pyversions/msmhelper)]()

![image](https://github.com/taddyb/marquette/assets/16233925/4a7b8745-7576-4150-bf4a-9469d44a9425)

A river mapping library to take .shp files and create River Network CSVs

## Quick Start
1. clone
2. set up env from `environment.yml`
3. put your data files into the `data/` folder (if it's not there, then create it), then reference them from your config
## Quick Start:
1. `conda create -n marquette python=3.11`
2. `conda activate marquette`
3. `pip install -r requirements.txt`

6 changes: 4 additions & 2 deletions marquette/merit/_streamflow_conversion_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def calculate_merit_flow(cfg: DictConfig) -> None:
streamflow_predictions_root = zarr.open(
Path(cfg.create_streamflow.predictions), mode="r"
)
log.info("Reading Zarr Store")
runoff = streamflow_predictions_root.Runoff[:]

log.info("Creating areas areas_array")
Expand All @@ -139,8 +140,9 @@ def calculate_merit_flow(cfg: DictConfig) -> None:

log.info("Converting runoff data")
streamflow_m3_s_data = runoff * areas_array
mask = np.any(np.isnan(runoff), axis=0)
streamflow_m3_s_data[:, mask] = 0.0
streamflow_m3_s_data = np.nan_to_num(
streamflow_m3_s_data, nan=1e-6, posinf=1e-6, neginf=1e-6
)

date_range = pd.date_range(
start=cfg.create_streamflow.start_date,
Expand Down
Loading