yrobink / SBCK

22 stars 9 forks source link

SBCK (Statistical Bias Correction Kit)

Clone

Python and R version are given in git submodules, so use:

git clone --recurse-submodules https://github.com/yrobink/SBCK

Release

The last release is the 0.4.13 version, in the version-0.4.X branch. The developpment version is the 0.5.X version.

Features

How to select a bias correction method ?

This summary of ability of each method to perform a bias correction is proposed by François, (2020). Please refer to this article for further interpretation.

Characteristics CDF-t R2D2 dOTC MBCn MRec
Correction of univariate dist. prop. :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Modification of correlations of the model :x: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Capacity to correct inter-var. prop. :x: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Capacity to correct spatial prop. :x: :heavy_check_mark: :heavy_check_mark: :warning: :warning:
Capacity to correct temporal prop. :x: :x: :x: :x: :x:
Preserve the rank structure of the model :heavy_check_mark: :warning: :warning: :warning: :warning:
Capacity to correct small geographical area n.a. :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Capacity to correct large geographical area n.a. :warning: :warning: :warning: :x:
Allow for change of the multi-dim. prop. :heavy_check_mark: :x: :heavy_check_mark: :warning: :heavy_check_mark:

Python instruction

Requires:

For python, just use the command:

python3 setup.py install --user

If the Eigen library is not found, use:

python3 setup.py install --user eigen="path-to-eigen"

Conda

If using conda to manage environments and packages, the module can be installed with:

conda create -n sbck eigen numpy scipy pybind11 cxx-compiler
conda activate sbck
python setup.py install

Make sure that you never try to import the package in an interpreter who's current working directory is the source folder. This would fail with ModuleNotFoundError: No module named 'SBCK.tools.__tools_cpp' since the compiled version of the module is not present in the source folder, but rather in the conda environment itself.

R instruction

SBCK is available in CRAN.

Requires:

Just run:

Rscript build.R -c -v -i

Examples

For bias correction example, X0 and X1 are respectively the random variable to correct in calibration and projection period. Y0 is the reference during calibration period. Z0 and Z1 are the corrections during calibration and projection period.

Univariate bias correction: QM, CDFt and QDM

Alt

Bivariate bias correction: dOTC

Alt

Bivariate bias correction: MBCn

Alt

Bivariate bias correction: MRec

Alt

License

Copyright(c) 2021 Yoann Robin

This file is part of SBCK.

SBCK is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

SBCK is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SBCK. If not, see https://www.gnu.org/licenses/.

References