You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Collection of different scale- and distribution-based bias adjustment techniques for climatic research (see `examples.ipynb` for help).
12
+
This Python module contains a collection of different scale- and distribution-based bias adjustment techniques for climatic research (see `examples.ipynb` for help).
13
13
14
-
Bias adjustment procedures in Python are very slow, so they should not be used on large data sets.
15
-
A C++ implementation that works way faster can be found [here](https://github.com/btschwertfeger/Bias-Adjustment-Cpp).
14
+
Since the Python programming language is very slow and bias adjustments are complex statistical transformations, it is recommended to use the C++ implementation on large data sets. This can be found [here](https://github.com/btschwertfeger/Bias-Adjustment-Cpp).
16
15
17
-
## About
16
+
---
17
+
18
+
## Table of Contents
19
+
20
+
1.[ About ](#about)
21
+
2.[ Available Methods ](#methods)
22
+
3.[ Installation ](#installation)
23
+
4.[ Usage and Examples ](#examples)
24
+
5.[ Notes ](#notes)
25
+
6.[ References ](#references)
26
+
27
+
---
28
+
29
+
<aname="about"></a>
30
+
31
+
## 1. About
18
32
19
33
These programs and data structures are designed to help minimize discrepancies between modeled and observed climate data. Data from past periods are used to adjust variables from current and future time series so that their distributional properties approximate possible actual values.
20
34
@@ -33,31 +47,41 @@ In this way, for example, modeled data, which on average represent values that a
33
47
src="images/dm-doy-plot.png?raw=true"
34
48
alt="Temperature per day of year in modeled, observed and bias-adjusted climate data"
|`delta_method`| Delta (Change) Method (additive and multiplicative) |
66
+
|`quantile_mapping`| Quantile Mapping (additive) and Detrended Quantile Mapping (additive and multiplicative) |
67
+
|`quantile_delta_mapping`| Quantile Delta Mapping (additive and multiplicative) |
68
+
|`adjust_3d`| requires a method name and the respective parameters to adjust all time series of a data set |
49
69
50
70
---
51
71
52
-
## Usage
72
+
<aname="installation"></a>
53
73
54
-
###Installation
74
+
##3. Installation
55
75
56
76
```bash
57
77
python3 -m pip install python-cmethods
58
78
```
59
79
60
-
### Import and application
80
+
---
81
+
82
+
<aname="examples"></a>
83
+
84
+
## 4. Usage and Examples
61
85
62
86
```python
63
87
import xarray as xr
@@ -91,15 +115,13 @@ qdm_result = cm.adjust_3d( # 3d = 2 spatial and 1 time dimension
91
115
Notes:
92
116
93
117
- When using the `adjust_3d` method you have to specify the method by name.
94
-
- For the multiplicative linear scaling and delta method is a maximum scaling factor of 10 set. This can be changed by the `max_scaling_factor` parameter.
95
-
96
-
---
118
+
- For the multiplicative linear scaling and the delta method as well as the variance scaling method a maximum scaling factor of 10 is defined. This can be changed by the parameter `max_scaling_factor`.
97
119
98
120
## Examples (see repository on [GitHub](https://github.com/btschwertfeger/Bias-Adjustment-Python))
99
121
100
-
`/examples/examples.ipynb`: Notebook containing different methods and plots
122
+
Notebook with different methods and plots: `/examples/examples.ipynb`
101
123
102
-
`/examples/do_bias_correction.py`: Example script for adjusting climate data
124
+
Example script for adjusting climate data: `/examples/do_bias_correction.py`
- Linear and variance, as well as delta change method require `--group time.month` as argument.
117
-
- Adjustment methods that apply changes in distributional biasses (QM, QDM, DQM; EQM, ...) need the `--nquantiles` argument set to some integer.
118
-
- Data sets should have the same spatial resolutions.
139
+
- Adjustment methods that apply changes in distributional biasses (QM, QDM, DQM, ...) need the `--nquantiles` argument set to some integer.
140
+
- Data sets must have the same spatial resolutions.
119
141
120
142
---
121
143
122
-
## Notes
144
+
<aname="notes"></a>
123
145
124
-
- Computation in Python takes some time, so this is only for demonstration. When adjusting large datasets, its best to the C++ implementation mentioned above.
146
+
## 5. Notes
147
+
148
+
- Computation in Python takes some time, so this is only for demonstration. When adjusting large datasets, its best to use the C++ implementation mentioned above.
125
149
- Formulas and references can be found in the implementations of the corresponding functions.
126
150
127
-
## Space for improvements
151
+
### Space for improvements:
152
+
153
+
Since the scaling methods implemented so far scale by default over the mean values of the respective months, unrealistic long-term mean values may occur at the month transitions. This can be prevented either by selecting `group='time.dayofyear'`. Alternatively, it is possible not to scale using long-term mean values, but using a 31-day interval, which takes the 31 surrounding values over all years as the basis for calculating the mean values. This is not yet implemented in this module, but is available in the C++ implementation [here](https://github.com/btschwertfeger/Bias-Adjustment-Cpp).
154
+
155
+
---
128
156
129
-
Since the scaling methods implemented so far scale by default over the mean values of the respective months, unrealistic long-term mean values may occur at the month transitions. This can be prevented either by selecting `group='time.dayofyear`. Alternatively, it is possible not to scale using long-term mean values, but using a 30-day interval, which takes the 30 surrounding values over all years as the basis for calculating the mean values. This is not yet implemented in this module, but is available in the C++ implementation [here](https://github.com/btschwertfeger/Bias-Adjustment-Cpp).
157
+
<aname="references"></a>
130
158
131
-
## References
159
+
## 6. References
132
160
133
161
- 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/)
134
162
- 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)
0 commit comments