Skip to content

Commit 66ecb6c

Browse files
authored
Merge pull request #297 from amoodie/generalize_sed_start
generalize the sediment parcel start location
2 parents d8247d9 + 538873c commit 66ecb6c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pyDeltaRCM/sed_tools.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ def route_all_sand_parcels(self) -> None:
126126

127127
_msg = "Supplying model state to SandRouter for iteration"
128128
self.log_info(_msg, verbosity=2)
129-
130129
self._sr.run(
131130
start_indices,
132131
self.eta,
@@ -691,13 +690,14 @@ def run(
691690
self.qx = qx
692691
self.qy = qy
693692
self.qs = qs
693+
_shape = self.eta.shape
694694

695695
num_starts = start_indices.shape[0]
696696
for np_sed in range(num_starts):
697697
self.Vp_res = self.Vp_sed
698698

699-
px = 0
700-
py = start_indices[np_sed]
699+
# get initial location based on flat index
700+
px, py = shared_tools.custom_unravel(start_indices[np_sed], _shape)
701701

702702
self.qs[px, py] = self.qs[px, py] + self.Vp_res / 2.0 / self._dt / self._dx
703703
self._route_one_parcel(px, py)
@@ -912,13 +912,14 @@ def run(
912912
self.qw = qw
913913
self.qx = qx
914914
self.qy = qy
915+
_shape = self.eta.shape
915916

916917
num_starts = start_indices.shape[0]
917918
for np_sed in range(num_starts):
918919
self.Vp_res = self.Vp_sed
919920

920-
px = 0
921-
py = start_indices[np_sed]
921+
# get initial location based on flat index
922+
px, py = shared_tools.custom_unravel(start_indices[np_sed], _shape)
922923

923924
self._route_one_parcel(px, py)
924925

0 commit comments

Comments
 (0)