Skip to content

Commit 726aed8

Browse files
committed
Only using .get() in if-statements doesn't work if the expected value is an array. Fix that in a couple of places.
1 parent f3a7ce9 commit 726aed8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/postgkyl/data/gdata.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def get_input_file(self) -> str:
189189

190190
# ---- Number of Cells ----
191191
def get_num_cells(self) -> np.ndarray:
192-
if self.ctx.get("cells"):
192+
if self.ctx.get("cells") is not None:
193193
return self.ctx["cells"]
194194
elif self._values is not None:
195195
num_dims = len(self._values.shape) - 1
@@ -218,7 +218,7 @@ def get_num_comps(self) -> int:
218218

219219
# ---- Number of Dimensions -----
220220
def get_num_dims(self, squeeze: bool = False) -> int:
221-
if self.ctx.get("cells"):
221+
if self.ctx.get("cells") is not None:
222222
num_dims = len(self.ctx["cells"])
223223
elif self._values is not None:
224224
num_dims = int(len(self._values.shape) - 1)

0 commit comments

Comments
 (0)