Skip to content

Commit da4577c

Browse files
created examples directory; moved examples; minor adjustments
1 parent 04fa119 commit da4577c

File tree

5 files changed

+76
-72
lines changed

5 files changed

+76
-72
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ cmake .. && cmake --build .
9797
- CMake v3.10+ ([How to install CMake](https://cmake.org/install/))
9898
- [optional] Climate Data Operators ([How to install cdo](https://www.isimip.org/protocol/preparing-simulation-files/cdo-help/))
9999

100-
Optional for working example notebook `examples.ipynb`:
100+
Optional for working example notebook `/examples/examples.ipynb`:
101101

102102
```bash
103103
conda create --name clingenv
104104
conda activate clingenv
105105
conda install xeus-cling notebook -c conda-forge/label/gcc7
106106
```
107107

108-
(There is also an `environment.yml` file that creates a working environment for this notebook.)
108+
(There is also an `/examples/environment.yml` file that creates a working environment for this notebook.)
109109

110110
### 3.3 Data requirements:
111111

@@ -141,10 +141,10 @@ conda install xeus-cling notebook -c conda-forge/label/gcc7
141141

142142
## 5. Usage and Examples
143143

144-
The script `example_all_methods.run.sh` serves as an example on how to adjust the example data using all implemented methods.
145-
`Hands-On-BiasAdjustCXX.ipynb` shows how to clone, build, compile, and run the `BiasAdjustCXX` command-line tool. Also plots validating the results are presented here.
144+
The script `/examples/example_all_methods.run.sh` serves as an example on how to adjust the example data using all implemented methods.
145+
`/examples/Hands-On-BiasAdjustCXX.ipynb` shows how to clone, build, compile, and run the `BiasAdjustCXX` command-line tool. Also plots validating the results are presented here.
146146

147-
All methods to bias-adjust climate data can be found in `src/CMethods.cxx`. These can be imported into a Jupyter Notebook (with C++ kernel) to test scripts and develop custom algorithms (see `examples.ipynb`).
147+
All methods to bias-adjust climate data can be found in `/src/CMethods.cxx`. These can be imported into a Jupyter Notebook (with C++ kernel) to test scripts and develop custom algorithms (see `/examples/examples.ipynb`).
148148

149149
Examples:
150150

@@ -211,7 +211,7 @@ BiasAdjustCXX -h
211211
1.) For adjusting data using the linear scaling, variance scaling or delta method and the `--no-group` flag:
212212

213213
> You have to separate the files by month and then apply the correction for each month individually.
214-
> e.g. For 30 years of data to correct, you need to create a data set that contains all data for all Januaries and then apply the adjustment for this data set. After that you have to do the same for the rest of the months (see `example_adjust.run.sh`).
214+
> e.g. For 30 years of data to correct, you need to create a data set that contains all data for all Januaries and then apply the adjustment for this data set. After that you have to do the same for the rest of the months (see `/examples/example_adjust.run.sh`).
215215
216216
2.) Formulas and references can be found below and at the implementation of the corresponding functions.
217217

Hands-On-BiasAdjustCXX.ipynb renamed to examples/Hands-On-BiasAdjustCXX.ipynb

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@
272272
]
273273
},
274274
{
275-
"attachments": {},
276275
"cell_type": "markdown",
277276
"id": "c9a00890",
278277
"metadata": {},
@@ -922,15 +921,21 @@
922921
],
923922
"metadata": {
924923
"kernelspec": {
925-
"display_name": "Julia 1.8.3",
926-
"language": "julia",
927-
"name": "julia-1.8"
924+
"display_name": "Python 3 (ipykernel)",
925+
"language": "python",
926+
"name": "python3"
928927
},
929928
"language_info": {
930-
"file_extension": ".jl",
931-
"mimetype": "application/julia",
932-
"name": "julia",
933-
"version": "1.8.3"
929+
"codemirror_mode": {
930+
"name": "ipython",
931+
"version": 3
932+
},
933+
"file_extension": ".py",
934+
"mimetype": "text/x-python",
935+
"name": "python",
936+
"nbconvert_exporter": "python",
937+
"pygments_lexer": "ipython3",
938+
"version": "3.9.13"
934939
},
935940
"vscode": {
936941
"interpreter": {
File renamed without changes.

example_adjust.run.sh renamed to examples/example_all_methods.run.sh

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@
3131
# ? OR: sh example.run.adjust.sh
3232
# * -------------------------------------------------------------------
3333

34-
work_dir=$(pwd)
34+
work_dir=$(pwd) # you may have to change the path here
3535
mkdir -p "${work_dir}/output"
3636
output_dir="${work_dir}/output"
3737
rm -rf tmp/
3838

39+
input_dir="../input_data"
3940
timespan="19810101_20101231"
40-
observations="${work_dir}/input_data/observations.nc"
41-
control="${work_dir}/input_data/control.nc"
42-
scenario="${work_dir}/input_data/scenario.nc"
41+
observations="${input_dir}/observations.nc"
42+
control="${input_dir}/control.nc"
43+
scenario="${input_dir}/scenario.nc"
4344

4445
variable="tas"
4546
kind="+"
4647
n_quantiles=100
4748

48-
exec_file="${work_dir}/build/BiasAdjustCXX"
49+
exec_file="${work_dir}/../build/BiasAdjustCXX"
4950

5051
declare -a month_methods=("delta_method" "linear_scaling" "variance_scaling")
5152
declare -a quant_methods=("quantile_mapping" "quantile_delta_mapping")
@@ -91,7 +92,7 @@ done
9192

9293

9394
# * -------------------------------------------------------------------
94-
# * ===== Default Scaling Adjustent =====
95+
# * ===== Default Scaling Adjustent (long-term 31-day intervals) =====
9596
# * -------------------------------------------------------------------
9697

9798
# ? Additive linear scaling based on 31 day long-term mean interval instead of
@@ -100,9 +101,9 @@ done
100101
# this is available for all scaling methods
101102

102103
$exec_file \
103-
--ref input_data/observations.nc \
104-
--contr input_data/control.nc \
105-
--scen input_data/scenario.nc \
104+
--ref $observations \
105+
--contr $control \
106+
--scen $scenario \
106107
-m "linear_scaling" \
107108
-v $variable \
108109
-k "add" \
@@ -111,7 +112,7 @@ $exec_file \
111112

112113

113114
# * -------------------------------------------------------------------
114-
# * ===== Scaling Adjustment based on monthly means =====
115+
# * ===== Scaling Adjustment based on long-term monthly means =====
115116
# * -------------------------------------------------------------------
116117

117118
# ? OR: Adjust using the regular formulas using long-term monthly means by using the --no-group flag
@@ -157,19 +158,17 @@ done
157158
# * -------------------------------------------------------------------
158159

159160
# ? Adjustment of a data set with only one dimension (time)
160-
$exec_file \
161-
--ref input_data/1d_observations.nc \
162-
--contr input_data/1d_control.nc \
163-
--scen input_data/1d_scenario.nc \
164-
-m "quantile_mapping" \
165-
-v $variable \
166-
-q $n_quantiles \
167-
-k $kind \
168-
--1dim \
161+
$exec_file \
162+
--ref "${input_dir}/1d_observations.nc" \
163+
--contr "${input_dir}/1d_control.nc" \
164+
--scen "${input_dir}/1d_scenario.nc" \
165+
-m "quantile_mapping" \
166+
-v $variable \
167+
-q $n_quantiles \
168+
-k $kind \
169+
--1dim \
169170
-o "${output_dir}/${variable}_1d_quantile_mapping_kind-${kind}_quants-${n_quantiles}_result_${timespan}.nc"
170171

171-
172-
173172
# * -------------------------------------------------------------------
174173
# * ===== clean-up =====
175174
# * -------------------------------------------------------------------

0 commit comments

Comments
 (0)