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

ENH: added setup_storage_volume to account for green-infratructure #101

Merged
merged 15 commits into from
Nov 9, 2023

Conversation

roeldegoede
Copy link
Collaborator

added an additional layer to the SfincsModel.grid to account for green-infrastructure. This layer describes a storage volume in m3 per cell that needs to be filled first before the cell becomes wet, and therefore mimics the presence of green-infrastructure.

input can be

  • a polygon with a volume in m3 that is divided over the cells within the polygon
  • a polygon with a height in m, then internally the volume is computed by multiplying the area and the hegiht
  • points with a volume

@roeldegoede roeldegoede self-assigned this Sep 13, 2023
@roeldegoede roeldegoede marked this pull request as ready for review November 8, 2023 08:49
Copy link
Contributor

@DirkEilander DirkEilander left a comment

Choose a reason for hiding this comment

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

I've just checked the code, not actually tested it.
Apart from some small comments, before merging, it would be good to

  • move the lines 1611-1691 to a workflow script
  • add a unit test with a gdf containing a point a polygon with and without volume/height attributes on a small rotated grid to make sure it works as expected.

Comment on lines 1656 to 1661
# rotate the point
x, y = ~da_vol.raster.transform * (x, y)
# select the grid cell nearest to the point
closest_point = da_vol.reindex(x=da_vol.x, y=da_vol.y).sel(
x=x, y=y, method="nearest"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this could be replaced with row,col = da_vol.raster.rowcol(x, y) after which you can use da_vol.iloc[row, col] later?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This doesn't seem to work for me ..

hydromt_sfincs/sfincs.py Outdated Show resolved Hide resolved
Copy link
Contributor

@DirkEilander DirkEilander left a comment

Choose a reason for hiding this comment

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

nice work on the test Roel, looks good to me!

@roeldegoede roeldegoede merged commit 6a116fc into main Nov 9, 2023
5 checks passed
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.

3 participants