terrakio-core 0.2.7__py3-none-any.whl → 0.3.0__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 terrakio-core might be problematic. Click here for more details.

terrakio_core/__init__.py CHANGED
@@ -4,4 +4,4 @@ Terrakio Core
4
4
  Core components for Terrakio API clients.
5
5
  """
6
6
 
7
- __version__ = "0.2.7"
7
+ __version__ = "0.3.0"
terrakio_core/client.py CHANGED
@@ -91,7 +91,7 @@ class BaseClient:
91
91
 
92
92
  async def wcs_async(self, expr: str, feature: Union[Dict[str, Any], ShapelyGeometry],
93
93
  in_crs: str = "epsg:4326", out_crs: str = "epsg:4326",
94
- output: str = "csv", resolution: int = -1, buffer: bool = True,
94
+ output: str = "csv", resolution: int = -1, buffer: bool = False,
95
95
  retry: int = 3, **kwargs):
96
96
  """
97
97
  Asynchronous version of the wcs() method using aiohttp.
@@ -129,16 +129,13 @@ class BaseClient:
129
129
  "resolution": resolution,
130
130
  **kwargs
131
131
  }
132
-
133
132
  request_url = f"{self.url}/geoquery"
134
-
135
133
  for attempt in range(retry + 1):
136
134
  try:
137
135
  session = await self.aiohttp_session
138
136
  async with session.post(request_url, json=payload, ssl=self.verify) as response:
139
137
  if not response.ok:
140
138
  should_retry = False
141
-
142
139
  if response.status in [408, 502, 503, 504]:
143
140
  should_retry = True
144
141
  elif response.status == 500:
@@ -684,7 +681,7 @@ class BaseClient:
684
681
  return self.mass_stats.random_sample(name, **kwargs)
685
682
 
686
683
  async def zonal_stats_async(self, gdb, expr, conc=20, inplace=False, output="csv",
687
- in_crs="epsg:4326", out_crs="epsg:4326", resolution=0.005, buffer=True):
684
+ in_crs="epsg:4326", out_crs="epsg:4326", resolution=-1, buffer=False):
688
685
  """
689
686
  Compute zonal statistics for all geometries in a GeoDataFrame using asyncio for concurrency.
690
687
 
@@ -709,6 +706,13 @@ class BaseClient:
709
706
  all_results = []
710
707
  row_indices = []
711
708
 
709
+ # Calculate total batches for progress reporting
710
+ total_geometries = len(gdb)
711
+ total_batches = (total_geometries + conc - 1) // conc # Ceiling division
712
+ completed_batches = 0
713
+
714
+ print(f"Processing {total_geometries} geometries with concurrency {conc}")
715
+
712
716
  async def process_geometry(geom, index):
713
717
  """Process a single geometry"""
714
718
  try:
@@ -760,11 +764,19 @@ class BaseClient:
760
764
  batch_results = await process_batch(batch_indices)
761
765
  all_results.extend(batch_results)
762
766
  row_indices.extend(batch_indices)
767
+
768
+ # Update progress
769
+ completed_batches += 1
770
+ processed_geometries = min(i + conc, total_geometries)
771
+ print(f"Progress: {completed_batches}/{total_batches} completed ({processed_geometries}/{total_geometries} geometries processed)")
772
+
763
773
  except Exception as e:
764
774
  if hasattr(e, 'response'):
765
775
  raise APIError(f"API request failed: {e.response.text}")
766
776
  raise
767
777
 
778
+ print("All batches completed! Processing results...")
779
+
768
780
  if not all_results:
769
781
  raise ValueError("No valid results were returned for any geometry")
770
782
 
@@ -857,7 +869,7 @@ class BaseClient:
857
869
  return result_gdf
858
870
 
859
871
  def zonal_stats(self, gdb, expr, conc=20, inplace=False, output="csv",
860
- in_crs="epsg:4326", out_crs="epsg:4326", resolution=0.005, buffer=True):
872
+ in_crs="epsg:4326", out_crs="epsg:4326", resolution=-1, buffer=False):
861
873
  """
862
874
  Compute zonal statistics for all geometries in a GeoDataFrame.
863
875
 
@@ -879,6 +891,8 @@ class BaseClient:
879
891
  raise ValueError("Concurrency (conc) is too high. Please set conc to 100 or less.")
880
892
  import asyncio
