Commit 88750074 authored by Eric Duminil's avatar Eric Duminil
Browse files

removing notebook

parent 97ec5d80
%% Cell type:code id:4888de6c tags:
``` python
from pathlib import Path
```
%% Cell type:code id:bb724cab tags:
``` python
import pickle
```
%% Cell type:code id:b584ca38 tags:
``` python
import pandas as pd
```
%% Cell type:code id:e74c7f88 tags:
``` python
from pyproj import Transformer
from shapely import LineString
```
%% Cell type:code id:9eac1a09 tags:
``` python
EPSG_ID = 25832
to_local = Transformer.from_crs("EPSG:4326", f"EPSG:{EPSG_ID}", always_xy=True)
```
%% Cell type:code id:0fed9052 tags:
``` python
pd.set_option('display.max_columns', None)
```
%% Cell type:code id:89e9aff8 tags:
``` python
list(Path('cache').glob('*.pickle'))
```
%% Output
[WindowsPath('cache/48_864071__48_866928__9_196641__9_203522.pickle'),
WindowsPath('cache/49_80081__49_803063__9_947011__9_95511.pickle'),
WindowsPath('cache/49_802665__49_804083__9_942116__9_945581.pickle'),
WindowsPath('cache/49_802698__49_804055__9_942167__9_945563.pickle'),
WindowsPath('cache/49_802704__49_803486__9_944034__9_945488.pickle')]
%% Cell type:code id:8aac3681 tags:
``` python
def load_cache(cache_path):
with open(Path('cache') / '49_802698__49_804055__9_942167__9_945563.pickle', 'rb') as f:
return pickle.load(f)
```
%% Cell type:code id:d050a116 tags:
``` python
def get_way_dict(way):
# Length
url = f'https://www.openstreetmap.org/way/{way.id}'
xy_s = [to_local.transform(node.lon, node.lat) for node in way.nodes]
path = LineString(xy_s)
other_info = {'id': way.id,
'URL': f'=HYPERLINK("{url}"; "{url}")',
'length [m]': round(path.length, 1)}
return other_info | way.tags
```
%% Cell type:code id:7a9f108b tags:
``` python
numerical_columns = ['maxspeed [km/h]', 'width [m]', 'length [m]']
```
%% Cell type:code id:741fa825 tags:
``` python
def create_table(ways):
df = pd.DataFrame([get_way_dict(way) for way in ways]).set_index('id').rename(columns={'width': 'width [m]', 'maxspeed': 'maxspeed [km/h]'})
for col in numerical_columns:
df[col] = pd.to_numeric(df[col])
df.fillna('')
return df
```
%% Cell type:code id:a12d5684 tags:
``` python
for cache_path in Path('cache').glob('*.pickle'):
df = create_table(load_cache(cache_path))
df.to_csv(Path('output') / f'OSM_infos_{cache_path.stem}.csv',
sep=';',
decimal=',',
encoding='utf-8-sig'
)
```
%% Cell type:code id:328d048f tags:
``` python
```
digraph G{
ratio="fill";
size="10,6!";
margin=0;
dpi=180;
rankdir="LR";
graph [fontname = "Ubuntu"];
node [fontname = "Ubuntu"];
edge [fontname = "Ubuntu"];
node [shape=ellipse];
compound=true;
citygml [label="CityGML", shape=box3d];
a [label="OpenStreetMap", shape=note];
b [label="Cadastre", shape=note];
c [label="Custom DB", shape=note];
trees [label="Trees.shp", shape=note];
# floors [label="Floors.csv", shape=note];
# dreso [label="DreSo.csv", shape=note];
# lib [label="Physics.lib", shape=component];
weather [label="Weather data", shape=component];
subgraph cluster_sim {
label="Simulation";
node [shape=note, style=rounded];
simstadt [label="<sim>SimStadt | <green> Green-Water analysis | <heat>Heating & Cooling demand", shape=record];
green [label="Green library", shape=cylinder];
# archetypes [label="Quarter archetypes", shape=cylinder];
color=lightgrey;
# green -> simstadt;
}
# green -> simstadt;
a -> trees;
b -> trees;
c -> trees;
citygml -> simstadt:sim;
trees -> citygml;
# dreso -> citygml [label="?"];
# floors -> citygml [label="add-floor.py"];
# lib -> simstadt:sim [label="window_ratio.py"];
weather -> simstadt:green;
weather -> simstadt:heat;
#shp [label="Results.shp", shape=note];
subgraph cluster_1 {
label="Outputs";
node [shape=record];
csv1 [label="Heating.csv"];
csv2 [label="Cooling.csv"];
csv3 [label="Water.csv |{ Missing water | Evapotranspiration | Cooling effect}"];
color=lightgrey;
}
# optimizer [label="TUM optimizer.py", style=filled, shape=cylinder];
# gis [label="ArcGIS", style=filled, shape=cylinder];
#csv3 -> optimizer [ltail=cluster_1];
#csv3 -> gis [ltail=cluster_1];
simstadt:heat -> csv1;
simstadt:heat -> csv2;
simstadt:green -> csv3;
#shp -> gis;
#optimizer -> lib [style=dotted];
#optimizer -> floors [style=dotted];
#gis -> trees [style=dotted];
{ rank=min; a; b; c}
{ rank=max; csv1; csv2; csv3}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment