https://github.com/developmentseed/async-geotiff
one file
import os
try:
!uv pip install async-geotiff obstore
from google.colab import auth, userdata
auth.authenticate_user()
os.environ["PROJECT_ID"] = userdata.get("PROJECT_ID")
except:
pass
from obstore.store import GCSStore
from async_geotiff import GeoTIFF
store = GCSStore(
bucket="alphaearth_foundations",
client_options={
"default_headers": {
"x-goog-user-project": os.environ.get("PROJECT_ID")
}
}
)
path = "satellite_embedding/v1/annual/2017/17N/xupko3qd8opdbbk86-0000000000-0000008192.tiff"
geotiff = await GeoTIFF.open(path, store=store)
overview = geotiff.overviews[9] # 8x8 pixels, Resolution: 10240.00m x 10240.00m
geotiff.count # 64
array = await overview.read()
multi files
import os
import asyncio
try:
!uv pip install async-geotiff obstore
from google.colab import auth, userdata
auth.authenticate_user()
os.environ["PROJECT_ID"] = userdata.get("PROJECT_ID")
except:
pass
from obstore.store import GCSStore
from async_geotiff import GeoTIFF
store = GCSStore(
bucket="alphaearth_foundations",
client_options={
"default_headers": {
"x-goog-user-project": os.environ.get("PROJECT_ID")
}
}
)
paths = [
"satellite_embedding/v1/annual/2017/17N/xupko3qd8opdbbk86-0000000000-0000008192.tiff",
"satellite_embedding/v1/annual/2017/17N/xupko3qd8opdbbk86-0000008192-0000008192.tiff",
"satellite_embedding/v1/annual/2017/17N/xfmer91p2y3c68dly-0000008192-0000000000.tiff",
"satellite_embedding/v1/annual/2017/17N/xfmer91p2y3c68dly-0000008192-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xi38zkaftq2pxqqf2-0000008192-0000000000.tiff",
"satellite_embedding/v1/annual/2017/18N/xviemv6ttwkhhdwro-0000008192-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xi38zkaftq2pxqqf2-0000000000-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xi38zkaftq2pxqqf2-0000008192-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xliurhz99ua07g3ll-0000008192-0000000000.tiff",
"satellite_embedding/v1/annual/2017/18N/xnkew8ex3gr3kxuve-0000000000-0000000000.tiff",
"satellite_embedding/v1/annual/2017/18N/xnkew8ex3gr3kxuve-0000008192-0000000000.tiff",
"satellite_embedding/v1/annual/2017/18N/xliurhz99ua07g3ll-0000008192-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xnkew8ex3gr3kxuve-0000000000-0000008192.tiff",
"satellite_embedding/v1/annual/2017/18N/xnkew8ex3gr3kxuve-0000008192-0000008192.tiff",
]
open_tasks = [GeoTIFF.open(path, store=store) for path in paths]
geotiffs = await asyncio.gather(*open_tasks)
read_tasks = [geotiff.read() for geotiff in geotiffs]
arrays = await asyncio.gather(*read_tasks)
for array in arrays:
print(f"Array: {array}")