Skip to content
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

Feature/initialization #186

Merged
merged 47 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
3dfcf29
remove bypass
r3dmos Feb 12, 2024
b88e1b7
add uz state ts
r3dmos Mar 28, 2024
5dc018e
add bypass
r3dmos Mar 28, 2024
551ef40
initializion of third soil layer
StefaniaGrimaldi Jun 5, 2024
ccc3362
add warmstart flag
StefaniaGrimaldi Jun 9, 2024
784db2f
update documentation and reference settings
StefaniaGrimaldi Jun 21, 2024
4171188
Added NumSpinUpDays for averarge soil flux computations
StefaniaGrimaldi Jun 28, 2024
5453e4e
Added NumSpinUpDays for averarge soil flux computations
StefaniaGrimaldi Jun 28, 2024
179acc9
Add scipy to requirements.txt
StefaniaGrimaldi Jul 2, 2024
89ea78d
add actual evapotraspiration only for forest and others
r3dmos Aug 6, 2024
80756a4
adding budyko evapotrapistation
r3dmos Aug 9, 2024
16904e1
Merge branch 'budyko' into InitBudyko
r3dmos Aug 9, 2024
25a722f
remove soil test
r3dmos Nov 5, 2024
824381b
comment code
r3dmos Nov 5, 2024
b398fe1
add output to xml files in test folder
r3dmos Nov 5, 2024
5501537
Update waterabstraction.py
r3dmos Nov 21, 2024
284c695
Use ColdStart flag, remove WarmStart flag
StefaniaGrimaldi Nov 28, 2024
de38626
Merge branch 'development' of https://github.com/ec-jrc/lisflood-code…
doc78 Nov 29, 2024
e1c9ada
mass balance computation when a reservoir/lake is located at the outlet
StefaniaGrimaldi Dec 1, 2024
4999db9
Fix wrong merge in reference xml file
doc78 Dec 3, 2024
0ba813f
edit transmission loss module
StefaniaGrimaldi Dec 3, 2024
6975ed8
Moved loadmap entry point for Lakes and Reservois to force caching th…
doc78 Dec 13, 2024
5a40aea
enable prerun computation in temporal chunks JRC-6424
StefaniaGrimaldi Dec 13, 2024
9dd66bb
enable prerun computation in temporal chunks JRC-6424
StefaniaGrimaldi Dec 13, 2024
5311f9b
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
afe9403
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
3612d9d
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
3ee6f69
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
91975f0
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
c171060
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
dacfaf6
improve documentation 3_step5_model-initialization
StefaniaGrimaldi Dec 15, 2024
b1dcb3d
Update snow.py
RDill69 Dec 17, 2024
1a32c02
waterabstraction: remove double correction fracgwused, abstract dom-l…
StefaniaGrimaldi Dec 18, 2024
269f946
reduce atol and rtol in test_latlon
StefaniaGrimaldi Dec 18, 2024
b79193c
add waterabstraction tss output keys in reference .xml
StefaniaGrimaldi Dec 18, 2024
9bf893f
Minor fixes to init variables
doc78 Dec 18, 2024
5d77f32
Merge branch 'feature/initialization' of https://github.com/ec-jrc/li…
doc78 Dec 18, 2024
a415bba
add tss output files TransLoss
StefaniaGrimaldi Dec 18, 2024
b950714
use ES0 map from input .xml
StefaniaGrimaldi Dec 18, 2024
d1d3e75
check NumSpinUpDays prerun length
StefaniaGrimaldi Dec 20, 2024
c863108
correct typos
StefaniaGrimaldi Dec 30, 2024
6d09f0c
Merge pull request #183 from JensenLaura/GFZ/feature/snow
doc78 Jan 27, 2025
8481a16
Merge remote-tracking branch 'origin/development' into feature/initia…
doc78 Feb 19, 2025
6bcf88e
Changed temporary version number to avoid confusion
doc78 Feb 19, 2025
9cb8bde
ChanQAvg in TrasmLoss
StefaniaGrimaldi Feb 25, 2025
d79ef36
Fix to initialization of average discharge for warm start with transm…
doc78 Feb 26, 2025
7ed10bd
Updated Lisflood name, message, date and authors
doc78 Feb 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.3.1.9998
4.3.1.500
390 changes: 372 additions & 18 deletions docs/3_step5_model-initialisation/index.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ tomli>=1.2.1
toolz>=0.10.0
xarray>=0.20.2
zipp>=0.6.0
scipy
12 changes: 7 additions & 5 deletions src/lisflood/Lisflood_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,14 @@ def splitlanduse(array1, array2=None, array3=None):
WaterLevelDyn = -9999
# Set water level dynamic wave to dummy value (needed

if option['InitLisflood'] or option['repAverageDis']:
# self.CumQ += self.ChanQ
if option['InitLisflood']:
if (self.TimeSinceStart > np.round(self.NumDaysSpinUp/self.DtDay)) :
self.CumQ += self.ChanQAvg
self.avgdis = self.CumQ/(self.TimeSinceStart + self.TimeSinceStartPrerunChunkInit[0] - np.round(self.NumDaysSpinUp/self.DtDay))
# to calculate average discharge over the entire simulation
elif option['repAverageDis']:
self.CumQ += self.ChanQAvg
#cmcheck - we should use ChanQAvg here not ChanQ
self.avgdis = self.CumQ/self.TimeSinceStart
# to calculate average discharge over the entire simulation
self.avgdis = self.CumQ/(self.TimeSinceStart)

#self.DischargeM3Out += np.where(self.AtLastPointC ,self.ChanQ * self.DtSec,0)
self.DischargeM3Out += np.where(self.AtLastPointC, self.ChanQAvg * self.DtSec, 0)
Expand Down
6 changes: 3 additions & 3 deletions src/lisflood/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

__version__ = version
__authors__ = "Ad de Roo, Emiliano Gelati, Peter Burek, Johan van der Knijff, Niko Wanders"
__date__ = "23/01/2024"
__copyright__ = "Copyright 2019-2024, European Commission - Joint Research Centre"
__maintainer__ = "Stefania Grimaldi, Cinzia Mazzetti, Carlo Russo, Damien Decremer, Corentin Carton De Wiart, Valerio Lorini, Ad de Roo"
__date__ = "27/02/2025"
__copyright__ = "Copyright 2019-2025, European Commission - Joint Research Centre"
__maintainer__ = "Stefania Grimaldi, Cinzia Mazzetti, Jesus Casado Rodriguez, Carlo Russo, Damien Decremer, Corentin Carton De Wiart"
__status__ = "Operation"
__institution__ = "European Commission DG Joint Research Centre (JRC) - E1, D2 Units"
2 changes: 1 addition & 1 deletion src/lisflood/global_modules/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __call__(self, *args, **kwargs):
return_data = self.cache[key]
else:
return_data = self.cache[key]
self.found[self.name] += 1
self.found[self.name] += 1
return return_data

@classmethod
Expand Down
132 changes: 109 additions & 23 deletions src/lisflood/global_modules/default_options.py

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion src/lisflood/global_modules/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""
from __future__ import (absolute_import, print_function, unicode_literals)


from future.backports import OrderedDict
from future.utils import with_metaclass
from nine import (iteritems, str, range, map, nine)
Expand All @@ -42,6 +43,7 @@
from .errors import LisfloodError, LisfloodWarning, LisfloodFileError
from .decorators import cached
from .default_options import default_options
##from .add1 import loadmap # Carlo, not sure....


project_dir = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '../../..'))
Expand Down Expand Up @@ -394,6 +396,12 @@ def __init__(self, settings_file, sys_args=[]):
self.step_start_dt = inttodate(self.step_start_int - 1, ref_date_start, binding=self.binding)
self.step_end_dt = inttodate(self.step_end_int - 1, ref_date_start, binding=self.binding)
self.maskpath = self.binding['MaskMap']
self.NumDaysSpinUp_d = self.binding['NumDaysSpinUp']
self.NumDaysSpinUp_d = int(self.NumDaysSpinUp_d)
DtSec_d1 = self.binding['DtSec']
DtSec_d = int(DtSec_d1)
self.DtDay_d = DtSec_d / 86400.


def build_reportedmaps_dicts(self):
self.report_timeseries = self._report_tss()
Expand Down Expand Up @@ -448,7 +456,7 @@ def _check_simulation_dates(self):

int_start, str_start = datetoint(self.binding['StepStart'], self.binding)
int_end, str_end = datetoint(self.binding['StepEnd'], self.binding)

self.numsteps = int_end
# test if start and end > begin
if (int_start < 0) or (int_end < 0) or ((int_end - int_start) < 0):
str_begin = begin.strftime("%d/%m/%Y %H:%M")
Expand Down
45 changes: 32 additions & 13 deletions src/lisflood/hydrological_modules/groundwater.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,27 @@ def initial(self):
self.var.LZ = np.where(LZInitValue == -9999, LZSteady, LZInitValue)
# Initialise lower store with steady-state value
# if LZInitValue is set to -9999

if option['InitLisflood']:
self.var.LZInflowCUM = loadmap('LZInflowCUMInit')
self.var.TimeSinceStartPrerunChunkInit = loadmap('TimeSinceStartPrerunChunkInit')
if isinstance(self.var.TimeSinceStartPrerunChunkInit, float):
MAP = []
MAP = maskinfo.in_zero() + self.var.TimeSinceStartPrerunChunkInit
self.var.TimeSinceStartPrerunChunkInit= []
self.var.TimeSinceStartPrerunChunkInit = MAP
# Cumulative lower zone inflow [mm]
# Needed for calculation of average LZ inflow (initialisation)
# Added the option to read LZInflowCUM from settings file: this is needed when the prerun is completed in separate chunks (e.g. 1990-200 and 2000-2010).
else:
self.var.NumDaysSpinUp = 0.0 # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk
self.var.TimeSinceStartPrerunChunkInit = 0.0 # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk
if isinstance(self.var.TimeSinceStartPrerunChunkInit, float):
MAP = []
MAP = maskinfo.in_zero() + self.var.TimeSinceStartPrerunChunkInit
self.var.TimeSinceStartPrerunChunkInit= []
self.var.TimeSinceStartPrerunChunkInit = MAP
self.var.LZInflowCUM = maskinfo.in_zero() # this allows to write lzavin in the model run, recommended ONLY when the run is done in 1 chunk

# Water in lower store [mm]
self.var.LZThreshold = loadmap('LZThreshold')
Expand All @@ -119,9 +140,6 @@ def initial(self):

self.var.GwLossCUM = maskinfo.in_zero()
# Cumulative groundwater loss [mm]
self.var.LZInflowCUM = maskinfo.in_zero()
# Cumulative lower zone inflow [mm]
# Needed for calculation of average LZ inflow (initialisation)

self.var.GwPercUZLZ = self.var.allocateVariableAllVegetation()
self.var.GwLossLZ = maskinfo.in_zero()
Expand All @@ -135,8 +153,6 @@ def dynamic(self):
# outflow from LZ to channel stops when LZ is below its threshold.
# LZ can be below its threshold because of water abstractions
self.var.LZOutflow = np.minimum(self.var.LowerZoneK * self.var.LZ, self.var.LZ - self.var.LZThreshold)
# Total UZ
self.var.UZtotal = self.var.deffraction(self.var.UZ)
# Outflow out of lower zone [mm per model timestep]
self.var.LZOutflow = np.maximum(self.var.LZOutflow, 0)
# No outflow if LZ is below threshold
Expand All @@ -163,19 +179,22 @@ def dynamic(self):
self.var.LZ = self.var.LZ - self.var.GwLossLZ
# (ground)water in lower response box [mm]

self.var.LZInflowCUM += (self.var.GwPercUZLZPixel - self.var.GwLossLZ)
# cumulative inflow into lower zone (can be used to improve
self.var.LZInflowCUM = np.maximum(self.var.LZInflowCUM, 0.0)
# LZInflowCUM would become negativ, if LZInit is set to high
# therefore this line is preventing LZInflowCUM getting negativ

