Skip to content

Commit

Permalink
return artist when 1D plot and bug-fix fargo3d spherical
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaylor Wafflard committed Dec 4, 2024
1 parent 25322d2 commit 32aa6fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 10 additions & 3 deletions nonos/_readers/binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,14 +600,21 @@ def read(
n1 = len(V["x1"]) - 1
n2 = len(V["x2"]) - 1
n3 = len(V["x3"]) - 1
grid_shape = n3, n1, n2
shift = n2 // 2
if geometry_str == "cylindrical":
grid_shape = n3, n1, n2
tuple_transposition = (1, 2, 0)
shift = n2 // 2
elif geometry_str == "spherical":
grid_shape = n2, n1, n3
tuple_transposition = (1, 0, 2)
shift = n3 // 2

def _read_array(file: Path):
return np.roll(
np.fromfile(file, dtype="float64")
.reshape(grid_shape)
.transpose(1, 2, 0),
# .transpose(1, 2, 0),
.transpose(tuple_transposition),
shift,
axis=1,
)
Expand Down
4 changes: 3 additions & 1 deletion nonos/api/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ def plot(
if "norm" in kwargs:
logger.info("norm has no meaning in 1D.")
kwargs.pop("norm")
ax.plot(self.avalue, data, **kwargs)
im = ax.plot(self.avalue, data, **kwargs)
ax.set_ylim(ymin=vmin)
ax.set_ylim(ymax=vmax)
ax.set_xlabel(self.akey)
if title is not None:
ax.set_ylabel(title)
else:
return im
else:
raise TypeError(
"Plotable doesn't support data with dimensionality>2, "
Expand Down

0 comments on commit 32aa6fe

Please sign in to comment.