Skip to content

Commit

Permalink
runoff: create record_hydrographs_time_zero() method (#408)
Browse files Browse the repository at this point in the history
makes the initialisation code a bit cleaner
  • Loading branch information
pesekon2 authored Jun 7, 2024
1 parent ccbf381 commit c8491df
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions smoderp2d/runoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,21 @@ def __init__(self, provider):
# method for single time step calculation
self.time_step = TimeStep()

# record values into hydrographs at time zero
self.record_hydrographs_time_zero()

Logger.info('-' * 80)

if Globals.computationType == 'implicit':
# list of flewdirection vectors - incialization
self.r, self.c = GridGlobals.get_dim()
self.list_fd = np.zeros((self.r, self.c, 8), dtype=int)

def record_hydrographs_time_zero(self):
"""Record values into hydrographs at time zero."""
zeros = ma.masked_array(
np.zeros((GridGlobals.r, GridGlobals.c)), mask=GridGlobals.masks
)

self.hydrographs.write_hydrographs_record(
None,
None,
Expand All @@ -200,7 +211,7 @@ def __init__(self, provider):
self.cumulative,
zeros
)
# record values into stream hydrographs at time zero
# stream hydrographs at time zero
self.hydrographs.write_hydrographs_record(
None,
None,
Expand All @@ -214,14 +225,6 @@ def __init__(self, provider):
True
)


Logger.info('-' * 80)

if Globals.computationType == 'implicit':
# list of flewdirection vectors - incialization
self.r, self.c = GridGlobals.get_dim()
self.list_fd = np.zeros((self.r, self.c, 8), dtype=int)

def run(self):
"""Perform the computation of the water level development.
Expand Down

0 comments on commit c8491df

Please sign in to comment.