ICON Grid Generator
Pure Python generation of deterministic ICON-style triangular grids.
The package provides spherical R<n>B<k> grids, planar triangular grids,
limited-area extraction, geometry diagnostics and transforms, xarray conversion,
and ICON-compatible NetCDF export. The same file-oriented API handles every grid
family; large global grids automatically use bounded derived-field memory and
resumable disk checkpoints.
Installation
The base package requires Python 3.10 or newer and NumPy:
python -m pip install icon-grid-generator
The NetCDF calls in the quick start require the netcdf extra. Install
acceleration and common output integrations for high-resolution work with:
python -m pip install "icon-grid-generator[accelerate,netcdf,xarray]"
Numba acceleration is optional for in-memory grids and required for the high-resolution export-first path.
Quick Start
Generate an in-memory grid and write the complete NetCDF schema:
from grid_generator import generate_grid
grid = generate_grid("R2B4")
print(grid.name, grid.dims)
grid.to_netcdf("icon_grid_R02B04.nc")
NetCDF grid_geometry follows ICON's geometry enum: spherical global and
limited-area grids use 1, planar tori use 2, planar channels use 3, and
general planar grids use 4. Regional spherical files carry a separate
open_boundary=1 attribute; openness is not a coordinate-geometry type.
ICON 2024.10's standard NWP interpolation path supports spherical grids and
planar tori, but not its channel or general-plane enum values; those additional
planar families remain useful for diagnostics and consumers with matching
operators rather than as standard ICON-NWP simulation grids.
Planar files write domain_length and domain_height from the physical spec
extents; they never inherit spherical-Earth dimensions.
Planar tori use rectangular, independently wrapped x/y periods by default and therefore require an even number of rows. The former coupled skew lattice remains available explicitly:
from grid_generator import TorusGridSpec, generate_grid
torus = generate_grid(TorusGridSpec(nx=12, ny=6, edge_length=1_000.0))
skew_torus = generate_grid(
TorusGridSpec(nx=12, ny=5, edge_length=1_000.0, periodic_layout="skew")
)
Generate any grid directly to NetCDF when the in-memory object is not needed:
from grid_generator import TorusGridSpec, generate_grid_to_netcdf
generate_grid_to_netcdf(
TorusGridSpec(nx=12, ny=6, edge_length=1_000.0),
"torus.nc",
)
The same call automatically selects the export-first implementation for a large global grid:
from grid_generator import generate_grid_to_netcdf
generate_grid_to_netcdf(
"R2B8",
"icon_grid_R02B08.nc",
max_cells=None,
accelerator="numba",
work_dir="icon-grid-R2B08-work",
fields="reduced",
)
Checkpointed, bounded-memory generation is currently specific to global grids;
other grid families use their normal in-memory generator before writing. R2B8
is a practical first large-grid example at about 9.86 km resolution; check the
resource tables before requesting finer grids.
The default full profile contains 88 fields, including the established
quadrilateral_area, vlon_vertices, and vlat_vertices fields.
reduced contains the 46-field union required by the standard ICON and
icon4py global-grid readers. Dedicated
icon and icon4py profiles and exact custom field lists are also available.
Place large outputs and checkpoint directories on disk-backed storage. Each
checkpoint manifest atomically selects a complete array snapshot, so an
interrupted overwrite leaves the preceding completed checkpoint resumable. The
final NetCDF file is also published atomically after it closes successfully.
Allow extra disk headroom when replacing checkpoints or an existing output:
old and new snapshots/files can coexist temporarily. After a successful export,
the work directory can be deleted unless it is being kept for a later resume.
Performance
Measurements used an exclusive dual-socket AMD EPYC 7713 node with 128 physical
cores and about 446 GiB of available memory. Times cover independent generation
and uncompressed NetCDF export; shared-filesystem I/O varies with storage load.
R2B12 has approximately 0.616 km resolution and is the largest standard R2
grid whose one-based exported identifiers fit signed 32-bit integers.
| R2B12 output | Generation | NetCDF export | Total | Peak RSS | Checkpoints | NetCDF |
|---|---|---|---|---|---|---|
| Full (85-field timing) | 43.51 min | 91.24 min | 134.74 min | 328.18 GiB | 162.46 GiB | 1,047.50 GiB |
| Reduced | 42.03 min | 42.05 min | 84.08 min | 328.18 GiB | 162.46 GiB | 485.00 GiB |
The full timing predates the three added grid-description fields. The current 88-field R2B12 payload is approximately 1,122.5 GiB; it requires a new scaling run before quoting an updated export time.
See Performance and Scaling for R2B8–R2B12 measurements, component timings, validation details, and all field-profile storage sizes.
Documentation
Citation metadata is provided in CITATION.cff. The package is distributed under the BSD 3-Clause License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file icon_grid_generator-0.7.0.tar.gz.
File metadata
- Download URL: icon_grid_generator-0.7.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a8dc44abf83a6c479ea56b42252c18d11108f9822d1d2694054bc8a1baf636
|
|
| MD5 |
6a4f354f4db678c8ad5123d21c798adb
|
|
| BLAKE2b-256 |
559718481bc42fd2662659157335fa83bba999816cf27f32f7997e3c141956df
|
Provenance
The following attestation bundles were made for icon_grid_generator-0.7.0.tar.gz:
Publisher:
release.yml on ofuhrer/icon-grid-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icon_grid_generator-0.7.0.tar.gz -
Subject digest:
f2a8dc44abf83a6c479ea56b42252c18d11108f9822d1d2694054bc8a1baf636 - Sigstore transparency entry: 2428478233
- Sigstore integration time:
-
Permalink:
ofuhrer/icon-grid-generator@a17ce41cc8af9e4abb4d6e67b2942a19e770dc33 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/ofuhrer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a17ce41cc8af9e4abb4d6e67b2942a19e770dc33 -
Trigger Event:
push
-
Statement type:
File details
Details for the file icon_grid_generator-0.7.0-py3-none-any.whl.
File metadata
- Download URL: icon_grid_generator-0.7.0-py3-none-any.whl
- Upload date:
- Size: 100.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
845c0e401e445a7e9db6d60b816153f79c058131c46e14ee2620bf44719a794c
|
|
| MD5 |
64d157bdcdc988c2b5ce530adfb44a7c
|
|
| BLAKE2b-256 |
9e7dc290efe71e90afafabddd55947ea4e7031450c2529d5edd614f46ddc5a89
|
Provenance
The following attestation bundles were made for icon_grid_generator-0.7.0-py3-none-any.whl:
Publisher:
release.yml on ofuhrer/icon-grid-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icon_grid_generator-0.7.0-py3-none-any.whl -
Subject digest:
845c0e401e445a7e9db6d60b816153f79c058131c46e14ee2620bf44719a794c - Sigstore transparency entry: 2428478491
- Sigstore integration time:
-
Permalink:
ofuhrer/icon-grid-generator@a17ce41cc8af9e4abb4d6e67b2942a19e770dc33 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/ofuhrer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@a17ce41cc8af9e4abb4d6e67b2942a19e770dc33 -
Trigger Event:
push
-
Statement type: