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
Copy file name to clipboardExpand all lines: README.md
+37-16
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Bias correction/adjustment procedures for climatic reasearch
1
+
# python-cmethods
2
2
3
3
<divalign="center">
4
4
@@ -18,7 +18,7 @@
18
18
19
19
</div>
20
20
21
-
This Python module contains a collection of different scale- and distribution-based bias adjustment techniques for climatic research (see `/examples/examples.ipynb` for help).
21
+
This Python module serves as a collection of different scale- and distribution-based bias correction techniques for climatic research
22
22
23
23
The documentation is available at: [https://python-kraken-sdk.readthedocs.io/en/stable/](https://python-kraken-sdk.readthedocs.io/en/stable/)
24
24
@@ -67,7 +67,7 @@ In this way, for example, modeled data, which on average represent values that a
67
67
68
68
## 2. Available methods
69
69
70
-
All methods except the `adjust_3d` function requires the application on one time series.
70
+
All methods except the `adjust_3d` function requires that the input data sets only contain one dimension.
Notebook with different methods and plots: `/examples/examples.ipynb`
133
133
134
-
Example script for adjusting climate data: `/examples/do_bias_correction.py`
134
+
There is also an exmple script (`/examples/biasadjust.py`) that can be used to apply the available bias correction methods
135
+
on 1- and 3-dimensional data sets (see `/examples/input_data/*.nc`).
136
+
137
+
Help:
135
138
136
139
```bash
137
-
python3 do_bias_correction.py \
138
-
--obs input_data/observations.nc \
140
+
╰─ python3 biasadjust.py --help
141
+
```
142
+
143
+
(1.) Example - Quantile Mapping bias correction on the provided example data:
144
+
145
+
```bash
146
+
╰─ python3 biasadjust.py \
147
+
--ref input_data/observations.nc \
139
148
--contr input_data/control.nc \
140
149
--scen input_data/scenario.nc \
141
-
--method linear_scaling \
142
-
--variable tas \
143
-
--unit '°C' \
144
-
--group 'time.month' \
145
-
--kind +
150
+
--kind "+" \
151
+
--variable "tas" \
152
+
--method quantile_mapping
146
153
```
147
154
148
-
- Linear and variance, as well as delta change method require `--group time.month` as argument.
149
-
- Adjustment methods that apply changes in distributional biases (QM, QDM, DQM, ...) require the `--nquantiles` argument set to some integer.
155
+
(2.) Example - Linear Scaling bias correction on the provided example data:
156
+
157
+
```bash
158
+
╰─ python3 biasadjust.py \
159
+
--ref input_data/observations.nc \
160
+
--contr input_data/control.nc \
161
+
--scen input_data/scenario.nc \
162
+
--kind "+" \
163
+
--variable "tas" \
164
+
--group "time.month" \
165
+
--method linear_scaling
166
+
```
167
+
168
+
Notes:
169
+
150
170
- Data sets must have the same spatial resolutions.
171
+
- This script is far away from perfect - so please look at it, as a starting point. (:
151
172
152
173
---
153
174
154
175
<aname="notes"></a>
155
176
156
177
## 5. Notes
157
178
158
-
- Computation in Python takes some time, so this is only for demonstration. When adjusting large datasets, its best to use the C++ tool [BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
159
-
- Formulas and references can be found in the implementations of the corresponding functions.
179
+
- Computation in Python takes some time, so this is only for demonstration. When adjusting large datasets, its best to use the command-line tool [BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
180
+
- Formulas and references can be found in the implementations of the corresponding functions, on the bottom of the README.md and in the [documentation](https://python-kraken-sdk.readthedocs.io/en/stable/).
160
181
161
182
### Space for improvements:
162
183
163
-
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++ tool[BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
184
+
-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, because even the computation for this takes so much time, that it is not worth implementing it in python - but this is available in[BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
0 commit comments