Skip to content

Commit

Permalink
changing some defaults to backwards compatible and adding comments
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer committed Oct 28, 2023
1 parent 97a19cb commit e89d998
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hydrolib/core/dflowfm/net/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _process(self, mesh2d_input) -> None:
def clip(
self,
geometrylist: mk.GeometryList,
deletemeshoption: int = 1, #TODO: 1 was changed
deletemeshoption: int = 0, #TODO: 1 was changed, INSIDE_NOT_INTERSECTED/0 is used elsewhere in code #deletemeshoption: mk.DeleteMeshOption = mk.DeleteMeshOption.INSIDE_NOT_INTERSECTED,
inside=False,
) -> None:
"""Clip the 2D mesh by a polygon. Both outside the exterior and inside the interiors is clipped
Expand Down Expand Up @@ -635,7 +635,7 @@ def clear(self) -> None:
self.link1d2d = np.empty((0, 2), np.int32)
# The meshkernel object needs to be resetted
self.meshkernel._deallocate_state()
self.meshkernel._allocate_state(self.meshkernel.projection)
self.meshkernel._allocate_state(self.meshkernel.is_geographic) #TODO: .get_projection() might be better
self.meshkernel.contacts_get()

def _process(self) -> None:
Expand Down Expand Up @@ -1115,7 +1115,12 @@ def __init__(self, projection: mk.ProjectType = mk.ProjectionType.CARTESIAN) ->
self.meshkernel = mk.MeshKernel(projection=projection)
# Monkeypatch the meshkernel object, because the "is_geographic" is not saved
# otherwise, and needed for reinitializing the meshkernel
# self.meshkernel.projection = projection
if projection == mk.ProjectionType.CARTESIAN:
is_geographic = False
else: #SPHERICAL or SPHERICALACCURATE
is_geographic = True
#TODO: this bool does not seems to have effect, maybe discontinue?
self.meshkernel.is_geographic = is_geographic

self._mesh1d = Mesh1d(meshkernel=self.meshkernel)
self._mesh2d = Mesh2d(meshkernel=self.meshkernel)
Expand Down

0 comments on commit e89d998

Please sign in to comment.