{"id":16469496,"url":"https://github.com/btschwertfeger/biasadjustcxx","last_synced_at":"2026-03-27T02:12:37.493Z","repository":{"id":62400409,"uuid":"495881923","full_name":"btschwertfeger/BiasAdjustCXX","owner":"btschwertfeger","description":"Bias correction command-line tool for climatic research written in C++","archived":false,"fork":false,"pushed_at":"2024-09-17T05:20:00.000Z","size":13098,"stargazers_count":8,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T22:08:34.943Z","etag":null,"topics":["bias-adjustment","bias-correction","bias-reduction","cdf","climate-data","climate-prediction","climate-science","command-line-tool","correction","delta-method","docker","docker-image","linear-scaling","post-processing","quantile-delta-mapping","quantile-mapping","reanalysis","scaling-algorithms","time-series-analysis","variance-scaling"],"latest_commit_sha":null,"homepage":"https://biasadjustcxx.readthedocs.io/en/latest/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/btschwertfeger.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-24T15:26:50.000Z","updated_at":"2024-09-17T05:20:02.000Z","dependencies_parsed_at":"2023-02-10T22:30:41.395Z","dependency_job_id":"e8f7be0c-349e-42de-90d5-79570997fc5b","html_url":"https://github.com/btschwertfeger/BiasAdjustCXX","commit_stats":{"total_commits":92,"total_committers":3,"mean_commits":"30.666666666666668","dds":"0.18478260869565222","last_synced_commit":"de38577fb02e82b5ae4770d32d43ef6d1d70f183"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2FBiasAdjustCXX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2FBiasAdjustCXX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2FBiasAdjustCXX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/btschwertfeger%2FBiasAdjustCXX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/btschwertfeger","download_url":"https://codeload.github.com/btschwertfeger/BiasAdjustCXX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244751542,"owners_count":20504242,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bias-adjustment","bias-correction","bias-reduction","cdf","climate-data","climate-prediction","climate-science","command-line-tool","correction","delta-method","docker","docker-image","linear-scaling","post-processing","quantile-delta-mapping","quantile-mapping","reanalysis","scaling-algorithms","time-series-analysis","variance-scaling"],"created_at":"2024-10-11T12:07:50.384Z","updated_at":"2026-03-27T02:12:37.454Z","avatar_url":"https://github.com/btschwertfeger.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nBiasAdjustCXX command-line tool for the application of fast and efficient bias corrections in climatic research\n===============================================================================================================\n\n.. BADGES\n.. |GitHub badge| image:: https://badgen.net/badge/icon/github?icon=github\u0026label\n   :target: https://github.com/btschwertfeger/BiasAdjustCXX\n\n.. |License badge| image:: https://img.shields.io/badge/License-GPLv3-orange.svg\n      :target: https://www.gnu.org/licenses/gpl-3.0\n\n.. |C++ badge| image:: https://img.shields.io/badge/-C++-blue?logo=c%2B%2B\n\n.. |CICD badge| image:: https://github.com/btschwertfeger/BiasAdjustCXX/actions/workflows/cicd.yaml/badge.svg\n   :target: https://github.com/btschwertfeger/BiasAdjustCXX/actions/workflows/cicd.yaml\n\n.. |Docker pulls badge| image:: https://img.shields.io/docker/pulls/btschwertfeger/biasadjustcxx.svg\n   :target: https://hub.docker.com/r/btschwertfeger/biasadjustcxx\n\n.. |Release date badge| image:: https://shields.io/github/release-date/btschwertfeger/BiasAdjustCXX\n\n.. |Release tag badge| image:: https://shields.io/github/v/release/btschwertfeger/BiasAdjustCXX?display_name=tag\n\n.. |GCC badge| image:: https://img.shields.io/badge/required-C%2B%2B11%2B-brightgreen\n\n.. |CMake badge| image:: https://img.shields.io/badge/required-CMake3.10%2B-brightgreen\n\n.. |GoogleTest badge| image:: https://img.shields.io/badge/GoogleTest-1.11.0-blue\n\n.. |DOI badge| image:: https://zenodo.org/badge/495881923.svg\n   :target: https://zenodo.org/badge/latestdoi/495881923\n\n.. |Publication badge| image:: https://img.shields.io/badge/Publication-doi.org%2F10.1016%2Fj.softx.2023.101379-blue\n   :target: https://doi.org/10.1016/j.softx.2023.101379\n\n.. LINKS\n.. _BiasAdjustCXX: https://github.com/btschwertfeger/BiasAdjustCXX\n\n.. _tool comparison: https://github.com/btschwertfeger/BiasAdjustCXX-Performance-Test\n\n.. _BiasAdjustCXX v1.8.1: https://github.com/btschwertfeger/BiasAdjustCXX/tree/v1.8.1\n\n.. _Dockerhub: https://hub.docker.com/repository/docker/btschwertfeger/biasadjustcxx/general\n\n.. _Documentation: https://biasadjustcxx.readthedocs.io/en/latest/\n\n\n.. the publication\n.. _https://doi.org/10.1016/j.softx.2023.101379: https://doi.org/10.1016/j.softx.2023.101379\n\n.. _python-cmethods: https://github.com/btschwertfeger/python-cmethods\n\n.. _BiasAdjustCXX/issues: https://github.com/btschwertfeger/BiasAdjustCXX/issues\n\n.. _BiasAdjustCXX/discussions: https://github.com/btschwertfeger/BiasAdjustCXX/discussions\n\n.. _NetCDF-4 C++: https://github.com/Unidata/netcdf-cxx4\n.. _How to install NetCDF-4 C++: `NetCDF-4 C++`_\n\n.. _CMake: https://cmake.org/install/\n.. _How to install CMake: `CMake`_\n\n.. _How to install cdo: https://www.isimip.org/protocol/preparing-simulation-files/cdo-help/\n\n\n.. REPOSITORY\n.. _/examples: https://github.com/btschwertfeger/BiasAdjustCXX/blob/master/examples\n\n.. _/examples/Hands-On-BiasAdjustCXX.ipynb: https://github.com/btschwertfeger/BiasAdjustCXX/blob/master/examples/Hands-On-BiasAdjustCXX.ipynb\n\n.. _/examples/example_all_methods.run.sh: https://github.com/btschwertfeger/BiasAdjustCXX/blob/master/examples/example_all_methods.run.sh\n\n.. _/examples/examples.ipynb: https://github.com/btschwertfeger/BiasAdjustCXX/blob/master/examples/examples.ipynb\n\n\n.. REFERENCES\n\n.. _Teutschbein et al. (2012): https://doi.org/10.1016/j.jhydrol.2012.05.052\n.. _Beyer et al. (2020): https://doi.org/10.5194/cp-16-1493-2020\n.. _Cannon et al. (2015): https://doi.org/10.1175/JCLI-D-14-00754.1\n.. _Tong et al. (2021): https://doi.org/10.1007/s00382-020-05447-4\n\n\n|GitHub badge| |License badge| |C++ badge| |CICD badge|\n|Docker pulls badge| |GCC badge| |CMake badge| |GoogleTest badge|\n|Release date badge| |Release tag badge| |DOI badge| |Publication badge|\n\n**The documentation can be found here: https://biasadjustcxx.readthedocs.io/en/latest.**\n\nThis software is tested using Google's testing framework *googletest*\n(https://github.com/google/googletest).\n\nThe related project `python-cmethods`_ is a Python package that  is implemented\nin Python and is way more flexible in terms of parameters, input data, shapes,\nand customization. For those who know Python at least a bit, this might be the\nbetter option, as it not only provides a command-line interface but also enables\naccessing its API in order to apply custom bias corrections.\n\n\n1. About\n--------\n\nThe command-line tool `BiasAdjustCXX`_ is the subject of a publication that\nprovides an insight into the architecture, possible applications and new\nscientific questions. This publication referencing `BiasAdjustCXX v1.8.1`_ was\npublished in the journal SoftwareX in March 2023 and is available at\n`https://doi.org/10.1016/j.softx.2023.101379`_.\n\nThis tool and the provided data structures are designed to help minimize\ndiscrepancies between modeled and observed climate data of different time\nperiods. Data from past periods are used to adjust variables from current and\nfuture time series so that their distributional properties approximate possible\nactual values.\n\n\n.. figure:: doc/_static/images/biasCdiagram.png\n    :width: 800\n    :align: center\n    :alt: Schematic representation of a bias adjustment procedure\n\n    Fig 1: Schematic representation of a bias adjustment procedure\n\n\nIn this way, for example, modeled data, which on average represent values that\nare too cold, can be bias-corrected by applying an adjustment procedure. The\nfollowing figure shows the observed, the modeled, and the bias-corrected values.\nIt is directly visible that the delta adjusted time series\n(:math:`T^{*DM}_{sim,p}`) are much more similar to the observed data\n(:math:`T_{obs,p}`) than the raw modeled data (:math:`T_{sim,p}`).\n\n.. figure:: doc/_static/images/dm-doy-plot.png\n    :width: 800\n    :align: center\n    :alt: Temperature per day of year in modeled, observed and bias-adjusted climate data\n\n    Fig 2: Temperature per day of year in modeled, observed and bias-adjusted climate data\n\nIn addition - all of these methods available here have also been implemented in\nPython. This can be found in the `python-cmethods`_ package.\n\nIf you have any inquiries, remarks, requests for assistance, ideas, or potential\ncollaborations, you can always create an issue on `BiasAdjustCXX/issues`_,\nutilize the discussion area on `BiasAdjustCXX/discussions`_, or directly contact\nme at contact@b-schwertfeger.de.\n\n\n2. Available bias correction methods\n------------------------------------\n\nThe following bias correction techniques are available:\n    Scaling-based techniques:\n        * Linear Scaling\n        * Variance Scaling\n        * Delta Method\n\n    Distribution-based techniques:\n        * Quantile Mapping\n        * Quantile Delta Mapping\n\nAll of these mathematical methods are intended to be applied on 1-dimensional\ntime-series climate data. This module also provides the possibility that enables\nthe application of the desired bias correction method on 3-dimensional data\nsets.\n\nGeneral Notes\n~~~~~~~~~~~~~\n\n- Except for the variance scaling, all methods can be applied on stochastic and\n  non-stochastic climate variables. Variance scaling can only be applied on\n  non-stochastic climate variables.\n\n  - Non-stochastic climate variables are those that can be predicted with\n    relative certainty based on factors such as location, elevation, and season.\n    Examples of non-stochastic climate variables include air temperature, air\n    pressure, and solar radiation.\n\n  - Stochastic climate variables, on the other hand, are those that exhibit a\n    high degree of variability and unpredictability, making them difficult to\n    forecast accurately. Precipitation is an example of a stochastic climate\n    variable because it can vary greatly in timing, intensity, and location due\n    to complex atmospheric and meteorological processes.\n\n- The Delta Method requires that the time series of the control period have the\n  same length as the time series to be adjusted.\n\n- Examples can be found in the `BiasAdjustCXX`_ repository and of course within\n  the `Documentation`_.\n\n- Speed/Performance tests and comparison to other tools can be found here: `tool\n  comparison`_\n\n\nNotes regarding the scaling-based techniques\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n- All data sets must exclude the 29th February and every year must have 365\n  entries. This is not required when using the ``--no-group`` flag which can be\n  used to apply the scaling techniques in such a way that the scaling factors\n  are based on the whole time series at once. This enables the possibility to\n  apply the BiasAdjustCXX tool to data sets with custom time scales for example\n  to adjust monthly separated time series individually to match the techniques\n  described by `Teutschbein et al. (2012)`_ and `Beyer et al. (2020)`_. On the\n  other hand the long-term 31-day interval procedures are customized variations\n  and prevent disproportionately high differences in the long-term mean values\n  at the monthly transitions. That's why the long-term 31-day interval variant\n  is the preferred method and is enabled by default for all scaling-based\n  techniques.\n\n\n3. Compilation and Installation\n-------------------------------\n\nBuild from source\n~~~~~~~~~~~~~~~~~\n\nSince this tool is written in C++ it must be compiled and installed, before it\ncan be used. The following libraries and tools must be installed to successfully\ncompile and install the BiasAdjustCXX command-line tool.\n\n- NetCDF-4 C++ library (`How to install NetCDF-4 C++`_)\n- CMake v3.10+ (`How to install CMake`_)\n- GNU Make (see https://www.gnu.org/software/make/)\n- [optional] Climate Data Operators (`How to install cdo`_)\n\nPlease have a look at the following code blocks that demonstrate how to\ndownload, build and install the BiasAdjustCXX tool from source:\n\n\n.. code:: bash\n\n    git clone https://github.com/btschwertfeger/BiasAdjustCXX.git\n    cd BiasAdjustCXX\n\n    make build\n    make install\n\nThe tool can be uninstalled using the following command within the project\ndirectory:\n\n.. code:: bash\n\n    make uninstall\n\n\nAfter the installation, the tool can be executed using the command listed below.\nThis repository also serves example data to test this. See the documentation for\nmore information (https://biasadjustcxx.readthedocs.io/en/latest).\n\nIf the netcdf-cxx4 libraries cannot be found - make sure that ``ncxx4-config``\nis globally executable, since this tool is used to determine the location of\nthese libraries.\n\n.. code:: bash\n\n  BiasAdjustCXX \\\n        --ref input_data/observations.nc  \\ # observations/reference time series of the control period\n        --contr input_data/control.nc     \\ # simulated time series of the control period\n        --scen input_data/scenario.nc     \\ # time series to adjust\n        --output linear_scaling.nc        \\ # output file\n        --method linear_scaling           \\ # adjustment method\n        --kind \"+\"                        \\ # kind of adjustment ('+' == 'add' and '*' == 'mult')\n        --variable tas                    \\ # variable to adjust\n        --processes 4                       # number of threads\n\n\nDocker 🐳\n~~~~~~~~~\n\nThe execution of BiasAdjustCXX is also possible within a Docker container. This\nis the preferred option when the installation of `NetCDF-4 C++`_, `CMake`_ or\n`BiasAdjustCXX`_ on the local system is not desired. It also makes easier to\naccess this tool since Docker container can run on nearly every operating\nsystem.\n\n.. code:: bash\n\n    # remove the comments before execution ...\n    docker run -it -v $(PWD):/work btschwertfeger/biasadjustcxx:latest BiasAdjustCXX \\\n        --ref input_data/observations.nc  \\ # observations/reference time series of the control period\n        --contr input_data/control.nc     \\ # simulated time series of the control period\n        --scen input_data/scenario.nc     \\ # time series to adjust\n        --output linear_scaling.nc        \\ # output file\n        --method linear_scaling           \\ # adjustment method\n        --kind \"+\"                        \\ # kind of adjustment ('+' == 'add' and '*' == 'mult')\n        --variable tas                    \\ # variable to adjust\n        --processes 4                       # number of threads\n\n\nSee the Dockerhub registry to access the dev, pinned and older versions:\n`Dockerhub`_\n\n4. Arguments and Parameters\n---------------------------\n\nThe following table lists the available command-line arguments that can be\npassed to the `BiasAdjustCXX`_ tool. Please also have a look at the requirements\nsection below.\n\n\n``--ref``, ``--reference``\n  path to observational/reference data set (control period)\n\n``--contr``, ``--control``\n  path to modeled data set (control period)\n``--scen``, ``--scenario``\n  path to data set that is to be adjusted (scenario period)\n``-v``, ``--variable``\n  variable to adjust\n``-k``, ``--kind``\n  kind of adjustment - one of: ``+`` or ``add`` and ``*`` or ``mult``\n``-m``, ``--method``\n  adjustment method name - one of: ``linear_scaling``, ``variance_scaling``,\n  ``delta_method``, ``quantile_mapping`` and ``quantile_delta_mapping``\n``-q``, ``--quantiles``\n  [optional] number of quantiles to respect (only required for distribution-based methods)\n``--1dim``\n  [optional] required if the data sets have no spatial dimensions (i.e. only one time dimension)\n``--no-group``\n  [optional] Disables the adjustment based on 31-day long-term moving\n  windows for the scaling-based methods. Scaling will be performed on the whole data set\n  at once, so it is recommended to separate the input files for example by month\n  and apply this program to every long-term month. (only for scaling-based methods)\n``--max-scaling-factor``\n  [optional] Define the maximum scaling factor to avoid unrealistic results when\n  adjusting ratio based variables for example in regions where heavy rainfall is not included in the\n  modeled data and thus creating disproportional high scaling factors.\n  (only for multiplicative methods except QM, default: 10)\n``-p``, ``--processes``\n  [optional] How many threads to use (default: 1)\n``-h``, ``--help``\n  [optional] display usage example, arguments, hints, and exits the program\n\n\nRequirements\n~~~~~~~~~~~~\n\nSee the documentation for more information\n(https://biasadjustcxx.readthedocs.io/en/latest).\n\n- The variable of interest must have the same name in all data sets.\n- The dimensions must be named \"time\", \"lat\" and \"lon\" (i.e., time, latitudes\n  and longitudes) in exactly this order - in case the data sets have more than\n  one dimension.\n- Executed scaling-based techniques without the ``--no-group`` flag require that\n  the data sets exclude the 29th February and every year has exactly 365\n  entries.\n- For adjusting data using the linear scaling, variance scaling or delta method\n  and the ``--no-group`` flag: You have to separate the input files by month and\n  then apply the correction for each month individually e.g., for 30 years of\n  data to correct, you need to prepare the three input data sets so that they\n  first contain all time series for all Januaries and then apply the adjustment\n  for this data set. After that you have to do the same for the rest of the\n  months (see ``/examples/example_all_methods.run.sh`` in\n  the repository).\n\n5. References\n-------------\n- Schwertfeger, Benjamin Thomas and Lohmann, Gerrit and Lipskoch, Henrik (2023) *\"Introduction of the BiasAdjustCXX command-line tool for the application of fast and efficient bias corrections in climatic research\"*, SoftwareX, Volume 22, 101379, ISSN 2352-7110, (https://doi.org/10.1016/j.softx.2023.101379)\n- Schwertfeger, Benjamin Thomas (2022) *\"The influence of bias corrections on variability, distribution, and correlation of temperatures in comparison to observed and modeled climate data in Europe\"* (https://epic.awi.de/id/eprint/56689/)\n- Delta Method based on: Beyer, R. and Krapp, M. and Manica, A. (2020) *\"An empirical evaluation of bias correction methods for palaeoclimate simulations\"* (https://doi.org/10.5194/cp-16-1493-2020)\n- Linear Scaling and Variance Scaling based on: Teutschbein, Claudia and Seibert, Jan (2012) *\"Bias correction of regional climate model simulations for hydrological climate-change impact studies: Review and evaluation of different methods\"* (https://doi.org/10.1016/j.jhydrol.2012.05.052)\n- Quantile Mapping based on: Alex J. Cannon and Stephen R. Sobie and Trevor Q. Murdock (2015) *\"Bias Correction of GCM Precipitation by Quantile Mapping: How Well Do Methods Preserve Changes in Quantiles and Extremes?\"* (https://doi.org/10.1175/JCLI-D-14-00754.1)\n- Quantile Delta Mapping based on: Tong, Y., Gao, X., Han, Z. et al. *\"Bias correction of temperature and precipitation over China for RCM simulations using the QM and QDM methods\"*. Clim Dyn 57, 1425–1443 (2021). (https://doi.org/10.1007/s00382-020-05447-4)\n- Schulzweida, U.: *\"CDO User Guide\"*, (https://doi.org/10.5281/zenodo.7112925), 2022.\n- This project took advantage of netCDF software developed by UCAR/Unidata (http://doi.org/10.5065/D6H70CW6).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtschwertfeger%2Fbiasadjustcxx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbtschwertfeger%2Fbiasadjustcxx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbtschwertfeger%2Fbiasadjustcxx/lists"}