voxcity 0.6.3__py3-none-any.whl → 0.6.5__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/downloader/gee.py +19 -14
- voxcity/exporter/cityles.py +6 -4
- voxcity/geoprocessor/__init__.py +6 -6
- voxcity/geoprocessor/utils.py +820 -785
- voxcity/simulator/solar.py +101 -25
- voxcity/simulator/view.py +2285 -2238
- voxcity/utils/visualization.py +28 -2
- {voxcity-0.6.3.dist-info → voxcity-0.6.5.dist-info}/METADATA +534 -537
- {voxcity-0.6.3.dist-info → voxcity-0.6.5.dist-info}/RECORD +13 -14
- {voxcity-0.6.3.dist-info → voxcity-0.6.5.dist-info}/WHEEL +1 -2
- voxcity-0.6.3.dist-info/top_level.txt +0 -1
- {voxcity-0.6.3.dist-info/licenses → voxcity-0.6.5.dist-info}/AUTHORS.rst +0 -0
- {voxcity-0.6.3.dist-info/licenses → voxcity-0.6.5.dist-info}/LICENSE +0 -0
voxcity/downloader/gee.py
CHANGED
|
@@ -26,16 +26,21 @@ import geemap
|
|
|
26
26
|
# Local imports
|
|
27
27
|
# from ..geo.utils import convert_format_lat_lon
|
|
28
28
|
|
|
29
|
-
def initialize_earth_engine():
|
|
30
|
-
"""Initialize the Earth Engine API.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
def initialize_earth_engine(**initialize_kwargs):
|
|
30
|
+
"""Initialize the Earth Engine API if not already initialized.
|
|
31
|
+
|
|
32
|
+
Uses a public-behavior check to determine whether Earth Engine is already
|
|
33
|
+
initialized by attempting to access asset roots. If that call fails, it will
|
|
34
|
+
initialize Earth Engine using the provided keyword arguments.
|
|
35
|
+
|
|
36
|
+
Arguments are passed through to ``ee.Initialize`` to support contexts such as
|
|
37
|
+
specifying a ``project`` or service account credentials.
|
|
37
38
|
"""
|
|
38
|
-
|
|
39
|
+
try:
|
|
40
|
+
# If this succeeds, EE is already initialized
|
|
41
|
+
ee.data.getAssetRoots()
|
|
42
|
+
except Exception:
|
|
43
|
+
ee.Initialize(**initialize_kwargs)
|
|
39
44
|
|
|
40
45
|
def get_roi(input_coords):
|
|
41
46
|
"""Create an Earth Engine region of interest polygon from coordinates.
|
|
@@ -243,7 +248,7 @@ def save_geotiff_esa_land_cover(roi, geotiff_path):
|
|
|
243
248
|
resolution of the ESA WorldCover dataset.
|
|
244
249
|
"""
|
|
245
250
|
# Initialize Earth Engine
|
|
246
|
-
|
|
251
|
+
initialize_earth_engine()
|
|
247
252
|
|
|
248
253
|
# Load and clip the ESA WorldCover dataset
|
|
249
254
|
esa = ee.ImageCollection("ESA/WorldCover/v200").first()
|
|
@@ -307,7 +312,7 @@ def save_geotiff_dynamic_world_v1(roi, geotiff_path, date=None):
|
|
|
307
312
|
actual date used.
|
|
308
313
|
"""
|
|
309
314
|
# Initialize Earth Engine
|
|
310
|
-
|
|
315
|
+
initialize_earth_engine()
|
|
311
316
|
|
|
312
317
|
# Load and filter Dynamic World dataset
|
|
313
318
|
# Load the Dynamic World dataset and filter by ROI
|
|
@@ -416,7 +421,7 @@ def save_geotiff_esri_landcover(roi, geotiff_path, year=None):
|
|
|
416
421
|
differ from the requested year if data is not available for that time.
|
|
417
422
|
"""
|
|
418
423
|
# Initialize Earth Engine
|
|
419
|
-
|
|
424
|
+
initialize_earth_engine()
|
|
420
425
|
|
|
421
426
|
# Load the ESRI Land Cover dataset and filter by ROI
|
|
422
427
|
esri_lulc = ee.ImageCollection("projects/sat-io/open-datasets/landcover/ESRI_Global-LULC_10m_TS").filterBounds(roi)
|
|
@@ -508,7 +513,7 @@ def save_geotiff_open_buildings_temporal(aoi, geotiff_path):
|
|
|
508
513
|
- Areas without buildings will have no-data values
|
|
509
514
|
"""
|
|
510
515
|
# Initialize Earth Engine
|
|
511
|
-
|
|
516
|
+
initialize_earth_engine()
|
|
512
517
|
|
|
513
518
|
# Load the dataset
|
|
514
519
|
collection = ee.ImageCollection('GOOGLE/Research/open-buildings-temporal/v1')
|
|
@@ -554,7 +559,7 @@ def save_geotiff_dsm_minus_dtm(roi, geotiff_path, meshsize, source):
|
|
|
554
559
|
- The function requires both DSM and DTM data to be available for the region
|
|
555
560
|
"""
|
|
556
561
|
# Initialize Earth Engine
|
|
557
|
-
|
|
562
|
+
initialize_earth_engine()
|
|
558
563
|
|
|
559
564
|
# Add buffer around ROI to ensure smooth interpolation at edges
|
|
560
565
|
buffer_distance = 100
|
voxcity/exporter/cityles.py
CHANGED
|
@@ -211,8 +211,9 @@ def export_topog(building_height_grid, building_id_grid, output_path,
|
|
|
211
211
|
material_code = BUILDING_MATERIAL_MAPPING.get(building_material,
|
|
212
212
|
BUILDING_MATERIAL_MAPPING['default'])
|
|
213
213
|
|
|
214
|
-
#
|
|
215
|
-
|
|
214
|
+
# Count only cells with building height > 0
|
|
215
|
+
building_mask = building_height_grid > 0
|
|
216
|
+
n_buildings = int(np.count_nonzero(building_mask))
|
|
216
217
|
|
|
217
218
|
with open(filename, 'w') as f:
|
|
218
219
|
# Write number of buildings
|
|
@@ -324,8 +325,9 @@ def export_vmap(canopy_height_grid, output_path, tree_base_ratio=0.3, tree_type=
|
|
|
324
325
|
ny, nx = canopy_height_grid.shape
|
|
325
326
|
tree_code = TREE_TYPE_MAPPING.get(tree_type, TREE_TYPE_MAPPING['default'])
|
|
326
327
|
|
|
327
|
-
#
|
|
328
|
-
|
|
328
|
+
# Count only cells with canopy height > 0
|
|
329
|
+
vegetation_mask = canopy_height_grid > 0
|
|
330
|
+
n_trees = int(np.count_nonzero(vegetation_mask))
|
|
329
331
|
|
|
330
332
|
with open(filename, 'w') as f:
|
|
331
333
|
# Write number of trees
|
voxcity/geoprocessor/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from .draw import *
|
|
2
|
-
from .grid import *
|
|
3
|
-
from .utils import *
|
|
4
|
-
from .network import *
|
|
5
|
-
from .polygon import *
|
|
6
|
-
from .mesh import *
|
|
1
|
+
from .draw import *
|
|
2
|
+
from .grid import *
|
|
3
|
+
from .utils import *
|
|
4
|
+
from .network import *
|
|
5
|
+
from .polygon import *
|
|
6
|
+
from .mesh import *
|