Cleanup get_heatvulnerabilityindex_gdf

course
anitagraser 2021-02-07 23:24:46 +01:00
rodzic 74b0736e39
commit 889387f34f
3 zmienionych plików z 18 dodań i 7 usunięć

Wyświetl plik

@ -32,7 +32,9 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Urban Heat Vulnerability Index (UHVI) "
"## Urban Heat\n",
"\n",
"Dataset: [Urban Heat Vulnerability Index (UHVI)](https://www.data.gv.at/katalog/dataset/urban-heat-vulnerability-index-uhvi-wien)"
]
},
{
@ -50,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"heatvulidx.hvplot(geo=True, tiles='OSM', c='AVG_UHVI_A', title='Urban Heat Vulnerability Index (AVG_UHVI_A)').opts(active_tools=['wheel_zoom'])"
"heatvulidx.hvplot(geo=True, tiles='OSM', c='AVG_UHVI_A', title='Average Urban Heat Vulnerability Index - All age groups').opts(active_tools=['wheel_zoom'])"
]
},
{

Wyświetl plik

@ -5,7 +5,7 @@ import pandas as pd
def gdf_from_wfs(layer):
"""
Get GeoPandas GeoDataFrame from data.wien.gv.at WFS service based on layer name
Get geopandas.GeoDataFrame from data.wien.gv.at WFS service based on layer name
Parameters
----------
@ -59,9 +59,10 @@ def get_weather_df():
df = pd.read_csv(file)
return df
def get_heatvulnerabilityindex_gdf():
def get_heatvulnerabilityindex_df():
"""
Get data from https://go.gv.at/l9lumesakt
Get pandas.DataFrame of heat vulnerability from
https://www.wien.gv.at/gogv/l9ogdaverageurbanheatvulnerabilityindex
"""
file = 'heatvulnerabilityindex.csv'
url = 'https://www.wien.gv.at/gogv/l9ogdaverageurbanheatvulnerabilityindex'
@ -72,6 +73,14 @@ def get_heatvulnerabilityindex_gdf():
df['AVG_UHVI_O'] = df['AVG_UHVI_O'].str.replace(',', '.').astype(float)
df['AVG_UHVI_Y'] = df['AVG_UHVI_Y'].str.replace(',', '.').astype(float)
df.set_index('SUB_DISTRICT_CODE_VIE', inplace=True)
return df
def get_heatvulnerabilityindex_gdf():
"""
Get geopandas.GeoDataFrame of heat vulnerability from
https://www.wien.gv.at/gogv/l9ogdaverageurbanheatvulnerabilityindex
"""
df = get_heatvulnerabilityindex_df()
districts = gdf_from_wfs('ZAEHLBEZIRKOGD')
districts['SUB_DISTRICT_CODE_VIE'] = districts['ZBEZ'].astype(int) + 90000
districts.set_index('SUB_DISTRICT_CODE_VIE', inplace=True)
@ -80,7 +89,7 @@ def get_heatvulnerabilityindex_gdf():
def get_zaehlsprengel_gdf(year=2020):
"""
Get Zählsprengel districts from Statistik Austria
Get geopandas.GeoDataFrame of Zählsprengel districts from Statistik Austria
"""
file = f'OGDEXT_ZSP_1_STATISTIK_AUSTRIA_{year}0101.zip'
url = f'http://data.statistik.gv.at/data/OGDEXT_ZSP_1_STATISTIK_AUSTRIA_{year}0101.zip'

Wyświetl plik

@ -4,7 +4,7 @@ def hvplot_with_buffer(gdf, buffer_size, *args, **kwargs):
Parameters
----------
gdf : geopandas.Geodataframe
gdf : geopandas.GeoDataFrame
point GeoDataFrame to plot
buffer_size : numeric
size of the buffer in meters (measured in EPSG:31287)