self.var.GwLossPixel = self.var.GwLossLZ
# from GROUNDWATER TRANSFER to here
# Compute pixel-average fluxes
self.var.GwLossCUM += self.var.GwLossPixel
self.var.GwLossWB = self.var.GwLossPixel
# Accumulated groundwater loss over simulation period [mm]
self.var.LZAvInflow = (self.var.LZInflowCUM * self.var.InvDtDay) / self.var.TimeSinceStart
# Average inflow into lower zone over executed time steps [mm/day]

if (self.var.TimeSinceStart > np.round(self.var.NumDaysSpinUp/self.var.DtDay)) :
self.var.LZInflowCUM += (self.var.GwPercUZLZPixel - self.var.GwLossLZ)
# cumulative inflow into lower zone (can be used to improve
self.var.LZInflowCUM = np.maximum(self.var.LZInflowCUM, 0.0)
# LZInflowCUM would become negativ, if LZInit is set to high
# therefore this line is preventing LZInflowCUM getting negativ
self.var.LZAvInflow = (self.var.LZInflowCUM * self.var.InvDtDay) / ( self.var.TimeSinceStart + self.var.TimeSinceStartPrerunChunkInit[0] - np.round(self.var.NumDaysSpinUp/self.var.DtDay))
# Average inflow into lower zone over executed time steps [mm/day]
self.var.TimeSinceStartPrerunChunk = self.var.TimeSinceStartPrerunChunkInit + self.var.TimeSinceStart - np.round(self.var.NumDaysSpinUp/self.var.DtDay)


self.var.LZOutflowToChannelPixel = self.var.LZOutflowToChannel
11 changes: 6 additions & 5 deletions src/lisflood/hydrological_modules/lakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ def initial(self):
binding = settings.binding
maskinfo = MaskInfo.instance()

if option['simulateLakes'] and not option['InitLisflood']:

LakeSitesC = loadmap('LakeSites')
if option['simulateLakes']:
LakeSitesC = loadmap('LakeSites') # moved here to use the caching feature during calibration
LakeSitesC[LakeSitesC < 1] = 0
LakeSitesC[self.var.IsChannel == 0] = 0
# Get rid of any lakes that are not part of the channel network
Expand All @@ -75,7 +74,10 @@ def initial(self):
# rebuild lists of reported files with repsimulateLakes and simulateLakes = False
settings.build_reportedmaps_dicts()
return
# break if no lakes
# break if no lakes
LakeSitePcr = loadmap('LakeSites', pcr=True) # moved here to use the caching feature during calibration

if option['simulateLakes'] and not option['InitLisflood']:

self.var.IsStructureKinematic = np.where(LakeSitesC > 0, np.bool8(1), self.var.IsStructureKinematic)
# Add lake locations to structures map (used to modify LddKinematic
Expand All @@ -86,7 +88,6 @@ def initial(self):

# PCRaster part
# -----------------------
LakeSitePcr = loadmap('LakeSites', pcr=True)
LakeSitePcr = pcraster.ifthen((pcraster.defined(LakeSitePcr) & pcraster.boolean(decompress(self.var.IsChannel))), LakeSitePcr)
IsStructureLake = pcraster.boolean(LakeSitePcr)
# additional structure map only for lakes to calculate water balance
Expand Down
1 change: 1 addition & 0 deletions src/lisflood/hydrological_modules/miscInitial.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def initial(self):
self.var.DtSecChannel = loadmap('DtSecChannel')
# Sub time step used for kinematic wave channel routing [seconds]
# within the model,the smallest out of DtSecChannel and DtSec is used
self.var.NumDaysSpinUp = loadmap('NumDaysSpinUp')

self.var.MMtoM = 0.001
# Multiplier to convert wate depths in mm to meters
Expand Down
5 changes: 3 additions & 2 deletions src/lisflood/hydrological_modules/readmeteo.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, readmeteo_variable):
# initialise xarray readers
if option['readNetcdfStack']:
self.forcings = {}
for data in ['PrecipitationMaps', 'TavgMaps', 'ET0Maps', 'E0Maps']:
for data in ['PrecipitationMaps', 'TavgMaps', 'ET0Maps', 'ES0Maps', 'E0Maps']:
self.forcings[data] = xarray_reader(data)

