Skip to content

Commit

Permalink
debug cases with no mct pixels
Browse files Browse the repository at this point in the history
  • Loading branch information
corentincarton committed Jul 29, 2024
1 parent d2556e7 commit 1a46d6c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lisflood/hydrological_modules/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pcraster import lddmask, accuflux, boolean, downstream, pit, path, lddrepair, ifthenelse, cover, nominal, uniqueid, \
catchment, upstream, pcr2numpy

import warnings

import numpy as np

from .lakes import lakes
Expand All @@ -30,6 +32,7 @@
from .mct import MCTWave

from ..global_modules.settings import LisSettings, MaskInfo
from ..global_modules.errors import LisfloodWarning
from ..global_modules.add1 import loadmap, loadmap_base, compressArray, decompress
from . import HydroModule

Expand Down Expand Up @@ -527,11 +530,18 @@ def initialMCT(self):
# ************************************************************
# ***** INITIALISATION FOR MCT ROUTING ************
# ************************************************************

# even if MCT is active, it should be deactivated if there is no MCT cell in the domain
if option['MCTRouting']:
maskinfo = MaskInfo.instance()

self.var.IsChannelMCTPcr = boolean(loadmap('ChannelsMCT', pcr=True)) #pcr
self.var.IsChannelMCT = np.bool8(compressArray(self.var.IsChannelMCTPcr)) #bool
if self.var.IsChannelMCT.sum()==0:
warnings.warn(LisfloodWarning('There are no MCT grid cell. MCT routing is deactivated'))
option['MCTRouting'] = False

if option['MCTRouting']:
maskinfo = MaskInfo.instance()

self.var.IsChannelMCTPcr = boolean(decompress(self.var.IsChannelMCT)) # pcr
# Identify channel pixels where Muskingum-Cunge-Todini is used

Expand Down

0 comments on commit 1a46d6c

Please sign in to comment.