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
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"""
|
|
2
|
+
palm-solar: GPU-accelerated solar radiation simulation for urban environments
|
|
3
|
+
|
|
4
|
+
This package emulates PALM's Radiative Transfer Model (RTM) using Taichi for
|
|
5
|
+
GPU acceleration. It computes:
|
|
6
|
+
- Direct and diffuse solar radiation on surfaces
|
|
7
|
+
- Shadows from buildings and vegetation
|
|
8
|
+
- Sky View Factors (SVF)
|
|
9
|
+
- Canopy Sink Factors (CSF) for plant canopy absorption
|
|
10
|
+
- Surface-to-surface radiative exchange
|
|
11
|
+
|
|
12
|
+
References:
|
|
13
|
+
- Resler et al., GMD 2017: https://doi.org/10.5194/gmd-10-3635-2017
|
|
14
|
+
- Krč et al., GMD 2021: https://doi.org/10.5194/gmd-14-3095-2021
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .core import (
|
|
18
|
+
Vector3, Point3,
|
|
19
|
+
SOLAR_CONSTANT, EXT_COEF, MIN_STABLE_COSZEN,
|
|
20
|
+
PI, TWO_PI, DEG_TO_RAD, RAD_TO_DEG,
|
|
21
|
+
normalize, dot, cross, spherical_to_cartesian
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
from .domain import Domain, Surfaces, extract_surfaces_from_domain
|
|
25
|
+
|
|
26
|
+
from .solar import (
|
|
27
|
+
SolarPosition, SolarCalculator,
|
|
28
|
+
calc_zenith, calc_solar_position_datetime,
|
|
29
|
+
discretize_sky_directions
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
from .raytracing import RayTracer
|
|
33
|
+
|
|
34
|
+
from .svf import SVFCalculator
|
|
35
|
+
|
|
36
|
+
from .csf import CSFCalculator
|
|
37
|
+
|
|
38
|
+
from .radiation import RadiationModel, RadiationConfig
|
|
39
|
+
|
|
40
|
+
from .volumetric import VolumetricFluxCalculator, VolumetricFluxMode
|
|
41
|
+
|
|
42
|
+
# EPW file processing for cumulative irradiance
|
|
43
|
+
from .epw import (
|
|
44
|
+
EPWLocation,
|
|
45
|
+
EPWSolarData,
|
|
46
|
+
read_epw_header,
|
|
47
|
+
read_epw_solar_data,
|
|
48
|
+
prepare_cumulative_simulation_input,
|
|
49
|
+
get_typical_days,
|
|
50
|
+
estimate_annual_irradiance,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
# Sky discretization for cumulative irradiance
|
|
54
|
+
from .sky import (
|
|
55
|
+
SkyPatches,
|
|
56
|
+
BinnedSolarData,
|
|
57
|
+
generate_tregenza_patches,
|
|
58
|
+
generate_reinhart_patches,
|
|
59
|
+
generate_uniform_grid_patches,
|
|
60
|
+
generate_fibonacci_patches,
|
|
61
|
+
generate_sky_patches,
|
|
62
|
+
bin_sun_positions_to_patches,
|
|
63
|
+
get_tregenza_patch_index,
|
|
64
|
+
get_tregenza_patch_index_fast,
|
|
65
|
+
bin_sun_positions_to_tregenza_fast,
|
|
66
|
+
get_patch_info,
|
|
67
|
+
calculate_cumulative_irradiance_weights,
|
|
68
|
+
visualize_sky_patches,
|
|
69
|
+
TREGENZA_BANDS,
|
|
70
|
+
TREGENZA_BAND_BOUNDARIES,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
# VoxCity integration
|
|
74
|
+
from .integration import (
|
|
75
|
+
load_voxcity,
|
|
76
|
+
convert_voxcity_to_domain,
|
|
77
|
+
apply_voxcity_albedo,
|
|
78
|
+
create_radiation_config_for_voxcity,
|
|
79
|
+
LandCoverAlbedo,
|
|
80
|
+
VoxCityDomainResult,
|
|
81
|
+
VOXCITY_GROUND_CODE,
|
|
82
|
+
VOXCITY_TREE_CODE,
|
|
83
|
+
VOXCITY_BUILDING_CODE,
|
|
84
|
+
# VoxCity API-compatible solar functions
|
|
85
|
+
get_direct_solar_irradiance_map,
|
|
86
|
+
get_diffuse_solar_irradiance_map,
|
|
87
|
+
get_global_solar_irradiance_map,
|
|
88
|
+
get_cumulative_global_solar_irradiance,
|
|
89
|
+
get_building_solar_irradiance,
|
|
90
|
+
get_cumulative_building_solar_irradiance,
|
|
91
|
+
get_global_solar_irradiance_using_epw,
|
|
92
|
+
get_building_global_solar_irradiance_using_epw,
|
|
93
|
+
save_irradiance_mesh,
|
|
94
|
+
load_irradiance_mesh,
|
|
95
|
+
# Temporal utilities
|
|
96
|
+
get_solar_positions_astral,
|
|
97
|
+
# Cache management
|
|
98
|
+
clear_radiation_model_cache,
|
|
99
|
+
clear_building_radiation_model_cache,
|
|
100
|
+
clear_all_radiation_caches,
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
__version__ = "0.1.0"
|
|
104
|
+
__all__ = [
|
|
105
|
+
# Core
|
|
106
|
+
'Vector3', 'Point3',
|
|
107
|
+
'SOLAR_CONSTANT', 'EXT_COEF', 'MIN_STABLE_COSZEN',
|
|
108
|
+
'PI', 'TWO_PI', 'DEG_TO_RAD', 'RAD_TO_DEG',
|
|
109
|
+
'normalize', 'dot', 'cross', 'spherical_to_cartesian',
|
|
110
|
+
# Domain
|
|
111
|
+
'Domain', 'Surfaces', 'extract_surfaces_from_domain',
|
|
112
|
+
# Solar
|
|
113
|
+
'SolarPosition', 'SolarCalculator',
|
|
114
|
+
'calc_zenith', 'calc_solar_position_datetime',
|
|
115
|
+
'discretize_sky_directions',
|
|
116
|
+
# Ray tracing
|
|
117
|
+
'RayTracer',
|
|
118
|
+
# SVF
|
|
119
|
+
'SVFCalculator',
|
|
120
|
+
# CSF
|
|
121
|
+
'CSFCalculator',
|
|
122
|
+
# Radiation
|
|
123
|
+
'RadiationModel', 'RadiationConfig',
|
|
124
|
+
# Volumetric flux
|
|
125
|
+
'VolumetricFluxCalculator',
|
|
126
|
+
# EPW file processing
|
|
127
|
+
'EPWLocation',
|
|
128
|
+
'EPWSolarData',
|
|
129
|
+
'read_epw_header',
|
|
130
|
+
'read_epw_solar_data',
|
|
131
|
+
'prepare_cumulative_simulation_input',
|
|
132
|
+
'get_typical_days',
|
|
133
|
+
'estimate_annual_irradiance',
|
|
134
|
+
# Sky discretization (VoxCity API compatible)
|
|
135
|
+
'SkyPatches',
|
|
136
|
+
'BinnedSolarData',
|
|
137
|
+
'generate_tregenza_patches',
|
|
138
|
+
'generate_reinhart_patches',
|
|
139
|
+
'generate_uniform_grid_patches',
|
|
140
|
+
'generate_fibonacci_patches',
|
|
141
|
+
'generate_sky_patches',
|
|
142
|
+
'bin_sun_positions_to_patches',
|
|
143
|
+
'bin_sun_positions_to_tregenza_fast',
|
|
144
|
+
'get_tregenza_patch_index',
|
|
145
|
+
'get_tregenza_patch_index_fast',
|
|
146
|
+
'get_patch_info',
|
|
147
|
+
'calculate_cumulative_irradiance_weights',
|
|
148
|
+
'visualize_sky_patches',
|
|
149
|
+
'TREGENZA_BANDS',
|
|
150
|
+
'TREGENZA_BAND_BOUNDARIES',
|
|
151
|
+
# VoxCity integration
|
|
152
|
+
'load_voxcity',
|
|
153
|
+
'convert_voxcity_to_domain',
|
|
154
|
+
'apply_voxcity_albedo',
|
|
155
|
+
'create_radiation_config_for_voxcity',
|
|
156
|
+
'LandCoverAlbedo',
|
|
157
|
+
'VoxCityDomainResult',
|
|
158
|
+
'VOXCITY_GROUND_CODE',
|
|
159
|
+
'VOXCITY_TREE_CODE',
|
|
160
|
+
'VOXCITY_BUILDING_CODE',
|
|
161
|
+
# VoxCity API-compatible solar functions
|
|
162
|
+
'get_direct_solar_irradiance_map',
|
|
163
|
+
'get_diffuse_solar_irradiance_map',
|
|
164
|
+
'get_global_solar_irradiance_map',
|
|
165
|
+
'get_cumulative_global_solar_irradiance',
|
|
166
|
+
'get_building_solar_irradiance',
|
|
167
|
+
'get_cumulative_building_solar_irradiance',
|
|
168
|
+
'get_global_solar_irradiance_using_epw',
|
|
169
|
+
'get_building_global_solar_irradiance_using_epw',
|
|
170
|
+
'save_irradiance_mesh',
|
|
171
|
+
'load_irradiance_mesh',
|
|
172
|
+
# Cache management
|
|
173
|
+
'clear_radiation_model_cache',
|
|
174
|
+
'clear_building_radiation_model_cache',
|
|
175
|
+
'clear_all_radiation_caches',
|
|
176
|
+
# Temporal utilities (VoxCity API compatible)
|
|
177
|
+
'get_solar_positions_astral',
|
|
178
|
+
]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Vector and ray utilities for palm-solar using Taichi.
|
|
3
|
+
Based on ray-tracing-one-weekend-taichi patterns.
|
|
4
|
+
|
|
5
|
+
GPU Optimization Notes:
|
|
6
|
+
- All functions use @ti.func for GPU inlining
|
|
7
|
+
- Branchless operations preferred where possible
|
|
8
|
+
- Memory coalescing friendly access patterns
|
|
9
|
+
- done-flag pattern for early termination (reduces warp divergence)
|
|
10
|
+
|
|
11
|
+
This module re-exports shared core utilities from simulator_gpu.core
|
|
12
|
+
and adds solar-specific extensions.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import taichi as ti
|
|
16
|
+
import math
|
|
17
|
+
|
|
18
|
+
# Import shared core utilities from parent package
|
|
19
|
+
from ..core import (
|
|
20
|
+
Vector3,
|
|
21
|
+
Point3,
|
|
22
|
+
Color3,
|
|
23
|
+
PI,
|
|
24
|
+
TWO_PI,
|
|
25
|
+
HALF_PI,
|
|
26
|
+
DEG_TO_RAD,
|
|
27
|
+
RAD_TO_DEG,
|
|
28
|
+
SOLAR_CONSTANT,
|
|
29
|
+
EXT_COEF,
|
|
30
|
+
MIN_STABLE_COSZEN,
|
|
31
|
+
GPU_BLOCK_SIZE,
|
|
32
|
+
normalize,
|
|
33
|
+
normalize_safe,
|
|
34
|
+
dot,
|
|
35
|
+
cross,
|
|
36
|
+
reflect,
|
|
37
|
+
ray_at,
|
|
38
|
+
length_squared,
|
|
39
|
+
distance_squared,
|
|
40
|
+
min3,
|
|
41
|
+
max3,
|
|
42
|
+
clamp,
|
|
43
|
+
random_in_unit_sphere,
|
|
44
|
+
random_in_hemisphere,
|
|
45
|
+
random_cosine_hemisphere,
|
|
46
|
+
spherical_to_cartesian,
|
|
47
|
+
cartesian_to_spherical,
|
|
48
|
+
rotate_vector_axis_angle,
|
|
49
|
+
build_face_basis,
|
|
50
|
+
Rays,
|
|
51
|
+
HitRecord,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Re-export all symbols for backward compatibility
|
|
55
|
+
__all__ = [
|
|
56
|
+
'Vector3', 'Point3', 'Color3',
|
|
57
|
+
'PI', 'TWO_PI', 'HALF_PI', 'DEG_TO_RAD', 'RAD_TO_DEG',
|
|
58
|
+
'SOLAR_CONSTANT', 'EXT_COEF', 'MIN_STABLE_COSZEN', 'GPU_BLOCK_SIZE',
|
|
59
|
+
'normalize', 'normalize_safe', 'dot', 'cross', 'reflect',
|
|
60
|
+
'ray_at', 'length_squared', 'distance_squared',
|
|
61
|
+
'min3', 'max3', 'clamp',
|
|
62
|
+
'random_in_unit_sphere', 'random_in_hemisphere', 'random_cosine_hemisphere',
|
|
63
|
+
'spherical_to_cartesian', 'cartesian_to_spherical',
|
|
64
|
+
'rotate_vector_axis_angle', 'build_face_basis',
|
|
65
|
+
'Rays', 'HitRecord',
|
|
66
|
+
]
|