Skip to content

Commit

Permalink
replace Aggregation Label with aggregation_label (#442)
Browse files Browse the repository at this point in the history
* replace Aggregation Label with aggregation_label

* remove space

* update version download artifact
  • Loading branch information
Santonia27 authored Feb 3, 2025
1 parent 4768731 commit 93dfbad
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
shell: bash -l {0}
run: python -m build

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: releases
path: dist
Expand All @@ -72,7 +72,7 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
if: ${{ github.event_name == 'release'}}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
Expand All @@ -126,7 +126,7 @@ jobs:
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: releases
path: dist
Expand Down
2 changes: 1 addition & 1 deletion docs/data/national_structure_inventory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ corresponding NSI fields (right-hand side)::
"ground_elevtn": "ground_el",
"X Coordinate": "x",
"Y Coordinate": "y",
"Aggregation Label: Census Block": "cbfips"
"aggregation_label:Census Block": "cbfips"

HydroMT-FIAT obtains the NSI data of the area of interest through the `NSI API
<https://www.hec.usace.army.mil/confluence/nsi/technicalreferences/latest/api-reference-guide>`_.
Expand Down
2 changes: 1 addition & 1 deletion docs/user_guide/user_guide_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ In case the user wants to add several aggregation zones at once, multiple aggreg

After loading the configuration file (*.yml*) and executing the **FIAT Hydro MT** model builder, the user receives a file (*.csv*) with the original exposure data and an additional column with the aggregation label(s) as output. The `FIAT toolbox <https://github.com/Deltares/delft-fiat>`_ will automatically prepend "*Aggregation Label*" to the prior specified aggregation label, therefore the aggregation labels can be identified as such.

Aggregation Label: {label_name}
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.* ::

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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure
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
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748561544418,-79.93000008,32.770545239,450190002002010,1,centroid,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635444641,-79.92968382,32.771271301,450190002002010,1,centroid,RES4
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.364031290178299,-79.93179589,32.773364727,450190002002004,1,centroid,RES1-2SNB
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_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
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_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
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
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,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
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,Zoning_map,Land_use_map,Horse_track,Accomodation_Zone
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,Land_use_map,Horse_track,Accomodation_Zone
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748561544418,-79.93000008,32.770545239,450190002002010,1,centroid,RES4,SR-3,Neighborhood,1,
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635444641,-79.92968382,32.771271301,450190002002010,1,centroid,RES4,SR-4,Neighborhood,1,
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.364031290178299,-79.93179589,32.773364727,450190002002004,1,centroid,RES1-2SNB,SR-5,Neighborhood,2,
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_damage_structure,max_damage_content,ground_elevtn,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_elevtn,aggregation_label:Census Block,ground_flht,extract_method,fn_damage_structure
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,4.5019E+14,1,centroid,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,4.5019E+14,1,centroid,RES4
573785665,573785665,RES,RES1-2SNB,330007.42,165003.71,7.36403129,4.5019E+14,1,centroid,RES1-2SNB
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_damage_structure,max_damage_content,ground_flht,ground_elevtn,Aggregation Label: Census Block,extract_method,fn_damage_structure,fn_damage_content
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_flht,ground_elevtn,aggregation_label:Census Block,extract_method,fn_damage_structure,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,0.5,2.580267906188965,450190001001006,centroid,RES3A_structure,RES3A_content
573783417,573783417,COM,RES4,1177614.2,588807.1,8.0,2.580267906188965,450190002002010,centroid,RES4_structure,RES4_content
573783433,573783433,COM,RES4,476216.254,238108.127,0.5,2.0590968132019043,450190002002010,centroid,RES4_structure,RES4_content
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_damage_structure,max_damage_content,ground_flht,ground_elevtn,Aggregation Label: Census Block,extract_method,fn_damage_structure,fn_damage_content
object_id,object_name,primary_object_type,secondary_object_type,max_damage_structure,max_damage_content,ground_flht,ground_elevtn,aggregation_label:Census Block,extract_method,fn_damage_structure,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,0.5,7.298348064632416,450190001001006,centroid,RES3A_structure,RES3A_content
573783417,573783417,COM,RES4,1177614.2,588807.1,8.0,8.381748561544418,450190002002010,centroid,RES4_structure,RES4_content
573783433,573783433,COM,RES4,476216.254,238108.127,0.5,7.374183635444641,450190002002010,centroid,RES4_structure,RES4_content
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,4.5019E+14,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,4.5019E+14,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,4.5019E+14,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content,index,Council,Zoning_map,Land_use_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,fn_damage_content,index,Council,Zoning_map,Land_use_map
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,450190000000000.0,1.0,centroid,RES3A,RES3A,,,,
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,450190000000000.0,1.0,centroid,RES4,RES4,,,,
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,450190000000000.0,1.0,centroid,RES4,RES4,,,,
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,4.5019E+14,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,4.5019E+14,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,4.5019E+14,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,2.580267906188965,-79.93682513,32.77688289,450190000000000.0,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,2.580267906188965,-79.93000008,32.77054524,450190000000000.0,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,2.0590968132019043,-79.92968382,32.7712713,450190000000000.0,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,4.5019E+14,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,4.5019E+14,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,4.5019E+14,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,450190000000000.0,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,450190000000000.0,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,450190000000000.0,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content
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,fn_damage_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,4.5019E+14,1,centroid,RES3A,RES3A
573783417,573783417,COM,RES4,1177614.2,588807.1,8.381748562,-79.93000008,32.77054524,4.5019E+14,1,centroid,RES4,RES4
573783433,573783433,COM,RES4,476216.254,238108.127,7.374183635,-79.92968382,32.7712713,4.5019E+14,1,centroid,RES4,RES4
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_damage_structure,max_damage_content,ground_elevtn,X Coordinate,Y Coordinate,Aggregation Label: Census Block,ground_flht,extract_method,fn_damage_structure,fn_damage_content,geometry,groundfloorheight,maxpotential_content
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,fn_damage_content,geometry,groundfloorheight,maxpotential_content
574486973,574486973,RES,RES3A,480189.335,240094.667,7.298348065,-79.93682513,32.77688289,450190000000000.0,1,centroid,RES3A,RES3A,POINT (-79.93682513 32.776882893),,
573783417,573783417,COM,RES4,10000.0,588807.1,8.381748562,-79.93000008,32.77054524,450190000000000.0,1,centroid,RES4,RES4,POINT (-79.93000008 32.770545239),7.0,10000.0
573783433,573783433,COM,RES4,10000.0,238108.127,7.374183635,-79.92968382,32.7712713,450190000000000.0,1,centroid,RES4,RES4,POINT (-79.92968382 32.771271301),7.0,10000.0
Expand Down
12 changes: 6 additions & 6 deletions examples/update_exposure_data.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"ground_flht": "found_ht",
"ground_elevtn": "ground_elv",
"geometry": "geometry",
"Aggregation Label: Census Blockgroup": "cbfips"
"aggregation_label:Census Blockgroup": "cbfips"
}
6 changes: 3 additions & 3 deletions hydromt_fiat/fiat.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,8 +1127,8 @@ def setup_equity_data(
# Save the census block aggregation area data
block_groups = equity.get_block_groups()

# Update the aggregation label: Census Blockgroup
del self.exposure.exposure_db["Aggregation Label: Census Blockgroup"]
# Update the aggregation_label:Census Blockgroup
del self.exposure.exposure_db["aggregation_label:Census Blockgroup"]
self.setup_aggregation_areas(
aggregation_area_fn=block_groups,
attribute_names="GEOID_short",
Expand Down Expand Up @@ -1206,7 +1206,7 @@ def setup_aggregation_areas(
aggregation_area_fn,
attribute_names,
# Make sure that column name for aggregation areas includes the Aggregation Label part
["Aggregation Label: " + name for name in label_names],
["aggregation_label:" + name for name in label_names],
new_composite_area,
keep_all=False,
)
Expand Down
8 changes: 4 additions & 4 deletions hydromt_fiat/workflows/exposure_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ class ExposureVector(Exposure):
"secondary_object_type",
"ground_elevtn",
]
_OPTIONAL_VARIABLE_COLUMNS = ["Aggregation Label: {}", "Aggregation Variable: {}"]
_OPTIONAL_VARIABLE_COLUMNS = ["aggregation_label:{}", "Aggregation Variable: {}"]

_CSV_COLUMN_DATATYPES = {
"object_id": int,
"object_name": str,
"primary_object_type": str,
"secondary_object_type": str,
"extract_method": str,
"Aggregation Label": str,
"aggregation_lable:": str,
"fn_damage_structure": str,
"fn_damage_content": str,
"Ground Flood Height": float,
"ground_flht": float,
"ground_elevtn": float,
"max_damage_structure": float,
"max_damage_content": float,
Expand Down Expand Up @@ -1985,7 +1985,7 @@ def get_object_ids(
ids = buildings["object_id"]
elif selection_type == "aggregation_area":
ids = buildings.loc[
buildings[f"Aggregation Label: {aggregation}"]
buildings[f"aggregation_label:{aggregation}"]
== aggregation_area_name,
"object_id",
]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_setup_new_composite_areas_ground_elevation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"test_read", "exposure", "aggregation_areas", "block_groups.gpkg"
),
"attribute_names": "GEOID_short",
"label_names": "Aggregation Label: Census Block",
"label_names": "aggregation_label:Census Block",
},
}

Expand Down

0 comments on commit 93dfbad

Please sign in to comment.