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

BUG: fix reading coordinates in Fargo3DReader.read #384

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

volodia99
Copy link
Owner

  • in 1D without title argument in plot() function: return artist to be consistent with the 2D case
  • wrong transposition when spherical 3D in fargo3d

Comment on lines -603 to +610
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
Copy link
Collaborator

@neutrinoceros neutrinoceros Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be an else: raise NotImplementedError (even if it's currently unreacheable) to guard against NameErrors

Comment on lines 139 to 140
else:
return im
Copy link
Collaborator

@neutrinoceros neutrinoceros Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this return conditional, and why would it depend on the seemingly unrelated title argument ?
Also note that returning early in this style makes the filename argument a no-op, which is probably not desired.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this condition is exactly the same as the one just before for 2D images.

2D case :
    im = plot
    if title is not None:
        colorbar by default
    else:
        return im # to have more flexibility on what you want in the colorbar, using im

I just reused this already existing structure for the 1D case, because I needed to have more flexibility on it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then my comment also applies there. I think you are effectively copy-pasting a bug here

@neutrinoceros neutrinoceros changed the title BUG: return artist when 1D plot + wrong transposition in fargo3d spherical BUG: fix reading coordinates in Fargo3DReader.read Dec 16, 2024
@neutrinoceros neutrinoceros merged commit c5ef2e7 into main Dec 16, 2024
17 checks passed
@neutrinoceros neutrinoceros deleted the return-plot-1d branch December 16, 2024 14:06
@neutrinoceros neutrinoceros added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants