Skip to content

Commit

Permalink
fix inifite loop caused by divide by zero (#105)
Browse files Browse the repository at this point in the history
* prevent infinite loop stemming from divide by zero

* bump version
  • Loading branch information
thurber authored Jan 4, 2024
1 parent a654bea commit dd61d8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mosartwmpy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.6.0"
__version__ = "0.6.1"
4 changes: 2 additions & 2 deletions mosartwmpy/grid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __init__(self, config: Benedict = None, parameters: Parameters = None, empty
# parameter for calculating number of main channel iterations needed
# phi_r
phi_main = np.where(
(self.mosart_mask > 0) & (self.channel_length > 0),
(self.mosart_mask > 0) & (self.channel_length > 0) & (self.channel_width > 0),
self.total_drainage_area_single * np.sqrt(self.channel_slope) / (self.channel_length * self.channel_width),
0
)
Expand Down Expand Up @@ -352,7 +352,7 @@ def __init__(self, config: Benedict = None, parameters: Parameters = None, empty
# parameter for calculating number of subnetwork iterations needed
# phi_t
phi_sub = np.where(
self.subnetwork_length > 0,
(self.mosart_mask > 0) & (self.subnetwork_length > 0) & (self.subnetwork_width > 0),
(self.area * np.sqrt(self.subnetwork_slope)) / (self.subnetwork_length * self.subnetwork_width),
0,
)
Expand Down

0 comments on commit dd61d8d

Please sign in to comment.