I have always been interested in the weather and how much it can change overtime whether its in a day or over a year. It can be quite unpredictable as meteorologist are sometimes very inaccurate. I think that is why I am fascinated by it since it can change so much and affect all of our lives everyday. I identified a data set and an API to analyse how the weather has changed overtime in Cincinnati. I am a big fan of nice weather especially when its warm and dry so this could help me decide whether I should live here long term. I am also curious to see if this data will support the many theories on climate change as this has been a big topic in recent times.
About the NOAA Data
The dataset is from the NOAA website or the National Oceanic and Atmospheric Administration. They have stations across the country that record weather and the station I got the data from was Lunken Airport. The data I took was from the start of 2015 to the end of 2024 so the last decade essentially. Each row is a day and certain things about the weather from that day such as temperature, wind, rain, and more. I have attached a link with a data dictionary and highlighted the attributes in my data as each station collects different statistics. https://myxavier-my.sharepoint.com/:b:/g/personal/pennellim_xavier_edu/EcHIt6C4rHRMvR3sWSGw96wBuLeZBs3HiHyG3AKgsqkaEA?e=RrbLFU
I have included some summary statistics here just to give examples of what data this dataset records. There have been 257 days where there has been a thunderstorm in the last decade. The next two tables show the top 10 rainiest and windiest days in the last decade. Precipitation is recorded in inches while wind is in MPH. Lastly, you have the hottest and coldest temperature recorded in the last decade with the average temperature across the decade. Cincinnati can get extremely hot and cold which makes it a unique city at least compared to the rest of the country.
Analysis With NOAA Data
This graph shows the average temperature over the last decade. I added a new column of average temperature by taking the average between the max and min temperature for that day. It seems it has been consistent aside from decent increase over the last 2 years. I am surprised it has not gone up more but these last few years have been hot nevertheless.
This graph shows the total amount of rain each year in inches. Meteorologists have said that with the increase in temperature due to climate change it could increase the water vapor or moisture in the air. With more water vapor in the air, this in turn will increase rainfall. Since the temperature has not gone up neither should rain according to their logic. Looking at the graph we have not gotten much rain in the last few years especially compared to 2018 or 2019.
This graph shows the relationship between the average temperature and the amount of precipitation in inches. There does not seem to be a positive relationship between the two. This means the warmer it is does not necessarily means it rains in larger amounts or more often. Even though a warmer atmosphere may have the ability to carry more water vapor or the water cycle speeds up, it still rains a lot in the Winter. This can obviously be very different across the country but for Cincinnati hotter temperatures does not mean there is more rain.
Here is a graph of the total number of days thunder occurred each year. As said previously a rise in temperature could create more moisture in the air which is what thunderstorms need to form. There have been a lot of thunder in the last 5 years compared to the 5 years prior to that. The temperature was a lot higher in 2023 and 2024 so that may have contributed to that but we can’t be certain.
I have added a graph with wind and in particular the number of days each year where average wind speed was over 10mph. Some scientists have claimed that climate change has caused more storms which would obviously increase windy days. There is no such increase here though in windy days. Wind also affects other things such as how fast storms move or cold and warm air fronts. It can also cause more erosion as it sweeps particles from one area to another and tree damage as we know. So, since the windy days have not increased at least from this data that is good from an environmental perspective.
Weather API and Analysis
For my secondary source of data I went out and found an API on the web called the Weather API. The link to the website is here: https://www.weatherapi.com/
You can get data from this API for free once you create an account and obtain a key that they give you. You will have to pay a subscription fee though as you want to get more data as I have done. I have collected the last 10 years of weather information from each day so that I can compare it to the prior dataset. It has very similar variables to the other dataset but in addition has average humidity and snowfall records which I will show in the next few graphs.
This is the same as the first graph show for the NOAA analysis but with data from the API. As you can see there is a little variability in temperature since they may have collected data from a different location in Cincinnati. Nevertheless it is almost the same as the NOAA data which boosts its credibility.
Here we see humidity on average has not changed much over the last decade and has decreased if anything. We do have quite a few outliers in terms of low humidity days especially in 2019. So even with warmer temperatures especially in the last few years humidity has not risen. Warmer air can hold more water vapor or humidity but as shown here that doesn’t mean it will actually happen.
This graph shows the relationship between average temperature and humidity. There is not too strong of a positive relationship here as the line of best fit is quite flat. So, as temperature rises that does not mean humidity will rise as well. This line of best fit is similar to the one between temperature and precipitation in one of the previous graphs. It seems temperature really doesn’t have an affect on rain or humidity at least in Cincinnati.
This graph shows the total snow fall each year in inches. If you look at the temperature graph previously it matches to that quite well. For example, 2015 had a cold average temperature compared to recent years and they had a lot of snow that year. The same goes for the last 2 years with little snow and a much higher average temperature. It is interesting how volatile the snowfall has been over the last few years with no true pattern. There have been many Winters that were not bad but you could also be in for a surprise with lots of snow too some years.
Conclusion
Overall, the weather can be very unpredictable and not necessarily have a clear pattern as seen in many of these visuals. For those that believe strongly in climate change and global warming the data here does not necessarily support this. Temperatures and thunderstorms have grown slightly in years while humidity and rain have not. This analysis only covers Cincinnati of course so there may be other cities with data that support climate change more. There is no clear relationship between temperature and humidity or rain which is quite interesting. My guess is this would definitely change in other parts of the country but unfortunately this data only covers Cincinnati. Lastly, Cincinnati has very cold winters looking at the temperatures with consistent snowfall every year. This snowfall has lots of variability throughout the years. So, if you love warm weather like myself you may want to rethink living in Cincinnati.
Source Code
---title: "Final Project"author: "Marco Pennelli"editor: visualtoc: true # Generates an automatic table of contents.format: # Options related to formatting. html: # Options related to HTML output. code-tools: TRUE # Allow the code tools option showing in the output. embed-resources: TRUE # Embeds all components into a single HTML file. execute: # Options related to the execution of code chunks. warning: FALSE # FALSE: Code chunk sarnings are hidden by default. message: FALSE # FALSE: Code chunk messages are hidden by default. echo: FALSE---## IntroductionI have always been interested in the weather and how much it can change overtime whether its in a day or over a year. It can be quite unpredictable as meteorologist are sometimes very inaccurate. I think that is why I am fascinated by it since it can change so much and affect all of our lives everyday. I identified a data set and an API to analyse how the weather has changed overtime in Cincinnati. I am a big fan of nice weather especially when its warm and dry so this could help me decide whether I should live here long term. I am also curious to see if this data will support the many theories on climate change as this has been a big topic in recent times.## About the NOAA DataThe dataset is from the NOAA website or the National Oceanic and Atmospheric Administration. They have stations across the country that record weather and the station I got the data from was Lunken Airport. The data I took was from the start of 2015 to the end of 2024 so the last decade essentially. Each row is a day and certain things about the weather from that day such as temperature, wind, rain, and more. I have attached a link with a data dictionary and highlighted the attributes in my data as each station collects different statistics. <https://myxavier-my.sharepoint.com/:b:/g/personal/pennellim_xavier_edu/EcHIt6C4rHRMvR3sWSGw96wBuLeZBs3HiHyG3AKgsqkaEA?e=RrbLFU>To access the dataset itself the link is here <https://myxavier-my.sharepoint.com/:x:/g/personal/pennellim_xavier_edu/Ee1fUThHgpxDokzblRoPlGMBJbdBTTakw67b3gq8_EfOmQ?download=1>```{r, results='hide'}library(tidyverse) # All the tidy thingslibrary(jsonlite) # Converting json data into data frameslibrary(magrittr) # Extracting items from list objects using piping grammarlibrary(httr) # Interacting with HTTP verbsread_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/pennellim_xavier_edu/Ee1fUThHgpxDokzblRoPlGMBJbdBTTakw67b3gq8_EfOmQ?download=1")new_data <- read_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/pennellim_xavier_edu/Ee1fUThHgpxDokzblRoPlGMBJbdBTTakw67b3gq8_EfOmQ?download=1")## seperare the date columnnew_data <- new_data %>% separate(DATE, into = c("month", "day", "year"), sep = "/", remove = FALSE)## change month from numbers to wordsnew_data <- new_data %>% mutate( month = month.name[as.integer(month)] )## create average temperature columnnew_data <- new_data %>% mutate(avg_temp = (TMIN + TMAX) / 2)``````{r}new_data %>%summarize(number_of_thunderstorms =sum(WT03, na.rm =TRUE))new_data %>%arrange(desc(PRCP))%>%slice_head(n=10) %>%select(PRCP,DATE)new_data %>%arrange(desc(AWND))%>%slice_head(n=10) %>%select(AWND,DATE)new_data %>%summarize(max_temp =max(TMAX),min_temp =min(TMIN),avg_temp =mean(avg_temp))```I have included some summary statistics here just to give examples of what data this dataset records. There have been 257 days where there has been a thunderstorm in the last decade. The next two tables show the top 10 rainiest and windiest days in the last decade. Precipitation is recorded in inches while wind is in MPH. Lastly, you have the hottest and coldest temperature recorded in the last decade with the average temperature across the decade. Cincinnati can get extremely hot and cold which makes it a unique city at least compared to the rest of the country.## Analysis With NOAA Data```{r}new_data %>%group_by(year) %>%summarize(avg_temp =mean(avg_temp)) %>%ggplot(aes(x=year, y =avg_temp)) +geom_col(aes(fill = avg_temp)) +labs(title ="Average Temperature by Year ") +scale_fill_gradient(low ="pink", high ="red")+geom_text(aes(label =round(avg_temp,1)), stat ="summary", fun = mean, vjust =-0.5, color ="black", size =3.4) ```This graph shows the average temperature over the last decade. I added a new column of average temperature by taking the average between the max and min temperature for that day. It seems it has been consistent aside from decent increase over the last 2 years. I am surprised it has not gone up more but these last few years have been hot nevertheless.```{r}new_data %>%group_by(year) %>%filter(TMIN >30)%>%summarize(total_rain =sum(PRCP,na.rm =TRUE)) %>%ggplot(aes(x=year, y =total_rain)) +geom_col(aes(fill = total_rain)) +labs(title ="Total Rain By Year ",y ="Inches") +scale_fill_gradient(low ="light green", high ="darkgreen")+geom_text(aes(label =round(total_rain,1)), stat ="summary", fun = mean, vjust =-0.5, color ="black", size =3.4)```This graph shows the total amount of rain each year in inches. Meteorologists have said that with the increase in temperature due to climate change it could increase the water vapor or moisture in the air. With more water vapor in the air, this in turn will increase rainfall. Since the temperature has not gone up neither should rain according to their logic. Looking at the graph we have not gotten much rain in the last few years especially compared to 2018 or 2019.```{r}new_data %>%filter(PRCP >0, TMIN >32)%>%ggplot(aes(x = avg_temp, y = PRCP)) +geom_point() +geom_smooth(method="lm")+labs(title ="Relationship between Temperature and Precipitation",y ="Rain in Inches")```This graph shows the relationship between the average temperature and the amount of precipitation in inches. There does not seem to be a positive relationship between the two. This means the warmer it is does not necessarily means it rains in larger amounts or more often. Even though a warmer atmosphere may have the ability to carry more water vapor or the water cycle speeds up, it still rains a lot in the Winter. This can obviously be very different across the country but for Cincinnati hotter temperatures does not mean there is more rain.```{r}new_data %>%group_by(year) %>%summarize(number_of_days =sum(WT03,na.rm =TRUE)) %>%ggplot(aes(x=year, y =number_of_days)) +geom_col(aes(fill = number_of_days)) +labs(title ="Number of Thunderstorms By Year ",y ="Number of Days") +scale_fill_gradient(low ="gray", high ="gray40")+geom_text(aes(label =round(number_of_days,1)), stat ="summary", fun = mean, vjust =-0.5, color ="black", size =3.4)```Here is a graph of the total number of days thunder occurred each year. As said previously a rise in temperature could create more moisture in the air which is what thunderstorms need to form. There have been a lot of thunder in the last 5 years compared to the 5 years prior to that. The temperature was a lot higher in 2023 and 2024 so that may have contributed to that but we can't be certain.```{r}new_data %>%filter(AWND >10) %>%mutate(day =as.numeric(day)) %>%group_by(year) %>%summarise(num_days =n_distinct(day)) %>%ggplot(aes(x=year, y =num_days)) +geom_col(aes(fill = num_days)) +labs(title ="Number of Days Where Average Wind Speed >10MPH by Year",y ="Number of Days") +scale_fill_gradient(low ="tan", high ="orange")+geom_text(aes(label =round(num_days,1)), vjust =-0.5, color ="black", size =3.4)```I have added a graph with wind and in particular the number of days each year where average wind speed was over 10mph. Some scientists have claimed that climate change has caused more storms which would obviously increase windy days. There is no such increase here though in windy days. Wind also affects other things such as how fast storms move or cold and warm air fronts. It can also cause more erosion as it sweeps particles from one area to another and tree damage as we know. So, since the windy days have not increased at least from this data that is good from an environmental perspective.## Weather API and AnalysisFor my secondary source of data I went out and found an API on the web called the Weather API. The link to the website is here: <https://www.weatherapi.com/>You can get data from this API for free once you create an account and obtain a key that they give you. You will have to pay a subscription fee though as you want to get more data as I have done. I have collected the last 10 years of weather information from each day so that I can compare it to the prior dataset. It has very similar variables to the other dataset but in addition has average humidity and snowfall records which I will show in the next few graphs.```{r, results='hide'}read_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/pennellim_xavier_edu/EY2bNU_d54NIg0KOMdLif8IBqx7DJGluGkVyc3j8PEdAHg?download=1")Weather_API_data <- read_csv("https://myxavier-my.sharepoint.com/:x:/g/personal/pennellim_xavier_edu/EY2bNU_d54NIg0KOMdLif8IBqx7DJGluGkVyc3j8PEdAHg?download=1")Weather_API_data <- Weather_API_data %>% separate(date, into = c("year", "month", "day"), sep = "-", remove = FALSE)Weather_API_data <- Weather_API_data %>% mutate(month = month.name[as.integer(month)])``````{r}Weather_API_data %>%group_by(year) %>%summarize(avg_temp =mean(day_avgtemp_f)) %>%ggplot(aes(x=year, y =avg_temp)) +geom_col(aes(fill = avg_temp)) +labs(title ="Average Temperature by Year ") +scale_fill_gradient(low ="pink", high ="red")+geom_text(aes(label =round(avg_temp,1)), stat ="summary", fun = mean, vjust =-0.5, color ="black", size =3.4)```This is the same as the first graph show for the NOAA analysis but with data from the API. As you can see there is a little variability in temperature since they may have collected data from a different location in Cincinnati. Nevertheless it is almost the same as the NOAA data which boosts its credibility.```{r}Weather_API_data %>%ggplot(aes(x = year, y = day_avghumidity)) +geom_boxplot() +labs(title ="Distribution of Average Humidity by Year")+scale_y_continuous(breaks =seq(0,100, by =10))```Here we see humidity on average has not changed much over the last decade and has decreased if anything. We do have quite a few outliers in terms of low humidity days especially in 2019. So even with warmer temperatures especially in the last few years humidity has not risen. Warmer air can hold more water vapor or humidity but as shown here that doesn't mean it will actually happen.```{r}Weather_API_data %>%ggplot(aes(x = day_avgtemp_f, y = day_avghumidity)) +geom_point() +geom_smooth(method="lm")+labs(title ="Relationship between Average Temperature and Humidity",y ="Humidity")```This graph shows the relationship between average temperature and humidity. There is not too strong of a positive relationship here as the line of best fit is quite flat. So, as temperature rises that does not mean humidity will rise as well. This line of best fit is similar to the one between temperature and precipitation in one of the previous graphs. It seems temperature really doesn't have an affect on rain or humidity at least in Cincinnati.```{r}Weather_API_data %>%group_by(year)%>%summarize(total_snow =sum(day_totalsnow_cm,na.rm =TRUE)*.394) %>%ggplot(aes(x=year, y =total_snow)) +geom_col(aes(fill = total_snow)) +labs(title ="Total Snowfall By Year ",y ="Inches") +scale_fill_gradient(low ="skyblue", high ="blue")+geom_text(aes(label =round(total_snow,1)), stat ="summary", fun = sum, vjust =-0.5, color ="black", size =3.4)```This graph shows the total snow fall each year in inches. If you look at the temperature graph previously it matches to that quite well. For example, 2015 had a cold average temperature compared to recent years and they had a lot of snow that year. The same goes for the last 2 years with little snow and a much higher average temperature. It is interesting how volatile the snowfall has been over the last few years with no true pattern. There have been many Winters that were not bad but you could also be in for a surprise with lots of snow too some years.## ConclusionOverall, the weather can be very unpredictable and not necessarily have a clear pattern as seen in many of these visuals. For those that believe strongly in climate change and global warming the data here does not necessarily support this. Temperatures and thunderstorms have grown slightly in years while humidity and rain have not. This analysis only covers Cincinnati of course so there may be other cities with data that support climate change more. There is no clear relationship between temperature and humidity or rain which is quite interesting. My guess is this would definitely change in other parts of the country but unfortunately this data only covers Cincinnati. Lastly, Cincinnati has very cold winters looking at the temperatures with consistent snowfall every year. This snowfall has lots of variability throughout the years. So, if you love warm weather like myself you may want to rethink living in Cincinnati.