# --------------------------------------------------------------------------
Expand All @@ -61,6 +61,7 @@ def dynamic(self):
self.var.Precipitation = self.forcings['PrecipitationMaps'][step] * self.var.DtDay * self.var.PrScaling
self.var.Tavg = self.forcings['TavgMaps'][step]
self.var.ETRef = self.forcings['ET0Maps'][step] * self.var.DtDay * self.var.CalEvaporation
self.var.ESRef = self.forcings['ES0Maps'][step] * self.var.DtDay * self.var.CalEvaporation
self.var.EWRef =self.forcings['E0Maps'][step] * self.var.DtDay * self.var.CalEvaporation

else:
Expand All @@ -71,11 +72,11 @@ def dynamic(self):
# average DAILY temperature (even if you are running the model on say an hourly time step) [degrees C]
self.var.ETRef = readmapsparse(binding['ET0Maps'], self.var.currentTimeStep(), self.var.ETRef) * self.var.DtDay * self.var.CalEvaporation
# daily reference evapotranspiration (conversion to [mm] per time step)
self.var.ESRef = readmapsparse(binding['ES0Maps'], self.var.currentTimeStep(), self.var.ESRef) * self.var.DtDay * self.var.CalEvaporation
# potential evaporation rate from a bare soil surface (conversion to [mm] per time step)
self.var.EWRef = readmapsparse(binding['E0Maps'], self.var.currentTimeStep(), self.var.EWRef) * self.var.DtDay * self.var.CalEvaporation
# potential evaporation rate from water surface (conversion to [mm] per time step)

self.var.ESRef = (self.var.EWRef + self.var.ETRef)/2

if option['TemperatureInKelvin']:
self.var.Tavg -= 273.15
17 changes: 8 additions & 9 deletions src/lisflood/hydrological_modules/reservoir.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ def initial(self):

settings = LisSettings.instance()
option = settings.options
binding = settings.binding
maskinfo = MaskInfo.instance()
if option['simulateReservoirs'] and not option['InitLisflood']:

binding = settings.binding

if option['simulateReservoirs']:
# load reservoir locations and keep only those on the channel network
reservoirs = loadmap('ReservoirSites')
reservoirs = loadmap('ReservoirSites') # moved here to use the caching feature during calibration
reservoirs[(reservoirs < 1) | (self.var.IsChannel == 0)] = 0
self.var.ReservoirSitesC = reservoirs
self.var.ReservoirSitesCC = np.compress(reservoirs > 0, reservoirs)
Expand All @@ -110,6 +108,9 @@ def initial(self):
# rebuild lists of reported files with simulateReservoirs and repsimulateReservoirs = False
settings.build_reportedmaps_dicts()
return
ReservoirSitePcr = loadmap('ReservoirSites', pcr=True) # moved here to use the caching feature during calibration

if option['simulateReservoirs'] and not option['InitLisflood']:

# Add reservoir locations to structures map
# (used to modify LddKinematic and to calculate LddStructuresKinematic)
Expand All @@ -119,11 +120,9 @@ def initial(self):
self.var.IsStructureChan = np.where(self.var.ReservoirSitesC > 0, np.bool8(1), self.var.IsStructureChan)
# Add reservoir locations to structures map (used to modify LddChan
# and to calculate LddStructuresChan)

ReservoirSitePcr = loadmap('ReservoirSites', pcr=True)

self.var.ReservoirSites = ReservoirSitePcr
ReservoirSitePcr = ifthen((defined(ReservoirSitePcr) & boolean(decompress(self.var.IsChannel))), ReservoirSitePcr)
# Get rid of any reservoirs that are not part of the channel network
# filter out reservoirs that are not part of the channel network
# (following logic of 'old' code the inflow into these reservoirs is
# always zero, so either change this or leave them out!)
ReservoirSitePcr = ifthen((defined(ReservoirSitePcr) & boolean(decompress(self.var.IsChannel))), ReservoirSitePcr)
Expand Down
23 changes: 15 additions & 8 deletions src/lisflood/hydrological_modules/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ def initial(self):
# Initialise discharge at kinematic wave pixels (note that InvBeta is simply 1/beta, computational efficiency!)

self.var.CumQ = maskinfo.in_zero()
if option['InitLisflood']:
self.var.CumQ = loadmap('CumQInit')
# Initialise sum of discharge to calculate average

# ************************************************************
Expand Down Expand Up @@ -399,13 +401,12 @@ def initial(self):
# For pixels in order 1 and beyond, upstream contribution is calculated during the calculation step.
# Initialisation is needed when using Lakes because lakes use average discharge from previous step to calculate the inflow.

if option['simulateLakes'] or option['simulateReservoirs'] and not option['InitLisflood']:
# Initialising average discharge for lakes
PrevDischargeAvg = loadmap('PrevDischargeAvg')
# Outflow (x+dx) Q during previous routing sub-step for full cross-section (average over last routing sub-step)
# Used to calculated average Inflow (x) to reservoirs and lakes
self.var.ChanQAvgDt = np.where(PrevDischargeAvg == -9999, self.var.ChanQAvgDt, PrevDischargeAvg) # np
self.var.ChanQKinAvgDt = np.where(PrevDischargeAvg == -9999, self.var.ChanQKinAvgDt, PrevDischargeAvg) # np
# Initialising average discharge for lakes, reservoirs and transmission loss warm start
PrevDischargeAvg = loadmap('PrevDischargeAvg')
# Outflow (x+dx) Q during previous routing sub-step for full cross-section (average over last routing sub-step)
# Used to calculated average Inflow (x) to reservoirs and lakes
self.var.ChanQAvgDt = np.where(PrevDischargeAvg == -9999, self.var.ChanQAvgDt, PrevDischargeAvg) # np
self.var.ChanQKinAvgDt = np.where(PrevDischargeAvg == -9999, self.var.ChanQKinAvgDt, PrevDischargeAvg) # np

# ************************************************************
# ***** CUMULATIVE OUTPUT VARIABLES *************************
Expand Down Expand Up @@ -635,7 +636,11 @@ def dynamic(self, NoRoutingExecuted):
self.polder_module.dynamic_inloop()

self.inflow_module.dynamic_inloop(NoRoutingExecuted)
self.transmission_module.dynamic_inloop()
self.transmission_module.dynamic_inloop(NoRoutingExecuted)

# ************************************************************
# ***** CHANNEL FLOW ROUTING: KINEMATIC WAVE ****************
# ************************************************************

if not(option['dynamicWave']):

Expand Down Expand Up @@ -882,6 +887,7 @@ def dynamic(self, NoRoutingExecuted):
StorageStep = StorageStep + self.var.ReservoirStorageM3.copy()
# DisStructureSR = np.where(self.var.IsUpsOfStructureKinematicC, sum1 * self.var.DtRouting, 0)
DisStructureSR = np.where(self.var.IsUpsOfStructureChanC, sum1 * self.var.DtRouting, 0)
DisStructureSR[self.var.AtLastPointC == 1 ] = 0 # this line avoids double-counting when a reservoir is located at the outlet of the cacthment
DischargeM3StructuresR = np.take(np.bincount(self.var.Catchments, weights=DisStructureSR), self.var.Catchments)
DischargeM3StructuresR -= self.var.DischargeM3StructuresIni

Expand All @@ -890,6 +896,7 @@ def dynamic(self, NoRoutingExecuted):
StorageStep = StorageStep + self.var.LakeStorageM3Balance.copy()
# DisStructureSR = np.where(self.var.IsUpsOfStructureKinematicC, sum1 * self.var.DtRouting, 0)
DisStructureSR = np.where(self.var.IsUpsOfStructureChanC, sum1 * self.var.DtRouting, 0)
DisStructureSR[self.var.AtLastPointC == 1 ] = 0 # this line avoids double-counting when a reservoir is located at the outlet of the cacthment
DischargeM3StructuresR = np.take(np.bincount(self.var.Catchments, weights=DisStructureSR), self.var.Catchments)
DisLake = maskinfo.in_zero()
np.put(DisLake, self.var.LakeIndex, 0.5 * self.var.LakeInflowCC * self.var.DtRouting)
Expand Down
Loading
Loading