Skip to content

Commit 0b5e202

Browse files
authored
Merge branch 'main' into adaptive_architecture
2 parents ecfcda5 + 06ff6d6 commit 0b5e202

File tree

17 files changed

+159
-145
lines changed

17 files changed

+159
-145
lines changed

.github/workflows/pre-commit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@v2
2121
with:
22-
python-version: 3.11.0
22+
python-version: 3.10.8
2323
- uses: conda-incubator/setup-miniconda@v2
2424
with:
2525
miniconda-version: "latest"
2626
channels: conda-forge
2727
channel-priority: flexible
2828
show-channel-urls: true
29-
- name: Create env from unpinned reqs
29+
- name: Create env from pinned environment
3030
run: |
31-
conda env create --name dev_env --file requirements/requirements.yml
31+
conda env create --name dev_env --file requirements/environment.yml
3232
- name: Install pre-commit hooks
3333
run: |
3434
conda run --name dev_env pre-commit install-hooks

.github/workflows/pytest.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ jobs:
1919
- name: Set up Python
2020
uses: actions/setup-python@v2
2121
with:
22-
python-version: 3.11.0
22+
python-version: 3.10.8
2323
- uses: conda-incubator/setup-miniconda@v2
2424
with:
2525
miniconda-version: "latest"
2626
channels: conda-forge
2727
channel-priority: flexible
2828
show-channel-urls: true
29-
- name: Create dev env from unpinned reqs
29+
- name: Create env from pinned environment
3030
run: |
31-
conda env create --name dev_env --file requirements/requirements.yml
31+
./setup_env.sh -n probtest
3232
- name: Run Pytest
3333
env:
3434
TZ: Europe/Zurich
3535
run: |
36-
conda run --name dev_env pytest -v -s --cov --cov-report=term tests/
36+
conda run --name probtest pytest -v -s --cov --cov-report=term tests/

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.idea*
2-
.vscode/*
3-
!.vscode/settings.json
2+
.vscode
43
*pycache*
54
*.swp
65
*.pdf
@@ -9,6 +8,7 @@
98
*.nc
109
.coverage
1110
coverage.xml
11+
miniconda
1212

1313
# output from unittest
1414
test_stats.csv

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,32 @@ Visualize the performance database generated with `performance`.
8080

8181
Even though probtest is used exclusively with ICON at the moment, it does not contain any information about the model or its directory structure. This makes it very flexible and applicable to any circumstance (e.g. usable by Buildbot, Jenkins and human users alike). However, it also requires a lot of information about the model and the data to be processed upon invocation. Since a typical probtest usage involves multiple commands (e.g. run-ensemble -> stats -> tolerance -> check) this leads to a lot of redundancy in the invocation. Therefore, probtest can read commonly used input variables (e.g. the model output directory, the experiment name, the name of the submit script, ...) from a configuration file in json format. To further ease the process, these configuration files can be created from templates using the `init` command. A template for ICON is contained in this repository in the `templates` subdirectory.
8282

83+
### Setup conda
84+
85+
All requirements for using probtest can be easily installed with conda using the
86+
setup scripts.
87+
88+
For setting up conda you use
89+
```console
90+
./setup_miniconda.sh -u
91+
```
92+
which will modify your `.bashrc`, or you can use
93+
```console
94+
./setup_miniconda.sh
95+
source miniconda/bin/activate
96+
```
97+
which requires to source minconda.
98+
99+
The pinned requirements can be installed by
100+
```console
101+
./setup_env.sh
102+
```
103+
The unpinned requirements and updating the environment can be done by
104+
```console
105+
./setup_env.sh -u -e
106+
```
107+
108+
83109
### The init command
84110

85111
This command sets up the configuration file. For more help on the command line arguments for `init`, see
@@ -102,13 +128,8 @@ Objective: Run an `exp_name` ICON experiment with an test build and check if the
102128
output of the test is within a perturbed ensemble of the reference build.
103129
This is in particular used to validate a GPU build against a CPU reference.
104130

105-
All requirements for using probtest can be easily installed with conda using the
106-
setup scripts:
107-
108-
```console
109-
./setup_miniconda.sh
110-
./setup_env.sh -n probtest -u
111-
```
131+
You need to have setup a proper environment, for example as described in the
132+
section [Setup conda](#setup-conda).
112133

113134
#### Initialize probtest
114135
Once set up, probtest can generate the config file according to your needs.

engine/cdo_table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def rel_diff_stats(
4545
horizontal_dims,
4646
xarray_ds,
4747
fill_value_key,
48-
): # pylint: disable=unused-argument
48+
): # pylint: disable=unused-argument, too-many-positional-arguments
4949
dims = xarray_ds[varname].dims
5050
dataarray = xarray_ds[varname]
5151
time = xarray_ds[time_dim].values
@@ -125,7 +125,7 @@ def cdo_table(
125125
perturbed_model_output_dir,
126126
cdo_table_file,
127127
file_specification,
128-
):
128+
): # pylint: disable=too-many-positional-arguments
129129
# TODO: A single perturbed run provides enough data to make proper statistics.
130130
# refactor cdo_table interface to reflect that
131131
if len(member_num) == 1:

engine/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def init(
9696
timing_current,
9797
timing_reference,
9898
append_time,
99-
):
99+
): # pylint: disable=too-many-positional-arguments
100100
template_partition = str(template_name).rpartition("/")
101101
env = Environment(
102102
loader=FileSystemLoader(template_partition[0]), undefined=StrictUndefined

engine/performance_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def performance_check(
5050
measurement_uncertainty,
5151
tolerance_factor,
5252
new_reference_threshold,
53-
):
53+
): # pylint: disable=too-many-positional-arguments
5454
ttcur = TimingTree.from_json(timing_current)
5555
ttref = TimingTree.from_json(timing_reference)
5656

engine/perturb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def perturb(
100100
variable_names,
101101
perturb_amplitude,
102102
copy_all_files,
103-
): # pylint: disable=unused-argument
103+
): # pylint: disable=unused-argument, too-many-positional-arguments
104104

105105
processed_member_num = process_member_num(member_num)
106106

engine/run_ensemble.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def prepare_perturbed_run_script(
7171
rhs_new,
7272
rhs_old,
7373
seed,
74-
):
74+
): # pylint: disable=too-many-positional-arguments
7575
with open(runscript, "r", encoding="utf-8") as in_file:
7676
with open(perturbed_runscript, "w", encoding="utf-8") as out_file:
7777

@@ -222,7 +222,7 @@ def run_ensemble(
222222
lhs,
223223
rhs_new,
224224
rhs_old,
225-
):
225+
): # pylint: disable=too-many-positional-arguments
226226
perturbed_run_dir = perturbed_run_dir if perturbed_run_dir else run_dir
227227
os.chdir(run_dir)
228228
job_list = []

engine/select_members.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def find_members_and_factor_validating_for_all_stats_files(
3333
min_factor,
3434
max_factor,
3535
iterations,
36-
):
36+
): # pylint: disable=too-many-positional-arguments
3737

3838
members = list(range(1, total_member_num + 1))
3939

@@ -263,7 +263,7 @@ def select_members(
263263
min_factor,
264264
max_factor,
265265
iterations,
266-
): # pylint: disable=unused-argument
266+
): # pylint: disable=unused-argument, too-many-positional-arguments
267267

268268
if min_member_num > max_member_num:
269269
logger.error(

0 commit comments

Comments
 (0)