Skip to content

Commit 5b5fe30

Browse files
committed
Merge branch 'master' into cmacmackin/hermes_collisions
2 parents 10c1335 + f5d308e commit 5b5fe30

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/boutdata/data.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@ def recalculate_xyz(self, *, nx=None, ny=None, nz=None):
780780
"don't know which parameters to choose"
781781
)
782782
with DataFile(self.gridfilename) as gridfile:
783-
self.nx = float(gridfile["nx"])
784-
self.ny = float(gridfile["ny"])
783+
self.nx = int(gridfile["nx"])
784+
self.ny = int(gridfile["ny"])
785785
try:
786786
nzfromfile = gridfile["MZ"]
787787
except KeyError:
@@ -817,10 +817,10 @@ def recalculate_xyz(self, *, nx=None, ny=None, nz=None):
817817
except KeyError:
818818
gridfilename = self["grid"]
819819
with DataFile(gridfilename) as gridfile:
820-
self.nx = float(gridfile["nx"])
821-
self.ny = float(gridfile["ny"])
820+
self.nx = int(gridfile["nx"])
821+
self.ny = int(gridfile["ny"])
822822
try:
823-
nzfromfile = float(gridfile["MZ"])
823+
nzfromfile = int(gridfile["MZ"])
824824
except KeyError:
825825
pass
826826
if nz is not None:
@@ -834,6 +834,9 @@ def recalculate_xyz(self, *, nx=None, ny=None, nz=None):
834834
except KeyError:
835835
if nzfromfile is not None:
836836
self.nz = nzfromfile
837+
else:
838+
self.nz = 1
839+
837840
mxg = self._keys.get("MXG", 2)
838841
myg = self._keys.get("MYG", 2)
839842

src/boututils/View3D.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ def magnetic_field(g, X, Y, Z, rmin, rmax, zmin, zmax, Br, Bz, Btrz):
322322
bz = np.zeros(np.shape(X))
323323
bt = np.zeros(np.shape(X))
324324

325-
nx, ny, nz = np.shape(X)
326-
327325
mask = (rho >= rmin) & (rho <= rmax) & (Z >= zmin) & (Z <= zmax)
328326
k = np.argwhere(mask is True)
329327

@@ -361,8 +359,6 @@ def psi_field(g, X, Y, Z, rmin, rmax, zmin, zmax):
361359

362360
psi = np.zeros(np.shape(X))
363361

364-
nx, ny, nz = np.shape(X)
365-
366362
mask = (rho >= rmin) & (rho <= rmax) & (Z >= zmin) & (Z <= zmax)
367363
k = np.argwhere(mask is True)
368364

src/boututils/datafile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ def _bout_dimensions_from_var(self, data):
523523
return defdims_list[len(np.shape(data))]
524524

525525
if bout_type == "string_t":
526-
nt, string_length = data.shape
526+
_, string_length = data.shape
527527
return ("t", f"char{string_length}")
528528
elif bout_type == "string":
529529
return (f"char{len(data)}",)

0 commit comments

Comments
 (0)