Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Created September 24, 2025 11:44
Show Gist options
  • Save mdsumner/bff376431ff3df99494510ba028f0b44 to your computer and use it in GitHub Desktop.
Save mdsumner/bff376431ff3df99494510ba028f0b44 to your computer and use it in GitHub Desktop.
import xarray
ds = xarray.open_dataset("s3://aodn-cloud-optimised/satellite_chlorophylla_oci_1day_aqua.zarr", 
                         engine = "zarr", storage_options = {"anon": True}, chunks = {})

## then we can do stuff like this, parallelized nicely with dask
#mn = ds.sel(longitude = slice(109, 164), latitude = slice(-42, -48), time = slice("2002-07-01", "2003-06-30")).groupby("time.month").mean()

Equivalent in GDAL to open the public-access (no-sign) Zarr endpoint

from osgeo import gdal
gdal.UseExceptions()
opt = gdal.GetConfigOption("AWS_NO_SIGN_REQUEST")
gdal.SetConfigOption("AWS_NO_SIGN_REQUEST", "YES")
ds = gdal.OpenEx("/vsis3/aodn-cloud-optimised/satellite_chlorophylla_oci_1day_aqua.zarr", gdal.OF_MULTIDIM_RASTER)
gdal.SetConfigOption("AWS_NO_SIGN_REQUEST", opt)
@rouault
Copy link

rouault commented Sep 24, 2025

Simpler GDAL version:

from osgeo import gdal
gdal.UseExceptions()
with gdal.config_option("AWS_NO_SIGN_REQUEST", "YES"):
    ds = gdal.OpenEx("/vsis3/aodn-cloud-optimised/satellite_chlorophylla_oci_1day_aqua.zarr", gdal.OF_MULTIDIM_RASTER)

@mdsumner
Copy link
Author

Oh thanks! Wondered about that 😂

Mostly I was excited about figuring out the xarray idiom for setting config finally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment