voxcity 0.3.24__tar.gz → 0.3.27__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.3.24 → voxcity-0.3.27}/PKG-INFO +2 -2
- {voxcity-0.3.24 → voxcity-0.3.27}/pyproject.toml +2 -2
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/generator.py +17 -4
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/utils/visualization.py +110 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity.egg-info/PKG-INFO +2 -2
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity.egg-info/requires.txt +1 -1
- {voxcity-0.3.24 → voxcity-0.3.27}/AUTHORS.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/CONTRIBUTING.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/HISTORY.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/LICENSE +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/MANIFEST.in +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/README.md +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/Makefile +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/archive/README.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/authors.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/conf.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/index.rst +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/docs/make.bat +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/setup.cfg +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/__init__.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/__init__.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/eubucco.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/gee.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/mbfp.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/oemj.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/omt.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/osm.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/overture.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/downloader/utils.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/exporter/__init_.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/exporter/envimet.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/exporter/magicavoxel.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/exporter/obj.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/__init_.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/draw.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/grid.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/mesh.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/network.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/polygon.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/geoprocessor/utils.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/simulator/__init_.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/simulator/solar.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/simulator/utils.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/simulator/view.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/utils/__init_.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/utils/lc.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/utils/material.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity/utils/weather.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity.egg-info/SOURCES.txt +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity.egg-info/dependency_links.txt +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/src/voxcity.egg-info/top_level.txt +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/tests/__init__.py +0 -0
- {voxcity-0.3.24 → voxcity-0.3.27}/tests/voxelcity.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: voxcity
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.27
|
|
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>
|
|
@@ -45,7 +45,7 @@ Requires-Dist: pycountry
|
|
|
45
45
|
Requires-Dist: osm2geojson
|
|
46
46
|
Requires-Dist: seaborn
|
|
47
47
|
Requires-Dist: overturemaps
|
|
48
|
-
Requires-Dist: protobuf
|
|
48
|
+
Requires-Dist: protobuf<=3.20.3
|
|
49
49
|
Requires-Dist: timezonefinder
|
|
50
50
|
Requires-Dist: astral
|
|
51
51
|
Requires-Dist: osmnx
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "voxcity"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.27"
|
|
4
4
|
requires-python = ">=3.10,<3.13"
|
|
5
5
|
classifiers = [
|
|
6
6
|
"Programming Language :: Python :: 3.10",
|
|
@@ -47,7 +47,7 @@ dependencies = [
|
|
|
47
47
|
"osm2geojson",
|
|
48
48
|
"seaborn",
|
|
49
49
|
"overturemaps",
|
|
50
|
-
"protobuf
|
|
50
|
+
"protobuf<=3.20.3",
|
|
51
51
|
"timezonefinder",
|
|
52
52
|
"astral",
|
|
53
53
|
"osmnx",
|
|
@@ -82,7 +82,8 @@ def get_land_cover_grid(rectangle_vertices, meshsize, source, output_dir, **kwar
|
|
|
82
82
|
print(f"Data source: {source}")
|
|
83
83
|
|
|
84
84
|
# Initialize Earth Engine for accessing satellite data
|
|
85
|
-
|
|
85
|
+
if source is not "OpenStreetMap":
|
|
86
|
+
initialize_earth_engine()
|
|
86
87
|
|
|
87
88
|
# Create output directory if it doesn't exist
|
|
88
89
|
os.makedirs(output_dir, exist_ok=True)
|
|
@@ -157,7 +158,8 @@ def get_building_height_grid(rectangle_vertices, meshsize, source, output_dir, *
|
|
|
157
158
|
"""
|
|
158
159
|
|
|
159
160
|
# Initialize Earth Engine for accessing satellite data
|
|
160
|
-
|
|
161
|
+
if source is not "OpenStreetMap":
|
|
162
|
+
initialize_earth_engine()
|
|
161
163
|
|
|
162
164
|
print("Creating Building Height grid\n ")
|
|
163
165
|
print(f"Data source: {source}")
|
|
@@ -320,7 +322,7 @@ def get_dem_grid(rectangle_vertices, meshsize, source, output_dir, **kwargs):
|
|
|
320
322
|
image = get_dem_image(roi_buffered, source)
|
|
321
323
|
|
|
322
324
|
# Save DEM data with appropriate resolution based on source
|
|
323
|
-
if source in ["England 1m DTM", 'DEM France 1m', 'DEM France 5m', 'AUSTRALIA 5M DEM']:
|
|
325
|
+
if source in ["England 1m DTM", 'DEM France 1m', 'DEM France 5m', 'AUSTRALIA 5M DEM', 'Netherlands 0.5m DTM']:
|
|
324
326
|
save_geotiff(image, geotiff_path, scale=meshsize, region=roi_buffered, crs='EPSG:4326')
|
|
325
327
|
elif source == 'USGS 3DEP 1m':
|
|
326
328
|
scale = max(meshsize, 1.25)
|
|
@@ -569,7 +571,18 @@ def get_voxcity(rectangle_vertices, building_source, land_cover_source, canopy_h
|
|
|
569
571
|
building_gdf.to_file(save_path, driver='GPKG')
|
|
570
572
|
|
|
571
573
|
# Get canopy height data
|
|
572
|
-
|
|
574
|
+
if canopy_height_source == "Static":
|
|
575
|
+
# Create canopy height grid with same shape as land cover grid
|
|
576
|
+
canopy_height_grid = np.zeros_like(land_cover_grid, dtype=float)
|
|
577
|
+
|
|
578
|
+
# Set default static height for trees (20 meters is a typical average tree height)
|
|
579
|
+
static_tree_height = kwargs.get("static_tree_height", 10.0)
|
|
580
|
+
tree_mask = (land_cover_grid == 4)
|
|
581
|
+
|
|
582
|
+
# Set static height for tree cells
|
|
583
|
+
canopy_height_grid[tree_mask] = static_tree_height
|
|
584
|
+
else:
|
|
585
|
+
canopy_height_grid = get_canopy_height_grid(rectangle_vertices, meshsize, canopy_height_source, output_dir, **kwargs)
|
|
573
586
|
|
|
574
587
|
# Handle DEM - either flat or from source
|
|
575
588
|
if dem_source == "Flat":
|
|
@@ -1109,6 +1109,116 @@ def visualize_voxcity_multi_view(voxel_array, meshsize, **kwargs):
|
|
|
1109
1109
|
plt.show()
|
|
1110
1110
|
plt.close()
|
|
1111
1111
|
|
|
1112
|
+
def visualize_voxcity_multi_view_with_multiple_sim_grids(voxel_array, meshsize, sim_configs, **kwargs):
|
|
1113
|
+
"""
|
|
1114
|
+
Create multiple views of the voxel city data with multiple simulation grids.
|
|
1115
|
+
|
|
1116
|
+
Args:
|
|
1117
|
+
voxel_array: 3D numpy array containing voxel data
|
|
1118
|
+
meshsize: Size of each voxel/cell
|
|
1119
|
+
sim_configs: List of dictionaries, each containing configuration for a simulation grid:
|
|
1120
|
+
{
|
|
1121
|
+
'sim_grid': 2D numpy array of simulation values,
|
|
1122
|
+
'z_offset': height offset in meters (default: 1.5),
|
|
1123
|
+
'cmap_name': colormap name (default: 'viridis'),
|
|
1124
|
+
'vmin': minimum value for colormap (optional),
|
|
1125
|
+
'vmax': maximum value for colormap (optional),
|
|
1126
|
+
'label': label for the colorbar (optional)
|
|
1127
|
+
}
|
|
1128
|
+
**kwargs: Additional arguments including:
|
|
1129
|
+
- vox_dict: Dictionary mapping voxel values to colors
|
|
1130
|
+
- output_directory: Directory to save output images
|
|
1131
|
+
- output_file_name: Base filename for exports
|
|
1132
|
+
- dem_grid: DEM grid for height information
|
|
1133
|
+
- projection_type: 'perspective' or 'orthographic'
|
|
1134
|
+
- distance_factor: Factor to adjust camera distance
|
|
1135
|
+
"""
|
|
1136
|
+
os.system('Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &')
|
|
1137
|
+
os.environ['DISPLAY'] = ':99'
|
|
1138
|
+
|
|
1139
|
+
# Configure PyVista settings
|
|
1140
|
+
pv.set_plot_theme('document')
|
|
1141
|
+
pv.global_theme.background = 'white'
|
|
1142
|
+
pv.global_theme.window_size = [1024, 768]
|
|
1143
|
+
pv.global_theme.jupyter_backend = 'static'
|
|
1144
|
+
|
|
1145
|
+
# Parse general kwargs
|
|
1146
|
+
vox_dict = kwargs.get("vox_dict", get_default_voxel_color_map())
|
|
1147
|
+
output_directory = kwargs.get("output_directory", 'output')
|
|
1148
|
+
base_filename = kwargs.get("output_file_name", None)
|
|
1149
|
+
dem_grid_ori = kwargs.get("dem_grid", None)
|
|
1150
|
+
projection_type = kwargs.get("projection_type", "perspective")
|
|
1151
|
+
distance_factor = kwargs.get("distance_factor", 1.0)
|
|
1152
|
+
|
|
1153
|
+
if dem_grid_ori is not None:
|
|
1154
|
+
dem_grid = dem_grid_ori - np.min(dem_grid_ori)
|
|
1155
|
+
|
|
1156
|
+
# Create meshes
|
|
1157
|
+
print("Creating voxel meshes...")
|
|
1158
|
+
meshes = create_city_meshes(voxel_array, vox_dict, meshsize=meshsize)
|
|
1159
|
+
|
|
1160
|
+
# Process each simulation grid
|
|
1161
|
+
for i, config in enumerate(sim_configs):
|
|
1162
|
+
sim_grid = config['sim_grid']
|
|
1163
|
+
if sim_grid is None or dem_grid is None:
|
|
1164
|
+
continue
|
|
1165
|
+
|
|
1166
|
+
z_offset = config.get('z_offset', 1.5)
|
|
1167
|
+
cmap_name = config.get('cmap_name', 'viridis')
|
|
1168
|
+
vmin = config.get('vmin', np.nanmin(sim_grid))
|
|
1169
|
+
vmax = config.get('vmax', np.nanmax(sim_grid))
|
|
1170
|
+
label = config.get('label', f'Simulation {i+1}')
|
|
1171
|
+
|
|
1172
|
+
print(f"Creating sim_grid surface mesh for {label}...")
|
|
1173
|
+
sim_mesh = create_sim_surface_mesh(
|
|
1174
|
+
sim_grid, dem_grid,
|
|
1175
|
+
meshsize=meshsize,
|
|
1176
|
+
z_offset=z_offset,
|
|
1177
|
+
cmap_name=cmap_name,
|
|
1178
|
+
vmin=vmin,
|
|
1179
|
+
vmax=vmax
|
|
1180
|
+
)
|
|
1181
|
+
|
|
1182
|
+
if sim_mesh is not None:
|
|
1183
|
+
meshes[f"sim_surface_{i}"] = sim_mesh
|
|
1184
|
+
|
|
1185
|
+
# Create colorbar for this simulation
|
|
1186
|
+
norm = mcolors.Normalize(vmin=vmin, vmax=vmax)
|
|
1187
|
+
scalar_map = cm.ScalarMappable(norm=norm, cmap=cmap_name)
|
|
1188
|
+
|
|
1189
|
+
fig, ax = plt.subplots(figsize=(6, 1))
|
|
1190
|
+
plt.colorbar(scalar_map, cax=ax, orientation='horizontal', label=label)
|
|
1191
|
+
plt.tight_layout()
|
|
1192
|
+
plt.show()
|
|
1193
|
+
|
|
1194
|
+
# Export if filename provided
|
|
1195
|
+
if base_filename is not None:
|
|
1196
|
+
print(f"Exporting files to '{base_filename}.*' ...")
|
|
1197
|
+
os.makedirs(output_directory, exist_ok=True)
|
|
1198
|
+
export_meshes(meshes, output_directory, base_filename)
|
|
1199
|
+
|
|
1200
|
+
# Create and save multiple views
|
|
1201
|
+
print("Creating multiple views...")
|
|
1202
|
+
os.makedirs(output_directory, exist_ok=True)
|
|
1203
|
+
image_files = create_multi_view_scene(
|
|
1204
|
+
meshes,
|
|
1205
|
+
output_directory=output_directory,
|
|
1206
|
+
projection_type=projection_type,
|
|
1207
|
+
distance_factor=distance_factor
|
|
1208
|
+
)
|
|
1209
|
+
|
|
1210
|
+
# Display each view separately
|
|
1211
|
+
for view_name, img_file in image_files:
|
|
1212
|
+
plt.figure(figsize=(12, 8))
|
|
1213
|
+
img = plt.imread(img_file)
|
|
1214
|
+
plt.imshow(img)
|
|
1215
|
+
plt.title(view_name.replace('_', ' ').title(), pad=20)
|
|
1216
|
+
plt.axis('off')
|
|
1217
|
+
plt.show()
|
|
1218
|
+
plt.close()
|
|
1219
|
+
|
|
1220
|
+
return meshes
|
|
1221
|
+
|
|
1112
1222
|
# def create_interactive_scene(meshes):
|
|
1113
1223
|
# scene = trimesh.Scene()
|
|
1114
1224
|
# scene.ambient_light = np.array([0.1, 0.1, 0.1, 1.0])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: voxcity
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.27
|
|
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>
|
|
@@ -45,7 +45,7 @@ Requires-Dist: pycountry
|
|
|
45
45
|
Requires-Dist: osm2geojson
|
|
46
46
|
Requires-Dist: seaborn
|
|
47
47
|
Requires-Dist: overturemaps
|
|
48
|
-
Requires-Dist: protobuf
|
|
48
|
+
Requires-Dist: protobuf<=3.20.3
|
|
49
49
|
Requires-Dist: timezonefinder
|
|
50
50
|
Requires-Dist: astral
|
|
51
51
|
Requires-Dist: osmnx
|
|
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
|
|
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
|