From be7d5806ea887b2da645dddef87866211f011a1e Mon Sep 17 00:00:00 2001 From: anitagraser Date: Tue, 9 Feb 2021 19:48:24 +0100 Subject: [PATCH] Add air quality map --- notebooks/environment.ipynb | 15 +++++++++++++-- notebooks/utils/dataaccess.py | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/notebooks/environment.ipynb b/notebooks/environment.ipynb index c664e64..0c2598e 100644 --- a/notebooks/environment.ipynb +++ b/notebooks/environment.ipynb @@ -52,7 +52,7 @@ "metadata": {}, "outputs": [], "source": [ - "uhvi.hvplot(geo=True, tiles='OSM', c='AVG_UHVI_A', title='Average Urban Heat Vulnerability Index - All age groups').opts(active_tools=['wheel_zoom'])" + "uhvi.hvplot(geo=True, tiles='OSM', c='AVG_UHVI_A', title='Average Urban Heat Vulnerability Index - All age groups', cmap='Reds').opts(active_tools=['wheel_zoom'])" ] }, { @@ -71,6 +71,7 @@ "outputs": [], "source": [ "stations = gdf_from_wfs('LUFTGUETENETZOGD')\n", + "stations.set_index('NAME_KURZ', inplace=True)\n", "stations.head()" ] }, @@ -81,7 +82,17 @@ "outputs": [], "source": [ "air_quality = get_airquality_df()\n", - "air_quality" + "air_quality.head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "col = 'airtemp °C'\n", + "stations.join(air_quality).dropna(subset=[col]).hvplot(geo=True, tiles='StamenToner', c=col, size=500, title=col.title())" ] }, { diff --git a/notebooks/utils/dataaccess.py b/notebooks/utils/dataaccess.py index 6825ebc..ed991f8 100644 --- a/notebooks/utils/dataaccess.py +++ b/notebooks/utils/dataaccess.py @@ -104,7 +104,7 @@ def get_heatvulnerabilityindex_gdf(): districts = gdf_from_wfs('ZAEHLBEZIRKOGD') districts['SUB_DISTRICT_CODE_VIE'] = districts['ZBEZ'].astype(int) + 90000 districts.set_index('SUB_DISTRICT_CODE_VIE', inplace=True) - gdf = gpd.GeoDataFrame(pd.DataFrame(districts).join(df)) + gdf = districts.join(df) #gpd.GeoDataFrame(pd.DataFrame(districts).join(df)) return gdf def get_zaehlsprengel_gdf(year=2020):