This notebook shows how to plot tabular data on the surface of a planet using the AAS WorldWide Telescope through pywwt. You can find out more about using pywwt in the documentation.
Start off by importing the WWTJupyterWidget
class:
from pywwt.jupyter import WWTJupyterWidget
We use this class to create the pywwt "widget". Crucially, the second line below (containing just wwt
) is needed to insert the widget into the notebook, and not just assign it to a variable:
wwt = WWTJupyterWidget()
wwt
If you're using JupyterLab and not just a plain Jupyter notebook, you can move the WWT view to a separate window pane. This is extremely useful since it lets you keep on typing code without scrolling WWT out of view. Here's how you do that:
If you don't get a menu when you right-click, or the menu doesn't look like the one pictured, you are using a plain Jupyter notebook and will have to scroll back and forth.
Once the widget appears, you can then use the wwt
object to change the current view to the Earth:
wwt.set_view('Earth')
Finally we load a dataset and add a data layer in WWT:
from astropy.table import Table
EARTHQUAKES = 'https://worldwidetelescope.github.io/pywwt/data/earthquakes_2010.csv'
table = Table.read(EARTHQUAKES, delimiter=',', format='ascii.basic', fast_reader=False)
layer = wwt.layers.add_data_layer(table=table, frame='Earth', lon_att='longitude', lat_att='latitude', color='red')
This notebook was prepared by Thomas Robitaille.