Skip to content

Commit

Permalink
Refactor steps in blending code (#453)
Browse files Browse the repository at this point in the history
* Refactored all names in the steps blending code from old to new

* Made some name changes but test still do not pass

* Fixed naming changes, now the tests pass

* Built the rough scaffolding for the blending class

* Refactored untill no rain case

* Added code to estimation of ar parameters of radar

* Next go, start with forecast loop #7

* Added some uniformity between nowcast and blending steps. Now at # 8.4 for the refactoring

* Small changes since prev commit

* All code is tranfered. Last part of the main loop needs to be refactored

* Everything is refactored, no test ran as of yet

* Old forecast function is updated to fit newly refactored code

* Removed old code which is no longer used

* 6 more tests that fail

* All tests pass, still need to fix TODOs

* Updated gitignore

* Cleanup of params and state dataclasses, next step: better typing

* Cleanup of params and state dataclasses, now all tests pass

* Added correct typing to all parts of params and state

* Ready for pull request

* Made changes for Codacy review

* Added aditional tests which currently fail in master branch

* Update .gitignore

Co-authored-by: mats-knmi <145579783+mats-knmi@users.noreply.github.com>

* Used the __zero_precip_time in __zero_precipitation_forecast()

* Changed typing hints to python 3.10+ version

* Added comments back to the State dataclass

* Changed the self.__state.velocity_perturbations = [] to self.__params.velocity_perturbations = [] in __initialize_random_generators

* Added code changes as suggested by Ruben, comments and documentation to come later

* Added frozen functionality to dataclasses, removed reset_state and fixed seed assingments

* Added frozen dataclass to nowcast

* The needed checks are done for this TODO so it can be removed

* Use the seed in all rng in blending code (#449)

* Use seed for all rng to make a test run completely deterministic

* fix probmatching test and some copy paste oversights

* Add test for vel_pert_method

* Change the test so that it actually runs the lines that need to be covered

* Removed deepcopy of worker_state. The state is now accessable to all workers at the same time

* Update to probmatching comments to keep in track with main

* Fix for multithreading issue, this produces exactly the same results as the master

* Added additional documentation

* Bump version

* Updates some files that do not pass the new black version

* Updated examples to work with new black version

---------

Co-authored-by: mats-knmi <145579783+mats-knmi@users.noreply.github.com>
  • Loading branch information
sidekock and mats-knmi authored Feb 3, 2025
1 parent a7dae54 commit 92deda1
Show file tree
Hide file tree
Showing 13 changed files with 2,908 additions and 1,961 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ venv.bak/

# Mac OS Stuff
.DS_Store

# Running local tests
/tmp
/pysteps/tests/tmp/
2 changes: 1 addition & 1 deletion PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: pysteps
Version: 1.13.0
Version: 1.14.0
Summary: Python framework for short-term ensemble prediction systems
Home-page: http://pypi.python.org/pypi/pysteps/
License: LICENSE
Expand Down
2 changes: 1 addition & 1 deletion examples/advection_correction.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Advection correction is a temporal interpolation procedure that is often used
when estimating rainfall accumulations to correct for the shift of rainfall patterns
between consecutive radar rainfall maps. This shift becomes particularly
between consecutive radar rainfall maps. This shift becomes particularly
significant for long radar scanning cycles and in presence of fast moving
precipitation features.
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_cascade_decomposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Cascade decomposition
=====================
This example script shows how to compute and plot the cascade decompositon of
This example script shows how to compute and plot the cascade decompositon of
a single radar precipitation field in pysteps.
"""
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_ensemble_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Ensemble verification
=====================
In this tutorial we perform a verification of a probabilistic extrapolation nowcast
In this tutorial we perform a verification of a probabilistic extrapolation nowcast
using MeteoSwiss radar data.
"""
Expand Down
2 changes: 1 addition & 1 deletion examples/plot_extrapolation_nowcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Extrapolation nowcast
=====================
This tutorial shows how to compute and plot an extrapolation nowcast using
This tutorial shows how to compute and plot an extrapolation nowcast using
Finnish radar data.
"""
Expand Down
4 changes: 2 additions & 2 deletions examples/plot_optical_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Optical flow
============
This tutorial offers a short overview of the optical flow routines available in
pysteps and it will cover how to compute and plot the motion field from a
This tutorial offers a short overview of the optical flow routines available in
pysteps and it will cover how to compute and plot the motion field from a
sequence of radar images.
"""

Expand Down
Loading

0 comments on commit 92deda1

Please sign in to comment.