Skip to content

rOpenGov/nasa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nasa

If this project helped, consider supporting it:

Buy Me a Coffee

Access National Aeronautics and Space Administration (NASA) Open APIs for Space and Earth Data.

The nasa package provides functions to access and download data from various NASA APIs, including:

All retrieved data is returned in cleaned, tidy data frames suitable for analysis or visualization.

Install

Install from CRAN:

install.packages("noaa")

Install from the rOpenGov universe:

# Enable repository from ropengov
options(repos = c(
  ropengov = 'https://ropengov.r-universe.dev',
  CRAN = 'https://cloud.r-project.org'))
  
# Download and install noaa
install.packages("noaa")

API Use

Most functions in this package can be run using the default DEMO_KEY. However, because the DEMO_KEY is publicly shared and subject to rate limits, it is recommended to request your own API key from NASA by visiting https://api.nasa.gov/.

Installation

Functions

get_apod_metadata(start_date, end_date, api_key = "DEMO_KEY", folder_name = NULL)

  • Queries APOD to retrieve image metadata between two dates.
  • Only returns results where the media type is an image.
  • Optionally saves images to a folder on the Desktop.

get_mars_rover_photos_and_metadata(rover, earth_date, api_key = "DEMO_KEY", folder_name = NULL)

  • Retrieves photos taken by a Mars rover on a specific Earth date.
  • Valid rover names: "curiosity", "opportunity", "spirit", "perseverance".
  • Optionally saves photos to a folder on the Desktop.

get_earthdata(keyword, n_results, start_date = NULL, end_date = NULL)

  • Searches the NASA Earthdata CMR database for datasets matching a keyword.
  • Can optionally filter results by a temporal range.
  • Returns a cleaned data frame of dataset metadata.

Example usage

Load the library

library(nasa)

Get Astronomy Picture of the Day metadata

apod_data <- get_apod_metadata(
  start_date = "2024-04-01",
  end_date = "2024-04-02",
  api_key = "DEMO_KEY")

Retrieve Mars Rover Photos metadata

mars_data <- get_mars_rover_photos_and_metadata(
  rover = "curiosity",
  earth_date = "2020-02-01",
  api_key = "DEMO_KEY")

Search Earthdata for "sea surface temperature" (or any keyword or phrase)

earthdata_results <- get_earthdata(
  keyword = "sea surface temperature",
  n_results = 10)

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages