A package to correct the bias of forecasts/hindcasts. Read the documentation at https://github.com/garovent/mva
Project description
Documentation
A python package to adjust the bias of probabilistic forecasts/hindcasts using "Mean and Variance Adjustment" method.
Read documentation at https://github.com/garovent/mva
References:
[1] Torralba, V., Doblas-Reyes, F. J., MacLeod, D., Christel, I. & Davis, M. Seasonal Climate Prediction: A New Source of Information for the Management of Wind Energy Resources. Journal of Applied Meteorology and Climatology 56, 1231–1247 (2017).
[2] Manzanas, R. et al. Bias adjustment and ensemble recalibration methods for seasonal forecasting: a comprehensive intercomparison using the C3S dataset. Clim Dyn 53, 1287–1305 (2019).
Installation:
pip install mva
Parameters:
hindcast: numpy.ndarray
The hindcast (or training) data. Kindly maintain the shape of the array as (years/samples,time,ensemble-members,grid-points).
observation: numpy.ndarray
The truth or observations corresponding to the hindcast. Kindly maintain the shape of the array as (years/samples,time,grid-points).
forecast: numpy.ndarray, optional
The forecast (or test) data. Kindly maintain the shape of the array as (time,ensemble-members,grid-points).
Note: Kindly respect the array shapes even if the computation is done for one time/grid point/ensemble member.
Methods:
adjust_hindcast():
This method corrects the bias of the hindcast using hindcast of the remaining years in the set (i.e., leave-one-out approach) and the corresponding observations.
Returns:
bias_adjusted_hindcast (Note: It has the same shape as the hindcast)
adjust_forecast():
This method corrects the bias of the forecast using hindcast and the corresponding observations. This method works only when the forecast parameter is given.
Returns:
bias_adjusted_forecast (Note: It has the same shape as the forecast)
Demonstration:
import numpy as np
import mva.mva as mva
Let's imagine that we have loaded the data of hindcast, forecast, and observation.
Example - 1
In [1]: hcast.shape
Out[1]: (20,46,10,6)
In [2]: fcast.shape
Out[2]: (46,50,6)
In [3]: obs.shape
Out[3]: (20,46,6)
In [4]: bc = mva(hcast,obs,fcast)
In [5]: ad_hcast = bc.adjust_hindcast()
In [6]: ad_hcast.shape
Out[6]: (20,46,10,6)
In [7]: ad_fcast = bc.adjust_forecast()
In [8]: ad_fcast.shape
Out[8]: (46,50,6)
Example - 2
In [1]: hcast.shape
Out[1]: (20,46,10,6)
In [2]: fcast.shape
Out[2]: (48,50,6)
In [3]: obs.shape
Out[3]: (20,46,6)
In [4]: ad_hcast = mva(hcast,obs,fcast).adjust_hindcast()
In [5]: ad_hcast.shape
Out[5]: (20,46,10,6)
In [6]: ad_fcast = mva(hcast,obs,fcast).adjust_forecast()
Out[6]: Please respect the array shapes and try again!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mva-0.0.1.tar.gz
.
File metadata
- Download URL: mva-0.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed19df77c880adf711e2e040b692c80e4ab05791c5476868cc1698898de59b5 |
|
MD5 | 0ee9637ec1f5fc0160b6971ebdb10b51 |
|
BLAKE2b-256 | cafa813cfb5277c51110d253b6005f5fc4ffdea4035303220acca9adb18bcf18 |
File details
Details for the file mva-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: mva-0.0.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccbb7678496fbfb099b82f248ec065f19d7bfad6b915228bbcacb060d9703861 |
|
MD5 | f3d0be960e20329b986426fa273c8dd1 |
|
BLAKE2b-256 | 6839905a66f9f2145c59b6e987ac5b1620c7a27c4c497725ade313533d0db2e1 |