knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
PDS3 is a data standard used extensively by NASA for archiving data from science missions, maintained by JPL. While being replaced by PDS4, PDS4 covers all currently active missions and those covering the history of US space exploration.
The R pds3 package provides tools for parsing PDS3 data, particularly the ODL label format which describes all the metadata of data collection. Want to plot a heatmap of Mars of all the images taken? This is the package for you!
The package is not yet on CRAN, so to install you'll want to use devtools
to
get the development version from Github.
# Install devtools if you don't already have it install.packages("devtools") # Install the development version of pds3 devtools::install_github("mwaldstein/pds3")
If you're exploring this package, chances are you already have a collection of PDS files, but if you're interested in exploring NASA data, the place to get started is The Planetary Data System.
Once you find a mission you're interested in exploring, finding the data explorer is typically straight forward. The metadata this package processes is typically stored in .lbl files. For instance, we'll look at the labels from the Mars Reconnaissance Orbiter's HiRise experiment, particularly the data associated with this image.
We'll start by grabbing the label (LBL) file.
href <- 'http://hirise.lpl.arizona.edu/PDS/RDR/ESP/ORB_011700_011799/ESP_011707_1440/ESP_011707_1440_COLOR.LBL' req <- curl::curl_fetch_memory(href) dat <- rawToChar(req$content)
Now we have the data, we'll process it using parse_pds3
.
library(pds3) res <- pds3_read(dat) str(res$odl)
All of the data you can access from NASA missions is public, but be aware that if you are going to download a large amount, there are almost always better ways than web scraping - be it either a catalog-only download or via FTP, investigate and be sure to be considerate.
Also of note that the data is public and free to use, it is the product of a lot of hard work and it is appropriate to cite the data source and the principle investigators of the instrument whose data you are using. NASA provides a guide to Citing PDS3 Data
One cool thing is that many PDS catalogs include citation information in a PDS3 formatted file we can use this package to extract!
cit_href <- "https://hirise.lpl.arizona.edu/PDS/CATALOG/RDR_DS.CAT" cit_req <- curl::curl_fetch_memory(cit_href) cit_dat <- rawToChar(cit_req$content) cit_res <- pds3_read(cit_dat) cit_res$odl$DATA_SET$DATA_SET_INFORMATION$CITATION_DESC
r cit_res$odl$DATA_SET$DATA_SET_INFORMATION$CITATION_DESC
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.