From f62817ff7b33dec89b05c16e8c2498b2025c5d24 Mon Sep 17 00:00:00 2001 From: Frederique Date: Fri, 20 Oct 2023 09:43:48 +0200 Subject: [PATCH] Fixed small bugs in example --- .gitignore | 4 +--- examples/aggregation_zones_example.ipynb | 10 ++-------- .../data/aggregation_zones/config_aggregation.yml | 12 ++++++------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 143ade5b..7e3a8fb7 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file +examples/data/aggregation_zones/output \ No newline at end of file diff --git a/examples/aggregation_zones_example.ipynb b/examples/aggregation_zones_example.ipynb index c273ea99..e26cd002 100644 --- a/examples/aggregation_zones_example.ipynb +++ b/examples/aggregation_zones_example.ipynb @@ -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", "

The base for this notebook is the DELFT FIAT toolbox.

\n", "\n", - "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.

" + "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.

" ] }, { @@ -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" ] }, @@ -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", diff --git a/examples/data/aggregation_zones/config_aggregation.yml b/examples/data/aggregation_zones/config_aggregation.yml index ee763e4d..ae077966 100644 --- a/examples/data/aggregation_zones/config_aggregation.yml +++ b/examples/data/aggregation_zones/config_aggregation.yml @@ -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