The new xarray version parses NetCDF dataset "time" coord as "int32" instead "timedelta". The issue occurs when parsing the NetCDF example weather data files loaded from google cloud bucket.
Problem
Inside the graphcast_demo.ipynb, section "Load the example data", a NetCDF file is loaded and opened with xarray:
with gcs_bucket.blob(f"{dir_prefix}dataset/{dataset_file.value}").open("rb") as f:
example_batch = xarray.load_dataset(f).compute()
The new xarray version parses the time coordinate of the dataset as int32. But the graphcast code excpects "An xarray.Dataset with a 'time' dimension whose coordinates are timedeltas.[…]" (graphcast.data_utils.extract_input_target_times).
This leads to the error in graphcast/graphcast/data_utils.py:282
TypeError: Concatenation operation is not implemented for NumPy arrays, use np.concatenate() instead. Please do not rely on this error; it may not be given on all Python implementations.
Reason
Xarray version 2026.4.0 finalizes the deprecation timedelta decoding via units:
Xarray will now no longer by default decode variables with only a timedelta-like "units" attribute into np.timedelta64 values. […]
pydata/xarray#11173
This means that the "time" coordinate of NetCDF files like graphcast/dataset/source-era5_date-2022-01-01_res-0.25_levels-37_steps-01.nc will not be parsed as timedelta64 even though it has the attribute units: hours.
Proposed Solution
Enforce previous behaviour by explicitly setting decode_timedelta=True:
with gcs_bucket.blob(f"{dir_prefix}dataset/{dataset_file.value}").open("rb") as f:
example_batch = xarray.load_dataset(f, decode_timedelta=True).compute()
The new xarray version parses NetCDF dataset "time" coord as "int32" instead "timedelta". The issue occurs when parsing the NetCDF example weather data files loaded from google cloud bucket.
Problem
Inside the
graphcast_demo.ipynb, section "Load the example data", a NetCDF file is loaded and opened with xarray:The new xarray version parses the
timecoordinate of the dataset asint32. But the graphcast code excpects "An xarray.Dataset with a 'time' dimension whose coordinates are timedeltas.[…]" (graphcast.data_utils.extract_input_target_times).This leads to the error in
graphcast/graphcast/data_utils.py:282Reason
Xarray version 2026.4.0 finalizes the deprecation timedelta decoding via units:
This means that the "time" coordinate of NetCDF files like
graphcast/dataset/source-era5_date-2022-01-01_res-0.25_levels-37_steps-01.ncwill not be parsed astimedelta64even though it has the attributeunits: hours.Proposed Solution
Enforce previous behaviour by explicitly setting
decode_timedelta=True: