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

Issue #1001 more msw regrid packages simplified #1151

Conversation

luitjansl
Copy link
Contributor

@luitjansl luitjansl commented Aug 14, 2024

Fixes #1001

Description

adds regridding for metaswap packages meteo and grid_data
Adds a utility function for computing cell area and grid area for equidistant and non-equidistant grids.

Checklist

  • Links to correct issue
  • Update changelog, if changes affect users
  • PR title starts with Issue #nr, e.g. Issue #737
  • Unit tests were added
  • If feature added: Added/extended example

@luitjansl luitjansl self-assigned this Aug 14, 2024
@luitjansl luitjansl marked this pull request as draft August 14, 2024 12:37
@luitjansl luitjansl changed the base branch from master to metaswap_regridding_feature_branch August 14, 2024 12:38
…re_msw_regrid_packages_simplified

# Conflicts:
#	imod/tests/test_msw/test_annual_crop_factors.py
…re_msw_regrid_packages_simplified

# Conflicts:
#	imod/msw/grid_data.py
#	imod/msw/infiltration.py
#	imod/msw/ponding.py
#	imod/msw/scaling_factors.py
@luitjansl luitjansl marked this pull request as ready for review August 15, 2024 14:18
Copy link
Contributor

@JoerivanEngelen JoerivanEngelen left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for also cleaning up the tests. I have a few small comments, approving in advance.

@@ -736,3 +736,48 @@ def _polygonize(da: xr.DataArray) -> "gpd.GeoDataFrame":
gdf = gpd.GeoDataFrame({"value": colvalues, "geometry": geometries})
gdf.crs = da.attrs.get("crs")
return gdf


def get_grid_area(array: xr.DataArray) -> float:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe: get_total_grid_area is more explicit? "grid_area" could still mean "a grid of cell areas" if you don't know that also a function named get_cell_area exists

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -6,6 +6,7 @@
import xugrid as xu

import imod
from imod.util.spatial import get_cell_area
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see tests for get_grid_area?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link

@luitjansl luitjansl merged commit 8e103f4 into metaswap_regridding_feature_branch Aug 16, 2024
6 checks passed
@luitjansl luitjansl deleted the issue_#1001_more_msw_regrid_packages_simplified branch August 16, 2024 09:47
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.

implement regridding for more Metaswap packages
2 participants