voxcity 0.5.10__tar.gz → 0.5.11__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.

Files changed (54) hide show
  1. {voxcity-0.5.10 → voxcity-0.5.11}/PKG-INFO +1 -1
  2. {voxcity-0.5.10 → voxcity-0.5.11}/pyproject.toml +1 -1
  3. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/generator.py +102 -1
  4. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity.egg-info/PKG-INFO +1 -1
  5. {voxcity-0.5.10 → voxcity-0.5.11}/AUTHORS.rst +0 -0
  6. {voxcity-0.5.10 → voxcity-0.5.11}/CONTRIBUTING.rst +0 -0
  7. {voxcity-0.5.10 → voxcity-0.5.11}/HISTORY.rst +0 -0
  8. {voxcity-0.5.10 → voxcity-0.5.11}/LICENSE +0 -0
  9. {voxcity-0.5.10 → voxcity-0.5.11}/MANIFEST.in +0 -0
  10. {voxcity-0.5.10 → voxcity-0.5.11}/README.md +0 -0
  11. {voxcity-0.5.10 → voxcity-0.5.11}/docs/Makefile +0 -0
  12. {voxcity-0.5.10 → voxcity-0.5.11}/docs/archive/README.rst +0 -0
  13. {voxcity-0.5.10 → voxcity-0.5.11}/docs/authors.rst +0 -0
  14. {voxcity-0.5.10 → voxcity-0.5.11}/docs/conf.py +0 -0
  15. {voxcity-0.5.10 → voxcity-0.5.11}/docs/index.rst +0 -0
  16. {voxcity-0.5.10 → voxcity-0.5.11}/docs/make.bat +0 -0
  17. {voxcity-0.5.10 → voxcity-0.5.11}/setup.cfg +0 -0
  18. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/__init__.py +0 -0
  19. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/__init__.py +0 -0
  20. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/citygml.py +0 -0
  21. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/eubucco.py +0 -0
  22. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/gee.py +0 -0
  23. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/mbfp.py +0 -0
  24. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/oemj.py +0 -0
  25. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/omt.py +0 -0
  26. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/osm.py +0 -0
  27. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/overture.py +0 -0
  28. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/downloader/utils.py +0 -0
  29. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/exporter/__init_.py +0 -0
  30. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/exporter/envimet.py +0 -0
  31. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/exporter/magicavoxel.py +0 -0
  32. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/exporter/obj.py +0 -0
  33. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/__init_.py +0 -0
  34. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/draw.py +0 -0
  35. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/grid.py +0 -0
  36. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/mesh.py +0 -0
  37. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/network.py +0 -0
  38. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/polygon.py +0 -0
  39. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/geoprocessor/utils.py +0 -0
  40. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/simulator/__init_.py +0 -0
  41. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/simulator/solar.py +0 -0
  42. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/simulator/utils.py +0 -0
  43. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/simulator/view.py +0 -0
  44. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/utils/__init_.py +0 -0
  45. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/utils/lc.py +0 -0
  46. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/utils/material.py +0 -0
  47. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/utils/visualization.py +0 -0
  48. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity/utils/weather.py +0 -0
  49. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity.egg-info/SOURCES.txt +0 -0
  50. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity.egg-info/dependency_links.txt +0 -0
  51. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity.egg-info/requires.txt +0 -0
  52. {voxcity-0.5.10 → voxcity-0.5.11}/src/voxcity.egg-info/top_level.txt +0 -0
  53. {voxcity-0.5.10 → voxcity-0.5.11}/tests/__init__.py +0 -0
  54. {voxcity-0.5.10 → voxcity-0.5.11}/tests/voxelcity.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voxcity
3
- Version: 0.5.10
3
+ Version: 0.5.11
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>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "voxcity"
3
- version = "0.5.10"
3
+ version = "0.5.11"
4
4
  requires-python = ">=3.10,<3.13"
