voxcity 0.3.5__py3-none-any.whl → 0.3.7__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/geo/network.py CHANGED
@@ -180,7 +180,8 @@ def get_network_values(grid, rectangle_vertices, meshsize, value_name='value', *
180
180
  vmin=settings['vmin'],
181
181
  vmax=settings['vmax'],
182
182
  linewidth=settings['edge_width'],
183
- legend_kwds={'label': value_name})
183
+ legend_kwds={'label': value_name,
184
+ 'shrink': 0.5}) # Make colorbar 50% smaller
184
185
 
185
186
  ctx.add_basemap(ax,
186
187
  source=settings['basemap_style'],
voxcity/sim/solar.py CHANGED
@@ -651,6 +651,8 @@ def get_global_solar_irradiance_using_epw(
651
651
  - calc_time (str): Time for instantaneous calculation ('MM-DD HH:MM:SS')
652
652
  - start_time (str): Start time for cumulative calculation
653
653
  - end_time (str): End time for cumulative calculation
654
+ - start_hour (int): Starting hour for daily time window (0-23)
655
+ - end_hour (int): Ending hour for daily time window (0-23)
654
656
  - view_point_height (float): Observer height in meters
655
657
  - tree_k (float): Tree extinction coefficient
656
658
  - tree_lad (float): Leaf area density in m^-1
@@ -675,11 +677,11 @@ def get_global_solar_irradiance_using_epw(
675
677
  return None
676
678
  else:
677
679
  # Calculate center point of rectangle
678
- lats = [coord[0] for coord in rectangle_vertices]
679
- lons = [coord[1] for coord in rectangle_vertices]
680
- center_lat = (min(lats) + max(lats)) / 2
680
+ lons = [coord[0] for coord in rectangle_vertices]
681
+ lats = [coord[1] for coord in rectangle_vertices]
681
682
  center_lon = (min(lons) + max(lons)) / 2
682
- target_point = (center_lat, center_lon)
683
+ center_lat = (min(lats) + max(lats)) / 2
684
+ target_point = (center_lon, center_lat)
683
685
 
684
686
  # Optional: specify maximum distance in kilometers
685
687
  max_distance = 100 # None for no limit
@@ -687,8 +689,8 @@ def get_global_solar_irradiance_using_epw(
687
689
  output_dir = kwargs.get("output_dir", "output")
688
690
 
689
691
  epw_file_path, weather_data, metadata = get_nearest_epw_from_climate_onebuilding(
690
- latitude=center_lat,
691
692
  longitude=center_lon,
693
+ latitude=center_lat,
692
694
  output_dir=output_dir,
693
695
  max_distance=max_distance,
694
696
  extract_zip=True,
@@ -743,10 +745,17 @@ def get_global_solar_irradiance_using_epw(
743
745
  **kwargs
744
746
  )
745
747
  if calc_type == 'cumulative':
748
+ # Get time window parameters
749
+ start_hour = kwargs.get("start_hour", 0) # Default to midnight
750
+ end_hour = kwargs.get("end_hour", 23) # Default to 11 PM
751
+
752
+ # Filter dataframe for specified hours
753
+ df_filtered = df[df.index.hour.between(start_hour, end_hour)]
754
+
746
755
  solar_map = get_cumulative_global_solar_irradiance(
747
756
  voxel_data,
748
757
  meshsize,
749
- df, lat, lon, tz,
758
+ df_filtered, lat, lon, tz,
750
759
  **kwargs
751
760
  )
752
761
 
voxcity/utils/weather.py CHANGED
@@ -512,8 +512,8 @@ def read_epw_for_solar_simulation(epw_file_path):
512
512
  month = int(vals[1])
513
513
  day = int(vals[2])
514
514
  hour = int(vals[3]) - 1
515
- dni = float(vals[13])
516
- dhi = float(vals[14])
515
+ dni = float(vals[14])
516
+ dhi = float(vals[15])
517
517
  timestamp = pd.Timestamp(year, month, day, hour)
518
518
  data.append([timestamp, dni, dhi])
519
519
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: voxcity
3
- Version: 0.3.5
3
+ Version: 0.3.7
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>
@@ -330,7 +330,7 @@ solar_kwargs = {
330
330
  }
331
331
 
332
332
  # Compute global solar irradiance map (direct + diffuse radiation)
333
- global_map = get_global_solar_irradiance_using_epw(
333
+ solar_grid = get_global_solar_irradiance_using_epw(
334
334
  voxcity_grid, # 3D voxel grid representing the urban environment
335
335
  meshsize, # Size of each voxel in meters
336
336
  calc_type='instantaneous', # Calculate instantaneous irradiance at specified time
@@ -345,7 +345,7 @@ solar_kwargs["end_time"] = "01-31 23:00:00" # End time for cumulative calculatio
345
345
  solar_kwargs["output_file_name"] = 'cummulative_solar_irradiance', # Base filename for outputs (without extension)
346
346
 
347
347
  # Calculate cumulative solar irradiance over the specified time period
348
- global_map = get_global_solar_irradiance_using_epw(
348
+ cum_solar_grid = get_global_solar_irradiance_using_epw(
349
349
  voxcity_grid, # 3D voxel grid representing the urban environment
350
350
  meshsize, # Size of each voxel in meters
351
351
  calc_type='cumulative', # Calculate cumulative irradiance over time period instead of instantaneous
@@ -418,6 +418,38 @@ landmark_vis_map = get_landmark_visibility_map(voxcity_grid, building_id_grid, b
418
418
  <em>Example Result Saved as OBJ and Rendered in Rhino</em>
419
419
  </p>
420
420
 
421
+ #### Network Analysis:
422
+
423
+ ```python
424
+ from voxcity.geo.network import get_network_values
425
+
426
+ network_kwargs = {
427
+ "network_type": "walk", # Type of network to download from OSM (walk, drive, all, etc.)
428
+ "colormap": "magma", # Matplotlib colormap for visualization
429
+ "vis_graph": True, # Whether to display the network visualization
430
+ "vmin": 0.0, # Minimum value for color scaling
431
+ "vmax": 600000, # Maximum value for color scaling
432
+ "edge_width": 2, # Width of network edges in visualization
433
+ "alpha": 0.8, # Transparency of network edges
434
+ "zoom": 16 # Zoom level for basemap
435
+ }
436
+
437
+ G, edge_gdf = get_network_values(
438
+ cum_solar_grid, # Grid of cumulative solar irradiance values
439
+ rectangle_vertices, # Coordinates defining simulation domain boundary
440
+ meshsize, # Size of each grid cell in meters
441
+ value_name='Cumulative Global Solar Irradiance (W/m²·hour)', # Label for values in visualization
442
+ **network_kwargs # Additional visualization and network parameters
443
+ )
444
+ ```
445
+
446
+ <p align="center">
447
+ <img src="https://raw.githubusercontent.com/kunifujiwara/VoxCity/main/images/network.png" alt="Example of Graph Output" width="500">
448
+ </p>
449
+ <p align="center">
450
+ <em>Cumulative Global Solar Irradiance (kW/m²·hour) on Road Network</em>
451
+ </p>
452
+
421
453
  ## References of Data Sources
422
454
 
423
455
  ### Building
@@ -17,20 +17,20 @@ 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=xKWBJHg-l7CHnC1-_k-aYfkI-GNEKCp57gTZZwJXuFs,6804
20
+ voxcity/geo/network.py,sha256=iBgvOaM4YPQKL5gnAU9rxe3ZlJLTjLIt7DoAIWzZRfs,6892
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=7waUoUMzDBf_Van3qghSG019TrgHgNj-TcVRVf0StuU,31306
23
+ voxcity/sim/solar.py,sha256=9vyzLCBiASh85b1TRRG4gFqSmMcbI0i-2sBdPrswMyM,31783
24
24
  voxcity/sim/utils.py,sha256=sEYBB2-hLJxTiXQps1_-Fi7t1HN3-1OPOvBCWtgIisA,130
25
25
  voxcity/sim/view.py,sha256=oq6G-f0Tn-KT0vjYNJfucmOIrv1GNjljhA-zvU4nNoA,36668
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
- voxcity/utils/weather.py,sha256=fJ2p5susoMgYSBlrmlTlZVUDe9kpQwmLuyv1TgcOnDM,21482
31
- voxcity-0.3.5.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
- voxcity-0.3.5.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
- voxcity-0.3.5.dist-info/METADATA,sha256=ZQfsmx9_kNBV9fDtdBuKU4PHTX-lG5WXnzbzRdHjpoo,23630
34
- voxcity-0.3.5.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
35
- voxcity-0.3.5.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
- voxcity-0.3.5.dist-info/RECORD,,
30
+ voxcity/utils/weather.py,sha256=P6s1y_EstBL1OGP_MR_6u3vr-t6Uawg8uDckJnoI7FI,21482
31
+ voxcity-0.3.7.dist-info/AUTHORS.rst,sha256=m82vkI5QokEGdcHof2OxK39lf81w1P58kG9ZNNAKS9U,175
32
+ voxcity-0.3.7.dist-info/LICENSE,sha256=-hGliOFiwUrUSoZiB5WF90xXGqinKyqiDI2t6hrnam8,1087
33
+ voxcity-0.3.7.dist-info/METADATA,sha256=B78MYc4ThBH3XI2d-3R7UrkFjVpThF0j66z_JcOwmmE,25087
34
+ voxcity-0.3.7.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
35
+ voxcity-0.3.7.dist-info/top_level.txt,sha256=00b2U-LKfDllt6RL1R33MXie5MvxzUFye0NGD96t_8I,8
36
+ voxcity-0.3.7.dist-info/RECORD,,