Skip to content

Conversation

@JoerivanEngelen
Copy link
Contributor

@JoerivanEngelen JoerivanEngelen commented Apr 3, 2024

Fixes #949

Description

  • Adds functionality to allocate river cells.
  • These can also be used to allocate DRN, GHB, and RCH cells
  • I had to move the polygonize util function to work around a nasty circular import. The solution also prevents changes to the public API.
  • A decorator was added to enforce an iMOD Python compatible dimension order (Related to: Force dimension order of packages #239 )
  • A decorator was added to preserve grid type (xu.UgridDataArray or xr.DataArray).

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

@JoerivanEngelen JoerivanEngelen marked this pull request as ready for review April 8, 2024 16:25
@JoerivanEngelen JoerivanEngelen requested a review from Manangka April 9, 2024 13:43
Copy link
Contributor

@luitjansl luitjansl 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, some comments

top of model layers
bottom: GridDataArray
bottom of model layers
bottom_elevation: GridDataArray
Copy link
Contributor

Choose a reason for hiding this comment

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

river_bottom_elevation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bottom_elevation is used in the River package, wanted to stick to that convention as much as possible.

top: GridDataArray,
bottom: GridDataArray,
head: GridDataArray,
) -> GridDataArray:
Copy link
Contributor

Choose a reason for hiding this comment

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

for all these allocation functions, input arrays like "top" and "bottom" should all be xr.DataArray or xu.UgridDataArray but they should (I assume) be all of the same type. If so, could you do some validation? you can probably use the same validation function for all allocators.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessarily true:

You can supply top and bottom as scalar xr.DataArray and 1D xr.DataArray with layer dimension and provide unstructured grids to the other variables.

@JoerivanEngelen JoerivanEngelen added this pull request to the merge queue Apr 10, 2024
Merged via the queue into master with commit 626af7d Apr 10, 2024
@JoerivanEngelen JoerivanEngelen deleted the issue_949_allocate_riv_layers branch April 10, 2024 15:53
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.

Create utility functions to allocate RIV/DRN/GHB cells

3 participants