voxcity 0.6.7__tar.gz → 0.6.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of voxcity might be problematic. Click here for more details.
- {voxcity-0.6.7 → voxcity-0.6.9}/PKG-INFO +1 -1
- {voxcity-0.6.7 → voxcity-0.6.9}/pyproject.toml +1 -1
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/exporter/cityles.py +17 -7
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/generator.py +12 -1
- {voxcity-0.6.7 → voxcity-0.6.9}/AUTHORS.rst +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/LICENSE +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/README.md +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/citygml.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/eubucco.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/gee.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/mbfp.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/oemj.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/osm.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/overture.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/downloader/utils.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/exporter/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/exporter/envimet.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/exporter/magicavoxel.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/exporter/obj.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/draw.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/grid.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/mesh.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/network.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/polygon.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/geoprocessor/utils.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/simulator/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/simulator/solar.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/simulator/utils.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/simulator/view.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/utils/__init__.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/utils/lc.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/utils/material.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/utils/visualization.py +0 -0
- {voxcity-0.6.7 → voxcity-0.6.9}/src/voxcity/utils/weather.py +0 -0
|
@@ -315,12 +315,14 @@ def export_dem(dem_grid, output_path):
|
|
|
315
315
|
# CityLES uses 1-based indexing
|
|
316
316
|
i_1based = i + 1
|
|
317
317
|
j_1based = j + 1
|
|
318
|
-
elevation = dem_grid[j, i]
|
|
319
|
-
|
|
318
|
+
elevation = float(dem_grid[j, i])
|
|
319
|
+
# Clamp negative elevations to 0.0 meters
|
|
320
|
+
if elevation < 0.0:
|
|
321
|
+
elevation = 0.0
|
|
320
322
|
f.write(f"{i_1based} {j_1based} {elevation:.1f}\n")
|
|
321
323
|
|
|
322
324
|
|
|
323
|
-
def export_vmap(canopy_height_grid, output_path, tree_base_ratio=0.3, tree_type='default'):
|
|
325
|
+
def export_vmap(canopy_height_grid, output_path, tree_base_ratio=0.3, tree_type='default', building_height_grid=None):
|
|
324
326
|
"""
|
|
325
327
|
Export vmap.txt file for CityLES
|
|
326
328
|
|
|
@@ -340,8 +342,14 @@ def export_vmap(canopy_height_grid, output_path, tree_base_ratio=0.3, tree_type=
|
|
|
340
342
|
ny, nx = canopy_height_grid.shape
|
|
341
343
|
tree_code = TREE_TYPE_MAPPING.get(tree_type, TREE_TYPE_MAPPING['default'])
|
|
342
344
|
|
|
345
|
+
# If building heights are provided, remove trees where buildings exist
|
|
346
|
+
if building_height_grid is not None:
|
|
347
|
+
effective_canopy = np.where(building_height_grid > 0, 0.0, canopy_height_grid)
|
|
348
|
+
else:
|
|
349
|
+
effective_canopy = canopy_height_grid
|
|
350
|
+
|
|
343
351
|
# Count only cells with canopy height > 0
|
|
344
|
-
vegetation_mask =
|
|
352
|
+
vegetation_mask = effective_canopy > 0
|
|
345
353
|
n_trees = int(np.count_nonzero(vegetation_mask))
|
|
346
354
|
|
|
347
355
|
with open(filename, 'w') as f:
|
|
@@ -354,7 +362,7 @@ def export_vmap(canopy_height_grid, output_path, tree_base_ratio=0.3, tree_type=
|
|
|
354
362
|
# CityLES uses 1-based indexing
|
|
355
363
|
i_1based = i + 1
|
|
356
364
|
j_1based = j + 1
|
|
357
|
-
total_height = float(
|
|
365
|
+
total_height = float(effective_canopy[j, i])
|
|
358
366
|
lower_height = total_height * tree_base_ratio
|
|
359
367
|
upper_height = total_height
|
|
360
368
|
# Format: i j lower_height upper_height tree_type
|
|
@@ -465,7 +473,7 @@ def export_cityles(building_height_grid, building_id_grid, canopy_height_grid,
|
|
|
465
473
|
export_dem(dem_grid, output_path)
|
|
466
474
|
|
|
467
475
|
print("\nExporting vmap.txt...")
|
|
468
|
-
export_vmap(canopy_height_grid, output_path, tree_base_ratio, tree_type)
|
|
476
|
+
export_vmap(canopy_height_grid, output_path, tree_base_ratio, tree_type, building_height_grid=building_height_grid)
|
|
469
477
|
|
|
470
478
|
print("\nExporting lonlat.txt...")
|
|
471
479
|
export_lonlat(rectangle_vertices, building_height_grid.shape, output_path)
|
|
@@ -483,7 +491,9 @@ def export_cityles(building_height_grid, building_id_grid, canopy_height_grid,
|
|
|
483
491
|
f.write(f"Tree type: {tree_type}\n")
|
|
484
492
|
f.write(f"Bounds: {rectangle_vertices}\n")
|
|
485
493
|
f.write(f"Buildings: {np.sum(building_height_grid > 0)}\n")
|
|
486
|
-
|
|
494
|
+
# Trees count after removing overlaps with buildings
|
|
495
|
+
trees_count = int(np.sum(np.where(building_height_grid > 0, 0.0, canopy_height_grid) > 0))
|
|
496
|
+
f.write(f"Trees: {trees_count}\n")
|
|
487
497
|
|
|
488
498
|
# Add land use value ranges
|
|
489
499
|
f.write(f"\nLand cover value range: {land_cover_grid.min()} - {land_cover_grid.max()}\n")
|
|
@@ -855,7 +855,18 @@ def get_voxcity_CityGML(rectangle_vertices, land_cover_source, canopy_height_sou
|
|
|
855
855
|
|
|
856
856
|
# building_height_grid, building_min_height_grid, building_id_grid, building_gdf = get_building_height_grid(rectangle_vertices, meshsize, building_source, output_dir, **kwargs)
|
|
857
857
|
print("Creating building height grid")
|
|
858
|
-
|
|
858
|
+
# Filter kwargs to only those accepted by create_building_height_grid_from_gdf_polygon
|
|
859
|
+
_allowed_building_kwargs = {
|
|
860
|
+
"overlapping_footprint",
|
|
861
|
+
"gdf_comp",
|
|
862
|
+
"geotiff_path_comp",
|
|
863
|
+
"complement_building_footprints",
|
|
864
|
+
"complement_height",
|
|
865
|
+
}
|
|
866
|
+
_building_kwargs = {k: v for k, v in kwargs.items() if k in _allowed_building_kwargs}
|
|
867
|
+
building_height_grid, building_min_height_grid, building_id_grid, filtered_buildings = create_building_height_grid_from_gdf_polygon(
|
|
868
|
+
building_gdf, meshsize, rectangle_vertices, **_building_kwargs
|
|
869
|
+
)
|
|
859
870
|
|
|
860
871
|
# Visualize grid if requested
|
|
861
872
|
grid_vis = kwargs.get("gridvis", True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|