Skip to main content

icon4py-atmosphere-dycore

Description

Contains code ported from ICON src/atm_dyn_iconam, which is the dynamical core of the ICON model.

Treatment of stencils operating on different vertical levels

Variables in ICON can either sit on full levels or half levels. Let's denote the number of full levels is nlev. Full-level variables have nlev levels in vertical dimension, while half-level variables have nlev+1 in vertical dimension. When running a GT4Py program over nlev+1 levels, do not output full-level and half-level variables together in a field_operator until the upper vertical bound of nlev+1 because the nlev+1 level will also be written for a full-level variable, which is out-of-bounds. The following code is an example:

@field_operator
def _foo(
    input_var: CellKField[wpfloat],
    k_field: KField[wpfloat],
    nlev: int32,
) -> tuple[CellKField[wpfloat], CellKField[wpfloat]]:
    (half_level_var, full_level_var) =  where(
        (k_field >= 0) & (k_field < nlev),
        _compute_var(input_var),
        (half_level_var, full_level_var),
    )
    half_level_var = where(k_field == nlev, _init_cell_kdim_field_with_zero_vp(), half_level_var)
    return half_level_var, full_level_var

@program
def foo(
    input_var: CellKField[wpfloat],
    k_field: KField[wpfloat],
    nlev: int32,
    full_level_var: CellField[wpfloat],
    half_level_var: CellField[wpfloat],
    horizontal_start: int32,
    horizontal_end: int32,
    vertical_start: int32,
    vertical_end: int32,
) -> None:
    _foo(
        input_var,
        k_field,
        nlev,
        out=(half_level_var, full_level_var),
        domain={
            CellDim: (horizontal_start, horizontal_end),
            KDim: (vertical_start, vertical_end),
        }
    )
)

foo(
    input_var=input_var,
    full_level_var=full_level_var,
    half_level_var=half_level_var,
    k_field=k_field,
    nlev=nlev,
    horizontal_start=start_cell,
    horizontal_end=end_cell,
    vertical_start=0,
    vertical_end=nlev + 1,
    offset_provider={},
)

Here is a fix to the example above:

@program
def foo(
    input_var: CellKField[wpfloat],
    full_level_var: CellField[wpfloat],
    half_level_var: CellField[wpfloat],
    horizontal_start: int32,
    horizontal_end: int32,
    vertical_start: int32,
    vertical_end: int32,
) -> None:
    _compute_var(
        input_var,
        out=(half_level_var, full_level_var),
        domain={
            CellDim: (horizontal_start, horizontal_end),
            KDim: (vertical_start, vertical_end - 1),
        }
    )
    _init_cell_kdim_field_with_zero_vp(
        out=half_level_var,
        domain={
            CellDim: (horizontal_start, horizontal_end),
            KDim: (vertical_end - 1, vertical_end),
        }
    )
)

foo(
    input_var=input_var,
    full_level_var=full_level_var,
    half_level_var=half_level_var,
    horizontal_start=start_cell,
    horizontal_end=end_cell,
    vertical_start=0,
    vertical_end=nlev + 1,
    offset_provider={},
)

In the fix above, the original field_operator _foo is removed and the GT4Py program directly calls _compute_var and _init_cell_kdim_field_with_zero_vp separately with different vertical bounds. The illegal access to nlev+1 level of the full-level variable can thus be avoided by calling _compute_var with vertical bounds of (0, nlev). The computation on nlev+1 level half_level_var = where(k_field == nlev, _init_cell_kdim_field_with_zero_vp(), half_level_var) in the removed field_operator _foo is instead performed explicitly by calling _init_cell_kdim_field_with_zero_vp with another vertical bounds of (nlev, nlev+1).

Installation instructions

Check the README.md at the root of the model folder for installation instructions.

Metadata

Release files for icon4py-atmosphere-dycore 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for icon4py-atmosphere-dycore 0.5.0
File Size Uploaded Provenance Actions
icon4py_atmosphere_dycore-0.5.0.tar.gz 54.5 kB With provenance Details for icon4py_atmosphere_dycore-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for icon4py-atmosphere-dycore 0.5.0
File Interpreter ABI Platform Actions
icon4py_atmosphere_dycore-0.5.0-py3-none-any.whl Python 3 none any Details for icon4py_atmosphere_dycore-0.5.0-py3-none-any.whl

Total release size: 159.5 kB

Release files / icon4py_atmosphere_dycore-0.5.0.tar.gz

Download URL icon4py_atmosphere_dycore-0.5.0.tar.gz
Size 54.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c29b881985c296d9e68ab07e072e9f9da1b084d3371bebd45b910459531742d5
BLAKE2b-256 checksum
How to use checksums
12604053853a5426d6bd9f79850113a246302ce4881265388acbb0658cfa4bb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / icon4py_atmosphere_dycore-0.5.0-py3-none-any.whl

Download URL icon4py_atmosphere_dycore-0.5.0-py3-none-any.whl
Size 105.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37f53fbe03e6a5a21175a95c841b7f80fc477f2446bf30b09b4fd71143d6e27a
BLAKE2b-256 checksum
How to use checksums
31e0cb7a0143ba628b0e26494fb2369b16a9eeae4c51da8c5d961eaa4af2d86f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for icon4py-atmosphere-dycore 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for icon4py_atmosphere_dycore-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page