Skip to content

Commit

Permalink
Add additive radar-CML merging with IDW and with Krignig, plus exampl…
Browse files Browse the repository at this point in the history
…e data (#3)

* docs/notebooks/data/openMRG_create.ipynb:
 - creates 5min aggregated CML, rain gauge and radar data for the openmerge dataset

src/mergeplg/merge.py:
 - first implementation of merging

src/mergeplg/interpolator.py and src/mergeplg/idw.py:
 - IDW interpolator functions from python

* docs/notebooks/openMRG_case.ipynb:
 - changed 'import mergeplg' to 'import mergeplg.merge'

src/mergeplg/idw.py:
 - replaced np.NaN with np.nan

src/mergeplg/interpolator.py and src/mergeplg/merge.py
 - changed idw import to relative import

* Added tests for calculate_cml_geometry and block_points_to_lengths

* Nox cleaning up sytax

* src/mergeplg/merge.py:
 - Move estimate_kriging_parameters to notebook.
 - Write docstrings to functions W.I.P.

* fixed typos in merge_additive_IDW

* updated notebook to run with changed funcitons

* renaming variables to nox standards

* renaming variables to nox standards

* updated idw interpolator after suggestions made by RUF

* disable mypy

* updated precommit after running nox

* delete chebank from top and fix file title, will need updates

* replace dataarray.values with .data

* clean up code according to nox

* fixing naming conventions according to nox

* spelling

* disable codespell and spellcheck

* disable --show diff on failure, this makes it possible to read output from nox without doing gid add for every step

* added sklearn to dependencies

* replaced IDW by sklearn KNeighborsRegressor

* changes before merge

* commit typos

* replaced config files with upstream verison

* replaced config files with upstream verison

* fix config files for environment

* Fix code syntax accoridng to pylint suggestions

* added dependencies

* updated notebook to run with RUFF complains and commented cnn wet dry detection

* rerun create notebook

* rerun notebook where CML with most rainfall is removed

* implemented tests for additive idw and blockkriging

* clean up RUFF complaints

* drop pypy from ci.yml
  • Loading branch information
eoydvin authored Sep 12, 2024
1 parent 92afa9a commit 573cd97
Show file tree
Hide file tree
Showing 12 changed files with 2,441 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
python-version: ["3.10", "3.11", "3.12"]
runs-on: [ubuntu-latest, windows-latest, macos-14]

include:
- python-version: "pypy-3.10"
runs-on: ubuntu-latest
#include:
# - python-version: "pypy-3.10"
# runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ repos:
rev: "v2.3.0"
hooks:
- id: codespell
args: ["--skip=*.ipynb"]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
Expand Down
697 changes: 697 additions & 0 deletions docs/notebooks/data/openMRG_create.ipynb

Large diffs are not rendered by default.

Binary file added docs/notebooks/data/openmrg_cml.nc
Binary file not shown.
Binary file added docs/notebooks/data/openmrg_municp_gauge.nc
Binary file not shown.
Binary file added docs/notebooks/data/openmrg_rad.nc
Binary file not shown.
Binary file added docs/notebooks/data/openmrg_smhi_gauge.nc
Binary file not shown.
1,185 changes: 1,185 additions & 0 deletions docs/notebooks/openMRG_case.ipynb

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ def lint(session: nox.Session) -> None:
"""Run the linter."""
session.install("pre-commit")
session.run(
"pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs
# "pre-commit", "run", "--all-files", "--show-diff-on-failure", *session.posargs
"pre-commit",
"run",
"--all-files",
*session.posargs,
)


Expand Down
15 changes: 14 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.10"
python = ">=3.10,<4.0.0"

furo = { version = ">=2023.08.17", optional = true }
myst_parser = { version = ">=0.13", optional = true }
Expand All @@ -38,6 +38,16 @@ docutils = { version = "!=0.21.post1", optional = true }
nbsphinx = { version = "*", optional = true }
nbmake = { version = ">=1.4.6", optional = true}

pykrige = ">=1.7.2"
poligrain = ">=0.1.0"
scipy = ">=1.14.0"
numpy = ">=2.0.1"
pandas = ">=2.2.2"
xarray = ">=2024.6.0"
wradlib = ">=2.0.3"
scikit-learn = ">=1.5.1"
scikit-gstat = ">=1.0.17"


[tool.poetry.dev-dependencies]
pytest = ">= 6"
Expand All @@ -56,6 +66,9 @@ docs = [
"nbsphinx",
]

[tool.poetry.group.dev.dependencies]
jupyterlab = "^4.2.4"

[tool.poetry-dynamic-versioning]
enable = true
substitution.files = ["src/mergeplg/__init__.py"]
Expand Down
Loading

0 comments on commit 573cd97

Please sign in to comment.