Skip to content

Commit f3e51dd

Browse files
committed
update docs
1 parent 707ed03 commit f3e51dd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
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(bbox, year=2024)
209+
embeddings = gt.fetch_embeddings_lazy(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(bbox, year=2024)
244+
embeddings = gt.fetch_embeddings_lazy(bbox, year=2024)
245245

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

geotessera/core.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,16 @@ def fetch_embeddings_lazy(
7979
year: int = 2024,
8080
progress_callback: Optional[callable] = None,
8181
) -> Generator[Tuple[float, float, np.ndarray, object, object], None, None]:
82-
"""Fetch all embedding tiles within a bounding box with CRS information.
82+
"""Lazily fetches all embedding tiles within a bounding box with CRS information.
83+
Use as a generator to process tiles one at a time in a memory-efficient manner.
8384
8485
Args:
8586
bbox: Bounding box as (min_lon, min_lat, max_lon, max_lat)
8687
year: Year of embeddings to download
8788
progress_callback: Optional callback function(current, total) for progress tracking
8889
8990
Returns:
90-
List of (tile_lon, tile_lat, embedding_array, crs, transform) tuples where:
91+
Generator of (tile_lon, tile_lat, embedding_array, crs, transform) tuples where:
9192
- tile_lon: Tile center longitude
9293
- tile_lat: Tile center latitude
9394
- embedding_array: shape (H, W, 128) with dequantized values
@@ -152,7 +153,8 @@ def fetch_embeddings(
152153
year: int = 2024,
153154
progress_callback: Optional[callable] = None,
154155
) -> List[Tuple[float, float, np.ndarray, object, object]]:
155-
"""Fetch all embedding tiles within a bounding box with CRS information.
156+
"""Eagerly fetch all embedding tiles within a bounding box with CRS information.
157+
For large areas, consider using fetch_embeddings_lazy() instead.
156158
157159
Args:
158160
bbox: Bounding box as (min_lon, min_lat, max_lon, max_lat)

0 commit comments

Comments
 (0)