Skip to content

Commit f8d70b4

Browse files
committed
always be lazy
1 parent f3e51dd commit f8d70b4

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ print(f"CRS: {crs}") # Coordinate reference system from landmask
206206

207207
# Method 2: Fetch all tiles in a bounding box
208208
bbox = (-0.2, 51.4, 0.1, 51.6) # (min_lon, min_lat, max_lon, max_lat)
209-
embeddings = gt.fetch_embeddings_lazy(bbox, year=2024)
209+
embeddings = gt.fetch_embeddings(bbox, year=2024)
210210

211211
for tile_lon, tile_lat, embedding_array, crs, transform in embeddings:
212212
print(f"Tile ({tile_lat}, {tile_lon}): {embedding_array.shape}")
@@ -241,7 +241,7 @@ files = gt.export_embedding_geotiffs(
241241

242242
```python
243243
# Fetch and process embeddings directly
244-
embeddings = gt.fetch_embeddings_lazy(bbox, year=2024)
244+
embeddings = gt.fetch_embeddings(bbox, year=2024)
245245

246246
for lon, lat, embedding, crs, transform in embeddings:
247247
# Compute statistics

geotessera/core.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def embeddings_count(self, bbox: Tuple[float, float, float, float], year: int =
7373
return len(tiles)
7474

7575
# returns a generator
76-
def fetch_embeddings_lazy(
76+
def fetch_embeddings(
7777
self,
7878
bbox: Tuple[float, float, float, float],
7979
year: int = 2024,
@@ -145,34 +145,7 @@ def tile_progress_callback(
145145
)
146146
continue
147147

148-
return None
149-
150-
def fetch_embeddings(
151-
self,
152-
bbox: Tuple[float, float, float, float],
153-
year: int = 2024,
154-
progress_callback: Optional[callable] = None,
155-
) -> List[Tuple[float, float, np.ndarray, object, object]]:
156-
"""Eagerly fetch all embedding tiles within a bounding box with CRS information.
157-
For large areas, consider using fetch_embeddings_lazy() instead.
158-
159-
Args:
160-
bbox: Bounding box as (min_lon, min_lat, max_lon, max_lat)
161-
year: Year of embeddings to download
162-
progress_callback: Optional callback function(current, total) for progress tracking
163-
164-
Returns:
165-
List of (tile_lon, tile_lat, embedding_array, crs, transform) tuples where:
166-
- tile_lon: Tile center longitude
167-
- tile_lat: Tile center latitude
168-
- embedding_array: shape (H, W, 128) with dequantized values
169-
- crs: CRS object from rasterio (coordinate reference system)
170-
- transform: Affine transform from rasterio
171-
"""
172-
173-
results = list(self.fetch_embeddings_lazy(bbox, year, progress_callback))
174-
175-
return results
148+
return None
176149

177150
def fetch_embedding(
178151
self,

0 commit comments

Comments
 (0)