Skip to content

Commit 5d7c56e

Browse files
committed
Ensure Time dim is added to landice initial condition
MPAS meshes include an empty, unlimited `Time` dimension but the latest NetCDF4 drops this dimension since no variable use it. the `create_from_generic_mpas_grid()` funciton in `landice.create` was taking advantage of `Time` being a dimension in the MPAS mesh but this should no longer be assumed. This merge fixes that assumption by explicitly adding `Time` to the list of dimensions to create if it is not already in the input dataset.
1 parent 0f401a5 commit 5d7c56e

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

conda_package/mpas_tools/landice/create.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,14 @@ def create_from_generic_mpas_grid(): # noqa C901
166166
# unlimited dimension. Special handling is needed with the netCDF
167167
# module.
168168
print('---- Copying dimensions from input file to output file ----')
169-
for dim in filein.dimensions.keys():
169+
170+
create_dims = list(filein.dimensions.keys())
171+
172+
# We will add variables with Time as a dimension so we need it
173+
if 'Time' not in create_dims:
174+
create_dims.append('Time')
175+
176+
for dim in create_dims:
170177
if dim == 'nTracers':
171178
pass # Do nothing - we don't want this dimension
172179
elif dim == 'nVertInterfaces':

0 commit comments

Comments
 (0)