Skip to content

Commit

Permalink
Update to newest Delft version and setup impacted population (#406)
Browse files Browse the repository at this point in the history
* start to setup a method to add affected population

* fix method name impacted pop

* add code to provide one file for occupancy and asset location

* add docstring

* fix self.get_geodataframe

* fix asset location

* add handling for multipolygons

* write exposure geopackage

* Update hydromt fiat exposure output names (#403)

* make variable names compatible with new Delft Fiat version

* add gfh attribute to setup exposure buildings

* update primary and secondary classification

* add docstring, add ground elevation unit, fix naming structure content

* setup populatoin remove geometry

* remove capitalized

* update gis

* uncomment zonal means

* revert code

* name fix ground_elevtn

* bugfix setup occupancy condition warning message. Add condition for gorund elevation unit

* clip exposure when setup hazard to hazard bounds. Add fn affected people step function

* replace max_damage with max_damages

* fix fn_damage_{ to fn_damages_{

* bugfix object_id and Object ID

* remove method=nearest

* add again method nearest just so it can run. need fixing

* remove method nearest

* revert to original (main)

* remove bug write geoms

* add additional/aggregation attributes to read geoms

* add aggregation and additional attributes to read()

* remove #

* revert old naming from merge of main to new naming

* #if isinstance(asset_locations, str):

* ead spatial joints incl bf

* ADD IF STATEMENT GFH CONVERSION

* get_full_gdf if-statement for old and new model object id (temporary)

* update damages to damage

* update damages to damage

* bugfix Object ID and object_id transition code

* update geometry files Object ID to object_id

* update notebooks

* fix tests

* fix tests

* fox road network notebook

* replace Max Potential Damage

* replace Max Potential Damage

* refactor multipolygon function

* snakecase segment_length
  • Loading branch information
Santonia27 authored Dec 12, 2024
1 parent bc7330f commit 18a2e66
Show file tree
Hide file tree
Showing 108 changed files with 15,568 additions and 14,911 deletions.
14 changes: 7 additions & 7 deletions docs/data/national_structure_inventory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ user can access the data through providing 'NSI' in the configuration file as su
The following attributes for Delft-FIAT (left-hand side) will be filled with data from the
corresponding NSI fields (right-hand side)::

"Object ID": "fd_id",
"Object Name": "fd_id",
"Primary Object Type": "st_damcat",
"Secondary Object Type": "occtype",
"Max Potential Damage: Structure": "val_struct",
"Max Potential Damage: Content": "val_cont",
"Ground Elevation": "ground_el",
"object_id": "fd_id",
"object_name": "fd_id",
"primary_object_type": "st_damcat",
"secondary_object_type": "occtype",
"max_damage_structure": "val_struct",
"max_damage_content": "val_cont",
"ground_elevtn": "ground_el",
"X Coordinate": "x",
"Y Coordinate": "y",
"Aggregation Label: Census Block": "cbfips"
Expand Down
4 changes: 2 additions & 2 deletions docs/user_guide/user_guide_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ After loading the configuration file (*.yml*) and executing the **FIAT Hydro MT*

Aggregation Label: {label_name}

*Note: It may occur that polygons overlap in the aggregation vector files. In this case the information for the affected Object ID will be merged and both aggregation zones will be assigned to the object.* ::
*Note: It may occur that polygons overlap in the aggregation vector files. In this case the information for the affected object_id will be merged and both aggregation zones will be assigned to the object.* ::

Object ID Zone
object_id Zone

1 Base Zone 1
2 Land Use 1, Land Use 3 > two zones (polygons) in the land-use aggregation file overlap and object
Expand Down
655 changes: 257 additions & 398 deletions examples/add_roadnetwork.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions examples/aggregation_zones_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Load the newly created *exposure.csv* file from the <em>/ \"output\" / \"aggregation_zones_test1\" /</em> - directory and the original exposure geopackage from the <em> \"exposure\" / \"buildings.gpkg\" </em>. Before the results can be displayed, we must merge the **exposure.csv** with the **buildings.gpkg** via common *\"Object ID\"*. "
"Load the newly created *exposure.csv* file from the <em>/ \"output\" / \"aggregation_zones_test1\" /</em> - directory and the original exposure geopackage from the <em> \"exposure\" / \"buildings.gpkg\" </em>. Before the results can be displayed, we must merge the **exposure.csv** with the **buildings.gpkg** via common *\"object_id\"*. "
]
},
{
Expand All @@ -354,7 +354,7 @@
"new_exposure=gpd.read_file(Path(os.path.abspath(\"\")) / \"data\" / \"aggregation_zones\" / \"aggregation_zones_test1\" / \"exposure\" / \"buildings.gpkg\")\n",
"\n",
"#Merge dataframe with GeoDataFrame\n",
"merged_gdf = new_exposure.merge(df_single_aggregation, left_on='Object ID', right_on='Object ID', how='inner')\n",
"merged_gdf = new_exposure.merge(df_single_aggregation, left_on='object_id', right_on='object_id', how='inner')\n",
"\n",
"#Display base_zones aggregation zone\n",
"base_zones_map = merged_gdf.explore(column = 'Base_zones')\n",
Expand All @@ -372,7 +372,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Load the newly created *exposure.csv* file from the <em>/ \"output\" / \"aggregation_zones_test2\" /</em> - directory and the original exposure geopackage from the <em> \"exposure\" / \"buildings.gpkg\" </em>. Before the results can be displayed, we must merge the **exposure.csv** with the **buildings.gpkg** via common *\"Object ID\"*. "
"Load the newly created *exposure.csv* file from the <em>/ \"output\" / \"aggregation_zones_test2\" /</em> - directory and the original exposure geopackage from the <em> \"exposure\" / \"buildings.gpkg\" </em>. Before the results can be displayed, we must merge the **exposure.csv** with the **buildings.gpkg** via common *\"object_id\"*. "
]
},
{
Expand All @@ -388,7 +388,7 @@
"new_exposure=gpd.read_file(Path(os.path.abspath(\"\")) / \"data\" / \"aggregation_zones\" / \"aggregation_zones_test2\" / \"exposure\" / \"buildings.gpkg\")\n",
"\n",
"# Merge dataframe with GeoDataFrame\n",
"merged_gdf_multiple = new_exposure.merge(df_multiple_aggregation, left_on='Object ID', right_on='Object ID', how='inner')"
"merged_gdf_multiple = new_exposure.merge(df_multiple_aggregation, left_on='object_id', right_on='object_id', how='inner')"
]
},
{
Expand Down
Binary file not shown.
1,000 changes: 500 additions & 500 deletions examples/data/aggregation_zones/fiat_model/exposure/exposure.csv

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Object ID,Object Name,Primary Object Type,Secondary Object Type,Max Potential Damage: Structure,Max Potential Damage: Content,Ground Elevation,X Coordinate,Y Coordinate,Aggregation Label: Census Block,Ground Floor Height,Extraction Method,Damage Function: Structure,Aggregation Label: Base_zones
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,Aggregation Label: Base_zones
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748561544418,-79.93000008,32.770545239,450190002002010,1,centroid,RES4,SR-3
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635444641,-79.92968382,32.771271301,450190002002010,1,centroid,RES4,SR-4
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.364031290178299,-79.93179589,32.773364727,450190002002004,1,centroid,RES1-2SNB,SR-5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Object ID,Object Name,Primary Object Type,Secondary Object Type,Max Potential Damage: Structure,Max Potential Damage: Content,Ground Elevation,X Coordinate,Y Coordinate,Aggregation Label: Census Block,Ground Floor Height,Extraction Method,Damage Function: Structure,Aggregation Label: Base_zones,Aggregation Label: Land_use,Aggregation Label: Accommodation_type
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,Aggregation Label: Base_zones,Aggregation Label: Land_use,Aggregation Label: Accommodation_type
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748561544418,-79.93000008,32.770545239,450190002002010,1,centroid,RES4,SR-3,Neighborhood,
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635444641,-79.92968382,32.771271301,450190002002010,1,centroid,RES4,SR-4,Neighborhood,
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.364031290178299,-79.93179589,32.773364727,450190002002004,1,centroid,RES1-2SNB,SR-5,Neighborhood,
Expand Down
2 changes: 1 addition & 1 deletion examples/data/aggregation_zones/fiat_model/settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ file = "./exposure/exposure.csv"
[exposure.geom]
crs = "EPSG:4326"
unit = "feet"
file1 = "./exposure/buildings.gpkg"
file1 = "exposure/buildings.gpkg"
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Object ID,Object Name,Primary Object Type,Secondary Object Type,Max Potential Damage: Structure,Max Potential Damage: Content,Ground Elevation,X Coordinate,Y Coordinate,Aggregation Label: Census Block,Ground Floor Height,Extraction Method,Damage Function: Structure,Aggregation Label: Zoning_map
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,Zoning_map
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748561544418,-79.93000008,32.770545239,450190002002010,1,centroid,RES4,SR-3
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635444641,-79.92968382,32.771271301,450190002002010,1,centroid,RES4,SR-4
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.364031290178299,-79.93179589,32.773364727,450190002002004,1,centroid,RES1-2SNB,SR-5
Expand Down Expand Up @@ -1572,8 +1572,8 @@ Object ID,Object Name,Primary Object Type,Secondary Object Type,Max Potential Da
573789313,573789313,RES,RES1-2SNB,316664.648,158332.324,5.035890999441147,-79.937703,32.771885698,450190001003020,1,centroid,RES1-2SNB,SR-2
573789328,573789328,COM,COM1,405166.887,405166.887,5.684294907550812,-79.93746248,32.775702903,450190001002003,1,centroid,COM1,DR-1F
573789334,573789334,RES,RES1-2SNB,317436.136,158718.068,3.665345899348259,-79.93868974,32.774538661,450190001002003,1,centroid,RES1-2SNB,DR-1F
573789341,573789341,RES,RES3A,309951.7,154975.85,3.9668100886774074,-79.93917071,32.774845088,450190001002003,1,centroid,RES3A,STR
573789342,573789342,COM,COM4,103317.233,103317.233,3.9668100886774074,-79.93917071,32.774845088,450190001002003,1,centroid,COM4,STR
573789341,573789341,RES,RES3A,309951.7,154975.85,3.966810088677408,-79.93917071,32.774845088,450190001002003,1,centroid,RES3A,STR
573789342,573789342,COM,COM4,103317.233,103317.233,3.966810088677408,-79.93917071,32.774845088,450190001002003,1,centroid,COM4,STR
573789344,573789344,RES,RES3A,570614.421,285307.21,4.573926436867714,-79.93837185,32.774970542,450190001002003,1,centroid,RES3A,DR-1F
573789358,573789358,RES,RES1-2SNB,351245.902,175622.951,5.113630868315696,-79.93831938,32.775569158,450190001002003,1,centroid,RES1-2SNB,DR-1F
573789363,573789363,RES,RES1-3SNB,309123.527,154561.763,5.60085426879406,-79.93765526,32.775658099,450190001002003,1,centroid,RES1-3SNB,DR-1F
Expand Down Expand Up @@ -2202,7 +2202,7 @@ Object ID,Object Name,Primary Object Type,Secondary Object Type,Max Potential Da
573789232,573789232,RES,RES3A,576162.41,288081.205,4.328003296589851,-79.93776485,32.772881263,450190001002007,1,centroid,RES3A,SR-2
573789237,573789237,RES,RES1-2SNB,208679.165,104339.582,5.003123696923256,-79.93759388,32.773226578,450190001002007,1,centroid,RES1-2SNB,SR-2
573789312,573789312,RES,RES3A,565328.563,282664.281,4.841776577877998,-79.93756021,32.7718473,450190001003020,1,centroid,RES3A,SR-2
573789336,573789336,RES,RES1-1SNB,246491.079,123245.539,3.9544648086738583,-79.93918259,32.774666558,450190001002003,1,centroid,RES1-1SNB,STR
573789336,573789336,RES,RES1-1SNB,246491.079,123245.539,3.9544648086738574,-79.93918259,32.774666558,450190001002003,1,centroid,RES1-1SNB,STR
573789351,573789351,RES,RES1-2SNB,364241.81,182120.905,6.969832595825196,-79.937993,32.775313812,450190001002003,1,centroid,RES1-2SNB,DR-1F
573789459,573789459,RES,RES1-2SNB,136383.114,68191.5572,5.929636081199646,-79.9379172,32.777179279,450190001001005,1,centroid,RES1-2SNB,DR-1F
573789691,573789691,RES,RES3A,528008.485,264004.242,4.63035451570034,-79.93868916,32.772740818,450190001002008,1,centroid,RES3A,SR-2
Expand Down
Loading

0 comments on commit 18a2e66

Please sign in to comment.