terraflow.export¶
Re-indexes pipeline output to H3 hexagonal cells for interop with DeckGL, Kepler.gl, and h3pandas. The h3-py dependency is optional — install with pip install terraflow-agro[h3].
Public surface¶
to_h3(features, resolution=8)— convert afeaturesDataFrame to an H3-indexed structure.run_export(config, ...)— orchestrator used byterraflow export --format h3.
API Reference¶
export
¶
H3-indexed export adapter for TerraFlow pipeline output.
run_export(config_path, resolution_override=None, format='h3')
¶
Run H3 export on an existing pipeline run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
Path | str
|
Path to YAML config file (must have an |
required |
resolution_override
|
int | None
|
If provided, overrides |
None
|
format
|
str
|
Export format. Currently only |
'h3'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written H3 parquet artifact. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If format is unsupported, config has no |
FileNotFoundError
|
If no pipeline run directory containing |
Source code in terraflow/export.py
to_h3(features, resolution=8)
¶
Convert features DataFrame to H3-indexed DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
DataFrame
|
Pipeline output with columns: lat, lon, score, v_index, mean_temp, total_rain, label. |
required |
resolution
|
int
|
H3 resolution (0-15). Default 8. |
8
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame indexed by |
Raises:
| Type | Description |
|---|---|
ImportError
|
If h3-py is not installed. |
ValueError
|
If resolution is outside 0-15 or required columns are missing. |