5
5
  classifiers = [
6
6
  "Programming Language :: Python :: 3.10",
@@ -689,6 +689,14 @@ def get_voxcity(rectangle_vertices, building_source, land_cover_source, canopy_h
689
689
  voxcity_grid_vis[-1, -1, -1] = -99 # Add marker to fix camera location and angle of view
690
690
  visualize_3d_voxel(voxcity_grid_vis, voxel_size=meshsize, save_path=kwargs["voxelvis_img_save_path"])
691
691
 
692
+ # Save all data if a save path is provided
693
+ save_voxcity = kwargs.get("save_voxctiy_data", True)
694
+ if save_voxcity:
695
+ save_path = kwargs.get("save_data_path", f"{output_dir}/voxcity_data.pkl")
696
+ save_voxcity_data(save_path, voxcity_grid, building_height_grid, building_min_height_grid,
697
+ building_id_grid, canopy_height_grid, land_cover_grid, dem_grid,
698
+ building_gdf, meshsize, rectangle_vertices)
699
+
692
700
  return voxcity_grid, building_height_grid, building_min_height_grid, building_id_grid, canopy_height_grid, land_cover_grid, dem_grid, building_gdf
693
701
 
694
702
  def get_voxcity_CityGML(rectangle_vertices, land_cover_source, canopy_height_source, meshsize, url_citygml=None, citygml_path=None, **kwargs):
@@ -817,6 +825,14 @@ def get_voxcity_CityGML(rectangle_vertices, land_cover_source, canopy_height_sou
817
825
  # Generate 3D voxel grid
818
826
  voxcity_grid = create_3d_voxel(building_height_grid, building_min_height_grid, building_id_grid, land_cover_grid, dem_grid, canopy_height_grid, meshsize, land_cover_source)
819
827
 
828
+ # Save all data if a save path is provided
829
+ save_voxcity = kwargs.get("save_voxctiy_data", True)
830
+ if save_voxcity:
831
+ save_path = kwargs.get("save_data_path", f"{output_dir}/voxcity_data.pkl")
832
+ save_voxcity_data(save_path, voxcity_grid, building_height_grid, building_min_height_grid,
833
+ building_id_grid, canopy_height_grid, land_cover_grid, dem_grid,
834
+ building_gdf, meshsize, rectangle_vertices)
835
+
820
836
  return voxcity_grid, building_height_grid, building_min_height_grid, building_id_grid, canopy_height_grid, land_cover_grid, dem_grid, filtered_buildings
821
837
 
822
838
  def replace_nan_in_nested(arr, replace_value=10.0):
@@ -844,4 +860,89 @@ def replace_nan_in_nested(arr, replace_value=10.0):
844
860
  if isinstance(arr[i][j][k][l], float) and np.isnan(arr[i][j][k][l]):
845
861
  arr[i][j][k][l] = replace_value
846
862
 
847
- return np.array(arr, dtype=object)
863
+ return np.array(arr, dtype=object)
864
+
865
+ def save_voxcity_data(output_path, voxcity_grid, building_height_grid, building_min_height_grid,
866
+ building_id_grid, canopy_height_grid, land_cover_grid, dem_grid,
867
+ building_gdf, meshsize, rectangle_vertices):
868
+ """Save voxcity data to a file for later loading.
869
+
870
+ Args:
871
+ output_path: Path to save the data file
872
+ voxcity_grid: 3D voxel grid of the complete city model
873
+ building_height_grid: 2D grid of building heights
874
+ building_min_height_grid: 2D grid of minimum building heights
875
+ building_id_grid: 2D grid of building IDs
876
+ canopy_height_grid: 2D grid of tree canopy heights
877
+ land_cover_grid: 2D grid of land cover classifications
878
+ dem_grid: 2D grid of ground elevation
879
+ building_gdf: GeoDataFrame of building footprints and metadata
880
+ meshsize: Size of each grid cell in meters
881
+ rectangle_vertices: List of coordinates defining the area of interest
882
+ """
883
+ import pickle
884
+ import os
885
+
886
+ # Create directory if it doesn't exist
887
+ os.makedirs(os.path.dirname(output_path), exist_ok=True)
888
+
889
+ # Create a dictionary with all the data
890
+ data_dict = {
891
+ 'voxcity_grid': voxcity_grid,
892
+ 'building_height_grid': building_height_grid,
893
+ 'building_min_height_grid': building_min_height_grid,
894
+ 'building_id_grid': building_id_grid,
895
+ 'canopy_height_grid': canopy_height_grid,
896
+ 'land_cover_grid': land_cover_grid,
897
+ 'dem_grid': dem_grid,
898
+ 'building_gdf': building_gdf,
899
+ 'meshsize': meshsize,
900
+ 'rectangle_vertices': rectangle_vertices
901
+ }
902
+
903
+ # Save the data to a file using pickle
904
+ with open(output_path, 'wb') as f:
905
+ pickle.dump(data_dict, f)
906
+
907
+ print(f"Voxcity data saved to {output_path}")
908
+
909
+ def load_voxcity_data(input_path):
910
+ """Load voxcity data from a saved file.
911
+
912
+ Args:
913
+ input_path: Path to the saved data file
914
+
915
+ Returns:
916
+ tuple: All the voxcity data components including:
917
+ - voxcity_grid: 3D voxel grid of the complete city model
918
+ - building_height_grid: 2D grid of building heights
919
+ - building_min_height_grid: 2D grid of minimum building heights
920
+ - building_id_grid: 2D grid of building IDs
921
+ - canopy_height_grid: 2D grid of tree canopy heights
922
+ - land_cover_grid: 2D grid of land cover classifications
923
+ - dem_grid: 2D grid of ground elevation
924
+ - building_gdf: GeoDataFrame of building footprints and metadata
925
+ - meshsize: Size of each grid cell in meters
926
+ - rectangle_vertices: List of coordinates defining the area of interest
927
+ """
928
+ import pickle
929
+
930
+ # Load the data from the file
931
+ with open(input_path, 'rb') as f:
932
+ data_dict = pickle.load(f)
933
+
934
+ print(f"Voxcity data loaded from {input_path}")
935
+
936
+ # Return all components as a tuple
937
+ return (
938
+ data_dict['voxcity_grid'],
939
+ data_dict['building_height_grid'],
940
+ data_dict['building_min_height_grid'],
941
+ data_dict['building_id_grid'],
942
+ data_dict['canopy_height_grid'],
943
+ data_dict['land_cover_grid'],
944
+ data_dict['dem_grid'],
945
+ data_dict['building_gdf'],
946
+ data_dict['meshsize'],
947
+ data_dict['rectangle_vertices']
948
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voxcity
3
- Version: 0.5.10
3
+ Version: 0.5.11
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>
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