voxcity 0.6.7__py3-none-any.whl → 0.6.8__py3-none-any.whl

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.

@@ -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 = canopy_height_grid > 0
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(canopy_height_grid[j, i])
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
- f.write(f"Trees: {np.sum(canopy_height_grid > 0)}\n")
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")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: voxcity
3
- Version: 0.6.7
3
+ Version: 0.6.8
4
4
  Summary: voxcity is an easy and one-stop tool to output 3d city models for microclimate simulation by integrating multiple geospatial open-data
5
5
  License: MIT
6
6
  Author: Kunihiko Fujiwara
@@ -9,7 +9,7 @@ voxcity/downloader/osm.py,sha256=9nOVcVE50N76F5uquJbNIFr8Xajff4ac2Uj2oSGcFrc,425
9
9
  voxcity/downloader/overture.py,sha256=4YG2DMwUSSyZKUw_o8cGhMmAkPJon82aPqOFBvrre-Y,11987
10
10
  voxcity/downloader/utils.py,sha256=tz6wt4B9BhEOyvoF5OYXlr8rUd5cBEDedWL3j__oT70,3099
11
11
  voxcity/exporter/__init__.py,sha256=dvyWJ184Eik9tFc0VviGbzTQzZi7O0JNyrqi_n39pVI,94
12
- voxcity/exporter/cityles.py,sha256=OhsGODC8bFq0MTGc0nBnqRyqnqg1JXL7UaL66a-CKsQ,17418
12
+ voxcity/exporter/cityles.py,sha256=_I0yJceBR54_BzUzckZNMp_RdknG9gKe0DAT5Aq3M4g,18019
13
13
  voxcity/exporter/envimet.py,sha256=Sh7s1JdQ6SgT_L2Xd_c4gtEGWK2hTS87bccaoIqik-s,31105
14
14
  voxcity/exporter/magicavoxel.py,sha256=SfGEgTZRlossKx3Xrv9d3iKSX-HmfQJEL9lZHgWMDX4,12782
15
15
  voxcity/exporter/obj.py,sha256=h1_aInpemcsu96fSTwjKMqX2VZAFYbZbElWd4M1ogyI,27973
@@ -30,8 +30,8 @@ voxcity/utils/lc.py,sha256=722Gz3lPbgAp0mmTZ-g-QKBbAnbxrcgaYwb1sa7q8Sk,16189
30
30
  voxcity/utils/material.py,sha256=H8K8Lq4wBL6dQtgj7esUW2U6wLCOTeOtelkTDJoRgMo,10007
31
31
  voxcity/utils/visualization.py,sha256=ZR9N-XKfydeSStO53IM2hGXyZJoeBiAyIMWw9Cb2MPM,116449
32
32
  voxcity/utils/weather.py,sha256=2Jtg-rIVJcsTtiKE-KuDnhIqS1-MSS16_zFRzj6zmu4,36435
33
- voxcity-0.6.7.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
34
- voxcity-0.6.7.dist-info/LICENSE,sha256=s_jE1Df1nTPL4A_5GCGic5Zwex0CVaPKcAmSilxJPPE,1089
35
- voxcity-0.6.7.dist-info/METADATA,sha256=lICJOYiGbMdF2Lee90GLEP-KBz3S71jHDaHucZrYs7g,26091
36
- voxcity-0.6.7.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
37
- voxcity-0.6.7.dist-info/RECORD,,
33
+ voxcity-0.6.8.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
34
+ voxcity-0.6.8.dist-info/LICENSE,sha256=s_jE1Df1nTPL4A_5GCGic5Zwex0CVaPKcAmSilxJPPE,1089
35
+ voxcity-0.6.8.dist-info/METADATA,sha256=ioGlejpNOqg_3pinFNf-oXVCJtiMH7gYrQqbq9eOgD4,26091
36
+ voxcity-0.6.8.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
37
+ voxcity-0.6.8.dist-info/RECORD,,