Skip to content

Commit

Permalink
FIX: read_arm_mmcr fails when using a read-only input file
Browse files Browse the repository at this point in the history
  • Loading branch information
isilber committed Dec 11, 2024
1 parent ce7d471 commit 1b4b7b1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions act/io/arm.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,12 +841,11 @@ def read_arm_mmcr(filenames):
# read it in with xarray
multi_ds = []
for f in filenames:
nc = Dataset(f, 'a')
# Change heights name to range to read appropriately to xarray
if 'heights' in nc.dimensions:
nc.renameDimension('heights', 'range')
nc = Dataset(f, 'r')
if nc is not None:
ds = xr.open_dataset(xr.backends.NetCDF4DataStore(nc))
# Change heights name to range to read appropriately to xarray
ds = ds.rename_dims({"heights": "range"})
multi_ds.append(ds)
# Concatenate datasets together
if len(multi_ds) > 1:
Expand Down

0 comments on commit 1b4b7b1

Please sign in to comment.