@@ -48,8 +48,7 @@ def __init__(self, method: str, available_methods: list):
48
48
class CMethods :
49
49
"""
50
50
The CMethods class serves a collection of bias correction procedures to adjust
51
- time-series of climate data. It accept no parameters but must be instantiated
52
- to apply the bias correction techniques.
51
+ time-series of climate data.
53
52
54
53
The following bias correction techniques are available:
55
54
Scaling-based techniques:
@@ -91,8 +90,9 @@ def get_available_methods(cls) -> list:
91
90
:linenos:
92
91
:caption: Example: Get available methods
93
92
94
- >>> from cmethods.CMethods import CMethods
95
- >>> CMethods().get_available_methods()
93
+ >>> from cmethods.CMethods import CMethods as cm
94
+
95
+ >>> cm.get_available_methods()
96
96
[
97
97
"linear_scaling", "variance_scaling", "delta_method",
98
98
"quantile_mapping", "quantile_delta_mapping"
@@ -169,7 +169,7 @@ def adjust_3d(
169
169
:caption: Example application - 3-dimensinoal bias correction
170
170
171
171
>>> import xarray as xr
172
- >>> from cmethods.CMethods import CMethods
172
+ >>> from cmethods.CMethods import CMethods as cm
173
173
174
174
>>> # Note: The data sets must contain the dimensions "time", "lat", and "lon"
175
175
>>> # for the respective variable.
@@ -178,8 +178,6 @@ def adjust_3d(
178
178
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
179
179
>>> variable = "tas" # temperatures
180
180
181
- >>> cm = CMethods()
182
-
183
181
'''
184
182
In the following the Quantile Delta Mapping techniques is applied on
185
183
3-dimensional time-series data sets containing the variable "tas". The
@@ -422,7 +420,7 @@ def linear_scaling(
422
420
:caption: Example: Linear Scaling
423
421
424
422
>>> import xarray as xr
425
- >>> from cmethods.CMethods import CMethods
423
+ >>> from cmethods.CMethods import CMethods as cm
426
424
427
425
>>> # Note: The data sets must contain the dimension "time"
428
426
>>> # for the respective variable.
@@ -431,7 +429,6 @@ def linear_scaling(
431
429
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
432
430
>>> variable = "tas" # temperatures
433
431
434
- >>> cm = CMethods()
435
432
>>> ls_adjusted = cm.linear_scaling(
436
433
... obs=obs[variable],
437
434
... simh=simh[variable],
@@ -543,7 +540,7 @@ def variance_scaling(
543
540
:caption: Example: Variance Scaling
544
541
545
542
>>> import xarray as xr
546
- >>> from cmethods.CMethods import CMethods
543
+ >>> from cmethods.CMethods import CMethods as cm
547
544
548
545
>>> # Note: The data sets must contain the dimension "time"
549
546
>>> # for the respective variable.
@@ -552,7 +549,6 @@ def variance_scaling(
552
549
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
553
550
>>> variable = "tas" # temperatures
554
551
555
- >>> cm = CMethods()
556
552
>>> vs_adjusted = cm.variance_scaling(
557
553
... obs=obs[variable],
558
554
... simh=simh[variable],
@@ -663,7 +659,7 @@ def delta_method(
663
659
:caption: Example: Delta Method
664
660
665
661
>>> import xarray as xr
666
- >>> from cmethods.CMethods import CMethods
662
+ >>> from cmethods.CMethods import CMethods as cm
667
663
668
664
>>> # Note: The data sets must contain the dimension "time"
669
665
>>> # for the respective variable.
@@ -672,7 +668,6 @@ def delta_method(
672
668
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
673
669
>>> variable = "tas" # temperatures
674
670
675
- >>> cm = CMethods()
676
671
>>> dm_adjusted = cm.delta_method(
677
672
... obs=obs[variable],
678
673
... simh=simh[variable],
@@ -775,7 +770,7 @@ def quantile_mapping(
775
770
:caption: Example: Quantile Mapping
776
771
777
772
>>> import xarray as xr
778
- >>> from cmethods.CMethods import CMethods
773
+ >>> from cmethods.CMethods import CMethods as cm
779
774
780
775
>>> # Note: The data sets must contain the dimension "time"
781
776
>>> # for the respective variable.
@@ -784,7 +779,6 @@ def quantile_mapping(
784
779
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
785
780
>>> variable = "tas" # temperatures
786
781
787
- >>> cm = CMethods()
788
782
>>> qm_adjusted = cm.quantile_mapping(
789
783
... obs=obs[variable],
790
784
... simh=simh[variable],
@@ -1005,7 +999,7 @@ def quantile_delta_mapping(
1005
999
:caption: Example: Quantile Delta Mapping
1006
1000
1007
1001
>>> import xarray as xr
1008
- >>> from cmethods.CMethods import CMethods
1002
+ >>> from cmethods.CMethods import CMethods as cm
1009
1003
1010
1004
>>> # Note: The data sets must contain the dimension "time"
1011
1005
>>> # for the respective variable.
@@ -1014,7 +1008,6 @@ def quantile_delta_mapping(
1014
1008
>>> simp = xr.open_dataset("path/to/the_dataset_to_adjust-scenario_period.nc")
1015
1009
>>> variable = "tas" # temperatures
1016
1010
1017
- >>> cm = CMethods()
1018
1011
>>> qdm_adjusted = cm.quantile_delta_mapping(
1019
1012
... obs=obs[variable],
1020
1013
... simh=simh[variable],
@@ -1089,8 +1082,8 @@ def get_pdf(x: Union[list, np.array], xbins: Union[list, np.array]) -> np.array:
1089
1082
:linenos:
1090
1083
:caption: Compute the probability density function :math:`P(x)`
1091
1084
1092
- >>> from cmethods.CMethods import CMethods
1093
- >>> cm = CMethods()
1085
+ >>> from cmethods.CMethods import CMethods as cm
1086
+
1094
1087
>>> x = [1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10]
1095
1088
>>> xbins = [0, 3, 6, 10]
1096
1089
>>> print(cm.get_pdf(x=x, xbins=xbins))
@@ -1117,8 +1110,8 @@ def get_cdf(x: Union[list, np.array], xbins: Union[list, np.array]) -> np.array:
1117
1110
:linenos:
1118
1111
:caption: Compute the cmmulative distribution function :math:`F(x)`
1119
1112
1120
- >>> from cmethods.CMethods import CMethods
1121
- >>> cm = CMethods()
1113
+ >>> from cmethods.CMethods import CMethods as cm
1114
+
1122
1115
>>> x = [1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10]
1123
1116
>>> xbins = [0, 3, 6, 10]
1124
1117
>>> print(cm.get_cdf(x=x, xbins=xbins))
0 commit comments