resultb

parent 06787178
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
...@@ -7,36 +7,75 @@ ...@@ -7,36 +7,75 @@
"# Subject 1: CO2 concentration in the atmosphere since 1958" "# Subject 1: CO2 concentration in the atmosphere since 1958"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In 1958, Charles David Keeling initiated a measurement of the concentration of CO2 in the atmosphere at the Mauna Loa Observatory, Hawaii, United States which continues to this day. The initial goal was to study seasonal variation, but interest later shifted to studying the increasing trend in the context of climate change. In honor of Keeling, this dataset is often referred to as the \"Keeling Curve\" (see https://en.wikipedia.org/wiki/Keeling_Curve for the history and significance of this data).\n",
"\n",
"The data is available on the Scripps Institute website. We use the file with weekly observations. Please note, this file is updated regularly with new observations."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In this computational document the following is done:\n",
"\n",
"1. A graph is generated illustrating a periodic oscillation superimposed on a slower systematic evolution.\n",
"2. These two phenomena are separated. A simple, linear model is proposed for the slow contribution, its parameters are estimated and an extrapolation is attempted until 2025 (with the aim of validating the model through future observations). The periodic oscillation is characterized. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To process the data read and downloaded from the web, and obtain results, code in Python language is used importing the Python necessary libraries."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We start by importing the necessary Python libraries"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Importation des bibliothèques nécessaires\n", "# Importing the necessary libraries\n",
"%matplotlib inline\n", "%matplotlib inline\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"import pandas as pd\n", "import pandas as pd"
"import isoweek" ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Download the data from the website and save a local copy of the downloaded version"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 48,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Téléchargement et chargement des données\n", "# Downloading and loading data\n",
"data_url = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\"" "data_url = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\""
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 49,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"# Charger les données à partir d'un fichier CSV local\n", "# Load data from a local CSV file\n",
"data_file = \"weekly_in_situ_co2.csv\"\n", "data_file = \"weekly_in_situ_co2.csv\"\n",
"\n", "\n",
"import os\n", "import os\n",
...@@ -45,9 +84,17 @@ ...@@ -45,9 +84,17 @@
" urllib.request.urlretrieve(data_url, data_file)" " urllib.request.urlretrieve(data_url, data_file)"
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A first inspection of the data is carried out opening the .csv file and it is noted that the data, dates and CO2 concentrations, appear from line 44 in two columns.\n",
"The data in .csv format is loaded into a panda table taking into account the pre-inspection considerations and a first visualization of the columns is performed."
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 51,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -64,10 +111,10 @@ ...@@ -64,10 +111,10 @@
} }
], ],
"source": [ "source": [
"# Charger les données dans une table de pandas\n", "# Load data into a pandas table\n",
"# data = pd.read_csv(data_file, skiprows=44, sep=r'\\s+', engine='python', parse_dates=[0], index_col=[0], names = ['Date', 'Concentration'])\n", "# data = pd.read_csv(data_file, skiprows=44, sep=r'\\s+', engine='python', parse_dates=[0], index_col=[0], names = ['Date', 'Concentration'])\n",
"data = pd.read_csv(data_file, skiprows=44, sep=r'\\s+', engine='python', parse_dates=[0], names = ['Date', 'Concentration'])\n", "data = pd.read_csv(data_file, skiprows=44, sep=r'\\s+', engine='python', parse_dates=[0], names = ['Date', 'Concentration'])\n",
"# Affichage des premières lignes des données pour vérification\n", "# Displaying the first rows of data for verification\n",
"print(data.head())" "print(data.head())"
] ]
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment