maRs
is a R package with functions to retrieve and visualize weather data from the last 7 sols (martian days) which is daily updated by NASA's InSight Mars lander. InSight is located at Elysium Planitia, a flat surface near the equator of Mars.
maRs
was built on R version 3.5.0; therefore, it is recommended to use a similar version or higher to avoid compatability issues.
git clone https://github.com/claudia-nikel/534_project/
setwd('path-to-github-repo')
library(devtools)
build()
install()
if updates are required, update all (1)
library(maRs)
maRs requires the following libraries:
library('dplyr') library('jsonlite') library('httr') library('purrr') library('tidyr') library('plotly')
Windspeed: retrieves the inputted sol's horizontal wind speed (m/s) from the summary table and visualizes it as a dial. The black bar is the average windspeed for the sol, which corresponds to the black text. The green background is the sol range (min and max), and the red or green text below is represents a decrease or increase, respectively, relative to the previous sol's average.
Pressure: retrieves the inputted sol's pressure (Pascal) from the summary table and visualizes it as a dial. The black bar is the average pressure for the sol, which corresponds to the black text. The orange background is the sol range (min and max), and the red or green text below is represents a decrease or increase, respectively, relative to the previous sol's average.
Temperature: retrieves the inputted sol's temperature (converted from Farhenheit to degrees Celsius) from the summary table and visualizes it as a dial. The black bar is the average pressure for the sol, which corresponds to the black text. The blue background is the sol range (min and max), and the red or green text below is represents a decrease or increase, respectively, relative to the previous sol's average.
marsMM: retrives the inputted sol's maximum and minimum value for temperature, windspeed and pressure and displays them in plot and histogram graphs for easier interpretation.
We start off by calling the library into the current session.
library(maRs)
The formatting of data happens within the API, we can directly make use of the final output for our functions.
marsInfo("yourAPI")
takes the API key you generated on NASA Open APIs as a string.
marsAverage(x, graph = NULL)
takes the saved output from the marsInfo() function and outputs a summary of the week's averages for temperature, horizontal windspeed, and pressure, which can be graphed with graph = TRUE
.
windspeed(sol, x)
where sol is sol number in the form of an integer and x is the saved output from the marsInfo()
function.
pressure(sol, x)
where sol is the sol number in the form of an integer and x is the saved output from the marsInfo()
function.
temperature(sol, x)
where sol is the sol number in the form of an integer and x is the saved output from the marsInfo()
function.
For windspeed, pressure, and temperature visualizations, user must input a number from the previous 7 Sols. Since the function makes use of Plotly, you must save the function as a variable.
If the input is not within the last 7 Sols, an error message will return listing valid options.
marsMM(func='t',x)
where function represents which phenomenon you want data about and x is the saved output from the marsInfo()
function.
use func='t'
fot temperature.
use func='w'
fot windspeed.
use func='p'
fot pressure.
The plot function of maRs is implicit, there is no need to call the plot function explicitly. Just make use of the variable that was assigned the function output and we should be able to plot a dial with our requested data.
df <- marsInfo("yourAPI")
w <- windspeed(415, df)
w
p <- pressure(415, df)
p
t <- temperature(415, df)
t
marsMM(func='t',x)
marsMM(func='w',x)
marsMM(func='p',x)
Authors: Claudia Nikel, KT Hobbs, Shreeram Murali
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.