881
893
 
894
+ print(f"Starting zonal statistics computation for expression: {expr}")
895
+
882
896
  # Check if we're in a Jupyter environment or already have an event loop
883
897
  try:
884
898
  loop = asyncio.get_running_loop()
@@ -912,6 +926,7 @@ class BaseClient:
912
926
  # Event loop may already be closed, ignore
913
927
  pass
914
928
 
929
+ print("Zonal statistics computation completed!")
915
930
  return result
916
931
 
917
932
  # Group access management protected methods
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: terrakio-core
3
- Version: 0.2.7
3
+ Version: 0.3.0
4
4
  Summary: Core components for Terrakio API clients
5
5
  Author-email: Yupeng Chao <yupeng@haizea.com.au>
6
6
  Project-URL: Homepage, https://github.com/HaizeaAnalytics/terrakio-python-api
@@ -21,6 +21,7 @@ Requires-Dist: pyyaml>=5.1
21
21
  Requires-Dist: xarray>=2023.1.0
22
22
  Requires-Dist: shapely>=2.0.0
23
23
  Requires-Dist: geopandas>=0.13.0
24
+ Requires-Dist: google-cloud-storage>=2.0.0
24
25
 
25
26
  # Terrakio Core
26
27
 
@@ -1,6 +1,6 @@
1
- terrakio_core/__init__.py,sha256=Un_V6wfdpzgstem38OlIcfKNKbTFR0e1ah50HHcZICU,88
1
+ terrakio_core/__init__.py,sha256=iguSJomKouzVNPOB2_Ox-FGnQBUQ0ykx8CshjVzU1QM,88
2
2
  terrakio_core/auth.py,sha256=Nuj0_X3Hiy17svYgGxrSAR-LXpTlP0J0dSrfMnkPUbI,7717
3
- terrakio_core/client.py,sha256=Y1nPxq3UqyLf8akYkxhlC7aOyhJMKTs9eaeRx_IV2UI,56012
3
+ terrakio_core/client.py,sha256=CQ1qiR_8tWKEGX-UT2wLeatk8fYMpyo9KseMpCapw7c,56813
4
4
  terrakio_core/config.py,sha256=AwJ1VgR5K7N32XCU5k7_Dp1nIv_FYt8MBonq9yKlGzA,2658
5
5
  terrakio_core/dataset_management.py,sha256=LKUESSDPRu1JubQaQJWdPqHLGt-_Xv77Fpb4IM7vkzM,8751
6
6
  terrakio_core/exceptions.py,sha256=9S-I20-QiDRj1qgjFyYUwYM7BLic_bxurcDOIm2Fu_0,410
@@ -8,7 +8,7 @@ terrakio_core/group_access_management.py,sha256=NJ7SX4keUzZAUENmJ5L6ynKf4eRlqtyi
8
8
  terrakio_core/mass_stats.py,sha256=AqYJsd6nqo2BDh4vEPUDgsv4T0UR1_TPDoXa3WO3gTU,9284
9
9
  terrakio_core/space_management.py,sha256=wlUUQrlj_4U_Lpjn9lbF5oj0Rv3NPvvnrd5mWej5kmA,4211
10
10
  terrakio_core/user_management.py,sha256=MMNWkz0V_9X7ZYjjteuRU4H4W3F16iuQw1dpA2wVTGg,7400
11
- terrakio_core-0.2.7.dist-info/METADATA,sha256=YEO4IiAHb9aUgWAoS8JjcBZY9wySuAQayaJaUwgd9CQ,1405
12
- terrakio_core-0.2.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
- terrakio_core-0.2.7.dist-info/top_level.txt,sha256=5cBj6O7rNWyn97ND4YuvvXm0Crv4RxttT4JZvNdOG6Q,14
14
- terrakio_core-0.2.7.dist-info/RECORD,,
11
+ terrakio_core-0.3.0.dist-info/METADATA,sha256=8mS_NJQUoFcr1lE3iUQXQi5VwSZo07t3XF0pCL7VNSI,1448
12
+ terrakio_core-0.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
13
+ terrakio_core-0.3.0.dist-info/top_level.txt,sha256=5cBj6O7rNWyn97ND4YuvvXm0Crv4RxttT4JZvNdOG6Q,14
14
+ terrakio_core-0.3.0.dist-info/RECORD,,