Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11.0
python-version: 3.10.8
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge
channel-priority: flexible
show-channel-urls: true
- name: Create env from unpinned reqs
- name: Create env from pinned environment
run: |
conda env create --name dev_env --file requirements/requirements.yml
conda env create --name dev_env --file requirements/environment.yml
- name: Install pre-commit hooks
run: |
conda run --name dev_env pre-commit install-hooks
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11.0
python-version: 3.10.8
- uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge
channel-priority: flexible
show-channel-urls: true
- name: Create dev env from unpinned reqs
- name: Create env from pinned environment
run: |
conda env create --name dev_env --file requirements/requirements.yml
./setup_env.sh -n probtest
- name: Run Pytest
env:
TZ: Europe/Zurich
run: |
conda run --name dev_env pytest -v -s --cov --cov-report=term tests/
conda run --name probtest pytest -v -s --cov --cov-report=term tests/
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.idea*
.vscode/*
!.vscode/settings.json
.vscode
*pycache*
*.swp
*.pdf
Expand All @@ -9,6 +8,7 @@
*.nc
.coverage
coverage.xml
miniconda

# output from unittest
test_stats.csv
Expand Down
35 changes: 28 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@ Visualize the performance database generated with `performance`.

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.

### Setup conda

All requirements for using probtest can be easily installed with conda using the
setup scripts.

For setting up conda you use
```console
./setup_miniconda.sh -u
```
which will modify your `.bashrc`, or you can use
```console
./setup_miniconda.sh
source miniconda/bin/activate
```
which requires to source minconda.

The pinned requirements can be installed by
```console
./setup_env.sh
```
The unpinned requirements and updating the environment can be done by
```console
./setup_env.sh -u -e
```


### The init command

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

All requirements for using probtest can be easily installed with conda using the
setup scripts:

```console
./setup_miniconda.sh
./setup_env.sh -n probtest -u
```
You need to have setup a proper environment, for example as described in the
section [Setup conda](#setup-conda).

#### Initialize probtest
Once set up, probtest can generate the config file according to your needs.
Expand Down
4 changes: 2 additions & 2 deletions engine/cdo_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def rel_diff_stats(
horizontal_dims,
xarray_ds,
fill_value_key,
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument, too-many-positional-arguments
dims = xarray_ds[varname].dims
dataarray = xarray_ds[varname]
time = xarray_ds[time_dim].values
Expand Down Expand Up @@ -125,7 +125,7 @@ def cdo_table(
perturbed_model_output_dir,
cdo_table_file,
file_specification,
):
): # pylint: disable=too-many-positional-arguments
# TODO: A single perturbed run provides enough data to make proper statistics.
# refactor cdo_table interface to reflect that
if len(member_num) == 1:
Expand Down
2 changes: 1 addition & 1 deletion engine/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def init(
timing_current,
timing_reference,
append_time,
):
): # pylint: disable=too-many-positional-arguments
template_partition = str(template_name).rpartition("/")
env = Environment(
loader=FileSystemLoader(template_partition[0]), undefined=StrictUndefined
Expand Down
2 changes: 1 addition & 1 deletion engine/performance_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def performance_check(
measurement_uncertainty,
tolerance_factor,
new_reference_threshold,
):
): # pylint: disable=too-many-positional-arguments
ttcur = TimingTree.from_json(timing_current)
ttref = TimingTree.from_json(timing_reference)

Expand Down
2 changes: 1 addition & 1 deletion engine/perturb.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def perturb(
variable_names,
perturb_amplitude,
copy_all_files,
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument, too-many-positional-arguments

processed_member_num = process_member_num(member_num)

Expand Down
4 changes: 2 additions & 2 deletions engine/run_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def prepare_perturbed_run_script(
rhs_new,
rhs_old,
seed,
):
): # pylint: disable=too-many-positional-arguments
with open(runscript, "r", encoding="utf-8") as in_file:
with open(perturbed_runscript, "w", encoding="utf-8") as out_file:

Expand Down Expand Up @@ -222,7 +222,7 @@ def run_ensemble(
lhs,
rhs_new,
rhs_old,
):
): # pylint: disable=too-many-positional-arguments
perturbed_run_dir = perturbed_run_dir if perturbed_run_dir else run_dir
os.chdir(run_dir)
job_list = []
Expand Down
4 changes: 2 additions & 2 deletions engine/select_members.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def find_members_and_factor_validating_for_all_stats_files(
min_factor,
max_factor,
iterations,
):
): # pylint: disable=too-many-positional-arguments

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

Expand Down Expand Up @@ -263,7 +263,7 @@ def select_members(
min_factor,
max_factor,
iterations,
): # pylint: disable=unused-argument
): # pylint: disable=unused-argument, too-many-positional-arguments

if min_member_num > max_member_num:
logger.error(
Expand Down
4 changes: 2 additions & 2 deletions engine/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def process_member(
file_id,
stats_file_name,
file_specification,
):
): # pylint: disable=too-many-positional-arguments
if m_num == 0:
input_dir = model_output_dir
m_id = "ref"
Expand Down Expand Up @@ -110,7 +110,7 @@ def stats(
member_type,
perturbed_model_output_dir,
file_specification,
):
): # pylint: disable=too-many-positional-arguments
file_specification = file_specification[0] # can't store dicts as defaults in click
assert isinstance(file_specification, dict), "must be dict"

Expand Down
Loading
Loading