voxcity.utils.classes¶
VoxCity Class Definitions
This module provides standard class definitions for voxel grid semantics and land cover classification used throughout VoxCity.
- Voxel Grid Semantics:
The 3D voxel grid uses integer codes to represent different urban elements. Negative values represent structural elements, while positive values represent land cover classes at the ground surface layer.
- Land Cover Classes:
Land cover is standardized to a 1-based indexing system (1-14) for consistency across different data sources. This standard classification is used in the voxel representation and exports.
Attributes¶
Functions¶
|
Print voxel semantic codes to console. |
|
Print standard land cover class definitions to console. |
|
Print both voxel codes and land cover class definitions. |
|
Get the land cover class name for a given index. |
|
Get the semantic name for a voxel code. |
|
Summarize the contents of a voxel grid. |
|
Summarize the contents of a land cover grid. |
Module Contents¶
- voxcity.utils.classes.VOXEL_CODES¶
- voxcity.utils.classes.VOXEL_CODE_DESCRIPTIONS = Multiline-String¶
Show Value
""" Voxel Grid Semantic Codes: -3 : Building volume -2 : Tree canopy (vegetation) -1 : Ground/Subsurface >=1: Land cover class at ground surface (see Land Cover Classes) """
- voxcity.utils.classes.LAND_COVER_CLASSES¶
- voxcity.utils.classes.LAND_COVER_DESCRIPTIONS = Multiline-String¶
Show Value
""" VoxCity Standard Land Cover Classes (1-based indices, used in voxel grids): -------------------------------------------------- 1: Bareland - Bare soil, rocks, desert 2: Rangeland - Grassland, pasture 3: Shrub - Shrubland, bushes 4: Agriculture land - Cropland, farmland 5: Tree - Forest, tree cover 6: Moss and lichen - Moss, lichen cover 7: Wet land - Wetland, marsh 8: Mangrove - Mangrove forest 9: Water - Water bodies 10: Snow and ice - Snow, ice, glaciers 11: Developed space - Urban areas, parking 12: Road - Roads, paved surfaces 13: Building - Building footprints 14: No Data - Missing or invalid data -------------------------------------------------- Note: Source-specific land cover classes are converted to these standard classes during voxelization. """
- voxcity.utils.classes.print_land_cover_classes() None[source]¶
Print standard land cover class definitions to console.
- voxcity.utils.classes.print_class_definitions() None[source]¶
Print both voxel codes and land cover class definitions.
- voxcity.utils.classes.get_land_cover_name(index: int) str[source]¶
Get the land cover class name for a given index.
- Parameters:
index – Land cover class index (1-14)
- Returns:
Class name string, or “Unknown” if index is invalid
- voxcity.utils.classes.get_voxel_code_name(code: int) str[source]¶
Get the semantic name for a voxel code.
- Parameters:
code – Voxel code (negative for structures, positive for land cover)
- Returns:
Semantic name string
- voxcity.utils.classes.summarize_voxel_grid(voxel_grid: numpy.ndarray, print_output: bool = True) Dict[int, int][source]¶
Summarize the contents of a voxel grid.
- Parameters:
voxel_grid – 3D numpy array of voxel codes
print_output – Whether to print the summary
- Returns:
Dictionary mapping voxel codes to counts
- voxcity.utils.classes.summarize_land_cover_grid(land_cover_grid: numpy.ndarray, print_output: bool = True) Dict[int, int][source]¶
Summarize the contents of a land cover grid.
- Parameters:
land_cover_grid – 2D numpy array of land cover class indices
print_output – Whether to print the summary
- Returns:
Dictionary mapping class indices to counts