A package to correct the bias of forecasts/hindcasts. Read the documentation at https://github.com/gouthamnaveen/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/gouthamnaveen/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.2.tar.gz
.
File metadata
- Download URL: mva-0.0.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8eebaf921716b6018da5097df07941f8210a5bddd9d764319c208ea401c81ead |
|
MD5 | 81eb5481783760035db85caf463d497b |
|
BLAKE2b-256 | e688ab62b1980d5b27614ab44da28b8efc071c171e71b1f161d4fad62bde3ac5 |
File details
Details for the file mva-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: mva-0.0.2-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.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 16502a56658820efaef5d60648c7ecd26ead93222d8ba85771422d7c033ce4a9 |
|
MD5 | f1742f6cfe4f811993dc0b37076c7079 |
|
BLAKE2b-256 | 28659a66e480891d454abbd1e08648f9deaed75f6fac8942fcea08e20fd80cc0 |