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

Main module blending #233

Merged
merged 96 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
b01fac3
First basic functions to implement STEPS blending
cvelascof Apr 3, 2019
236fb2e
Add compute of blend means,sigmas and recompose
cvelascof Apr 5, 2019
d38e26d
Merge branch 'master' into steps_blending
cvelascof Jul 13, 2021
92b8ecc
Merge branch 'master' into steps_blending
dnerini Jul 26, 2021
0082738
pysteps.io with xarray (#219)
dnerini Aug 4, 2021
3802f8d
Merge branch 'master' into pysteps-v2
dnerini Aug 8, 2021
f5750b0
Merge branch 'master' into steps_blending
RubenImhoff Aug 9, 2021
b58d806
Add blend_optical_flow
cvelascof Aug 10, 2021
6b1de65
Merge branch 'steps_blending' of github.com:pySTEPS/pysteps into step…
cvelascof Aug 10, 2021
a568e4a
changes to steps blending procedure - weights according to adjusted B…
RubenImhoff Aug 10, 2021
fff9c7e
changes to blending procedures - adjust weights from original BPS2006…
RubenImhoff Aug 10, 2021
b209139
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 10, 2021
1552a47
Determine spatial correlation of NWP model forecast
RubenImhoff Aug 11, 2021
0c3a260
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 11, 2021
912282b
First attempt to make correlations and thus weights lead time depende…
RubenImhoff Aug 11, 2021
5209631
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 11, 2021
2c2b807
Merge remote-tracking branch 'origin/pysteps-v2' into steps_blending
RubenImhoff Aug 12, 2021
29a6450
Merge remote-tracking branch 'origin/pysteps-v2' into steps_blending_RI
RubenImhoff Aug 12, 2021
ce46582
Change back to original BPS2006 blending formulation and add regressi…
RubenImhoff Aug 12, 2021
193d90f
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 12, 2021
1b15c4b
Reformat code with Black
RubenImhoff Aug 12, 2021
94995cf
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 12, 2021
add0931
Skill score script imports climatological correlation-values from fil…
RubenImhoff Aug 13, 2021
029a9a9
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 13, 2021
79a4e61
Small changes to skill score script
RubenImhoff Aug 13, 2021
624bc7c
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 13, 2021
694c9d3
Add skill score tests and an interface
RubenImhoff Aug 16, 2021
6e3db59
Add skill score tests and an interface
RubenImhoff Aug 16, 2021
6feec67
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 16, 2021
1fe5ff3
Small change to docstring
RubenImhoff Aug 16, 2021
2dfd531
Merge branch 'steps_blending_RI' into steps_blending
RubenImhoff Aug 16, 2021
2b8ee58
Bom import xarray (#228)
cvelascof Aug 17, 2021
c6368ab
Functions to store and compute climatological weights (#231)
ladc Aug 18, 2021
4b2ca89
Merge remote-tracking branch 'origin/pysteps-v2' into steps_blending
RubenImhoff Aug 18, 2021
ec65725
Main blending module, first steps
RubenImhoff Aug 24, 2021
3fa773d
Add simple tests
RubenImhoff Aug 24, 2021
f9ed749
Minor changes to tester: velocity now based on rainfall field of NWP
RubenImhoff Aug 24, 2021
81e88fe
Add utilities to decompose, store and load NWP cascades for use in bl…
ladc Aug 25, 2021
56bd0e9
Add importer for RMI NWP data (#234)
ladc Aug 25, 2021
e39e025
Merge branch 'pysteps-v2' into steps_blending
ladc Aug 25, 2021
d86cd7b
Add KNMI Harmonie NWP netcdf importer and tests (#235)
RubenImhoff Aug 25, 2021
f9f09ae
Merge branch 'pysteps-v2' into steps_blending
ladc Aug 25, 2021
296ef53
Changes to v_models to make use of multiple timesteps. Changes in the…
RubenImhoff Aug 25, 2021
4d1fb51
Fixes for KNMI importer:
ladc Aug 25, 2021
779ff18
Merge branch 'pysteps-v2' into steps_blending
ladc Aug 25, 2021
e9059cb
Avoid shadowing of pysteps.blending.utils by pysteps.utils
ladc Aug 26, 2021
cf2d585
First attempt for probability matching and masking utility; part 1
RubenImhoff Aug 26, 2021
7e30217
Changes to prob matching and masking methods; part 2
RubenImhoff Aug 27, 2021
40bdd69
Prob matching and masking changes; part 3. Ready for testing with rea…
RubenImhoff Sep 2, 2021
01ef1e6
Remove unnecessary print statements
RubenImhoff Sep 2, 2021
fb3ab19
Cleanup imports
dnerini Sep 15, 2021
5566c1e
More cleanup
dnerini Sep 15, 2021
5c26e10
Update docstrings
dnerini Sep 15, 2021
a763b59
Merge pull request #11 from pySTEPS/steps_blending
RubenImhoff Sep 28, 2021
8ddeeb2
RMI importer for gallery example (will follow)
RubenImhoff Oct 1, 2021
a101e55
Merge branch 'master' into pysteps-v2
dnerini Oct 5, 2021
bccb8fc
Reprojection functionality (#236)
RubenImhoff Oct 5, 2021
d1b1ac4
Merge branch 'main_module_blending' into pysteps-v2
RubenImhoff Oct 6, 2021
9ff3970
Merge pull request #12 from pySTEPS/pysteps-v2
RubenImhoff Oct 6, 2021
ce65906
Fixes in nwp importers
RubenImhoff Oct 6, 2021
2c639f8
Merge branch 'steps_blending' into pysteps-v2
RubenImhoff Oct 11, 2021
a342b02
Revert "Merge branch 'steps_blending' into pysteps-v2" (#239)
RubenImhoff Oct 11, 2021
82a9d18
Merge latest version pysteps-v2 into steps_blending branch (#237)
RubenImhoff Oct 11, 2021
cfcb572
NWP skill calculation only within radar domain
RubenImhoff Oct 11, 2021
b432013
Merge branch 'master' into pysteps-v2
dnerini Oct 12, 2021
c831878
Update docs
RubenImhoff Oct 15, 2021
64a0a37
resolve conflicts
RubenImhoff Oct 15, 2021
85807ca
Add example for gallery examples
RubenImhoff Oct 15, 2021
faa8396
Fix docstrings example
RubenImhoff Oct 15, 2021
671592b
Remove additional normalization step
RubenImhoff Oct 19, 2021
41f69b7
Fixes for the tests
RubenImhoff Oct 19, 2021
b367608
update docs
RubenImhoff Oct 19, 2021
7648372
changes to post-processing rainfall field and docstrings
RubenImhoff Oct 20, 2021
9b72689
Update contributing guidelines (#241)
aperezhortal Oct 25, 2021
9aba683
Advect noise cascade
RubenImhoff Oct 25, 2021
048fd88
Allow for moving domain mask of extrapolation component
RubenImhoff Nov 2, 2021
1b8d952
minor fixes
RubenImhoff Nov 2, 2021
d30b07e
Linear blending (#229)
wdewettin Nov 3, 2021
63ec111
merge pysteps-v2
RubenImhoff Nov 3, 2021
053edf4
weights calculation adjustment outside radar domain if only one model…
RubenImhoff Nov 3, 2021
dabd10b
allow for mirroring of advected noise cascade
RubenImhoff Nov 3, 2021
ae6b826
implementation of weights following Seed et al. (2013)
RubenImhoff Nov 17, 2021
d8ba4ea
Allow for decomposed NWP precip and NWP velocity fields: part 2
RubenImhoff Dec 2, 2021
daf1998
Store decomposed fields with compression
RubenImhoff Dec 2, 2021
4479e69
changes after first review Daniele
RubenImhoff Dec 8, 2021
ac4363b
Remove unnecessary print statement
RubenImhoff Dec 8, 2021
60cc1ea
fixes to blending utils and implementation of blending utils tests
RubenImhoff Dec 10, 2021
dc05cb9
remove unnecessary lines
RubenImhoff Dec 10, 2021
9ef4052
Fix one time step shift of extrapolation skill prior to blending
RubenImhoff Dec 16, 2021
855935b
minor changes to blending climatology, blending weights and remove pa…
RubenImhoff Dec 20, 2021
9391c90
Make NWP forecast decomposition prior to blending function optional
RubenImhoff Dec 20, 2021
760f2bf
Use pathlib
dnerini Dec 22, 2021
b84191b
Extract methods
dnerini Dec 22, 2021
a036e0f
Minor changes to docstrings
RubenImhoff Jan 3, 2022
fd04a39
Merge pull request #13 from RubenImhoff/refactor-blending
RubenImhoff Jan 10, 2022
dddf02e
Access climatological skill file for multiple NWP model and date stri…
RubenImhoff Jan 13, 2022
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
Prev Previous commit
Next Next commit
Merge latest version pysteps-v2 into steps_blending branch (#237)
* Update docstrings

* More cleanup

* Cleanup imports

* Cleanup imports

* More cleanup

* Update docstrings

* Update references

Mention the work of Ravuri et al (2021, Nature) as an example of work using cGANs to generate ensembles

* Clean up page

* Reprojection functionality (#236)

* Added Lesley's reprojection module to this branch

* Added compatibility for three-dimensional xarrays

* Add commentary to reprojection util

* Changes to make reprojection of KNMI data possible

* Changes after Daniele's review

* Add dependencies

* Changes to importers, see issue #215

* Add tests

* Fix some issues

* documentation

* Fixes for tests

* Set requirements again

* Some fixes

* Changes to nwp_importers after Carlos' response

* Remove wrong example script

* Remove rasterio dependencies from lists

* First try to prevent testing error

* Changes Daniele and fix knmi nwp importer

* Add rasterio to tox.ini

* Aesthetics

* rasterio import test

* Add rasterio to the test dependencies

* Reset try-except functionality for rasterio import

* Fix for failing test on windows python 3.6

* add importerskip rasterio

Co-authored-by: Wout Dewettinck <wout.dewettinck@ugent.be>

* Revert "Merge branch 'steps_blending' into pysteps-v2" (#239)

This reverts commit 2c639f8, reversing
changes made to bccb8fc.

Co-authored-by: ned <daniele.nerini@meteoswiss.ch>
Co-authored-by: dnerini <daniele.nerini@gmail.com>
Co-authored-by: Wout Dewettinck <wout.dewettinck@ugent.be>
  • Loading branch information
4 people authored Oct 11, 2021
commit 82a9d1896f8dbbd031a8b9b40dde33812b715ea1
2 changes: 1 addition & 1 deletion .github/workflows/test_pysteps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test Pysteps

env:
MINIMAL_DEPENDENCIES: cython numpy jsmin jsonschema matplotlib netCDF4 opencv pillow pyproj scipy dask
OPTIONAL_DEPENDENCIES: pyfftw cartopy h5py PyWavelets pandas scikit-image
OPTIONAL_DEPENDENCIES: pyfftw cartopy h5py PyWavelets pandas scikit-image rasterio
TEST_DEPENDENCIES: pytest pytest-cov

on:
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,3 @@ venv.bak/

# mypy
.mypy_cache/

# example data
examples/radar/
2 changes: 1 addition & 1 deletion doc/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Additional requeriments related to the documentation build only
# Additional requirements related to the documentation build only
sphinx
numpydoc
sphinxcontrib.bibtex
Expand Down
1 change: 1 addition & 0 deletions doc/source/pysteps_reference/utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Implementation of miscellaneous utility functions.
.. automodule:: pysteps.utils.spectral
.. automodule:: pysteps.utils.tapering
.. automodule:: pysteps.utils.transformation
.. automodule:: pysteps.utils.reprojection
11 changes: 11 additions & 0 deletions doc/source/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,17 @@ @ARTICLE{RC2011
YEAR=2011
}

@ARTICLE{Ravuri2021,
AUTHOR = "Ravuri, Suman and Lenc, Karel and Willson, Matthew and Kangin, Dmitry and Lam, Remi and Mirowski, Piotr and Fitzsimons, Megan and Athanassiadou, Maria and Kashem, Sheleem and Madge, Sam and Prudden, Rachel and Mandhane, Amol and Clark, Aidan and Brock, Andrew and Simonyan, Karen and Hadsell, Raia and Robinson, Niall and Clancy, Ellen and Arribas, Alberto and Mohamed, Shakir",
JOURNAL = "Nature",
TITLE = "Skilful precipitation nowcasting using deep generative models of radar",
VOLUME = 597,
NUMBER = 7878,
PAGES = "672--677",
YEAR = 2011,
DOI = "10.1038/s41586-021-03854-z",
}

@ARTICLE{RCW2011,
AUTHOR = "E. Ruzanski and V. Chandrasekar and Y. Wang",
TITLE = "The {CASA} Nowcasting System",
Expand Down
30 changes: 15 additions & 15 deletions doc/source/user_guide/machine_learning_pysteps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Before starting the comparison, you need to ask yourself what is the objective o
To achieve objective 1, it is sufficient to produce a single deterministic nowcast that filters out the unpredictable small-scale precipitation features.
However, this will create a nowcast that will become increasingly smooth over time.

To achieve objective 2, you need to produce a probabilistic or an ensemble nowcast (several ensemble members and realizations).
To achieve objective 2, you need to produce a probabilistic or an ensemble nowcast (several ensemble members or realizations).

In weather forecasting (and nowcasting) we usually want to achieve both goals because it is impossible to predict the evolution of a chaotic system with 100% accuracy, especially space-time precipitation fields and thunderstorms!
In weather forecasting (and nowcasting), we usually want to achieve both goals because it is impossible to predict the evolution of a chaotic system with 100% accuracy, especially space-time precipitation fields and thunderstorms!

Machine learning and pysteps offer several methods to produce both deterministic and probabilistic nowcasts.
Therefore, if you want to compare machine learning-based nowcasts to simpler extrapolation-based models, you need to select the right method.
Therefore, if you want to compare machine learning-based nowcasts to simpler extrapolation-based models, you need to select the right method and verification measure.

1. Deterministic nowcasting
--------------------------------------------
Expand All @@ -32,17 +32,17 @@ This is best explained by the decomposition of the mean squared error (MSE):

:math:`MSE = bias^2 + Var`

All deterministic machine learning algorithms that minimize the MSE (or a variation) will also inevitably minimize the variance of nowcast fields.
This is a natural attempt to filter out the unpredictable precipitation features, which would otherwise increase the variance (and the MSE).
All deterministic machine learning algorithms that minimize the MSE (or a related measure) will also inevitably minimize the variance of nowcast fields.
This is a natural attempt to filter out the unpredictable evolution of precipitation features, which would otherwise increase the variance (and the MSE).
The same principle holds for convolutional and/or deep neural network architectures, which also produce smooth nowcasts.

Therefore, it is better to avoid directly comparing an error-minimization machine learning nowcast to a variance-preserving radar extrapolation, as produced by the module :py:mod:`pysteps.nowcasts.extrapolation`. Instead, you should use the pysteps ensemble mean.
Therefore, it is better to avoid directly comparing an error-minimization machine learning nowcast to a variance-preserving radar extrapolation, as produced by the module :py:mod:`pysteps.nowcasts.extrapolation`. Instead, you should use compare with the mean of a sufficiently large ensemble.

A deterministic equivalent of the ensemble mean can be approximated using the modules :py:mod:`pysteps.nowcasts.sprog` or :py:mod:`pysteps.nowcasts.anvil`.
Another possibility, but more computationally demanding, is to average many ensemble members generated by the modules :py:mod:`pysteps.nowcasts.steps` or :py:mod:`pysteps.nowcasts.sseps`.
Another possibility, but more computationally demanding, is to average many ensemble members generated by the modules :py:mod:`pysteps.nowcasts.steps` or :py:mod:`pysteps.nowcasts.linda`.

Still, even by using the pysteps ensemble mean, it is not given that its variance will be the same as the one of machine learning predictions.
Possible solutions are to:
Possible solutions to this:

#. use a normalized MSE (NMSE) or another score accounting for differences in the variance between prediction and observation.
#. decompose the field with a Fourier (or wavelet) transform to compare features at the same spatial scales.
Expand All @@ -54,7 +54,7 @@ A good deterministic comparison of a deep convolutional machine learning neural

Probabilistic machine learning regression methods can be roughly categorized into:

a. Quantile-based methods, such as quantile regression, quantile random forests and quantile neural networks.
a. Quantile-based methods, such as quantile regression, quantile random forests, and quantile neural networks.
b. Ensemble-based methods, such as generative adversarial networks (GANs) and variational auto-encoders (VAEs).

Quantile-based machine learning nowcasts are interesting, but can only estimate the probability of exceedance at a given point (see e.g. :cite:`FSNBG2019`).
Expand All @@ -63,7 +63,7 @@ To estimate areal exceedance probabilities, for example above catchments, or to

Generative machine learning methods are similar to the pysteps ensemble members. Both are designed to produce an ensemble of possible realizations that preserve the variance of observed radar fields.

A proper probabilistic verification of generative machine learning models against pysteps would be an interesting research direction.
A proper probabilistic verification of generative machine learning models against pysteps is an interesting research direction which was recently undertake in the work of :cite:`Ravuri2021`.

Summary
-------
Expand All @@ -85,19 +85,19 @@ The comparison of methods from different types should only be done carefully and
- Pysteps
- Verification
* - Deterministic (variance-preserving)
- SRGAN (Wang et al., 2018), Others?
- SRGAN, Others?
- :py:mod:`pysteps.nowcasts.extrapolation` (any optical flow method)
- MSE, RMSE, MAE, ETS, etc
* - Deterministic (error-minimization)
- Classical ANNs, (deep) CNNs, random forests, AdaBoost, etc
- :py:mod:`pysteps.nowcasts.sprog`, :py:mod:`pysteps.nowcasts.anvil` or ensemble mean of :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.sseps`
- :py:mod:`pysteps.nowcasts.sprog`, :py:mod:`pysteps.nowcasts.anvil` or ensemble mean of :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.linda`
- MSE, RMSE, MAE, ETS, etc or better normalized scores, etc
* - Probabilistic (quantile-based)
- Quantile ANN, quantile random forests, quantile regression
- :py:mod:`pysteps.nowcasts.lagrangian_probability` or probabilities derived from :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.sseps`
- :py:mod:`pysteps.nowcasts.lagrangian_probability` or probabilities derived from :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.linda`
- Reliability diagram (predicted vs observed quantile), probability integral transform (PIT) histogram
* - Probabilistic (ensemble-based)
- GANs, VAEs, etc
- Ensemble and probabilities derived from :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.sseps`
- GANs (:cite:`Ravuri2021`), VAEs, etc
- Ensemble and probabilities derived from :py:mod:`pysteps.nowcasts.steps`/:py:mod:`~pysteps.nowcasts.linda`
- Probabilistic verification: reliability diagrams, continuous ranked probability scores (CRPS), etc.
Ensemble verification: rank histograms, spread-error relationships, etc
1 change: 1 addition & 0 deletions environment_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ dependencies:
- scikit-image
- pandas
- xarray
- rasterio
9 changes: 0 additions & 9 deletions examples/read_netcdf.py

This file was deleted.

71 changes: 0 additions & 71 deletions examples/test_decomposition_NWP.py

This file was deleted.

4 changes: 0 additions & 4 deletions pysteps/blending/__init__.py

This file was deleted.

Loading