voxcity 0.3.8__py3-none-any.whl → 0.3.10__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.
- voxcity/file/geojson.py +306 -99
- voxcity/geo/network.py +452 -141
- voxcity/sim/solar.py +12 -7
- voxcity/sim/view.py +5 -3
- voxcity/voxcity.py +23 -20
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/METADATA +5 -4
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/RECORD +11 -11
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/WHEEL +1 -1
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/AUTHORS.rst +0 -0
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/LICENSE +0 -0
- {voxcity-0.3.8.dist-info → voxcity-0.3.10.dist-info}/top_level.txt +0 -0
voxcity/sim/solar.py
CHANGED
|
@@ -57,7 +57,7 @@ def compute_direct_solar_irradiance_map_binary(voxel_data, sun_direction, view_p
|
|
|
57
57
|
# Check if current voxel is empty/tree and voxel below is solid
|
|
58
58
|
if voxel_data[x, y, z] in (0, -2) and voxel_data[x, y, z - 1] not in (0, -2):
|
|
59
59
|
# Skip if standing on building/vegetation/water
|
|
60
|
-
if voxel_data[x, y, z - 1] in (
|
|
60
|
+
if (voxel_data[x, y, z - 1] in (7, 8, 9)) or (voxel_data[x, y, z - 1] < 0):
|
|
61
61
|
irradiance_map[x, y] = np.nan
|
|
62
62
|
found_observer = True
|
|
63
63
|
break
|
|
@@ -148,9 +148,10 @@ def get_direct_solar_irradiance_map(voxel_data, meshsize, azimuth_degrees_ori, e
|
|
|
148
148
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
149
149
|
cmap.set_bad(color='lightgray')
|
|
150
150
|
plt.figure(figsize=(10, 8))
|
|
151
|
-
plt.title("Horizontal Direct Solar Irradiance Map (0° = North)")
|
|
151
|
+
# plt.title("Horizontal Direct Solar Irradiance Map (0° = North)")
|
|
152
152
|
plt.imshow(direct_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
153
153
|
plt.colorbar(label='Direct Solar Irradiance (W/m²)')
|
|
154
|
+
plt.axis('off')
|
|
154
155
|
plt.show()
|
|
155
156
|
|
|
156
157
|
# Optional OBJ export
|
|
@@ -231,9 +232,10 @@ def get_diffuse_solar_irradiance_map(voxel_data, meshsize, diffuse_irradiance=1.
|
|
|
231
232
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
232
233
|
cmap.set_bad(color='lightgray')
|
|
233
234
|
plt.figure(figsize=(10, 8))
|
|
234
|
-
plt.title("Diffuse Solar Irradiance Map")
|
|
235
|
+
# plt.title("Diffuse Solar Irradiance Map")
|
|
235
236
|
plt.imshow(diffuse_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
236
237
|
plt.colorbar(label='Diffuse Solar Irradiance (W/m²)')
|
|
238
|
+
plt.axis('off')
|
|
237
239
|
plt.show()
|
|
238
240
|
|
|
239
241
|
# Optional OBJ export
|
|
@@ -310,7 +312,7 @@ def get_global_solar_irradiance_map(
|
|
|
310
312
|
# Create kwargs for diffuse calculation
|
|
311
313
|
direct_diffuse_kwargs = kwargs.copy()
|
|
312
314
|
direct_diffuse_kwargs.update({
|
|
313
|
-
'show_plot':
|
|
315
|
+
'show_plot': True,
|
|
314
316
|
'obj_export': False
|
|
315
317
|
})
|
|
316
318
|
|
|
@@ -343,9 +345,10 @@ def get_global_solar_irradiance_map(
|
|
|
343
345
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
344
346
|
cmap.set_bad(color='lightgray')
|
|
345
347
|
plt.figure(figsize=(10, 8))
|
|
346
|
-
plt.title("Global Solar Irradiance Map")
|
|
348
|
+
# plt.title("Global Solar Irradiance Map")
|
|
347
349
|
plt.imshow(global_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
348
350
|
plt.colorbar(label='Global Solar Irradiance (W/m²)')
|
|
351
|
+
plt.axis('off')
|
|
349
352
|
plt.show()
|
|
350
353
|
|
|
351
354
|
# Optional OBJ export
|
|
@@ -571,8 +574,9 @@ def get_cumulative_global_solar_irradiance(
|
|
|
571
574
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
572
575
|
cmap.set_bad(color='lightgray')
|
|
573
576
|
plt.figure(figsize=(8, 6))
|
|
574
|
-
plt.title(f"Global Solar Irradiance at {time_local.strftime('%Y-%m-%d %H:%M:%S')}")
|
|
577
|
+
# plt.title(f"Global Solar Irradiance at {time_local.strftime('%Y-%m-%d %H:%M:%S')}")
|
|
575
578
|
plt.imshow(global_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
579
|
+
plt.axis('off')
|
|
576
580
|
plt.colorbar(label='Global Solar Irradiance (W/m²)')
|
|
577
581
|
plt.show()
|
|
578
582
|
|
|
@@ -588,9 +592,10 @@ def get_cumulative_global_solar_irradiance(
|
|
|
588
592
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
589
593
|
cmap.set_bad(color='lightgray')
|
|
590
594
|
plt.figure(figsize=(8, 6))
|
|
591
|
-
plt.title("Cumulative Global Solar Irradiance Map")
|
|
595
|
+
# plt.title("Cumulative Global Solar Irradiance Map")
|
|
592
596
|
plt.imshow(cumulative_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
593
597
|
plt.colorbar(label='Cumulative Global Solar Irradiance (W/m²·hour)')
|
|
598
|
+
plt.axis('off')
|
|
594
599
|
plt.show()
|
|
595
600
|
|
|
596
601
|
# Optional OBJ export
|
voxcity/sim/view.py
CHANGED
|
@@ -413,6 +413,7 @@ def get_view_index(voxel_data, meshsize, mode=None, hit_values=None, inclusion_m
|
|
|
413
413
|
plt.figure(figsize=(10, 8))
|
|
414
414
|
plt.imshow(vi_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
415
415
|
plt.colorbar(label='View Index')
|
|
416
|
+
plt.axis('off')
|
|
416
417
|
plt.show()
|
|
417
418
|
|
|
418
419
|
# Optional OBJ export
|
|
@@ -626,7 +627,7 @@ def compute_visibility_map(voxel_data, landmark_positions, opaque_values, view_h
|
|
|
626
627
|
for z in range(1, nz):
|
|
627
628
|
if voxel_data[x, y, z] == 0 and voxel_data[x, y, z - 1] != 0:
|
|
628
629
|
# Skip if standing on building or vegetation
|
|
629
|
-
if voxel_data[x, y, z - 1] in (
|
|
630
|
+
if (voxel_data[x, y, z - 1] in (7, 8, 9)) or (voxel_data[x, y, z - 1] < 0):
|
|
630
631
|
visibility_map[x, y] = np.nan
|
|
631
632
|
found_observer = True
|
|
632
633
|
break
|
|
@@ -696,7 +697,7 @@ def compute_landmark_visibility(voxel_data, target_value=-30, view_height_voxel=
|
|
|
696
697
|
plt.legend(handles=[visible_patch, not_visible_patch],
|
|
697
698
|
loc='center left',
|
|
698
699
|
bbox_to_anchor=(1.0, 0.5))
|
|
699
|
-
|
|
700
|
+
plt.axis('off')
|
|
700
701
|
plt.show()
|
|
701
702
|
|
|
702
703
|
return np.flipud(visibility_map)
|
|
@@ -852,9 +853,10 @@ def get_sky_view_factor_map(voxel_data, meshsize, show_plot=False, **kwargs):
|
|
|
852
853
|
cmap = plt.cm.get_cmap(colormap).copy()
|
|
853
854
|
cmap.set_bad(color='lightgray')
|
|
854
855
|
plt.figure(figsize=(10, 8))
|
|
855
|
-
plt.title("Sky View Factor Map")
|
|
856
|
+
# plt.title("Sky View Factor Map")
|
|
856
857
|
plt.imshow(vi_map, origin='lower', cmap=cmap, vmin=vmin, vmax=vmax)
|
|
857
858
|
plt.colorbar(label='Sky View Factor')
|
|
859
|
+
plt.axis('off')
|
|
858
860
|
plt.show()
|
|
859
861
|
|
|
860
862
|
# Optional OBJ export
|
voxcity/voxcity.py
CHANGED
|
@@ -294,28 +294,31 @@ def get_dem_grid(rectangle_vertices, meshsize, source, output_dir, **kwargs):
|
|
|
294
294
|
print("Creating Digital Elevation Model (DEM) grid\n ")
|
|
295
295
|
print(f"Data source: {source}")
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
if source == "Local file":
|
|
298
|
+
geotiff_path = kwargs["dem_path"]
|
|
299
|
+
else:
|
|
300
|
+
# Initialize Earth Engine for accessing elevation data
|
|
301
|
+
initialize_earth_engine()
|
|
299
302
|
|
|
300
|
-
|
|
303
|
+
geotiff_path = os.path.join(output_dir, "dem.tif")
|
|
301
304
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
305
|
+
# Add buffer around ROI to ensure smooth interpolation at edges
|
|
306
|
+
buffer_distance = 100
|
|
307
|
+
roi = get_roi(rectangle_vertices)
|
|
308
|
+
roi_buffered = roi.buffer(buffer_distance)
|
|
309
|
+
|
|
310
|
+
# Get DEM data
|
|
311
|
+
image = get_dem_image(roi_buffered, source)
|
|
312
|
+
|
|
313
|
+
# Save DEM data with appropriate resolution based on source
|
|
314
|
+
if source in ["England 1m DTM", 'DEM France 1m', 'DEM France 5m', 'AUSTRALIA 5M DEM']:
|
|
315
|
+
save_geotiff(image, geotiff_path, scale=meshsize, region=roi_buffered, crs='EPSG:4326')
|
|
316
|
+
elif source == 'USGS 3DEP 1m':
|
|
317
|
+
scale = max(meshsize, 1.25)
|
|
318
|
+
save_geotiff(image, geotiff_path, scale=scale, region=roi_buffered, crs='EPSG:4326')
|
|
319
|
+
else:
|
|
320
|
+
# Default to 30m resolution for other sources
|
|
321
|
+
save_geotiff(image, geotiff_path, scale=30, region=roi_buffered)
|
|
319
322
|
|
|
320
323
|
# Create DEM grid with optional interpolation method
|
|
321
324
|
dem_interpolation = kwargs.get("dem_interpolation")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: voxcity
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.10
|
|
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
|
Author-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
|
|
6
6
|
Maintainer-email: Kunihiko Fujiwara <kunihiko@nus.edu.sg>
|
|
@@ -49,6 +49,7 @@ Requires-Dist: protobuf==3.20.3
|
|
|
49
49
|
Requires-Dist: timezonefinder
|
|
50
50
|
Requires-Dist: astral
|
|
51
51
|
Requires-Dist: osmnx
|
|
52
|
+
Requires-Dist: joblib
|
|
52
53
|
Provides-Extra: dev
|
|
53
54
|
Requires-Dist: coverage; extra == "dev"
|
|
54
55
|
Requires-Dist: mypy; extra == "dev"
|
|
@@ -65,7 +66,7 @@ Requires-Dist: ruff; extra == "dev"
|
|
|
65
66
|
|
|
66
67
|
# VoxCity
|
|
67
68
|
|
|
68
|
-
**VoxCity** is a Python package that
|
|
69
|
+
**VoxCity** is a Python package that provides a one-stop solution for grid-based 3D city model generation and urban simulation for cities worldwide. It integrates various geospatial datasets—such as building footprints, land cover, canopy height, and digital elevation models (DEMs)—to generate 2D and 3D representations of urban areas. It can export data in formats compatible with popular simulation tools like ENVI-MET, as well as visualization tools like MagicaVoxel, and supports simulations such as sky view index and green view index calculations.
|
|
69
70
|
|
|
70
71
|
<!-- <p align="center">
|
|
71
72
|
<picture>
|
|
@@ -283,7 +284,7 @@ The generated OBJ files can be opened and rendered in the following 3D visualiza
|
|
|
283
284
|
<img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/obj.png" alt="OBJ 3D City Model Rendered in Rhino" width="600">
|
|
284
285
|
</p>
|
|
285
286
|
<p align="center">
|
|
286
|
-
<em>Example Output Exported in OBJ and Rendered in
|
|
287
|
+
<em>Example Output Exported in OBJ and Rendered in Rhino</em>
|
|
287
288
|
</p>
|
|
288
289
|
|
|
289
290
|
#### MagicaVoxel VOX Files:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
voxcity/__init__.py,sha256=HJM0D2Mv9qpk4JdVzt2SRAAk-hA1D_pCO0ezZH9F7KA,248
|
|
2
|
-
voxcity/voxcity.py,sha256=
|
|
2
|
+
voxcity/voxcity.py,sha256=tZOgRnyvw4ZHuuJr_QP3qeen5DxhYOkDglNDtpB0hzY,33664
|
|
3
3
|
voxcity/download/__init__.py,sha256=OgGcGxOXF4tjcEL6DhOnt13DYPTvOigUelp5xIpTqM0,171
|
|
4
4
|
voxcity/download/eubucco.py,sha256=e1JXBuUfBptSDvNznSGckRs5Xgrj_SAFxk445J_o4KY,14854
|
|
5
5
|
voxcity/download/gee.py,sha256=j7jmzp44T3M6j_4DwhU9Y8Y6gqbZo1zFIlduQPc0jvk,14339
|
|
@@ -11,26 +11,26 @@ voxcity/download/overture.py,sha256=daOvsySC2KIcTcMJUSA7XdbMELJuyLAIM2vr1DRLGp0,
|
|
|
11
11
|
voxcity/download/utils.py,sha256=z6MdPxM96FWQVqvZW2Eg5pMewVHVysUP7F6ueeCwMfI,1375
|
|
12
12
|
voxcity/file/__init_.py,sha256=cVyNyE6axEpSd3CT5hGuMOAlOyU1p8lVP4jkF1-0Ad8,94
|
|
13
13
|
voxcity/file/envimet.py,sha256=SPVoSyYTMNyDRDFWsI0YAsIsb6yt_SXZeDUlhyqlEqY,24282
|
|
14
|
-
voxcity/file/geojson.py,sha256=
|
|
14
|
+
voxcity/file/geojson.py,sha256=h6WYr1bdvzC46w6CbjKzO4wMtVrKTSF7SGaOUuUMkCM,33412
|
|
15
15
|
voxcity/file/magicavoxel.py,sha256=Fsv7yGRXeKmp82xcG3rOb0t_HtoqltNq2tHl08xVlqY,7500
|
|
16
16
|
voxcity/file/obj.py,sha256=oW-kPoZj53nfmO9tXP3Wvizq6Kkjh-QQR8UBexRuMiI,21609
|
|
17
17
|
voxcity/geo/__init_.py,sha256=AZYQxK1zY1M_mDT1HmgcdVI86OAtwK7CNo3AOScLHco,88
|
|
18
18
|
voxcity/geo/draw.py,sha256=roljWXyqYdsWYkmb-5_WNxrJrfV5lnAt8uZblCCo_3Q,13555
|
|
19
19
|
voxcity/geo/grid.py,sha256=_MzO-Cu2GhlP9nuCql6f1pfbU2_OAL27aQ_zCj1u_zk,36288
|
|
20
|
-
voxcity/geo/network.py,sha256=
|
|
20
|
+
voxcity/geo/network.py,sha256=P1oaosieFPuWj9QbU9VmZHpoXV3HR61VssZMcUZLYIw,17403
|
|
21
21
|
voxcity/geo/utils.py,sha256=1BRHp-DDeOA8HG8jplY7Eo75G3oXkVGL6DGONL4BA8A,19815
|
|
22
22
|
voxcity/sim/__init_.py,sha256=APdkcdaovj0v_RPOaA4SBvFUKT2RM7Hxuuz3Sux4gCo,65
|
|
23
|
-
voxcity/sim/solar.py,sha256=
|
|
23
|
+
voxcity/sim/solar.py,sha256=wpnDC3BAm4edx5Z-dz2g_5rqnFNi_YKXneHY2RVBk1w,31968
|
|
24
24
|
voxcity/sim/utils.py,sha256=sEYBB2-hLJxTiXQps1_-Fi7t1HN3-1OPOvBCWtgIisA,130
|
|
25
|
-
voxcity/sim/view.py,sha256=
|
|
25
|
+
voxcity/sim/view.py,sha256=FoXovh406hmvL1obaIXi2MyiRnPdXHY9SWxqfqmcJnc,36758
|
|
26
26
|
voxcity/utils/__init_.py,sha256=nLYrj2huBbDBNMqfchCwexGP8Tlt9O_XluVDG7MoFkw,98
|
|
27
27
|
voxcity/utils/lc.py,sha256=RwPd-VY3POV3gTrBhM7TubgGb9MCd3nVah_G8iUEF7k,11562
|
|
28
28
|
voxcity/utils/material.py,sha256=Vt3IID5Ft54HNJcEC4zi31BCPqi_687X3CSp7rXaRVY,5907
|
|
29
29
|
voxcity/utils/visualization.py,sha256=FNBMN0V5IPuAdqvLHnqSGYqNS7jWesg0ZADEtsUtl0A,31925
|
|
30
30
|
voxcity/utils/weather.py,sha256=P6s1y_EstBL1OGP_MR_6u3vr-t6Uawg8uDckJnoI7FI,21482
|
|
31
|
-
voxcity-0.3.
|
|
32
|
-
voxcity-0.3.
|
|
33
|
-
voxcity-0.3.
|
|
34
|
-
voxcity-0.3.
|
|
35
|
-
voxcity-0.3.
|
|
36
|
-
voxcity-0.3.
|
|
31
|
+
voxcity-0.3.10.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
|
|
32
|
+
voxcity-0.3.10.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
|
|
33
|
+
voxcity-0.3.10.dist-info/METADATA,sha256=Lf4DIH1_hPKyQkxAset4cMlL5dJWwHosXpBgj6Ybta8,25122
|
|
34
|
+
voxcity-0.3.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
35
|
+
voxcity-0.3.10.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
|
|
36
|
+
voxcity-0.3.10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|