Pipeline
Core classes for executing the scene generation pipeline.
s2gos_generator.core.pipeline.SceneGenerationPipeline
Scene generation pipeline with automatic dependency resolution.
This pipeline automatically manages dependencies between scene generation steps, ensuring resources are processed in the correct order.
Initialize the scene generation pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SceneGenConfig
|
Scene generation configuration |
required |
Attributes
Functions
clear_cache
Remove the on-disk cache for this scene.
The next call to :meth:run will regenerate all cacheable resources
from scratch.
get_resource_dependencies
Get the current resource dependency graph.
Returns:
| Type | Description |
|---|---|
Dict[str, List[str]]
|
Dictionary mapping resource IDs to their dependencies |
run
Execute the complete scene generation pipeline.
Runs all resources registered from the SceneGenConfig and returns the resulting SceneDescription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
use_cache
|
bool
|
When |
True
|
Returns:
| Type | Description |
|---|---|
SceneDescription
|
|
SceneDescription
|
instance with complete scene configuration. |
visualize_dag
Render the pipeline dependency graph to an image file using Graphviz.
Nodes are colour-coded by resource category (AOI, DEM, landcover,
mesh, texture, etc.) and shaped by type (ellipse for AOIs, diamond for
meshes, double-octagon for the final scene description). The output
file is written next to the scene output directory when output_path
is not supplied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Optional[Path]
|
Destination path for the rendered image (without
extension). Defaults to
|
None
|
format
|
str
|
Graphviz output format (e.g. |
'png'
|
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path to the rendered file, or |
Optional[Path]
|
installed or rendering fails. |
s2gos_generator.core.context.SceneResourceContext
SceneResourceContext(
config: SceneGenConfig,
combined_user_assets: List = None,
additional_material_libraries: List = None,
**kwargs,
)
Resource context for scene generation pipeline execution.
Initialize scene resource context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
SceneGenConfig
|
Scene generation configuration |
required |
combined_user_assets
|
List
|
List combining config + XML assets |
None
|
additional_material_libraries
|
List
|
Extra material libraries from XML |
None
|
Attributes
background_aoi_polygon
property
Lazy AOI polygon for the background area, or None if unconfigured.
buffer_aoi_polygon
property
Lazy AOI polygon for the buffer area, or None if unconfigured.
coordinate_system
property
Get cached coordinate system for this scene.
Returns:
| Type | Description |
|---|---|
CoordinateSystem
|
CoordinateSystem instance for this scene's center location |
exclusion_zone_geometries
property
Exclusion zone geometries in scene coordinates, derived from config.
road_polygons_by_material
property
Merged road footprints per material, derived from the roads list.
Computed once and cached. Each value is the unary_union of all buffered centerlines for that material — the geometry the texture painter needs, without storing it redundantly in the sidecar.
target_scene_bounds
property
Lazy axis-aligned scene-coord clip bounds for the target AOI.
Functions
s2gos_generator.core.assets.SceneAssets
dataclass
SceneAssets(
dem_file: Optional[UPath] = None,
landcover_file: Optional[UPath] = None,
mesh_file: Optional[UPath] = None,
selection_texture_file: Optional[UPath] = None,
preview_texture_file: Optional[UPath] = None,
config_file: Optional[UPath] = None,
scene_description_file: Optional[UPath] = None,
buffer_dem_file: Optional[UPath] = None,
buffer_landcover_file: Optional[UPath] = None,
buffer_mesh_file: Optional[UPath] = None,
buffer_selection_texture_file: Optional[UPath] = None,
buffer_preview_texture_file: Optional[UPath] = None,
background_landcover_file: Optional[UPath] = None,
background_selection_texture_file: Optional[
UPath
] = None,
background_preview_texture_file: Optional[UPath] = None,
vegetation_objects_file: Optional[UPath] = None,
user_assets_file: Optional[UPath] = None,
hamster_paths_file: Optional[UPath] = None,
roads_file: Optional[UPath] = None,
buildings_objects_file: Optional[UPath] = None,
sentinel2_file: Optional[UPath] = None,
matched_materials_file: Optional[UPath] = None,
)
s2gos_generator.core.resource_registry.ResourceRegistry
Registry for managing resource definitions.
Functions
get_execution_order
Get resources in dependency order using topological sort with cycle detection.
register
register(
id: str,
dependencies: List[str],
func: Callable,
*,
optional: Optional[List[str]] = None,
)
Register a resource explicitly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
Unique resource identifier. |
required |
dependencies
|
List[str]
|
Required dependencies that must run before this resource. |
required |
func
|
Callable
|
Resource function to execute. |
required |
optional
|
Optional[List[str]]
|
Optional dependencies — added to the required list only if
they are already registered when |
None
|