diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 7dae629..86cf431 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -197,7 +197,7 @@ tiles = gt.registry.load_blocks_for_region(bounds=bbox, year=2024) embeddings = gt.fetch_embeddings(tiles) # Export as GeoTIFF -files = gt.export_embedding_geotiffs(bbox=bbox, output_dir="./output", year=2024) +files = gt.export_embedding_geotiffs(tiles_to_fetch=tiles, output_dir="./output") ``` ### Registry Operations diff --git a/README.md b/README.md index c5eecdf..3bc9303 100644 --- a/README.md +++ b/README.md @@ -236,10 +236,14 @@ for year, tile_lon, tile_lat, embedding_array, crs, transform in embeddings: ```python # Export embeddings for a region as individual GeoTIFF files +# Step 1: Get the tiles for the region +bbox = (-0.2, 51.4, 0.1, 51.6) +tiles_to_fetch = gt.registry.load_blocks_for_region(bounds=bbox, year=2024) + +# Step 2: Export those tiles as GeoTIFFs files = gt.export_embedding_geotiffs( - bbox=(-0.2, 51.4, 0.1, 51.6), + tiles_to_fetch=tiles_to_fetch, output_dir="./output", - year=2024, bands=None, # Export all 128 bands (default) compress="lzw" # Compression method ) @@ -248,9 +252,8 @@ print(f"Created {len(files)} GeoTIFF files") # Export specific bands only (e.g., first 3 for RGB visualization) files = gt.export_embedding_geotiffs( - bbox=(-0.2, 51.4, 0.1, 51.6), + tiles_to_fetch=tiles_to_fetch, output_dir="./rgb_output", - year=2024, bands=[0, 1, 2] # Only export first 3 bands ) ``` diff --git a/docs/quickstart.rst b/docs/quickstart.rst index f2594a6..745ea37 100644 --- a/docs/quickstart.rst +++ b/docs/quickstart.rst @@ -428,17 +428,15 @@ Complete analysis workflow:: selected_tiles = [r for r in results if r['mean_band_50'] > threshold] print(f"Exporting {len(selected_tiles)} tiles above threshold") - - files = [] - for tile in selected_tiles: - file = gt.export_embedding_geotiffs( - bbox=(tile['lon']-0.05, tile['lat']-0.05, - tile['lon']+0.05, tile['lat']+0.05), - output_dir="./selected_tiles", - year=2024, - bands=[40, 50, 60] # Bands around band 50 - ) - files.extend(file) + + # Prepare tiles for export + tiles_to_export = [(2024, tile['lon'], tile['lat']) for tile in selected_tiles] + + files = gt.export_embedding_geotiffs( + tiles_to_fetch=tiles_to_export, + output_dir="./selected_tiles", + bands=[40, 50, 60] # Bands around band 50 + ) # Create PCA visualization from selected tiles # CLI: geotessera visualize ./selected_tiles pca_selected.tif @@ -468,17 +466,16 @@ Use both numpy and GeoTIFF formats in the same workflow:: selected_coords.append((lon, lat)) print(f"Selected {len(selected_coords)} interesting tiles") - - # Step 2: Export selected tiles as GeoTIFF - all_files = [] - for lon, lat in selected_coords: - files = gt.export_embedding_geotiffs( - bbox=(lon-0.05, lat-0.05, lon+0.05, lat+0.05), - output_dir="./interesting_tiles", - year=2024, - bands=[60, 64, 68] # Bands around interesting band 64 - ) - all_files.extend(files) + + # Step 2: Export selected tiles as GeoTIFF + # Prepare tiles for export + tiles_to_export = [(2024, lon, lat) for lon, lat in selected_coords] + + all_files = gt.export_embedding_geotiffs( + tiles_to_fetch=tiles_to_export, + output_dir="./interesting_tiles", + bands=[60, 64, 68] # Bands around interesting band 64 + ) # Step 3: Create PCA visualization from selected tiles print("Creating PCA visualization...")