Skip to content

Commit

Permalink
fix: update notebook SBR; add to_csv for all dataframes
Browse files Browse the repository at this point in the history
  • Loading branch information
RDWimmers committed Jun 21, 2024
1 parent 78ed32a commit 0d9af45
Showing 1 changed file with 67 additions and 6 deletions.
73 changes: 67 additions & 6 deletions notebooks/NBxxxxx_SBR.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,16 @@
"ctx.add_basemap(fig.axes[0], crs=\"EPSG:28992\", source=ctx.providers.Esri.WorldTopoMap)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2d9fd72c-4d49-44ee-9eeb-9c7008ee256e",
"metadata": {},
"outputs": [],
"source": [
"results.gdf.to_csv(\"SBRa.csv\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -616,7 +626,6 @@
"outputs": [],
"source": [
"name = get_normative_building_sound(buildings, location)\n",
"\n",
"if name:\n",
" single_payload = create_single_payload(multi_vibration_payload, name=name)\n",
" result = client.call_endpoint(\n",
Expand All @@ -629,7 +638,7 @@
" building_name=name,\n",
" response_dict=result,\n",
" vibration_type=vibration_type,\n",
" installation_type=installation_type,\n",
" installation_type=\"driving\" if methode == \"prepal\" else installation_type,\n",
" period=period,\n",
" settings={\n",
" \"source_location\": {\"label\": \"Trillingsbron\", \"color\": \"blue\"},\n",
Expand All @@ -638,6 +647,22 @@
" \"label\": \"<= 1 day\",\n",
" \"color\": \"darkred\",\n",
" },\n",
" # {\n",
" # \"label\": \"2 days\",\n",
" # \"color\": \"red\",\n",
" # },\n",
" # {\n",
" # \"label\": \"3 days\",\n",
" # \"color\": \"red\",\n",
" # },\n",
" # {\n",
" # \"label\": \"4 days\",\n",
" # \"color\": \"red\",\n",
" # },\n",
" # {\n",
" # \"label\": \"5 days\",\n",
" # \"color\": \"red\",\n",
" # },\n",
" {\n",
" \"label\": \">= 6 days; <26 days\",\n",
" \"color\": \"orange\",\n",
Expand Down Expand Up @@ -669,7 +694,7 @@
"source": [
"# create a dataframe for all buildings\n",
"_df_list = []\n",
"for name in buildings[\"name\"]:\n",
"for name in tqdm(buildings[\"name\"]):\n",
" single_payload = create_single_payload(multi_vibration_payload, name=name)\n",
" result = client.call_endpoint(\n",
" \"VibraCore\", f\"/{methode.lower()}/validation/single\", schema=single_payload\n",
Expand All @@ -681,12 +706,13 @@
" building_name=name,\n",
" response_dict=result,\n",
" vibration_type=vibration_type,\n",
" installation_type=installation_type,\n",
" installation_type=\"driving\" if methode == \"prepal\" else installation_type,\n",
" period=period,\n",
" )\n",
" )\n",
"\n",
"pd.concat(_df_list, axis=1)"
"df = pd.concat(_df_list, axis=1).T\n",
"df.to_csv(\"SBRb.csv\")"
]
},
{
Expand All @@ -708,7 +734,42 @@
"name = get_normative_building_sound(buildings, location)\n",
"if name:\n",
" fig = map_sound(\n",
" buildings, location, building_name=name, power=power, k2=k2, period=period\n",
" buildings,\n",
" location,\n",
" building_name=name,\n",
" power=power,\n",
" k2=k2,\n",
" period=period,\n",
" settings={\n",
" \"source_location\": {\"label\": \"Trillingsbron\", \"color\": \"blue\"},\n",
" \"levels\": [\n",
" {\n",
" \"label\": \">80 db [0 dagen]\",\n",
" \"level\": 80,\n",
" \"color\": \"darkred\",\n",
" },\n",
" {\n",
" \"label\": \">75 db [5 dagen]\",\n",
" \"level\": 75,\n",
" \"color\": \"red\",\n",
" },\n",
" {\n",
" \"label\": \">70 db [15 dagen]\",\n",
" \"level\": 70,\n",
" \"color\": \"orange\",\n",
" },\n",
" {\n",
" \"label\": \">65 db [30 dagen]\",\n",
" \"level\": 65,\n",
" \"color\": \"darkgreen\",\n",
" },\n",
" {\n",
" \"label\": \">62 db [50 dagen]\",\n",
" \"level\": 62,\n",
" \"color\": \"lightgreen\",\n",
" },\n",
" ],\n",
" },\n",
" )\n",
"\n",
" # add basemap\n",
Expand Down

0 comments on commit 0d9af45

Please sign in to comment.