How to load PDS data directly into Python with w10n

Posted by Chase Million on September 12, 2016  Improve this post

The PDS Cartography and Imaging Science node has implemented w10n “webification” for its holdings. The very quick explanation of what those words mean is that w10n “webification” is a protocol that allows you to interact with directory structures and data by means of well formed REST queries. It is described more completely here. One upshot is that you can interact with the archive in potentially rather complex and automated ways down to the level of individual pixels from within your programming environment without the need to transfer the data to a local machine or worry about formats. I’ve found this to be incredibly useful, so I thought that I would offer a quick practical example of what it looks like to do this in Python.

import requests
import matplotlib.pyplot as plt
import matplotlib.cm as cm

URL = "http://data.jpl.nasa.gov/pds/imaging/cassini/cassini_orbiter/coiss_2015/data/1506288646_1506388236/N1506378403_1.IMG/0/raster/data[]"

img_leaf = requests.get(URL+'?output=json').json()
plt.imshow(img_leaf['data'],cmap = cm.Greys_r)
plt.show()

The result in an interactive Jupyter notebook looks like:


 Discuss on Slack

We use Slack for all our real-time community communication. You can request membership to the OpenPlanetary Slack team here. Alternatively, you can leave a comment below for a more public discussion.

COMMENTS