Introduction

At the moment pyCAT provides bias correction facilities for climate model data.

The implemented methods are described in detail in the following papers

You will find sample data in the corresponding directory which comprises:

  • observation: An extract of the SPARTACUS temperature dataset generated by ZAMG - Central Institute for Meteorology and Geodynamics Vienna/Austria. The extract holds data for one arbitrary cell in Austria for the years 1971–1990
  • model/scenario: 3x3 cells around the observation cell of the EURO-CORDEX model CNRM-CERFACS-CNRM-CM5_rcp45_r1i1p1_CLMcom-CCLM4-8-17 for the years 1971–1990 (model) and 2021-2030 (scenario)

You can run Quantile Mapping (QM) using the sample data

from pycat.io import Dataset
from pycat.esd import QuantileMapping

obs = Dataset('sample-data', 'observation.nc')
mod = Dataset('sample-data', 'model*.nc')
sce = Dataset('sample-data', 'scenario*.nc')

qm = QuantileMapping(obs, mod, sce)
qm.correct()

Please refer to esd.BiasCorrector and esd.QuantileMapping for non-default usage. Optionally you can run the correct function for a single day of the year or a list of days, e.g. qm.correct(59) will only correct the leap-days for the regarded period.

For Scaled Distribution Mapping (SDM) the procedure is analogue. Again take a look at esd.ScaledDistributionMapping for additional arguments. Again with sdm.correct([2, 9]) you can limit the bias correction the months February and September.

from pycat.io import Dataset
from pycat.esd import ScaledDistributionMapping

obs = Dataset('sample-data', 'observation.nc')
mod = Dataset('sample-data', 'model*.nc')
sce = Dataset('sample-data', 'scenario*.nc')

sdm = ScaledDistributionMapping(obs, mod, sce)
sdm.correct()

Both methods correct the scenario data using observational data and reference data from the model. The output will be written to the working directory of the corrector. To gain best efficiency these intermediate files do not contain the time-series for the correction period but are split into day of year (QM) and month of year (SDM), respectively.

You can rearrange these temporary files by using the helper-script merge-bc-output.py, e.g:

merge-bc-output.py --in='/tmp/quantile*' --out=/data/qm

which will store the final output into the /data directory and name the files qm_YYYY.nc. See merge-bc-output.py --help for all options.