Assets & Regions
Configuration classes for scene assets including user-defined objects, material regions, and material mappings.
s2gos_generator.core.config.assets.UserAssets
pydantic-model
Bases: BaseModel
User assets to be placed on scene.
Coordinates can be specified in either: - Geographic coordinates (WGS84): coordinate=[lon, lat] with coord_type="geographic" - Scene coordinates (meters from scene center): coordinate=[x, y] with coord_type="scene"
Config:
default:{'validate_assignment': True}
Fields:
-
object_id(str) -
ply_path(PathRef) -
coordinate(list[float]) -
coord_type(Literal['geographic', 'scene']) -
material(Union[str, Dict[str, Any]]) -
elevation_offset(float) -
scale(float) -
rotation_x(float) -
rotation_y(float) -
rotation_z(float) -
blender_fix(bool) -
face_normals(Optional[bool]) -
exclusion_zone(Optional[Union[float, Tuple[float, float]]])
Validators:
-
validate_coordinate→coordinate -
validate_ply_path→ply_path -
validate_material→material -
validate_scale→scale -
validate_coordinate_format
Attributes
blender_fix
pydantic-field
Informs as to whether a 90 degree around x was added to adjust from blender, useful to know what the actual rotation intended was
coordinate
pydantic-field
Coordinates: [lon, lat] if geographic, [x, y] if scene
elevation_offset
pydantic-field
Height offset above terrain surface in meters
exclusion_zone
pydantic-field
Vegetation exclusion zone centered on this object. Can be: - float: Circular radius in meters - (width, height): Rectangular box in meters
face_normals
pydantic-field
Mitsuba PLY face normals setting: True=smooth normals, False=per-face normals, None=use PLY file defaults
material
pydantic-field
Material reference (string ID) or inline material definition dict
Functions
get_inline_material_dict
Return inline material definition if present, else None.
get_inline_material_id
Return generated material ID for inline materials, None otherwise.
validate_coordinate_format
pydantic-validator
Ensure coordinate format matches coord_type.
validate_material
pydantic-validator
Validate material is either a non-empty string reference or a valid dict definition.
validate_ply_path
pydantic-validator
Validate and resolve PLY file path using configured search paths.
s2gos_generator.core.config.assets.HamsterConfig
pydantic-model
Bases: BaseModel
HAMSTER albedo data configuration for baresoil material replacement.
Config:
default:{'arbitrary_types_allowed': True}
Fields:
-
enabled(bool) -
data_path(PathRef) -
variable_name(str) -
fallback_on_error(bool)
Validators:
Attributes
fallback_on_error
pydantic-field
Fall back to standard baresoil material on errors
Functions
s2gos_generator.core.config.assets.XmlSceneConfig
pydantic-model
Bases: BaseModel
Configuration for importing assets and materials from XML scene files.
Coordinates can be specified in either: - Geographic coordinates (WGS84): base_coordinate=(lon, lat) with coord_type="geographic" - Scene coordinates (meters from scene center): base_coordinate=(x, y) with coord_type="scene"
Config:
default:{'arbitrary_types_allowed': True, 'validate_assignment': True}
Fields:
-
xml_path(PathRef) -
base_coordinate(Tuple[float, float]) -
coord_type(Literal['geographic', 'scene']) -
object_id_prefix(Optional[str]) -
elevation_offset(float) -
scale(float) -
fix_blender_coords(bool) -
rotation_x(float) -
rotation_y(float) -
rotation_z(float) -
material_mappings(list[MaterialMapping]) -
validate_materials(bool) -
exclusion_zone(Optional[Union[float, Tuple[float, float]]])
Validators:
Attributes
base_coordinate
pydantic-field
Base coordinates: (lon, lat) if geographic, (x, y) if scene
elevation_offset
pydantic-field
Global elevation offset for all assets in meters
exclusion_zone
pydantic-field
Vegetation exclusion zone centered on base_coordinate for this XML scene. Can be: - float: Circular radius in meters - (width, height): Rectangular box in meters
fix_blender_coords
pydantic-field
Apply Blender coordinate system correction (90° rotation around X-axis)
material_mappings
pydantic-field
List of material mappings for mesh filename patterns
rotation_x
pydantic-field
Global rotation around X-axis in degrees (applied after fix_blender_coords)
rotation_y
pydantic-field
Global rotation around Y-axis in degrees (applied after fix_blender_coords)
rotation_z
pydantic-field
Global rotation around Z-axis in degrees (applied after fix_blender_coords)
validate_materials
pydantic-field
Validate that all materials are properly defined
Functions
validate_coordinate_format
pydantic-validator
Ensure coordinate format matches coord_type.
s2gos_generator.core.config.assets.MaterialRegion
pydantic-model
Bases: BaseModel
Material region for spatially-selective material overrides.
Defines a spatial region where the terrain material will be overridden with a specified material. Supports rectangle and polygon geometry types in both geographic (WGS84) and scene coordinate systems.
Used in SceneGenConfig
via the material_regions field. The material_name must reference a
Material known to the scene.
Fields:
-
region_id(str) -
geometry(Dict[str, Any]) -
material_name(str) -
priority(int) -
applies_to(List[Literal['target', 'buffer', 'background']]) -
landcover_filter(Optional[List[int]])
Validators:
-
validate_region_id→region_id -
validate_material_name→material_name -
validate_applies_to→applies_to -
validate_landcover_filter→landcover_filter
Attributes
applies_to
pydantic-field
Which scene areas this region applies to (target/buffer/background)
geometry
pydantic-field
Region geometry specification. Supported types: rectangle and polygon.
landcover_filter
pydantic-field
Optional ESA WorldCover class filter. If specified, only override pixels matching these landcover classes. If None, override all pixels. Example: [60, 80] = only bare/sparse vegetation
material_name
pydantic-field
Material reference to apply in this region (must exist in materials)
priority
pydantic-field
Priority for overlapping regions (higher priority wins). Default is 0.
Functions
validate_applies_to
pydantic-validator
Ensure at least one area is specified.
validate_landcover_filter
pydantic-validator
Validate landcover class codes.
s2gos_generator.core.config.assets.MaterialMapping
pydantic-model
Bases: BaseModel
Material mapping for XML assets.
Maps mesh filenames to material IDs using pattern matching.
Attributes:
| Name | Type | Description |
|---|---|---|
pattern |
str
|
Filename pattern to match (without .ply extension) |
material |
str
|
Material ID to assign to matching meshes |
mode |
Literal['glob', 'regex']
|
Pattern matching mode ('glob' or 'regex') |
Config:
default:{'validate_assignment': True}
Fields:
Validators:
Attributes
mode
pydantic-field
Pattern matching mode: 'glob' for wildcards (* and ?), 'regex' for regular expressions
Functions
validate_material
pydantic-validator
Validate material reference is non-empty.