Skip to content

Commit 84fb40d

Browse files
Update the documentation + project maintenance (#70)
1 parent 00f4152 commit 84fb40d

22 files changed

+188
-92
lines changed

.github/dependabot.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"

.github/workflows/_build.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: Build
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
workflow_call:
1316
inputs:
@@ -23,10 +26,10 @@ jobs:
2326
runs-on: ${{ inputs.os }}
2427
steps:
2528
- name: Checkout repository
26-
uses: actions/checkout@v4
29+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
2730

2831
- name: Set up Python ${{ inputs.python-version }}
29-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
3033
with:
3134
python-version: ${{ inputs.python-version }}
3235

.github/workflows/_build_doc.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
name: Build Doc
99

10+
permissions:
11+
contents: read
12+
1013
on:
1114
workflow_call:
1215
inputs:
@@ -22,10 +25,10 @@ jobs:
2225
runs-on: ${{ inputs.os }}
2326
steps:
2427
- name: Checkout repository
25-
uses: actions/checkout@v4
28+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
2629

2730
- name: Set up Python ${{ inputs.python-version }}
28-
uses: actions/setup-python@v5
31+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
2932
with:
3033
python-version: ${{ inputs.python-version }}
3134

.github/workflows/_codecov.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
name: CodeCov
1010

11+
permissions:
12+
contents: read
13+
1114
on:
1215
workflow_call:
1316
inputs:
@@ -32,10 +35,10 @@ jobs:
3235

3336
steps:
3437
- name: Checkout repository
35-
uses: actions/checkout@v4
38+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
3639

3740
- name: Set up Python ${{ matrix.python-version }}
38-
uses: actions/setup-python@v5
41+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
3942
with:
4043
python-version: ${{ inputs.python-version }}
4144

@@ -49,7 +52,7 @@ jobs:
4952
run: pytest --cov --cov-report=xml
5053

5154
- name: Upload coverage to Codecov
52-
uses: codecov/codecov-action@v3
55+
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab #v4.1.0
5356
with:
5457
token: ${{ secrets.CODECOV_TOKEN }}
5558
files: coverage.xml

.github/workflows/_codeql.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
steps:
3535
- name: Checkout repository
36-
uses: actions/checkout@v4
36+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
3737

3838
# Initializes the CodeQL tools for scanning.
3939
- name: Initialize CodeQL

.github/workflows/_pre_commit.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
name: Pre-Commit
99

10+
permissions:
11+
contents: read
12+
1013
on:
1114
workflow_call:
1215

@@ -15,5 +18,5 @@ jobs:
1518
runs-on: ubuntu-latest
1619
steps:
1720
- name: Checkout
18-
uses: actions/checkout@v4
19-
- uses: pre-commit/[email protected].0
21+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
22+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

.github/workflows/_pypi_publish.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
name: PyPI Publish
1111

12+
permissions:
13+
contents: read
14+
1215
on:
1316
workflow_call:
1417
inputs:
@@ -28,12 +31,12 @@ jobs:
2831

2932
steps:
3033
- name: Checkout repository
31-
uses: actions/checkout@v4
34+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
3235
with:
3336
fetch-depth: 0 # IMPORTANT: otherwise the current tag does not get fetched and the build version gets worse
3437

3538
- name: Set up Python 3.11
36-
uses: actions/setup-python@v5
39+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
3740
with:
3841
python-version: 3.11
3942

.github/workflows/_test.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
name: Test Spot
99

10+
permissions:
11+
contents: read
12+
1013
on:
1114
workflow_call:
1215
inputs:
@@ -23,10 +26,10 @@ jobs:
2326
runs-on: ${{ inputs.os }}
2427
steps:
2528
- name: Checkout repository
26-
uses: actions/checkout@v4
29+
uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0
2730

2831
- name: Set up Python ${{ inputs.python-version }}
29-
uses: actions/setup-python@v5
32+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
3033
with:
3134
python-version: ${{ inputs.python-version }}
3235

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,6 @@ clean:
104104
find tests -name "__pycache__" | xargs rm -rf
105105
find cmethods -name "__pycache__" | xargs rm -rf
106106
find examples -name "__pycache__" | xargs rm -rf
107+
108+
# for file in `ls .github/workflows`; do sed -i '' 's/actions\/checkout@v4/actions\/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0/g' .github/workflows/$file; done
109+
# for file in `ls .github/workflows`; do sed -i '' 's/actions\/setup-python@v5/actions\/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0/g' .github/workflows/$file; done

README.md

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,25 @@
1010
[![CI/CD](https://github.com/btschwertfeger/python-cmethods/actions/workflows/cicd.yaml/badge.svg?branch=master)](https://github.com/btschwertfeger/python-cmethods/actions/workflows/cicd.yaml)
1111
[![codecov](https://codecov.io/github/btschwertfeger/python-cmethods/branch/master/graph/badge.svg?token=OSO4PAABPD)](https://codecov.io/github/btschwertfeger/python-cmethods)
1212

13+
[![OpenSSF ScoreCard](https://img.shields.io/ossf-scorecard/github.com/btschwertfeger/python-cmethods?label=openssf%20scorecard&style=flat)](https://securityscorecards.dev/viewer/?uri=github.com/btschwertfeger/python-cmethods)
14+
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8666/badge)](https://www.bestpractices.dev/projects/8666)
15+
1316
![release](https://shields.io/github/release-date/btschwertfeger/python-cmethods)
1417
![release](https://shields.io/github/v/release/btschwertfeger/python-cmethods?display_name=tag)
1518
[![DOI](https://zenodo.org/badge/496160109.svg)](https://zenodo.org/badge/latestdoi/496160109)
1619
[![Documentation Status](https://readthedocs.org/projects/python-cmethods/badge/?version=stable)](https://python-cmethods.readthedocs.io/en/latest/?badge=stable)
1720

1821
</div>
1922

20-
This Python module serves as a collection of different scale- and
21-
distribution-based bias correction techniques for climate sciences.
22-
23-
The documentation is available at: [https://python-cmethods.readthedocs.io/en/stable/](https://python-cmethods.readthedocs.io/en/stable/)
23+
Welcome to python-cmethods, a powerful Python package designed for bias
24+
correction and adjustment of climate data. Built with a focus on ease of use and
25+
efficiency, python-cmethods offers a comprehensive suite of functions tailored
26+
for applying bias correction methods to climate model simulations and
27+
observational datasets.
2428

2529
Please cite this project as described in
2630
https://zenodo.org/doi/10.5281/zenodo.7652755.
2731

28-
> ⚠️ For the application of bias corrections on _large data sets_ it is
29-
> recommended to also try the command-line tool
30-
> [BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
31-
32-
---
33-
3432
## Table of Contents
3533

3634
1. [ About ](#about)
@@ -41,16 +39,16 @@ https://zenodo.org/doi/10.5281/zenodo.7652755.
4139
6. [ Contribution ](#contribution)
4240
7. [ References ](#references)
4341

44-
---
45-
4642
<a name="about"></a>
4743

4844
## 1. About
4945

50-
These programs and data structures are developed with the aim of reducing
51-
discrepancies between modeled and observed climate data. Historical data is
52-
utilized to calibrate variables from current and future time series to achieve
53-
distributional properties that closely resemble the possible actual values.
46+
Bias correction in climate research involves the adjustment of systematic errors
47+
or biases present in climate model simulations or observational datasets to
48+
improve their accuracy and reliability, ensuring that the data better represents
49+
actual climate conditions. This process typically involves statistical methods
50+
or empirical relationships to correct for biases caused by factors such as
51+
instrument calibration, spatial resolution, or model deficiencies.
5452

5553
<figure>
5654
<img
@@ -60,12 +58,24 @@ distributional properties that closely resemble the possible actual values.
6058
<figcaption>Figure 1: Schematic representation of a bias adjustment procedure</figcaption>
6159
</figure>
6260

63-
For instance, modeled data typically indicate values that are colder than the
64-
actual values. To address this issue, an adjustment procedure is employed. The
65-
figure below illustrates the observed, modeled, and adjusted values, revealing
66-
that the delta adjusted time series ($T^{*DM}_{sim,p}$) are significantly more
67-
similar to the observed data ($T{obs,p}$) than the raw modeled data
68-
($T_{sim,p}$).
61+
python-cmethods empowers scientists to effectively address those biases in
62+
climate data, ensuring greater accuracy and reliability in research and
63+
decision-making processes. By leveraging cutting-edge techniques and seamless
64+
integration with popular libraries like [xarray](https://xarray.dev/) and
65+
[Dask](https://docs.dask.org/en/stable/), this package simplifies the process
66+
of bias adjustment, even when dealing with large-scale climate simulations and
67+
extensive spatial domains.
68+
69+
In this way, for example, modeled data, which on average represent values that
70+
are too cold, can be easily bias-corrected by applying any adjustment procedure
71+
included in this package.
72+
73+
For instance, modeled data can report values that are way colder than the those
74+
data reported by reanalysis time-series. To address this issue, an adjustment
75+
procedure can be employed. The figure below illustrates the observed, modeled,
76+
and adjusted values, revealing that the delta-adjusted time series
77+
($T^{*DM}_{sim,p}$) is significantly more similar to the observational data
78+
($T{obs,p}$) than the raw model output ($T_{sim,p}$).
6979

7080
<figure>
7181
<img
@@ -75,6 +85,12 @@ similar to the observed data ($T{obs,p}$) than the raw modeled data
7585
<figcaption>Figure 2: Temperature per day of year in observed, modeled, and bias-adjusted climate data</figcaption>
7686
</figure>
7787

88+
The mathematical foundations supporting each bias correction technique
89+
implemented in python-cmethods are integral to the package, ensuring
90+
transparency and reproducibility in the correction process. Each method is
91+
accompanied by references to trusted publications, reinforcing the reliability
92+
and rigor of the corrections applied.
93+
7894
<a name="methods"></a>
7995

8096
## 2. Available Methods
@@ -96,16 +112,16 @@ https://python-cmethods.readthedocs.io/en/stable/
96112
non-stochastic climate variables. Variance scaling can only be applied on
97113
non-stochastic climate variables.
98114

99-
- Non-stochastic climate variables are those that can be predicted with relative
100-
certainty based on factors such as location, elevation, and season. Examples
101-
of non-stochastic climate variables include air temperature, air pressure, and
102-
solar radiation.
115+
- Non-stochastic climate variables are those that can be predicted with
116+
relative certainty based on factors such as location, elevation, and season.
117+
Examples of non-stochastic climate variables include air temperature, air
118+
pressure, and solar radiation.
103119

104-
- Stochastic climate variables, on the other hand, are those that exhibit a high
105-
degree of variability and unpredictability, making them difficult to forecast
106-
accurately. Precipitation is an example of a stochastic climate variable
107-
because it can vary greatly in timing, intensity, and location due to complex
108-
atmospheric and meteorological processes.
120+
- Stochastic climate variables, on the other hand, are those that exhibit a
121+
high degree of variability and unpredictability, making them difficult to
122+
forecast accurately. Precipitation is an example of a stochastic climate
123+
variable because it can vary greatly in timing, intensity, and location due
124+
to complex atmospheric and meteorological processes.
109125

110126
- Except for the detrended quantile mapping (DQM) technique, all methods can be
111127
applied to 1- and 3-dimensional data sets. The implementation of DQM to
@@ -114,7 +130,8 @@ https://python-cmethods.readthedocs.io/en/stable/
114130
- Except for DQM, all methods can be applied using `cmethods.adjust`. Chunked
115131
data for computing e.g. in a dask cluster is possible as well.
116132

117-
- For any questions -- please open an issue at https://github.com/btschwertfeger/python-cmethods/issues
133+
- For any questions -- please open an issue at
134+
https://github.com/btschwertfeger/python-cmethods/issues
118135

119136
<a name="installation"></a>
120137

@@ -124,8 +141,6 @@ https://python-cmethods.readthedocs.io/en/stable/
124141
python3 -m pip install python-cmethods
125142
```
126143

127-
---
128-
129144
<a name="examples"></a>
130145

131146
## 4. Usage and Examples
@@ -178,8 +193,9 @@ Notes:
178193

179194
Notebook with different methods and plots: `/examples/examples.ipynb`
180195

181-
There is also an example script (`/examples/biasadjust.py`) that can be used to apply the available bias correction methods
182-
on 1- and 3-dimensional data sets (see `/examples/input_data/*.nc`).
196+
There is also an example script (`/examples/biasadjust.py`) that can be used to
197+
apply the available bias correction methods on 1- and 3-dimensional data sets
198+
(see `/examples/input_data/*.nc`).
183199

184200
Help:
185201

@@ -219,8 +235,6 @@ Notes:
219235
- This script is far away from perfect - so please see it, as a starting point.
220236
(:
221237

222-
---
223-
224238
<a name="notes"></a>
225239

226240
## 5. Notes
@@ -246,8 +260,6 @@ Notes:
246260
is available in
247261
[BiasAdjustCXX](https://github.com/btschwertfeger/BiasAdjustCXX).
248262

249-
---
250-
251263
<a name="contribution"></a>
252264

253265
## 6. 🆕 Contributions
@@ -277,5 +289,3 @@ Notes:
277289
https://github.com/btschwertfeger/python-cmethods/issues/47. I appreciate all
278290
the valuable suggestions provided throughout the implementation of the
279291
subsequent changes.
280-
281-
---

0 commit comments

Comments
 (0)