{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#
Analyse de la concentration de CO2,
" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import datetime\n", "from scipy import interpolate\n", "from IPython.core.interactiveshell import InteractiveShell\n", "InteractiveShell.ast_node_interactivity = \"all\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Nous récupérons les données les plus récentes sur le site en pointant sur un fichier au format .csv, si cette récupération est possible nous enregistrons une copie de ce fichier. Si pour une raison quelconque nous n'arrivons pas a faire ce téléchargement, nous travaillons sur le dernières données téléchargé." ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Erreur lors du téléchargement : \n", "Nous téléchargeons les dernières données enregistrer sur notre PC\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0Excel[ppm][ppm][ppm][ppm][ppm][ppm].1
0019581212001958.0411-99.99-99.99-99.99-99.99-99.99-99.99
1119582212311958.1260-99.99-99.99-99.99-99.99-99.99-99.99
2219583212591958.2027315.70314.44316.19314.91315.70314.44
3319584212901958.2877317.45315.16317.30314.99317.45315.16
4419585213201958.3699317.51314.71317.86315.06317.51314.71
\n", "
" ], "text/plain": [ " Unnamed: 0 Excel [ppm] [ppm] \\\n", "0 0 1958 1 21200 1958.0411 -99.99 -99.99 \n", "1 1 1958 2 21231 1958.1260 -99.99 -99.99 \n", "2 2 1958 3 21259 1958.2027 315.70 314.44 \n", "3 3 1958 4 21290 1958.2877 317.45 315.16 \n", "4 4 1958 5 21320 1958.3699 317.51 314.71 \n", "\n", " [ppm] [ppm] [ppm] [ppm].1 \n", "0 -99.99 -99.99 -99.99 -99.99 \n", "1 -99.99 -99.99 -99.99 -99.99 \n", "2 316.19 314.91 315.70 314.44 \n", "3 317.30 314.99 317.45 315.16 \n", "4 317.86 315.06 317.51 314.71 " ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Unnamed: 0Excel[ppm][ppm][ppm][ppm][ppm][ppm].1
75175120208440582020.6230-99.99-99.99-99.99-99.99-99.99-99.99
75275220209440892020.7077-99.99-99.99-99.99-99.99-99.99-99.99
753753202010441192020.7896-99.99-99.99-99.99-99.99-99.99-99.99
754754202011441502020.8743-99.99-99.99-99.99-99.99-99.99-99.99
755755202012441802020.9563-99.99-99.99-99.99-99.99-99.99-99.99
\n", "
" ], "text/plain": [ " Unnamed: 0 Excel [ppm] [ppm] \\\n", "751 751 2020 8 44058 2020.6230 -99.99 -99.99 \n", "752 752 2020 9 44089 2020.7077 -99.99 -99.99 \n", "753 753 2020 10 44119 2020.7896 -99.99 -99.99 \n", "754 754 2020 11 44150 2020.8743 -99.99 -99.99 \n", "755 755 2020 12 44180 2020.9563 -99.99 -99.99 \n", "\n", " [ppm] [ppm] [ppm] [ppm].1 \n", "751 -99.99 -99.99 -99.99 -99.99 \n", "752 -99.99 -99.99 -99.99 -99.99 \n", "753 -99.99 -99.99 -99.99 -99.99 \n", "754 -99.99 -99.99 -99.99 -99.99 \n", "755 -99.99 -99.99 -99.99 -99.99 " ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "try:\n", " raw_data = pd.read_csv(\"https://scrippsco.ucsd.edu/assets/data/atmospheric/stations/\"\n", " \"in_situ_co2/monthly/monthly_in_situ_co2_mlo.csv\",skiprows=56)\n", "except OSError as err:\n", " print(\"Erreur lors du téléchargement : {0}\".format(err))\n", " print(\"Nous téléchargeons les dernières données enregistrer sur notre PC\")\n", " raw_data = pd.read_csv(\"monthly_in_situ_co2_mlo\")\n", "except:\n", " print(\"Unexpected error:\", sys.exc_info()[0])\n", " raise\n", "else:\n", " raw_data.to_csv('monthly_in_situ_co2_mlo',index=True)\n", "\n", "raw_data.head(5)\n", "raw_data.tail(5)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }