Skip to content

Commit e27d1ef

Browse files
committed
Remove encoding unlimited_dims if Time not present
When xarray 2025.08.0 opens a file with an empty unlimited Time dimension but no variables with Time, it drops `Time` as a dimension but keeps it in `unlimited_dims`. This is probably not an expected behavior but it's easy enough to address by setting `unlimited_dims = None` if `Time` is not present.
1 parent 85b0413 commit e27d1ef

File tree

1 file changed

+2
-0
lines changed
  • conda_package/mpas_tools

1 file changed

+2
-0
lines changed

conda_package/mpas_tools/io.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ def write_netcdf(
135135
# make sure the Time dimension is unlimited because MPAS has trouble
136136
# reading Time otherwise
137137
ds.encoding['unlimited_dims'] = {'Time'}
138+
else:
139+
ds.encoding['unlimited_dims'] = None
138140

139141
# for performance, we have to handle this as a special case
140142
convert = format == 'NETCDF3_64BIT_DATA'

0 commit comments

Comments
 (0)