Skip to content

Commit

Permalink
replace .dims with .sizes (#212)
Browse files Browse the repository at this point in the history
* replace .dims with .sizes

* additional dims replacements
  • Loading branch information
veenstrajelmer authored Feb 9, 2024
1 parent ccc9e63 commit 0a41f61
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions tests/test_ugrid_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,11 +1133,11 @@ def get_ugrid_fillvaluem999_startindex1_ds():
)

# add dummy face variable in order to have a face dimension in the uds
facevar = np.ones(shape=(ds2.dims[mesh2d_attrs["face_dimension"]]))
facevar = np.ones(shape=(ds2.sizes[mesh2d_attrs["face_dimension"]]))
ds2["mesh2d_facevar"] = xr.DataArray(facevar, dims=(mesh2d_attrs["face_dimension"]))

# add dummy nodevar to plot and trigger triangulation procedure
nodevar = np.ones(shape=(ds2.dims[mesh2d_attrs["node_dimension"]]))
nodevar = np.ones(shape=(ds2.sizes[mesh2d_attrs["node_dimension"]]))
ds2["mesh2d_nodevar"] = xr.DataArray(nodevar, dims=(mesh2d_attrs["node_dimension"]))
return ds2

Expand Down
2 changes: 1 addition & 1 deletion xugrid/ugrid/conventions.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _infer_dims(
f" with dimensions: {var_dims}"
)
elif isinstance(key, int):
dim_size = ds.dims[dim]
dim_size = ds.sizes[dim]
if not dim_size == key:
raise UgridDimensionError(
f"Expected size {key} for dimension {dim} in variable "
Expand Down

0 comments on commit 0a41f61

Please sign in to comment.