Skip to content

Commit

Permalink
Introduce icon4py model (#221)
Browse files Browse the repository at this point in the history
Introduces the icon4py.model namespace which contains the common namespace package and the atmosphere.dycore namespace package.

---------

Co-authored-by: Enrique G. Paredes <18477+egparedes@users.noreply.github.com>
  • Loading branch information
samkellerhals and egparedes authored Jul 20, 2023
1 parent 6108462 commit 260043c
Show file tree
Hide file tree
Showing 301 changed files with 1,457 additions and 1,467 deletions.
41 changes: 0 additions & 41 deletions .coveragerc

This file was deleted.

20 changes: 11 additions & 9 deletions .github/workflows/icon4py-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,18 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
- name: Install icon4py-atmosphere-dycore
working-directory: model/atmosphere/dycore
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install $(cat ./base-requirements-dev.txt | grep pre-commit)
pre-commit install-hooks
# mypy hook uses local repo and thus requires installing icon4py & gt4py
python -m pip install $(cat ./base-requirements-dev.txt | grep mypy)
python -m pip install $(cat ./base-requirements-dev.txt | grep gt4py)
python -m pip install $(cat ./requirements-dev.txt | grep '\-e')
- name: Run checks
python -m pip install -r ./requirements-dev.txt
- name: Install icon4py-common
working-directory: model/common
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r ./requirements-dev.txt
- name: Run checks icon4py-model
run: |
python -m pip list
pre-commit run --config .pre-commit-config.yaml --all-files
pre-commit run --config model/.pre-commit-config.yaml --all-files
10 changes: 2 additions & 8 deletions .github/workflows/icon4py-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,9 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Test with tox
- name: Test icon4py-model with tox
run: |
pyversion_no_dot="${{ matrix.python-version }}"
pyversion_no_dot="${pyversion_no_dot/./}"
pip install tox clang-format
tox -r -e py${pyversion_no_dot}
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: _reports/coverage_html/
tox -r -e py${pyversion_no_dot} -c model/
1 change: 1 addition & 0 deletions .github/workflows/icon4pytools-qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
with:
python-version: "3.10"
- name: Install dependencies
working-directory: tools
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r ./requirements-dev.txt
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/icon4pytools-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ jobs:
strategy:
matrix:
python-version: ["3.10"]
defaults:
run:
working-directory: tools

steps:
- uses: actions/checkout@v2
Expand All @@ -58,10 +55,4 @@ jobs:
pyversion_no_dot="${{ matrix.python-version }}"
pyversion_no_dot="${pyversion_no_dot/./}"
pip install tox clang-format
tox -r -e py${pyversion_no_dot}
- name: Archive code coverage results
uses: actions/upload-artifact@v2
with:
name: code-coverage-report
path: _reports/coverage_html/
tox -r -e py${pyversion_no_dot} -c tools/
15 changes: 0 additions & 15 deletions .isort.cfg

This file was deleted.

29 changes: 0 additions & 29 deletions .mypy.ini

This file was deleted.

40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

# ICON4Py

## Description
ICON4Py hosts Python implementations of various components from the ICON climate and weather model. Additionally, it includes icon4pytools, a collection of command-line interfaces (CLIs), and utilities required for the integration of ICON4Py code into the ICON Fortran model. ICON4Py leverages [GT4Py](https://github.com/GridTools/gt4py) to ensure efficient and performance portable implementations of these components.

ICON4Py contains Python (GT4Py) implementations of ICON (inspired) components for weather and climate models as well as `icon4pytools`, a package containing CLIs and utilties needed for the integration of ICON4Py code into the ICON Fortran model.
## Project Structure

## Project structure

Each directory contains Python packages of ICON components or utility packages that are deployable on their own. As these packages are not available from a package repository (yet), location of dependencies within this repository have to be provided explicitly, e.g. by installing the dependencies first. See [Installation instructions](#installation-instructions).
The repository is organized into directories, each containing independent Python namespace packages for different ICON components or utility packages. These packages can be installed independently. Since these packages are not available from a package repository (yet), you need to specify the location of dependencies within this repository. This can be done by installing the required dependencies first. Refer to the [Installation instructions](#installation-instructions) below.

## Installation instructions

Expand Down Expand Up @@ -49,7 +47,7 @@ pip install --src _external_src -r requirements-dev.txt
pytest -v
```

The `--src _external_src` option tells `pip` to use a specific folder as base path for checked out sources, which is very convenient for development tasks involving changes in external dependencies like `gt4py`. For convenience, `./_external_src` has been already added to the repository `.gitignore`.
The `--src _external_src` option tells `pip` to use a specific folder as the base path for checked out sources, which is very convenient for development tasks involving changes in external dependencies like `gt4py`. For convenience, `./_external_src` has been already added to the repository `.gitignore`.

### Installation of specific subpackages

Expand All @@ -70,7 +68,7 @@ source .venv/bin/activate
pip install --upgrade wheel

# Install a specific ICON4Py subpackage and its dependencies
cd _SUBPACKAGE_ # where _SUBPACKAGE_ in atm_dyn_iconam | tools | ...
cd _SUBPACKAGE_ # where _SUBPACKAGE_ in model/atmosphere/dycore | tools | ...
pip install -r requirements-dev.txt

# or in the case of there being a pyproject.toml file
Expand All @@ -83,24 +81,14 @@ After following the installation instructions above using the development requir

### Code quality checks

[pre-commit](https://pre-commit.com/) is used to run several linting and checking tools. It should always be executed locally before opening a pull request. `pre-commit` can also be installed as a _git hook_ to automatically check the staged changes before committing:
[pre-commit](https://pre-commit.com/) is used to run several linting and checking tools. It should always be executed locally before opening a pull request. When executing pre-commit locally you can either run it for the `model` or `tools` folder:

```bash
# Install pre-commit as a git hook and set up all the tools
pre-commit install --install-hooks
```

Or it can be executed on demand from the command line:
For example to run code checks on all components in `icon4py.model` you can do:

```bash
# Check only the staged changes
pre-commit run

# Check all the files in the repository
pre-commit run -a

# Run only some of the tools (e.g. mypy)
pre-commit run -a mypy
# running precommit for all components in model
cd model/
pre-commit run --all-files
```

### Testing
Expand All @@ -126,3 +114,11 @@ tox -e py310
```

The default `tox` environment is configured to generate HTML test coverage reports in `_reports/coverage_html/`.

### Benchmarking

We use [`pytest-benchmark`](https://pytest-benchmark.readthedocs.io/en/latest/) to benchmark the execution time of stencils in icon4py. To disable benchmarking during testing you can use `--benchmark-disable` when invoking `pytest`.

### More Information

For more information please consult the package specific READMEs found in the `model` and `tools` folders.
9 changes: 0 additions & 9 deletions atm_dyn_iconam/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions atm_dyn_iconam/requirements-dev.txt

This file was deleted.

3 changes: 0 additions & 3 deletions atm_dyn_iconam/requirements.txt

This file was deleted.

50 changes: 0 additions & 50 deletions atm_dyn_iconam/setup.cfg

This file was deleted.

12 changes: 0 additions & 12 deletions atm_dyn_iconam/tests/__init__.py

This file was deleted.

12 changes: 0 additions & 12 deletions atm_dyn_iconam/tests/test_utils/__init__.py

This file was deleted.

Loading

0 comments on commit 260043c

Please sign in to comment.