voxcity 0.7.0__py3-none-any.whl → 1.0.13__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.
- voxcity/__init__.py +14 -14
- voxcity/downloader/ocean.py +559 -0
- voxcity/exporter/__init__.py +12 -12
- voxcity/exporter/cityles.py +633 -633
- voxcity/exporter/envimet.py +733 -728
- voxcity/exporter/magicavoxel.py +333 -333
- voxcity/exporter/netcdf.py +238 -238
- voxcity/exporter/obj.py +1480 -1480
- voxcity/generator/__init__.py +47 -44
- voxcity/generator/api.py +727 -675
- voxcity/generator/grids.py +394 -379
- voxcity/generator/io.py +94 -94
- voxcity/generator/pipeline.py +582 -282
- voxcity/generator/update.py +429 -0
- voxcity/generator/voxelizer.py +18 -6
- voxcity/geoprocessor/__init__.py +75 -75
- voxcity/geoprocessor/draw.py +1494 -1219
- voxcity/geoprocessor/merge_utils.py +91 -91
- voxcity/geoprocessor/mesh.py +806 -806
- voxcity/geoprocessor/network.py +708 -708
- voxcity/geoprocessor/raster/__init__.py +2 -0
- voxcity/geoprocessor/raster/buildings.py +435 -428
- voxcity/geoprocessor/raster/core.py +31 -0
- voxcity/geoprocessor/raster/export.py +93 -93
- voxcity/geoprocessor/raster/landcover.py +178 -51
- voxcity/geoprocessor/raster/raster.py +1 -1
- voxcity/geoprocessor/utils.py +824 -824
- voxcity/models.py +115 -113
- voxcity/simulator/solar/__init__.py +66 -43
- voxcity/simulator/solar/integration.py +336 -336
- voxcity/simulator/solar/sky.py +668 -0
- voxcity/simulator/solar/temporal.py +792 -434
- voxcity/simulator_gpu/__init__.py +115 -0
- voxcity/simulator_gpu/common/__init__.py +9 -0
- voxcity/simulator_gpu/common/geometry.py +11 -0
- voxcity/simulator_gpu/core.py +322 -0
- voxcity/simulator_gpu/domain.py +262 -0
- voxcity/simulator_gpu/environment.yml +11 -0
- voxcity/simulator_gpu/init_taichi.py +154 -0
- voxcity/simulator_gpu/integration.py +15 -0
- voxcity/simulator_gpu/kernels.py +56 -0
- voxcity/simulator_gpu/radiation.py +28 -0
- voxcity/simulator_gpu/raytracing.py +623 -0
- voxcity/simulator_gpu/sky.py +9 -0
- voxcity/simulator_gpu/solar/__init__.py +178 -0
- voxcity/simulator_gpu/solar/core.py +66 -0
- voxcity/simulator_gpu/solar/csf.py +1249 -0
- voxcity/simulator_gpu/solar/domain.py +561 -0
- voxcity/simulator_gpu/solar/epw.py +421 -0
- voxcity/simulator_gpu/solar/integration.py +2953 -0
- voxcity/simulator_gpu/solar/radiation.py +3019 -0
- voxcity/simulator_gpu/solar/raytracing.py +686 -0
- voxcity/simulator_gpu/solar/reflection.py +533 -0
- voxcity/simulator_gpu/solar/sky.py +907 -0
- voxcity/simulator_gpu/solar/solar.py +337 -0
- voxcity/simulator_gpu/solar/svf.py +446 -0
- voxcity/simulator_gpu/solar/volumetric.py +1151 -0
- voxcity/simulator_gpu/solar/voxcity.py +2953 -0
- voxcity/simulator_gpu/temporal.py +13 -0
- voxcity/simulator_gpu/utils.py +25 -0
- voxcity/simulator_gpu/view.py +32 -0
- voxcity/simulator_gpu/visibility/__init__.py +109 -0
- voxcity/simulator_gpu/visibility/geometry.py +278 -0
- voxcity/simulator_gpu/visibility/integration.py +808 -0
- voxcity/simulator_gpu/visibility/landmark.py +753 -0
- voxcity/simulator_gpu/visibility/view.py +944 -0
- voxcity/utils/__init__.py +11 -0
- voxcity/utils/classes.py +194 -0
- voxcity/utils/lc.py +80 -39
- voxcity/utils/shape.py +230 -0
- voxcity/visualizer/__init__.py +24 -24
- voxcity/visualizer/builder.py +43 -43
- voxcity/visualizer/grids.py +141 -141
- voxcity/visualizer/maps.py +187 -187
- voxcity/visualizer/renderer.py +1146 -928
- {voxcity-0.7.0.dist-info → voxcity-1.0.13.dist-info}/METADATA +56 -52
- voxcity-1.0.13.dist-info/RECORD +116 -0
- voxcity-0.7.0.dist-info/RECORD +0 -77
- {voxcity-0.7.0.dist-info → voxcity-1.0.13.dist-info}/WHEEL +0 -0
- {voxcity-0.7.0.dist-info → voxcity-1.0.13.dist-info}/licenses/AUTHORS.rst +0 -0
- {voxcity-0.7.0.dist-info → voxcity-1.0.13.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Utilities to merge GeoDataFrames while resolving ID conflicts.
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
import pandas as pd
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def _merge_gdfs_with_missing_columns(gdf_1, gdf_2):
|
|
9
|
-
"""
|
|
10
|
-
Helper to merge two GeoDataFrames while handling missing columns by filling with None.
|
|
11
|
-
"""
|
|
12
|
-
columns_1 = set(gdf_1.columns)
|
|
13
|
-
columns_2 = set(gdf_2.columns)
|
|
14
|
-
|
|
15
|
-
only_in_1 = columns_1 - columns_2
|
|
16
|
-
only_in_2 = columns_2 - columns_1
|
|
17
|
-
|
|
18
|
-
for col in only_in_2:
|
|
19
|
-
gdf_1[col] = None
|
|
20
|
-
for col in only_in_1:
|
|
21
|
-
gdf_2[col] = None
|
|
22
|
-
|
|
23
|
-
all_columns = sorted(list(columns_1.union(columns_2)))
|
|
24
|
-
gdf_1 = gdf_1[all_columns]
|
|
25
|
-
gdf_2 = gdf_2[all_columns]
|
|
26
|
-
|
|
27
|
-
merged_gdf = pd.concat([gdf_1, gdf_2], ignore_index=True)
|
|
28
|
-
return merged_gdf
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def merge_gdfs_with_id_conflict_resolution(gdf_1, gdf_2, id_columns=['id', 'building_id']):
|
|
32
|
-
"""
|
|
33
|
-
Merge two GeoDataFrames while resolving ID conflicts by modifying IDs in the second GeoDataFrame.
|
|
34
|
-
"""
|
|
35
|
-
gdf_primary = gdf_1.copy()
|
|
36
|
-
gdf_secondary = gdf_2.copy()
|
|
37
|
-
|
|
38
|
-
missing_columns = []
|
|
39
|
-
for col in id_columns:
|
|
40
|
-
if col not in gdf_primary.columns:
|
|
41
|
-
missing_columns.append(f"'{col}' missing from gdf_1")
|
|
42
|
-
if col not in gdf_secondary.columns:
|
|
43
|
-
missing_columns.append(f"'{col}' missing from gdf_2")
|
|
44
|
-
|
|
45
|
-
if missing_columns:
|
|
46
|
-
print(f"Warning: Missing ID columns: {', '.join(missing_columns)}")
|
|
47
|
-
id_columns = [col for col in id_columns if col in gdf_primary.columns and col in gdf_secondary.columns]
|
|
48
|
-
|
|
49
|
-
if not id_columns:
|
|
50
|
-
print("Warning: No valid ID columns found. Merging without ID conflict resolution.")
|
|
51
|
-
merged_gdf = _merge_gdfs_with_missing_columns(gdf_primary, gdf_secondary)
|
|
52
|
-
return merged_gdf
|
|
53
|
-
|
|
54
|
-
max_ids = {}
|
|
55
|
-
for col in id_columns:
|
|
56
|
-
if gdf_primary[col].dtype in ['int64', 'int32', 'float64', 'float32']:
|
|
57
|
-
max_ids[col] = gdf_primary[col].max()
|
|
58
|
-
else:
|
|
59
|
-
max_ids[col] = len(gdf_primary)
|
|
60
|
-
|
|
61
|
-
next_ids = {col: max_ids[col] + 1 for col in id_columns}
|
|
62
|
-
modified_buildings = 0
|
|
63
|
-
|
|
64
|
-
for idx, row in gdf_secondary.iterrows():
|
|
65
|
-
needs_new_ids = False
|
|
66
|
-
for col in id_columns:
|
|
67
|
-
current_id = row[col]
|
|
68
|
-
if current_id in gdf_primary[col].values:
|
|
69
|
-
needs_new_ids = True
|
|
70
|
-
break
|
|
71
|
-
if needs_new_ids:
|
|
72
|
-
modified_buildings += 1
|
|
73
|
-
for col in id_columns:
|
|
74
|
-
new_id = next_ids[col]
|
|
75
|
-
gdf_secondary.at[idx, col] = new_id
|
|
76
|
-
next_ids[col] += 1
|
|
77
|
-
|
|
78
|
-
merged_gdf = _merge_gdfs_with_missing_columns(gdf_primary, gdf_secondary)
|
|
79
|
-
|
|
80
|
-
total_buildings = len(merged_gdf)
|
|
81
|
-
primary_buildings = len(gdf_primary)
|
|
82
|
-
secondary_buildings = len(gdf_secondary)
|
|
83
|
-
|
|
84
|
-
print(f"Merged {primary_buildings} buildings from primary dataset with {secondary_buildings} buildings from secondary dataset.")
|
|
85
|
-
print(f"Total buildings in merged dataset: {total_buildings}")
|
|
86
|
-
if modified_buildings > 0:
|
|
87
|
-
print(f"Modified IDs for {modified_buildings} buildings in secondary dataset to resolve conflicts.")
|
|
88
|
-
|
|
89
|
-
return merged_gdf
|
|
90
|
-
|
|
91
|
-
|
|
1
|
+
"""
|
|
2
|
+
Utilities to merge GeoDataFrames while resolving ID conflicts.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import pandas as pd
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _merge_gdfs_with_missing_columns(gdf_1, gdf_2):
|
|
9
|
+
"""
|
|
10
|
+
Helper to merge two GeoDataFrames while handling missing columns by filling with None.
|
|
11
|
+
"""
|
|
12
|
+
columns_1 = set(gdf_1.columns)
|
|
13
|
+
columns_2 = set(gdf_2.columns)
|
|
14
|
+
|
|
15
|
+
only_in_1 = columns_1 - columns_2
|
|
16
|
+
only_in_2 = columns_2 - columns_1
|
|
17
|
+
|
|
18
|
+
for col in only_in_2:
|
|
19
|
+
gdf_1[col] = None
|
|
20
|
+
for col in only_in_1:
|
|
21
|
+
gdf_2[col] = None
|
|
22
|
+
|
|
23
|
+
all_columns = sorted(list(columns_1.union(columns_2)))
|
|
24
|
+
gdf_1 = gdf_1[all_columns]
|
|
25
|
+
gdf_2 = gdf_2[all_columns]
|
|
26
|
+
|
|
27
|
+
merged_gdf = pd.concat([gdf_1, gdf_2], ignore_index=True)
|
|
28
|
+
return merged_gdf
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def merge_gdfs_with_id_conflict_resolution(gdf_1, gdf_2, id_columns=['id', 'building_id']):
|
|
32
|
+
"""
|
|
33
|
+
Merge two GeoDataFrames while resolving ID conflicts by modifying IDs in the second GeoDataFrame.
|
|
34
|
+
"""
|
|
35
|
+
gdf_primary = gdf_1.copy()
|
|
36
|
+
gdf_secondary = gdf_2.copy()
|
|
37
|
+
|
|
38
|
+
missing_columns = []
|
|
39
|
+
for col in id_columns:
|
|
40
|
+
if col not in gdf_primary.columns:
|
|
41
|
+
missing_columns.append(f"'{col}' missing from gdf_1")
|
|
42
|
+
if col not in gdf_secondary.columns:
|
|
43
|
+
missing_columns.append(f"'{col}' missing from gdf_2")
|
|
44
|
+
|
|
45
|
+
if missing_columns:
|
|
46
|
+
print(f"Warning: Missing ID columns: {', '.join(missing_columns)}")
|
|
47
|
+
id_columns = [col for col in id_columns if col in gdf_primary.columns and col in gdf_secondary.columns]
|
|
48
|
+
|
|
49
|
+
if not id_columns:
|
|
50
|
+
print("Warning: No valid ID columns found. Merging without ID conflict resolution.")
|
|
51
|
+
merged_gdf = _merge_gdfs_with_missing_columns(gdf_primary, gdf_secondary)
|
|
52
|
+
return merged_gdf
|
|
53
|
+
|
|
54
|
+
max_ids = {}
|
|
55
|
+
for col in id_columns:
|
|
56
|
+
if gdf_primary[col].dtype in ['int64', 'int32', 'float64', 'float32']:
|
|
57
|
+
max_ids[col] = gdf_primary[col].max()
|
|
58
|
+
else:
|
|
59
|
+
max_ids[col] = len(gdf_primary)
|
|
60
|
+
|
|
61
|
+
next_ids = {col: max_ids[col] + 1 for col in id_columns}
|
|
62
|
+
modified_buildings = 0
|
|
63
|
+
|
|
64
|
+
for idx, row in gdf_secondary.iterrows():
|
|
65
|
+
needs_new_ids = False
|
|
66
|
+
for col in id_columns:
|
|
67
|
+
current_id = row[col]
|
|
68
|
+
if current_id in gdf_primary[col].values:
|
|
69
|
+
needs_new_ids = True
|
|
70
|
+
break
|
|
71
|
+
if needs_new_ids:
|
|
72
|
+
modified_buildings += 1
|
|
73
|
+
for col in id_columns:
|
|
74
|
+
new_id = next_ids[col]
|
|
75
|
+
gdf_secondary.at[idx, col] = new_id
|
|
76
|
+
next_ids[col] += 1
|
|
77
|
+
|
|
78
|
+
merged_gdf = _merge_gdfs_with_missing_columns(gdf_primary, gdf_secondary)
|
|
79
|
+
|
|
80
|
+
total_buildings = len(merged_gdf)
|
|
81
|
+
primary_buildings = len(gdf_primary)
|
|
82
|
+
secondary_buildings = len(gdf_secondary)
|
|
83
|
+
|
|
84
|
+
print(f"Merged {primary_buildings} buildings from primary dataset with {secondary_buildings} buildings from secondary dataset.")
|
|
85
|
+
print(f"Total buildings in merged dataset: {total_buildings}")
|
|
86
|
+
if modified_buildings > 0:
|
|
87
|
+
print(f"Modified IDs for {modified_buildings} buildings in secondary dataset to resolve conflicts.")
|
|
88
|
+
|
|
89
|
+
return merged_gdf
|
|
90
|
+
|
|
91
|
+
|