Skip to content

Commit

Permalink
Merge pull request #188 from akrherz/230620
Browse files Browse the repository at this point in the history
Omnibus
  • Loading branch information
akrherz committed Jul 3, 2023
2 parents ec7a6ee + 9d65fd9 commit 12d7306
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 41 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
**/*.pdf
**/*.xlsx
**/*.txt
**/*.pptx
/.vscode
prj2wepp/wepp/hill.slp
prj2wepp/wepp/data/managements
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.272"
rev: "v0.0.275"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
4 changes: 3 additions & 1 deletion scripts/cligen/daily_clifile_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from scipy.interpolate import NearestNDInterpolator
from tqdm import tqdm

gdal.UseExceptions()
LOG = logger()
CENTRAL = ZoneInfo("America/Chicago")
UTC = datetime.timezone.utc
Expand Down Expand Up @@ -222,7 +223,8 @@ def qc_precip(data, valid, xtile, ytile, tile_bounds):
bring it to near the stage IV value.
"""
hires_total = np.sum(data["precip"], 2)
if valid.year >= 2015:
# Only do this check for tiles west of -101, likely too crude for east
if valid.year >= 2015 and xtile < 5:
# Do an assessment of the hires_total (A2M MRMS), it may have too many
# zeros where stage IV has actual data.
a2m_zeros = hires_total < 0.01
Expand Down
38 changes: 0 additions & 38 deletions scripts/cligen/print_rate.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/pydep/io/wepp.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def intensity(times, points, compute_intensity_over) -> dict:
return entry

# Rectify times to integer minutes
times = (np.array(times) * 60.0).astype(int)
times = (np.array(times) * 60.0).round(0)
# Resample to every minute
df = (
pd.DataFrame({"pcpn": points}, index=times)
Expand Down
9 changes: 9 additions & 0 deletions tests/io/test_wepp.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ def get_path(name):
return os.path.join(basedir, "..", "data", name)


def test_intensity_rounding():
"""Test we can handle time resolution pain."""
times = [5.73, 23.9667, 23.9833]
points = [0.0, 12.62, 14.0]
res = intensity(times, points, [10, 20])
assert abs(res["i10_mm"] - 1.48) < 0.01
assert abs(res["i20_mm"] - 1.6) < 0.01


def test_intensity():
"""Test basic intensity calculations."""
times = [0.5, 1.5]
Expand Down

0 comments on commit 12d7306

Please sign in to comment.