-
Notifications
You must be signed in to change notification settings - Fork 3
Issue #1414 add cleanup hfb #1426
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
Conversation
imod/prepare/hfb.py
Outdated
@@ -217,3 +222,55 @@ def linestring_to_trapezoid_zpolygons( | |||
_line_to_trapezoid_zpolygon(x, y, zt, zb) | |||
for x, y, zt, zb in zip(x_pairs, y_pairs, zt_pairs, zb_pairs) | |||
] | |||
|
|||
|
|||
def _clip_linestring( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move these method to this class?
The original intent of moving them to a separate clip class was to keep the package classes small while keeping the similar functionality grouped. Which also makes it easier to unit test. This was done using the Visitor Pattern.
I wouldn't move this to the hfb class because we now get a mix of clip methods being in a separate clip class and clip methods being in classes specificly related to a certain package class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason is that I ran into circular imports, as the logic was put in the imod/mf6/utilities
namespace. The cleanup was in the imod/prepare/cleanup
namespace, which is imported in the imod/mf6/hfb.py
namespace.
So probably what is required is moving imod/mf6/utilties/clip.py
to imod/util/clip.py
. This, however is heavily depending on imod/mf6/interfaces
, so these probably have to be moved one level up as well. That is probably better.
@@ -336,3 +337,31 @@ def cleanup_wel( | |||
cleaned_wells, minimum_thickness | |||
) | |||
return cleaned_wells | |||
|
|||
|
|||
def cleanup_hfb( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also be called clean_linedata
or remove_inactive_hfb_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is public API, so I think I keep this to the MODFLOW6 package names, which is what users are familiar with.
|
Fixes #1414
Description
cleanup_hfb
function to clip barrier lines/Z polygons outside the active domain. This unfortunately cannot deal with the edge case where a hfb line is snapped to the outer edge of the active domain. (These edges are filtered out when callingto_mf6_pkg
, but a ValidationError is thrown whenstrict_hfb_validation
is switched on).HorizontalFlowBarrierBase.cleanup
methodimod.mf6.utilities
toimod.prepare.hfb
andimod.util.hfb
, to avoid circular imports.Checklist
Issue #nr
, e.g.Issue #737