diff --git a/examples/aggregation_zones_example.ipynb b/examples/aggregation_zones_example.ipynb index e26cd002..e965cf44 100644 --- a/examples/aggregation_zones_example.ipynb +++ b/examples/aggregation_zones_example.ipynb @@ -50,9 +50,415 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "import geopandas as gpd\n", "from pathlib import Path\n", @@ -91,7 +497,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -166,9 +572,52 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{\n", + " \"cases\": {\n", + " \"test1_single_aggregation\": {\n", + " \"new_root\": \"./data/Aggregation_zones/output/aggregation_zones_test1\",\n", + " \"configuration\": {\n", + " \"setup_aggregation_areas\": {\n", + " \"aggregation_area_fn\": \"./data/Aggregation_zones/aggregation_zones/base_zones.gpkg\",\n", + " \"attribute_names\": \"ZONE_BASE\",\n", + " \"label_names\": \"Base_zones\"\n", + " }\n", + " }\n", + " },\n", + " \"test2_multiple_aggregation\": {\n", + " \"new_root\": \"./data/Aggregation_zones/output/aggregation_zones_test2\",\n", + " \"configuration\": {\n", + " \"setup_aggregation_areas\": {\n", + " \"aggregation_area_fn\": [\n", + " \"./data/Aggregation_zones/aggregation_zones/base_zones.gpkg\",\n", + " \"./data/Aggregation_zones/aggregation_zones/land_use.gpkg\",\n", + " \"./data/Aggregation_zones/aggregation_zones/accomodation_type.gpkg\"\n", + " ],\n", + " \"attribute_names\": [\n", + " \"ZONE_BASE\",\n", + " \"LAND_USE\",\n", + " \"ACCOM\"\n", + " ],\n", + " \"label_names\": [\n", + " \"Base_zones\",\n", + " \"Land_use\",\n", + " \"Accommodation_type\"\n", + " ]\n", + " }\n", + " }\n", + " }\n", + " }\n", + "}\n" + ] + } + ], "source": [ "#Let's read the yaml file with the required information \n", "#and set up the FIAT model for the two test cases. \n", @@ -197,9 +646,17 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2023-10-20 09:59:17,072 - hydromt_fiat - log - INFO - HydroMT version: 0.8.0\n" + ] + } + ], "source": [ "# Set up Fiat Model\n", "root = Path(os.path.abspath(\"\")) / \"data\" / \"aggregation_zones\" / \"fiat_model\"\n", @@ -229,9 +686,42 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2023-10-20 09:59:18,050 - hydromt_fiat - log - DEBUG - Appending log messages to file c:\\Repositories\\hydromt_fiat\\examples\\data\\aggregation_zones\\fiat_model\\hydromt.log.\n", + "2023-10-20 09:59:18,051 - hydromt_fiat - model_api - INFO - Initializing fiat model from hydromt_fiat (v0.2.1.dev0).\n", + "2023-10-20 09:59:18,052 - hydromt_fiat - fiat - INFO - Reading model data from c:\\Repositories\\hydromt_fiat\\examples\\data\\aggregation_zones\\fiat_model\n", + "2023-10-20 09:59:18,053 - hydromt_fiat - model_api - DEBUG - User defined config read from c:\\Repositories\\hydromt_fiat\\examples\\data\\aggregation_zones\\fiat_model\\settings.toml\n", + "2023-10-20 09:59:18,054 - hydromt_fiat - fiat - INFO - Reading model table files.\n", + "2023-10-20 09:59:18,055 - hydromt_fiat - fiat - DEBUG - Reading vulnerability table c:\\Repositories\\hydromt_fiat\\examples\\data\\aggregation_zones\\fiat_model\\vulnerability\\vulnerability_curves.csv\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2023-10-20 09:59:18,085 - hydromt_fiat - fiat - DEBUG - Reading exposure table c:\\Repositories\\hydromt_fiat\\examples\\data\\aggregation_zones\\fiat_model\\exposure\\exposure.csv\n", + "2023-10-20 09:59:18,092 - hydromt_fiat - fiat - INFO - Reading exposure geometries.\n", + "2023-10-20 09:59:18,093 - hydromt_fiat - exposure_vector - INFO - Setting geometry name to buildings...\n", + "2023-10-20 09:59:18,181 - hydromt_fiat - exposure_vector - INFO - Setting exposure geometries...\n", + "2023-10-20 09:59:18,181 - hydromt_fiat - model_api - INFO - setup_aggregation_areas.aggregation_area_fn: ./data/Aggregation_zones/aggregation_zones/base_zones.gpkg\n", + "2023-10-20 09:59:18,182 - hydromt_fiat - model_api - INFO - setup_aggregation_areas.attribute_names: ZONE_BASE\n", + "2023-10-20 09:59:18,182 - hydromt_fiat - model_api - INFO - setup_aggregation_areas.label_names: Base_zones\n", + "2023-10-20 09:59:18,285 - hydromt_fiat - log - DEBUG - Writing log messages to new file c:\\Repositories\\hydromt_fiat\\examples\\data\\Aggregation_zones\\output\\aggregation_zones_test1\\hydromt.log.\n", + "2023-10-20 09:59:18,286 - hydromt_fiat - fiat - INFO - Updating all data objects...\n", + "2023-10-20 09:59:18,287 - hydromt_fiat - fiat - INFO - Writing model data to c:\\Repositories\\hydromt_fiat\\examples\\data\\Aggregation_zones\\output\\aggregation_zones_test1\n", + "2023-10-20 09:59:18,288 - hydromt_fiat - model_api - INFO - Writing model config to c:\\Repositories\\hydromt_fiat\\examples\\data\\Aggregation_zones\\output\\aggregation_zones_test1\\settings.toml\n", + "2023-10-20 09:59:18,289 - hydromt_fiat - model_api - DEBUG - Writing file exposure/buildings.gpkg\n", + "2023-10-20 09:59:18,396 - hydromt_fiat - fiat - INFO - Writing model exposure table file to exposure/exposure.csv.\n", + "2023-10-20 09:59:18,411 - hydromt_fiat - fiat - INFO - Writing model vulnerability_curves table file to vulnerability/vulnerability_curves.csv.\n" + ] + } + ], "source": [ "#Start running the new model with the new exposure output \n", "fm = FiatModel(root=root, mode=\"r\", logger=logger)\n", diff --git a/examples/data/aggregation_zones/fiat_model/settings.toml b/examples/data/aggregation_zones/fiat_model/settings.toml index 44b60c5b..3ae7d2ea 100644 --- a/examples/data/aggregation_zones/fiat_model/settings.toml +++ b/examples/data/aggregation_zones/fiat_model/settings.toml @@ -15,8 +15,10 @@ file = "./vulnerability/vulnerability_curves.csv" unit = "feet" step_size = 0.1 +[exposure.csv] +file = "./exposure/exposure.csv" + [exposure.geom] -csv = "./exposure/exposure.csv" crs = "EPSG:4326" unit = "ft" file1 = "./exposure/buildings.gpkg" diff --git a/hydromt_fiat/fiat.py b/hydromt_fiat/fiat.py index ab7128bd..c1dd90e6 100644 --- a/hydromt_fiat/fiat.py +++ b/hydromt_fiat/fiat.py @@ -718,7 +718,7 @@ def read_tables(self): logging.warning(f"File {vulnerability_fn} does not exist!") # Now with exposure - exposure_fn = Path(self.root) / self.get_config("exposure.geom.csv") + exposure_fn = Path(self.root) / self.get_config("exposure.csv.file") if Path(exposure_fn).is_file(): self.logger.debug(f"Reading exposure table {exposure_fn}") self.exposure = ExposureVector(