kopia lustrzana https://github.com/anitagraser/ogd-at-lab
184 wiersze
4.4 KiB
Plaintext
184 wiersze
4.4 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Environmental Conditions in Vienna"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"[![Binder](http://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/anitagraser/ogd-at-lab/main?urlpath=lab/tree/notebooks/environment.ipynb)\n",
|
|
"\n",
|
|
"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import hvplot.pandas\n",
|
|
"import pandas as pd\n",
|
|
"import geopandas as gpd\n",
|
|
"from utils.dataaccess import get_gdf_from_wfs, get_airquality_df, get_heatvulnerabilityindex_gdf"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Urban Heat\n",
|
|
"\n",
|
|
"Dataset: [Urban Heat Vulnerability Index (UHVI)](https://www.data.gv.at/katalog/dataset/urban-heat-vulnerability-index-uhvi-wien)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"uhvi = get_heatvulnerabilityindex_gdf()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"uhvi.hvplot(geo=True, tiles='OSM', c='AVG_UHVI_A', title='Average Urban Heat Vulnerability Index - All age groups', cmap='Reds', alpha=0.7).opts(active_tools=['wheel_zoom'])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Air Quality\n",
|
|
"\n",
|
|
"Dataset: [Luftmessnetz: aktuelle Messdaten Wien](https://www.data.gv.at/katalog/dataset/luftmessnetz-aktuelle-messdaten-wien/)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"stations = get_gdf_from_wfs('LUFTGUETENETZOGD')\n",
|
|
"stations.set_index('NAME_KURZ', inplace=True)\n",
|
|
"stations.head()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"air_quality = get_airquality_df()\n",
|
|
"air_quality.head()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"col = 'airtemp °C'\n",
|
|
"stations = stations.join(air_quality).dropna(subset=[col])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"stations.hvplot(geo=True, tiles='StamenToner', c=col, size=500, title=col.title())"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"from holoviews.selection import link_selections"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"my_map = stations.hvplot(geo=True, tiles='CartoLight', c=col, cmap='Viridis', size=200, title=col.title(), width=400, height=250)\n",
|
|
"my_scatter = pd.DataFrame(stations).hvplot.scatter(x='airtemp °C', y='windspeed kmh', width=250, height=250)\n",
|
|
"my_hist = pd.DataFrame(stations).hvplot.hist('airtemp °C', width=250, height=250)\n",
|
|
"link_selections(my_map + my_hist + my_scatter , index_cols=['id'])"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import panel as pn"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"def my_plot(my_col='airtemp °C'):\n",
|
|
" try: \n",
|
|
" my_map = stations.hvplot(geo=True, tiles='CartoLight', c=my_col, cmap='Viridis', size=200, title=my_col, width=400, height=250)\n",
|
|
" my_hist = pd.DataFrame(stations).hvplot.hist(my_col, title=my_col, width=250, height=250)\n",
|
|
" return link_selections(my_map + my_hist, index_cols=['id']) \n",
|
|
" except:\n",
|
|
" pass\n",
|
|
"kw = dict(my_col=air_quality.columns)\n",
|
|
"pn.interact(my_plot, **kw)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"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.7.15"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|