{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Subject 1: CO2 concentration in the atmosphere since 1958" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "import isoweek" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "data_url = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\"" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "data_file = \"weekly_in_situ_co2.csv\"\n", "\n", "import os\n", "import urllib.request\n", "if not os.path.exists(data_file):\n", " urllib.request.urlretrieve(data_url, data_file)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "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", " \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", " \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", " \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", "
DateConcentration
01958-03-29316.19
11958-04-05317.31
21958-04-12317.69
31958-04-19317.58
41958-04-26316.48
51958-05-03316.95
61958-05-17317.56
71958-05-24317.99
81958-07-05315.85
91958-07-12315.85
101958-07-19315.46
111958-07-26315.59
121958-08-02315.64
131958-08-09315.10
141958-08-16315.09
151958-08-30314.14
161958-09-06313.54
171958-11-08313.05
181958-11-15313.26
191958-11-22313.57
201958-11-29314.01
211958-12-06314.56
221958-12-13314.41
231958-12-20314.77
241958-12-27315.21
251959-01-03315.24
261959-01-10315.50
271959-01-17315.69
281959-01-24315.86
291959-01-31315.42
.........
33282023-06-10424.01
33292023-06-17422.93
33302023-06-24422.21
33312023-07-01422.80
33322023-07-08422.32
33332023-07-15421.43
33342023-07-22420.74
33352023-07-29420.88
33362023-08-05420.39
33372023-08-12420.30
33382023-08-19418.96
33392023-08-26418.84
33402023-09-02418.50
33412023-09-09418.28
33422023-09-16418.52
33432023-09-23417.77
33442023-09-30417.89
33452023-10-07418.10
33462023-10-14418.82
33472023-10-21418.85
33482023-10-28418.62
33492023-11-04419.07
33502023-11-11419.41
33512023-11-18421.18
33522023-11-25421.22
33532023-12-02420.28
33542023-12-09421.23
33552023-12-16422.57
33562023-12-23422.06
33572023-12-30421.76
\n", "

3358 rows × 2 columns

\n", "
" ], "text/plain": [ " Date Concentration\n", "0 1958-03-29 316.19\n", "1 1958-04-05 317.31\n", "2 1958-04-12 317.69\n", "3 1958-04-19 317.58\n", "4 1958-04-26 316.48\n", "5 1958-05-03 316.95\n", "6 1958-05-17 317.56\n", "7 1958-05-24 317.99\n", "8 1958-07-05 315.85\n", "9 1958-07-12 315.85\n", "10 1958-07-19 315.46\n", "11 1958-07-26 315.59\n", "12 1958-08-02 315.64\n", "13 1958-08-09 315.10\n", "14 1958-08-16 315.09\n", "15 1958-08-30 314.14\n", "16 1958-09-06 313.54\n", "17 1958-11-08 313.05\n", "18 1958-11-15 313.26\n", "19 1958-11-22 313.57\n", "20 1958-11-29 314.01\n", "21 1958-12-06 314.56\n", "22 1958-12-13 314.41\n", "23 1958-12-20 314.77\n", "24 1958-12-27 315.21\n", "25 1959-01-03 315.24\n", "26 1959-01-10 315.50\n", "27 1959-01-17 315.69\n", "28 1959-01-24 315.86\n", "29 1959-01-31 315.42\n", "... ... ...\n", "3328 2023-06-10 424.01\n", "3329 2023-06-17 422.93\n", "3330 2023-06-24 422.21\n", "3331 2023-07-01 422.80\n", "3332 2023-07-08 422.32\n", "3333 2023-07-15 421.43\n", "3334 2023-07-22 420.74\n", "3335 2023-07-29 420.88\n", "3336 2023-08-05 420.39\n", "3337 2023-08-12 420.30\n", "3338 2023-08-19 418.96\n", "3339 2023-08-26 418.84\n", "3340 2023-09-02 418.50\n", "3341 2023-09-09 418.28\n", "3342 2023-09-16 418.52\n", "3343 2023-09-23 417.77\n", "3344 2023-09-30 417.89\n", "3345 2023-10-07 418.10\n", "3346 2023-10-14 418.82\n", "3347 2023-10-21 418.85\n", "3348 2023-10-28 418.62\n", "3349 2023-11-04 419.07\n", "3350 2023-11-11 419.41\n", "3351 2023-11-18 421.18\n", "3352 2023-11-25 421.22\n", "3353 2023-12-02 420.28\n", "3354 2023-12-09 421.23\n", "3355 2023-12-16 422.57\n", "3356 2023-12-23 422.06\n", "3357 2023-12-30 421.76\n", "\n", "[3358 rows x 2 columns]" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "raw_data = pd.read_csv(data_file, skiprows=44, names = ['Date', 'Concentration'])\n", "raw_data" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Visualizar el conjunto de datos\n", "plt.figure(figsize=(15, 6))\n", "plt.plot(raw_data['Date'], raw_data['Concentration'], label='CO2 Concentration')\n", "plt.title('CO2 Concentration Over Time')\n", "plt.xlabel('Year')\n", "plt.ylabel('CO2 Concentration (ppm)')\n", "plt.legend()\n", "plt.grid(True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Visualizar el conjunto de datos\n", "plt.figure(figsize=(15, 6))\n", "plt.plot(raw_data['Date'][-300:], raw_data['Concentration'][-300:], label='CO2 Concentration')\n", "plt.title('CO2 Concentration Over Time')\n", "plt.xlabel('Year')\n", "plt.ylabel('CO2 Concentration (ppm)')\n", "plt.legend()\n", "plt.grid(True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Cargar datos desde el archivo CSV local\n", "file_path = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\" # Reemplaza con la ruta correcta a tu archivo\n", "\n", "data_file_co2 = \"weekly_co2_in_situ_co2.csv\"\n", "\n", "import os\n", "import urllib.request\n", "if not os.path.exists(data_file):\n", " urllib.request.urlretrieve(file_path, data_file_co2)\n", "\n", "data_co2 = pd.read_csv(file_path, skiprows=44, sep=r'\\s+', engine='python', parse_dates=[0], index_col=[0])\n", "\n", "# Verificar los primeros registros de datos\n", "print(data_co2.head())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_co2_subset = data_co2.dropna()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Visualizar el conjunto de datos\n", "plt.figure(figsize=(15, 6))\n", "plt.plot(data_co2, label='CO2 Concentration')\n", "plt.title('CO2 Concentration Over Time')\n", "plt.xlabel('Year')\n", "plt.ylabel('CO2 Concentration (ppm)')\n", "plt.legend()\n", "plt.grid(True)\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Visualizar el conjunto de datos\n", "plt.figure(figsize=(15, 6))\n", "plt.plot(data_co2[-300:], label='CO2 Concentration')\n", "plt.title('CO2 Concentration Over Time')\n", "plt.xlabel('Year')\n", "plt.ylabel('CO2 Concentration (ppm)')\n", "plt.legend()\n", "plt.grid(True)\n", "plt.show()\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Subject 4: Latency and capacity estimation for a network connection from asymmetric measurements\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_url_latency_campus = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_file_campus = \"latency_campus.csv\"\n", "\n", "import os\n", "import urllib.request\n", "if not os.path.exists(data_file_campus):\n", " urllib.request.urlretrieve(data_url_latency_campus, data_file_campus)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "raw_data_campus = pd.read_csv(data_file_campus, skiprows=1)\n", "raw_data_campus" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_url_latency_remote = \"https://scrippsco2.ucsd.edu/assets/data/atmospheric/stations/in_situ_co2/weekly/weekly_in_situ_co2_mlo.csv\"" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "data_file_remote = \"latency_remote.csv\"\n", "\n", "import os\n", "import urllib.request\n", "if not os.path.exists(data_file):\n", " urllib.request.urlretrieve(data_url_latency_remote, data_file_remote)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "raw_data_remote = pd.read_csv(data_file_remote, skiprows=1)\n", "raw_data_remote" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n" ] } ], "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 }