High Level HEALPix API¶
This section contains the main functionality for creating and working with HEALPix-based dataset representations, including pyramid construction and resolution handling.
Pyramid creation¶
These functions build HEALPix pyramids from gridded source data and provide the main higher-level workflow for preparing multi-resolution outputs.
create_healpix_pyramid(ds, max_level=None, min_level=0, *, coarsen_mode='auto', min_valid_fraction=0.5, **kwargs)
¶
Create a multi-resolution HEALPix pyramid.
The input dataset is first remapped to max_level with
regrid_to_healpix.
For nested output ordering, lower levels are derived efficiently
with
coarsen_healpix.
For ring ordering, each lower level is regenerated directly from
the source dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Source dataset. |
required |
max_level
|
int | None
|
Finest HEALPix level. |
None
|
min_level
|
int
|
Coarsest HEALPix level to keep. |
0
|
coarsen_mode
|
CoarsenMode
|
Coarsening strategy for building lower pyramid levels.
|
'auto'
|
min_valid_fraction
|
float
|
Minimum fraction of valid children for a parent cell to be
valid. Default |
0.5
|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
dict[int, Dataset]
|
Pyramid keyed by level. |
Source code in .tox/docs/lib/python3.13/site-packages/grid_doctor/helpers.py
Resolution helpers¶
These utilities help translate between source grid resolution and the corresponding HEALPix level used for remapping and pyramid generation.
get_latlon_resolution(ds)
¶
Estimate the horizontal resolution of ds in degrees.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ds
|
Dataset
|
Dataset on a regular lon/lat grid, a curvilinear grid, or an unstructured grid. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Approximate grid spacing in degrees. |
Examples:
Source code in .tox/docs/lib/python3.13/site-packages/grid_doctor/helpers.py
resolution_to_healpix_level(resolution_deg)
¶
Convert an approximate source resolution to a HEALPix level.
The heuristic uses a characteristic HEALPix pixel spacing of about
58.6° / 2**level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution_deg
|
float
|
Approximate source resolution in degrees. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Suggested HEALPix level. |
Examples: