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

3D map plotting #4591

Closed
wants to merge 4 commits into from
Closed

3D map plotting #4591

wants to merge 4 commits into from

Conversation

dstansby
Copy link
Member

This is a very very rough draft of code to enable 3D plots to be made with Map. This works by:

  1. Calculating the coordinates of all the corners of the pixels in a map
  2. Converting these to HeliocentricInertial coordinates (an arbitrary, but fixed choice of coordinate frame).
  3. Using the x, y, z coordinate values in these cooridnates to define the corners of mesh quadrilaterals
  4. Creating a pyvista (a python interface to VTK) mesh from these mesh coordinates
  5. Plotting in pyvista

This is super useful when combining visualisation of multiple objects (e.g. adding magnetic field lines, or adding a LASCO map and an AIA map as in #3997 (comment))

If you checkout this branch and run test.py hopefully you should get something like:
aia_3d

All feedback welcome!

@dstansby dstansby added map Affects the map submodule visualization Affects the visualization submodule labels Oct 19, 2020
@dstansby dstansby requested a review from a team as a code owner October 19, 2020 18:05
@pep8speaks
Copy link

pep8speaks commented Oct 19, 2020

Hello @dstansby! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2020-12-20 10:53:15 UTC

@dstansby dstansby marked this pull request as draft October 19, 2020 18:08
@Cadair
Copy link
Member

Cadair commented Oct 20, 2020

Maybe this would be better as a submodule in sunpy.visualization?

@hayesla
Copy link
Member

hayesla commented Oct 20, 2020

This is super cool 🌞

@nabobalis nabobalis added this to the 2.1 milestone Oct 21, 2020
@dstansby dstansby modified the milestones: 2.1, 3.0 Oct 21, 2020
@nabobalis nabobalis removed this from the 3.0 milestone Oct 21, 2020
@Cadair Cadair added this to Nice to Haves in 2.1 Oct 21, 2020
@dstansby
Copy link
Member Author

😢 readthedocs doesn't support a headless display, so I don't think pyvista examples will run on RTD (readthedocs/readthedocs.org#1951 (comment))

@nabobalis
Copy link
Contributor

😢 readthedocs doesn't support a headless display, so I don't think pyvista examples will run on RTD (readthedocs/readthedocs.org#1951 (comment))

Given this, what about skipping the example just so people know it's possible?
We can leave a note saying why its static.

@dstansby
Copy link
Member Author

Yep, that's what I was planning. Could also possibly embed a .gif or a .png with the output run locally.

@Cadair
Copy link
Member

Cadair commented Dec 22, 2020

It is technically possible to compile VTK in headless mode so it doesn't need an X server...

@Cadair
Copy link
Member

Cadair commented Dec 22, 2020

Another (easier idea) is maybe to spin this up in the conf.py: https://pypi.org/project/xvfbwrapper/

@Cadair
Copy link
Member

Cadair commented Dec 22, 2020

It is technically possible to compile VTK in headless mode so it doesn't need an X server...

There is supposed to be a conda-forge vtk variant which is compiled with osmesa (off screen mesa GL), but it seems to have been disabled for the newest builds (despite me seemingly being able to use it with a rc of vtk 9.0) so it's possible there is a decent solution to this not that far away.

@dstansby
Copy link
Member Author

Another (easier idea) is maybe to spin this up in the conf.py: https://pypi.org/project/xvfbwrapper/

Hmm, I gave this a go, but VTK doesn't seem to be detecting/using the xvfb wrapper and is just spinning up it's own window for me locally.

@dstansby
Copy link
Member Author

I'm wondering about spinning this off into a separate package, so I can more rapidly develop and test it without putting it all in what would be a mega PR. I think there's enough things different (needing pyvista/vtk installed, and really need a way to do image comparison tests with pyvista, which is possible, but I think worth trialing elsewhere first) to warrant this.

@dstansby dstansby closed this Jan 19, 2021
2.1 automation moved this from Nice to Haves to Done Jan 19, 2021
@dstansby dstansby deleted the 3dplot branch November 5, 2021 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
map Affects the map submodule visualization Affects the visualization submodule
Projects
No open projects
2.1
Done
Development

Successfully merging this pull request may close these issues.

None yet

5 participants