Skip to content

Commit

Permalink
Fixed small bugs in example
Browse files Browse the repository at this point in the history
  • Loading branch information
frederique-hub committed Oct 20, 2023
1 parent 82b2762 commit f62817f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,5 @@ venv.bak/
cache
/examples/FIAT_database
hydromt_fiat/data/damage_functions/flooding/AllDDF_HAZUS_fractions.xlsx
hydromt_fiat/data/damage_functions/flooding/~$AllDDF_HAZUS_fractions.xlsx
examples/data/building_footprints/fiat_model_bfs
examples/data/aggregation_zones_example/aggregation_test_1_output
examples/data/aggregation_zones_example/aggregation_test_2_output
examples/data/aggregation_zones/output
10 changes: 2 additions & 8 deletions examples/aggregation_zones_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"In spatial analysis and urban planning the division of objects into spatial zones is a pivotal tool to facilitate analysis and/or visualization. This jupyter notebook demonstrates how to create a **spatial joint** of the FIAT model data with single or multiple **aggregation zones** in order to link an the zone and objects of interest. \n",
"<p>The base for this notebook is the <strong>DELFT FIAT</strong> toolbox. </p>\n",
"\n",
"<em>Note: In this notebook the model was already initialized. Unless the user does not wish to use own data, there is `no need` to create a new model and the user can simply continue with the example data found in the / \"example\" / \"data\"/ \"aggregation_zone_example\" - directory.</p></em>"
"<em>Note: In this notebook the model was already initialized. Unless the user does not wish to use own data, there is `no need` to create a new model and the user can simply continue with the example data found in the / \"example\" / \"data\"/ \"aggregation_zone\" - directory.</p></em>"
]
},
{
Expand Down Expand Up @@ -95,17 +95,11 @@
"metadata": {},
"outputs": [],
"source": [
"from typing import Sequence\n",
"from _pytest.mark.structures import ParameterSet\n",
"from hydromt_fiat.fiat import FiatModel\n",
"from hydromt.log import setuplog\n",
"import pytest\n",
"import pandas as pd\n",
"from hydromt_fiat.workflows.aggregation_areas import join_exposure_aggregation_areas\n",
"import yaml\n",
"import json\n",
"from hydromt_fiat.workflows.exposure_vector import ExposureVector\n",
"from hydromt_fiat.workflows.vulnerability import Vulnerability\n",
"import shutil"
]
},
Expand Down Expand Up @@ -270,7 +264,7 @@
"outputs": [],
"source": [
"#If case exist\n",
"if Path(config_aggregation[\"cases\"][\"test1_single_aggregation\"][\"new_root\"]).exists():\n",
"if Path(config_aggregation[\"cases\"][\"test2_multiple_aggregation\"][\"new_root\"]).exists():\n",
" shutil.rmtree(config_aggregation[\"cases\"][\"test2_multiple_aggregation\"][\"new_root\"])\n",
" \n",
"# Set up the logger\n",
Expand Down
12 changes: 6 additions & 6 deletions examples/data/aggregation_zones/config_aggregation.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
cases:
test1_single_aggregation:
new_root: "./data/Aggregation_zones_example/output/aggregation_zones_test1"
new_root: "./data/Aggregation_zones/output/aggregation_zones_test1"
configuration:
setup_aggregation_areas:
aggregation_area_fn: "./data/Aggregation_zones_example/aggregation_zones/base_zones.gpkg"
aggregation_area_fn: "./data/Aggregation_zones/aggregation_zones/base_zones.gpkg"
attribute_names: ZONE_BASE
label_names: Base_zones

test2_multiple_aggregation:
new_root: "./data/Aggregation_zones_example/output/aggregation_zones_test2"
new_root: "./data/Aggregation_zones/output/aggregation_zones_test2"
configuration:
setup_aggregation_areas:
aggregation_area_fn:
- "./data/Aggregation_zones_example/aggregation_zones/base_zones.gpkg"
- "./data/Aggregation_zones_example/aggregation_zones/land_use.gpkg"
- "./data/Aggregation_zones_example/aggregation_zones/accomodation_type.gpkg"
- "./data/Aggregation_zones/aggregation_zones/base_zones.gpkg"
- "./data/Aggregation_zones/aggregation_zones/land_use.gpkg"
- "./data/Aggregation_zones/aggregation_zones/accomodation_type.gpkg"
attribute_names:
- ZONE_BASE
- LAND_USE
Expand Down

0 comments on commit f62817f

Please sign in to comment.