{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"\n",
""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Climatograph\n",
"\n",
"A climatograph (or [climograph](https://en.wikipedia.org/wiki/Climograph)) is a visualization of the monthly average [precipitation](https://simple.wikipedia.org/wiki/Precipitation) and [temperature](https://simple.wikipedia.org/wiki/Temperature) at a particular location to show the climate there.\n",
"\n",
"In this notebook we are using climate data from [The World Bank](https://www.worldbank.org/en/about/legal/terms-of-use-for-datasets) because we are [allowed to share and remix](https://creativecommons.org/licenses/by/4.0/) their content.\n",
"\n",
"Select the next cell and click the `▶Run` button to import the code libraries that we will use."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: geopy in /home/mikel/anaconda3/lib/python3.7/site-packages (2.0.0)\n",
"Requirement already satisfied: geographiclib<2,>=1.49 in /home/mikel/anaconda3/lib/python3.7/site-packages (from geopy) (1.50)\n",
"Libraries successfully imported.\n"
]
}
],
"source": [
"!pip install geopy\n",
"import pandas as pd\n",
"import plotly.graph_objs as go\n",
"import numpy as np\n",
"from geopy.geocoders import Nominatim\n",
"geolocator = Nominatim(user_agent='Callysto Climatograph')\n",
"print('Libraries successfully imported.')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Data\n",
"\n",
"In the following cell, change the city or town name in `location = 'Calgary, AB'` to something like `location = 'Honolulu'`.\n",
"\n",
"You can also change `year = 2016` to any year between `1991` and `2016`.\n",
"\n",
"`Run` the cell to get and show the data."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n", " | Precipitation (mm) | \n", "Temperature (°C) | \n", "
---|---|---|
Month | \n", "\n", " | \n", " |
Jan | \n", "16.463793 | \n", "-8.776923 | \n", "
Feb | \n", "13.843966 | \n", "-6.119231 | \n", "
Mar | \n", "22.156035 | \n", "-2.688462 | \n", "
Apr | \n", "35.161207 | \n", "3.015385 | \n", "
May | \n", "62.089656 | \n", "8.023077 | \n", "
Jun | \n", "96.690519 | \n", "11.803846 | \n", "
Jul | \n", "64.767242 | \n", "15.165385 | \n", "
Aug | \n", "58.593966 | \n", "14.300000 | \n", "
Sep | \n", "44.335346 | \n", "10.061539 | \n", "
Oct | \n", "21.901724 | \n", "4.261539 | \n", "
Nov | \n", "19.450000 | \n", "-2.792308 | \n", "
Dec | \n", "15.482759 | \n", "-7.769231 | \n", "