Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: improve clarity of error messages for OffAxisSlicePlot with curvilinear geometries #4038

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions yt/visualization/plot_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,7 @@ class OffAxisSlicePlot(SlicePlot, PWViewerMPL):

_plot_type = "OffAxisSlice"
_frb_generator = FixedResolutionBuffer
_supported_geometries = ("cartesian", "spectral_cube")

def __init__(
self,
Expand Down Expand Up @@ -2372,6 +2373,12 @@ def __init__(
)
del origin

if ds.geometry not in self._supported_geometries:
raise NotImplementedError(
f"off-axis slices are not supported for {ds.geometry!r} geometry\n"
f"currently supported geometries: {self._supported_geometries!r}"
)

(bounds, center_rot) = get_oblique_window_parameters(normal, center, width, ds)
if field_parameters is None:
field_parameters = {}
Expand Down Expand Up @@ -2554,6 +2561,7 @@ class OffAxisProjectionPlot(ProjectionPlot, PWViewerMPL):
"""
_plot_type = "OffAxisProjection"
_frb_generator = OffAxisProjectionFixedResolutionBuffer
_supported_geometries = ("cartesian", "spectral_cube")

def __init__(
self,
Expand All @@ -2578,6 +2586,12 @@ def __init__(
data_source=None,
buff_size=(800, 800),
):
if ds.geometry not in self._supported_geometries:
raise NotImplementedError(
f"off-axis slices are not supported for {ds.geometry!r} geometry\n"
f"currently supported geometries: {self._supported_geometries!r}"
)

(bounds, center_rot) = get_oblique_window_parameters(
normal, center, width, ds, depth=depth
)
Expand Down