Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

298 add attributes for aggregation areas and spatial joins #316

Conversation

panosatha
Copy link
Collaborator

@panosatha panosatha commented May 14, 2024

Refactoring to allow for saving connections for the spatial joins (aggregation areas or additional attributes) that are performed during model build up:

  • Created a seperate setup for additional attributes
  • Geometries of spatial joined objects are stored in the object and saved in the exposure folder when model is written
  • Only geometries that intersect with the exposure data are saved
  • A spatial joins toml file is saved that describes all the connections
  • This file is used when a model is read to create a spatial joins object

@panosatha panosatha linked an issue May 14, 2024 that may be closed by this pull request
@panosatha panosatha marked this pull request as ready for review May 15, 2024 09:49
@panosatha panosatha requested a review from Santonia27 May 15, 2024 09:49
Copy link
Collaborator

@Santonia27 Santonia27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice! just a few minor comments

hydromt_fiat/data_apis/open_street_maps.py Show resolved Hide resolved
hydromt_fiat/fiat.py Show resolved Hide resolved
exposure_gdf: gpd.GeoDataFrame,
aggregation_area_fn: Union[List[str], List[Path], List[gpd.GeoDataFrame]],
areas: Union[List[str], List[Path], List[gpd.GeoDataFrame]],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why rename here to areas and everywhere else agregation_area_fn? Maybe it should be the same everywhere?

Copy link
Collaborator Author

@panosatha panosatha May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it back to aggregation_area_fn, but to be honest we call it aggregation areas but this could be anything, right? It could be any continues value maps (like SVI) etc.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's true, we were thinking about changing the name everywhere some months ago but then it got lost somehow.
so we could agree on a name and replace it all!

predicate="intersects",
how="left",
)

# If we want to keep only used area we filter based on the intersections else we provide the whole dataframe
if not keep_all:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we connect this option then also to the frontend with a checkbox button?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is a good idea. Let's leave as is for now and make an issue for it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good


exposure_gdf = join_exposure_aggregation_multiple_areas(exposure_gdf, aggregation_area_fn, attribute_names, label_names)
exposure_gdf, areas_gdf = spatial_joins(exposure_gdf, aggregation_area_fn, attribute_names, label_names, keep_all)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

somehow keep_all is False here by default and also passed that way into the next function,
Shouldnt it be True by default?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My prespective is that we should only save the parts that are used so we avoid saving huge files. Imagine you have a file that covers a whole county and then you want a FIAT model for a town. Wouldn't it make sense to keep only that part?

@panosatha panosatha changed the base branch from main to floodadapt May 27, 2024 15:13
@panosatha panosatha requested a review from Santonia27 May 29, 2024 14:51
@Santonia27 Santonia27 merged commit 01deeff into floodadapt Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add attributes for aggregation areas and spatial joins
2 participants