title: "Mars Weather Data Dive"
author: "Rihab Badawi"
date: "2025-01-25"
output:html_decoment
Introduction:
This analysis investigates the Mars Weather dataset, focusing on
temperature, pressure, and seasonal patterns. The goal is to explore
trends, relationships, and anomalies in the data to better understand
the Martian climate.
Load required libraries:
library(tidyverse)
Load the dataset:
marsdata <-
readcsv("C:/Users/rbada/Downloads/mars-weather.csv")
Numeric and Categorical Summaries:
Numeric Summary
Numeric summary for min_temp and pressure
summaryfornumericcols <- marsdata %>%
summarise( MinMinTemp = min(mintemp, na.rm = TRUE),
MaxMinTemp = max(mintemp, na.rm = TRUE), MeanMinTemp =
mean(mintemp, na.rm = TRUE), MedianMinTemp =
median(mintemp, na.rm = TRUE), Q1MinTemp =
quantile(mintemp, 0.25, na.rm = TRUE), Q3MinTemp =
quantile(mintemp, 0.75, na.rm = TRUE),
Min_Pressure = min(pressure, na.rm = TRUE),
Max_Pressure = max(pressure, na.rm = TRUE),
Mean_Pressure = mean(pressure, na.rm = TRUE),
Median_Pressure = median(pressure, na.rm = TRUE),
Q1_Pressure = quantile(pressure, 0.25, na.rm = TRUE),
Q3_Pressure = quantile(pressure, 0.75, na.rm = TRUE)
) print(summaryfornumeric_cols)
Insight:
The numeric summary shows that minimum temperatures on Mars can drop
as low as -90°C and reach a maximum of -62°C, with an average of -60°C.
Atmospheric pressure ranges between 700 Pa and 925 Pa, with an average
of 853 Pa. These values highlight the extreme cold and thin atmosphere
on Mars, which are critical for planning future missions.
Categorical summary for unique values and counts:
categoricalsummary <- marsdata %>% summarise(
UniqueMonths = ndistinct(month), UniqueAtmoOpacity =
ndistinct(atmoopacity) ) print(categorical_summary)
Frequency counts for month and atmospheric opacity
monthcounts <- marsdata %>% count(month, sort = TRUE)
opacitycounts <- marsdata %>% count(atmo_opacity, sort =
TRUE)
print(monthcounts) print(opacitycounts)
Insight:
The dataset includes 12 unique Martian months. The atmospheric
opacity is mostly reported as Sunny, with very few instances of unclear
(--) values. This indicates relatively stable atmospheric conditions on
Mars, which is promising for solar-powered systems. However, further
investigation into the rare unclear values might provide insights into
unusual weather events.
combinedsummary <- list( NumericSummary =
numericsummary, CategoricalSummary = categoricalsummary,
MonthFrequencies = monthcounts, OpacityFrequencies =
opacitycounts, DistinctCategories = distinct_categories )
Print combined summary
print(combined_summary)
Novel Questions to Investigate:
1. How do minimum and maximum temperatures vary across different
Martian months?
2, What is the relationship between atmospheric pressure and
temperature on Mars?
3. Are there significant differences in atmospheric opacity (e.g.,
Sunny vs. --) during specific Martian months or seasons?
Column Summaries:
Numaric column
1. min_temp: Represents the minimum daily temperature on Mars (°C)
and helps analyze the coldest weather conditions to understand extreme
environments.
2. max_temp: Indicates the maximum daily temperature on Mars (°C),
providing insights into the hottest conditions and daily temperature
ranges.
3.pressure: Measures the atmospheric pressure on Mars (Pa), allowing
for the study of stability and variability in Martian atmospheric
conditions.
4.ls: Represents the solar longitude (0°–360°), which corresponds to
Mars’s position in its orbit and helps analyze seasonal changes
affecting weather patterns.
5.sol:Tracks the Martian solar day (count of days since the mission
began) and enables the analysis of trends or changes in weather.
Categorical Columns
1.month:Specifies the Martian month (from Month 1 to Month 12),
allowing seasonal trends and variations in Martian weather to be
studied throughout the year.
2.atmo_opacity:Describes the clarity of the Martian atmosphere
(e.g.,Sunny), providing insights into atmospheric conditions such as
clear skies or dusty weather.
1.terrestrial_date:Refers to the Earth-based date corresponding to
the Martian weather data, enabling chronological analysis and linking
Mars observations to Earth’s timeline.
1.id:unique identifier for each observation, ensuring each row can
be tracked and distinguished for analysis purposes.
2.wind_speed:Records the wind speed on Mars,which provides valuable
information about wind dynamics and weather patterns.
Dataset Documentation:
This dataset contains weather observations from Mars, collected over
a specific period. It includes both numerical and categorical data, such
as temperature, atmospheric pressure, and seasonal attributes, offering
insights into the Martian climate. The data was likely obtained from
Mars weather missions, such as NASA's Curiosity rover or similar
projects, and serves as a valuable resource for studying Martian
environmental conditions.
project's goals/purpose:
The goal of this project is to analyze the Mars weather dataset to
better understand the Martian climate. This includes studying
temperature patterns, atmospheric pressure, and seasonal changes across
Martian months. The project aims to identify trends, explore
relationships between variables like temperature and pressure, and gain
insights into how Martian weather behaves over time. These findings can
provide valuable context for future Mars missions and research.
Addressing a Question Using Aggregation:
Aggregation: How do minimum and maximum temperatures vary across
Martian months?
Aggregate mean mintemp and maxtemp by Martian month
tempbymonth <- marsdata %>% groupby(month)
%>% summarise( MeanMinTemp = mean(mintemp, na.rm = TRUE),
MeanMaxTemp = mean(maxtemp, na.rm = TRUE) )
print(tempbymonth)
Aggregation: What is the relationship between atmospheric pressure
and temperature?
Aggregate mean pressure and temperature by Martian month
pressuretempbymonth <- marsdata %>%
groupby(month) %>% summarise( MeanPressure = mean(pressure,
na.rm = TRUE), MeanMinTemp = mean(mintemp, na.rm = TRUE) )
print(pressuretempby_month)
Insight:
Aggregating minimum and maximum temperatures by Martian month
reveals seasonal trends. Month 1 shows the coldest temperatures, while
Month 8 is relatively warmer. These findings help us understand how
temperatures change with Martian seasons, which can inform planning for
seasonal activities or missions on Mars.
Visual Summaries:
Filter and Clean the Data
cleaneddata <- marsdata %>% filter(!is.na(mintemp)
& !is.na(pressure) & !is.na(atmoopacity))
Check the cleaned dataset
summary(cleaned_data)
Boxplot
Boxplot: Minimum Temperatures by Martian Month
cleaneddata |> ggplot() + geomboxplot(mapping = aes(x =
month, y = mintemp, fill = month)) + ggtitle("Minimum Temperatures
by Martian Month") + thememinimal() + theme(axis.text.x =
element_text(angle = 45, hjust = 1))
Insight:
The boxplot shows that minimum temperatures vary significantly
across months. For example, Month 3 experiences the coldest
temperatures, while Month 4 has greater variability. This variability
could indicate transitional weather patterns, which are crucial to
consider for long-term exploration missions.
Line Plot
Line Plot: Atmospheric Pressure Over Time
cleaneddata |> ggplot(aes(x = terrestrialdate, y =
pressure)) + geomline(color = "blue") + labs( title = "Atmospheric
Pressure on Mars Over Time", x = "Earth Date", y = "Atmospheric Pressure
(Pa)" ) + thememinimal()
Insight:
The line plot shows how atmospheric pressure changes over time on
Mars. It highlights periods of high and low pressure, which could be
linked to Martian seasons or other patterns. This helps in understanding
how pressure varies and its impact on Mars missions.
Scatter plot
Scatter Plot: Pressure vs Minimum Temperature
cleaneddata |> ggplot(mapping = aes(x = pressure, y =
mintemp, color = month)) + geompoint() + labs( title =
"Pressure vs Minimum Temperature", x = "Atmospheric Pressure (Pa)", y =
"Minimum Temperature (°C)" ) + thememinimal()
Insight
The scatter plot highlights a positive correlation between
atmospheric pressure and minimum temperature. This suggests that higher
pressures are generally associated with warmer temperatures. Further
analysis of outliers in this relationship could reveal extreme weather
events or anomalies