Skip to content

Commit 2ebbb52

Browse files
committed
fix the quickstart documentation for export_embedding_geotiffs
the current interface is a bit suboptimal as it should use a Tiles list but saving that for a future rev of the interface (#122). fixes #115 reported by @GieziJo
1 parent 32171df commit 2ebbb52

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ tiles = gt.registry.load_blocks_for_region(bounds=bbox, year=2024)
197197
embeddings = gt.fetch_embeddings(tiles)
198198

199199
# Export as GeoTIFF
200-
files = gt.export_embedding_geotiffs(bbox=bbox, output_dir="./output", year=2024)
200+
files = gt.export_embedding_geotiffs(tiles_to_fetch=tiles, output_dir="./output")
201201
```
202202

203203
### Registry Operations

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,14 @@ for year, tile_lon, tile_lat, embedding_array, crs, transform in embeddings:
236236

237237
```python
238238
# Export embeddings for a region as individual GeoTIFF files
239+
# Step 1: Get the tiles for the region
240+
bbox = (-0.2, 51.4, 0.1, 51.6)
241+
tiles_to_fetch = gt.registry.load_blocks_for_region(bounds=bbox, year=2024)
242+
243+
# Step 2: Export those tiles as GeoTIFFs
239244
files = gt.export_embedding_geotiffs(
240-
bbox=(-0.2, 51.4, 0.1, 51.6),
245+
tiles_to_fetch=tiles_to_fetch,
241246
output_dir="./output",
242-
year=2024,
243247
bands=None, # Export all 128 bands (default)
244248
compress="lzw" # Compression method
245249
)
@@ -248,9 +252,8 @@ print(f"Created {len(files)} GeoTIFF files")
248252

249253
# Export specific bands only (e.g., first 3 for RGB visualization)
250254
files = gt.export_embedding_geotiffs(
251-
bbox=(-0.2, 51.4, 0.1, 51.6),
255+
tiles_to_fetch=tiles_to_fetch,
252256
output_dir="./rgb_output",
253-
year=2024,
254257
bands=[0, 1, 2] # Only export first 3 bands
255258
)
256259
```

docs/quickstart.rst

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -428,17 +428,15 @@ Complete analysis workflow::
428428
selected_tiles = [r for r in results if r['mean_band_50'] > threshold]
429429
430430
print(f"Exporting {len(selected_tiles)} tiles above threshold")
431-
432-
files = []
433-
for tile in selected_tiles:
434-
file = gt.export_embedding_geotiffs(
435-
bbox=(tile['lon']-0.05, tile['lat']-0.05,
436-
tile['lon']+0.05, tile['lat']+0.05),
437-
output_dir="./selected_tiles",
438-
year=2024,
439-
bands=[40, 50, 60] # Bands around band 50
440-
)
441-
files.extend(file)
431+
432+
# Prepare tiles for export
433+
tiles_to_export = [(2024, tile['lon'], tile['lat']) for tile in selected_tiles]
434+
435+
files = gt.export_embedding_geotiffs(
436+
tiles_to_fetch=tiles_to_export,
437+
output_dir="./selected_tiles",
438+
bands=[40, 50, 60] # Bands around band 50
439+
)
442440
443441
# Create PCA visualization from selected tiles
444442
# CLI: geotessera visualize ./selected_tiles pca_selected.tif
@@ -468,17 +466,16 @@ Use both numpy and GeoTIFF formats in the same workflow::
468466
selected_coords.append((lon, lat))
469467
470468
print(f"Selected {len(selected_coords)} interesting tiles")
471-
472-
# Step 2: Export selected tiles as GeoTIFF
473-
all_files = []
474-
for lon, lat in selected_coords:
475-
files = gt.export_embedding_geotiffs(
476-
bbox=(lon-0.05, lat-0.05, lon+0.05, lat+0.05),
477-
output_dir="./interesting_tiles",
478-
year=2024,
479-
bands=[60, 64, 68] # Bands around interesting band 64
480-
)
481-
all_files.extend(files)
469+
470+
# Step 2: Export selected tiles as GeoTIFF
471+
# Prepare tiles for export
472+
tiles_to_export = [(2024, lon, lat) for lon, lat in selected_coords]
473+
474+
all_files = gt.export_embedding_geotiffs(
475+
tiles_to_fetch=tiles_to_export,
476+
output_dir="./interesting_tiles",
477+
bands=[60, 64, 68] # Bands around interesting band 64
478+
)
482479
483480
# Step 3: Create PCA visualization from selected tiles
484481
print("Creating PCA visualization...")

0 commit comments

Comments
 (0)