Skip to content

Instantly share code, notes, and snippets.

@mdsumner
Created June 28, 2026 23:47
Show Gist options
  • Select an option

  • Save mdsumner/2cd2953e64692adaf7cae364f4003999 to your computer and use it in GitHub Desktop.

Select an option

Save mdsumner/2cd2953e64692adaf7cae364f4003999 to your computer and use it in GitHub Desktop.
#run --rm -ti -v $HOME/Git/gdalxarray:/gdalxarray  ghcr.io/hypertidy/gdal-r-python:dev


import os
os.environ["AWS_NO_SIGN_REQUEST"] = "YES"
os.environ["AWS_REGION"] = "us-west-2"

# 1. confirm register() is active and chunk manager is happy
from dask_array.xarray import register; register()
import xarray as xr, numpy as np
print(type(xr.DataArray(np.arange(12).reshape(3,4)).chunk({"dim_0":1}).data).__module__)
# -> dask_array._collection   (gate 1 open)

# 2. confirm the adapter is the un-tokenizable layer
from xarray.core.indexing import ImplicitToExplicitIndexingAdapter
print(hasattr(ImplicitToExplicitIndexingAdapter, "__dask_tokenize__"))   # False

dsn = "/vsiicechunk/{/vsis3/dynamical-ecmwf-aifs-single/ecmwf-aifs-single-forecast/v0.1.0.icechunk}/wind_v_10m"
# 3. try the fix: does forwarding a name through from_array_kwargs work?
gds = xr.open_dataset(dsn, chunks={}, engine="gdalxarray")

gds = xr.open_dataset(dsn, chunks={}, engine="gdalxarray",
                          from_array_kwargs={"name": "gdalxr-wind_v_10m-test"})



dsn = "/vsiicechunk/{/vsis3/dynamical-ecmwf-aifs-single/ecmwf-aifs-single-forecast/v0.1.0.icechunk}/wind_v_10m"

import os
os.environ["AWS_NO_SIGN_REQUEST"] = "YES"
os.environ["AWS_REGION"] = "us-west-2"

import dask_array.core._conversion as conv
_orig = conv.from_array
def spy(x, *a, **k):
    print(">>> conv.from_array name=", k.get("name"), "args=", len(a))
    return _orig(x, *a, **k)
conv.from_array = spy

import xarray as xr
gds = xr.open_dataset(dsn, chunks={}, engine="gdalxarray")   # no kwargs — the failing path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment