Metadata-Version: 2.4
Name: icon-grid-generator
Version: 0.1.0
Summary: Pure Python generation of ICON-style triangular grids
Project-URL: Homepage, https://github.com/ofuhrer/icon-grid-generator
Project-URL: Repository, https://github.com/ofuhrer/icon-grid-generator
Project-URL: Issues, https://github.com/ofuhrer/icon-grid-generator/issues
Author: Oliver Fuhrer, MeteoSwiss
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: ICON,geodesic,grid,netcdf,torus
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.10
Requires-Dist: numpy
Provides-Extra: netcdf
Requires-Dist: netcdf4; extra == 'netcdf'
Provides-Extra: test
Requires-Dist: netcdf4; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: ruff; extra == 'test'
Requires-Dist: xarray; extra == 'test'
Provides-Extra: xarray
Requires-Dist: xarray; extra == 'xarray'
Description-Content-Type: text/markdown

# ICON Grid Generator

Pure Python generation of ICON-style triangular grids.

The package provides spherical RxxByy grids, planar doubly periodic torus grids,
limited-area grids extracted from generated global grids, and optional NetCDF
export. It has no dependency on model runtimes or stencil frameworks.

## Installation

From a local checkout:

```bash
python -m pip install -e .
```

Install optional NetCDF and xarray support with:

```bash
python -m pip install -e ".[netcdf,xarray]"
```

## Usage

Generate a global spherical grid:

```python
from grid_generator import GlobalGridSpec, generate_grid

grid = generate_grid(GlobalGridSpec(root=2, bisections=3))
print(grid.dims)
```

Generate a planar torus grid:

```python
from grid_generator import TorusGridSpec, generate_grid

grid = generate_grid(TorusGridSpec(nx=32, ny=16, edge_length=1_000.0))
print(grid.metadata["grid_geometry"])
```

Extract a limited-area grid from a generated global parent:

```python
from grid_generator import LimitedAreaGridSpec, generate_grid

spec = LimitedAreaGridSpec(
    "R02B03",
    lon_min=-20.0,
    lon_max=20.0,
    lat_min=35.0,
    lat_max=60.0,
    boundary_depth=2,
)
grid = generate_grid(spec, options={"max_cells": None})
```

For global grids, the compact RxxByy string remains available as shorthand:

```python
grid = generate_grid("R02B03")
```

Write an ICON-style NetCDF file:

```python
grid.to_netcdf("grid.nc")
```

NetCDF export requires the `netcdf` optional extra.

## Release History

See [CHANGELOG.md](CHANGELOG.md).
