Skip to content

Commit

Permalink
fixed bug where additional attributes appeared double when updating t…
Browse files Browse the repository at this point in the history
…he model
  • Loading branch information
panosatha committed May 15, 2024
1 parent 4026dcf commit 44b9191
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions hydromt_fiat/api/hydromt_fiat_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ def new_additional_attributes(self, config_yaml):
aggregation_area_fn = config_yaml.model_extra["setup_additional_attributes"].aggregation_area_fn
attribute_names = config_yaml.model_extra["setup_additional_attributes"].attribute_names
label_names = config_yaml.model_extra["setup_additional_attributes"].label_names
# Check if additional attributes already exist
add_attrs_existing = [attr["name"] for attr in self.fiat_model.spatial_joins["additional_attributes"]]
for i, label_name in enumerate(label_names):
if label_name in add_attrs_existing: # if it exists exclude it from the list
aggregation_area_fn.pop(i)
attribute_names.pop(i)
label_names.pop(i)

self.fiat_model.setup_additional_attributes(aggregation_area_fn, attribute_names, label_names)

def new_ground_elevation(self, config_yaml):
Expand Down

0 comments on commit 44b9191

Please sign in to comment.