This project aims to comprehensively examine the factors contributing to global warming by analyzing a diverse dataset of global surface temperature measurements, atmospheric CO2 concentrations, volcanic activity, and solar irradiance over various timescales. By employing robust statistical methods and data visualization techniques, we will explore the relationships between these variables to discern whether human-made factors, particularly increased CO2 emissions, are the primary drivers of observed global temperature increases
- Determine temperature trends at distinct geographical locations.
- Calculate and analyze the global surface average temperature variation over time.
- Investigate the correlation between levels of CO2 and temperature patterns.
- Explore the potential impact of volcanic eruptions on global surface temperature changes.
- Examine the influence of solar irradiance activity on variations in global surface temperature.
Libraries Used
import pandas as pd
import numpy as np
import netCDF4 as nc
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.lines import Line2D
import matplotlib as mplt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import PIL
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import KFold
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error
Monthly Temperature data for each latitude and longitude from year 1880-2023 is present in a grided form in .netcdf file. We need to extract data for specific cities from this .netcdf file for all the years. Below steps are followed :
- Extract Temperature, latitude and longitude present in .netcdf file.
- Actual latitude and longitude for each city are different than those present in .netcdf file. Hence we need to compute square distance between each latitude and longitude of respective city and find the nearest co-ordinate.
- Extract data for that city and add it in final dataframe.
- Repeat above step till data for each city is extracted and present in final dataframe.
- Final dataframe will contain Date, city, temperature, actual latitude, actual longitude, Nearest latitude, Nearest longitude and country column.
Note: Grided Form means latitude and longitude are divided into a sequence from max to min values. For e.g. latitude range from -90 to +90. Then it will be present as -90, -88, -86,....., +86, +88, +90.
Below is the Final extracted dataset obtained.
The GIF depicts the mean land surface temperature for 12 months as line on the polar scale. Each line indicates mean temperature of a respective year with inner most line indicating year 1880 and outer most as year 2022.
Below figure depicts a line graph with mean land temperature on y-axis and Year on x-axis.
Above figures indicate a noticeable increase in mean land surface temperatures from 1880 to 2022. The temperature range rose from -0.35°C to 1.3°C over a 42-year span which signifies a significant 471% temperature increase during this period.
We repeat the same procedure mentioned above (Land Surface Temperature) to extract temperature data for Ocean surface.
The above figure depicts the rise in annual mean ocean surface temperatures.The initial temperature in 1880 was approximately -0.19°C and by the year 2022, the final temperature had risen to around 1.53°C.
In summary, both land and ocean surface temperature data plots exhibit a consistent rise in temperatures over the years. The land surface temperature experienced a substantial increase, while the ocean surface temperature similarly showed an upward trend.
First load the yearwise atmospheric Carbon dioxide emission data and visualize the data using barplot to observe its trend.
The atmospheric carbon dioxide (CO2) levels have exhibited a consistent upward trend over the course of time. The initial recorded atmospheric CO2 concentration in the year 1959 was 315.98 parts per million (ppm), while in the year 2022, it was measured to be 418.56 ppm.
Since CO2 levels in the atmosphere have been steadily rising, let's investigate if this has anything to do with the increase in temperature.
We now calculate the correlation between mean land surface temperature and CO2 levels over a common range of years to assess their relationship. This is done by combining temperature and CO2 datasets using inner merge.
The above scatter plot with temperature on the x-axis and CO2 levels on the y-axis, where each point is colored based on the year. It also adds a regression line to the plot which indicates the trajectory of linear relationship. It reveals a significant positive correlation between the two, substantiated by a Pearson correlation coefficient of 0.951. This coefficient indicates a strong linear relationship between the two variables, suggesting that as CO2 concentrations increase, there is a corresponding elevation in temperature levels.
Volcanic eruptions release a significant amount of natural CO2 into the atmosphere. We examine how much of the total atmospheric CO2 comes from volcanic emissions.
The substantial volume of CO2 emissions has reached a level where sensors struggle to differentiate between CO2 originating from volcanic sources and CO2 generated by human activities. As a consequences, there is currently a lack of available data specifically attributing CO2 emissions to volcanic sources. Hence we conducted a data modelling procedure to derive estimations of CO2 emissions originating from volcanic activities.
Sulphur dioxide is the second most prevalent gas emitted during volcanic eruptions. Each volcano has a unique CO2/SO2 ratio, allowing us to estimate the amount of carbon dioxide (CO2) released during an eruption.
The discovered dataset includes a CS ratio (carbon dioxide to sulphur dioxide ratio) for each volcano, but there are some missing values for CS. A separate dataset holds volcanic details like explosivity, type, primary rock compositions, elevation, tectonic context, and sulphur dioxide levels. We will utilize this information to predict and fill in missing CS ratios for corresponding records without these values.
We examined three different machine learning methods – linear regression, random forest, and support vector machine – to predict missing CS ratios. Among these, the random forest regression performed the best, showing a lower RMSE (Root Mean Squared Error) of 1.33. This means the predicted values were closer to the actual ones.
Below are the steps involved in model evaluation and prediction :
-
Data Collection and Integration: Merge two datasets - one containing CS ratio and SO2 values, and the other with various attributes of volcanoes.
-
Data Preprocessing: Standardize the data and split it into training, validation, and test sets based on available CS values.
-
Model Development and Training: Develop a Random Forest regression model. Train this model using the training and validation datasets, implementing K-folds cross-validation to enhance performance.
-
Model Evaluation: Evaluate the model's predictive accuracy by calculating the Root Mean Squared Error (RMSE) on the validation dataset (RMSE = 1.33).
-
Prediction and Volcanic CO2 Calculation: Apply the trained model to predict CS values for the test data. Estimate volcanic CO2 emissions by multiplying predicted CS ratios with corresponding SO2 values (measured in Kilotons).
-
Conversions and Visualizations: Convert volcanic CO2 emissions (Kilotons) and atmospheric CO2 levels (Parts per million) into Gigatons for better scale. Visualize the data to gain insights and understanding.
In summary, through merging datasets, training a Random Forest regression model, and evaluating its performance, we predicted missing CS ratios. This information was then used to estimate volcanic CO2 emissions. The chosen algorithm, Random Forest, yielded promising results with an RMSE of 1.33.
It is evident from the plot that atmospheric CO2 levels are significantly higher than volcanic CO2 emissions. Atmospheric CO2 levels have been steadily increasing over the years, while volcanic CO2 emissions remain relatively stable. Hence Volcanic CO2 is not the major factor in rising atmospheric CO2 levels.
Solar irradiance refers to the amount of solar energy received per unit area at a specific location on Earth's surface. It is a measure of the intensity of sunlight reaching a particular area and is typically expressed in watts per square meter (W/m²). Solar irradiance plays a crucial role in understanding and predicting various natural processes, including climate patterns, energy generation from solar panels, and environmental impacts.
Lets examine the potential influence of solar irradiance activity as an additional natural factor contributing to the observed rise in temperature.
We choose a dataset with yearly total solar irradiance measured in W/m^2 from year 1660-2022.
The scatter plot portrays temperature on the x-axis and Total Solar Irradiance (TSI) on the y-axis. A regression line is incorporated to display the direction of linear relationship. The plot displays a low positive correlation, as supported by a Pearson correlation coefficient of 0.345. This coefficient indicates a weak linear association, implying that with increasing TSI values, there is a minor increase in global temperature.
Based on the analysis, since we observe a low positive correlation between the two, we can observe increased solar activity aligns with temperature rise. There are Instances of divergence i.e. the temperature fluctuations do not match the solar irradiance activity variations which suggest that solar activity isn't major factor in temperature changes. This can be observed in the year 1980, where we notice a separation between the temperature line and the solar irradiance line. This indicates that these two factors are not strongly linked or correlated with each other. The variations in the amount of solar energy (irradiance) reaching the Earth's surface have a limited and relatively small impact on causing changes in temperature over longer periods. Overall correlation doesn't fully explain recent temperature rise.
We need further research to precisely quantify solar influence on long-term temperature trends.
After a comprehensive analysis of the data, it becomes apparent that volcanic eruptions and solar irradiance variations are not the main drivers of the temperature increase. While these natural factors do have some influence, their impact on temperature changes seems to be relatively small. Therefore, we can deduce that the primary cause of the temperature rise is the CO2 emissions resulting from human activities.
-
Study to figure out how much human activities contribute to the changes in temperature we see. Look into things like how much greenhouse gases we release, changes in how we use land, and other factors that might play a role.
-
Look closely at really extreme weather events, like heatwaves and hurricanes, and see if they match up with changes in temperature over time. Check if these events are happening more often or getting stronger in recent years.
-
Take a broader look at what global warming means for our society and economy. Consider things like how it affects our ability to make money, where people live and move, and the health of the public.
-
Check how well different plans to reduce the problem, like cutting down on pollution or using more clean energy, actually work. See if these strategies can change the trends in temperature and levels of CO2 in the air.
-
Use past temperature and CO2 data to make educated guesses about what might happen in the future. Think about different situations, like if we keep polluting at the same rate or if we make big changes, and what the outcomes could be.
- Surface Temperature : NASA GISS
- Atmospheric CO2 : GML NOAA
- Volcanic SO2 : NASA GES DISC
- Volcano Eruption Details : Global Volcanism Program
- Total Solar Irradiance : NCEI NOAA
-
CO₂ and Greenhouse Gas Emissions by Hannah Ritchie, Max Roser and Pablo Rosado This article was first published in May 2017; last revised in August 2020.
-
The emissions of CO2 and other volatiles from the world’s subaerial volcanoes by Tobias P. Fischer, Santiago Arellano, Simon Carn, Alessandro Aiuppa, Bo Galle, Patrick Allard, Taryn Lopez, Hiroshi Shinohara, Peter Kelly, Cynthia Werner, Carlo Cardellini & Giovanni Chiodini
- pip install --upgrade spacepy
- Download CDF C library from "https://cdf.gsfc.nasa.gov/html/sw_and_docs.html" (Check 32 or 64 bit)
- Create a new folder in "C" drive as "CDF" and paste all the data in this folder (after unzipping the downloaded file)
- Set environment variables (in system variables tab) -->
- CDF_LIB --> C:\CDF\bin
- CDF_HOME --> C:\CDF
- Import library using "from spacepy import pycdf" command