Index: wflow-py/Sandbox/wflow_musle.py =================================================================== diff -u -r3e39e84af48f1bcb5ec0d243748147be223674f2 -r5191d30aab0a049554d6f048c56a3689f9a07a56 --- wflow-py/Sandbox/wflow_musle.py (.../wflow_musle.py) (revision 3e39e84af48f1bcb5ec0d243748147be223674f2) +++ wflow-py/Sandbox/wflow_musle.py (.../wflow_musle.py) (revision 5191d30aab0a049554d6f048c56a3689f9a07a56) @@ -393,7 +393,7 @@ self.xl, self.yl, self.reallength = pcrut.detRealCellLength( self.ZeroMap, sizeinmetres ) - self.hru_km = (self.reallength / 1000.) ** 2 + self.hru_km = (self.reallength / 1000.0) ** 2 # Calulate slope taking into account that x,y may be in lat,lon self.Slope = slope(self.Altitude) @@ -403,59 +403,61 @@ self.percent_sand = 100 - self.percent_clay - self.percent_silt self.erod_k = ifthenelse( pcrand( - self.percent_clay >= 40., - pcrand(self.percent_sand >= 20., self.percent_sand <= 45.), + self.percent_clay >= 40.0, + pcrand(self.percent_sand >= 20.0, self.percent_sand <= 45.0), ), 2.0, ifthenelse( pcrand( - self.percent_clay >= 27., - pcrand(self.percent_sand >= 20., self.percent_sand <= 45.), + self.percent_clay >= 27.0, + pcrand(self.percent_sand >= 20.0, self.percent_sand <= 45.0), ), 1.7, ifthenelse( - pcrand(self.percent_silt <= 40., self.percent_sand <= 20.), + pcrand(self.percent_silt <= 40.0, self.percent_sand <= 20.0), 2.0, ifthenelse( - pcrand(self.percent_silt > 40., self.percent_clay >= 40.), + pcrand(self.percent_silt > 40.0, self.percent_clay >= 40.0), 1.6, ifthenelse( - pcrand(self.percent_clay >= 35., self.percent_sand >= 45.), + pcrand( + self.percent_clay >= 35.0, self.percent_sand >= 45.0 + ), 1.9, ifthenelse( pcrand( - self.percent_clay >= 27., self.percent_sand < 20. + self.percent_clay >= 27.0, self.percent_sand < 20.0 ), 1.6, ifthenelse( pcrand( - self.percent_clay <= 10., - self.percent_silt >= 80., + self.percent_clay <= 10.0, + self.percent_silt >= 80.0, ), 1.2, ifthenelse( self.percent_silt >= 50, 1.5, ifthenelse( pcrand( - self.percent_clay >= 7., + self.percent_clay >= 7.0, pcrand( - self.percent_sand <= 52., - self.percent_silt >= 28., + self.percent_sand <= 52.0, + self.percent_silt >= 28.0, ), ), 2.0, ifthenelse( - self.percent_clay >= 20., + self.percent_clay >= 20.0, 2.1, ifthenelse( self.percent_clay - >= self.percent_sand - 70., + >= self.percent_sand - 70.0, 2.6, ifthenelse( self.percent_clay - >= (2. * self.percent_sand) - - 170., + >= (2.0 * self.percent_sand) + - 170.0, 3, scalar(1.9), ), @@ -546,28 +548,30 @@ self.sedspl = ( self.erod_k * ke_total - * exp(-self.eros_spl * self.Runoff / 1000.) + * exp(-self.eros_spl * self.Runoff / 1000.0) * self.hru_km ) # tons per cell """ Impervious area of HRU """ # JS PAthFrac (Fimp) is already impervious fraction so this (sedspl) is the pervious? # So we multiply sedspl with pervious area fraction - self.sedspl = self.sedspl * (1. - self.PathFrac) + self.sedspl = self.sedspl * (1.0 - self.PathFrac) """ maximum water depth that allows splash erosion """ self.sedspl = ifthenelse( - pcror(self.Runoff >= 3. * rain_d50, self.Runoff <= 1.e-6), 0., self.sedspl + pcror(self.Runoff >= 3.0 * rain_d50, self.Runoff <= 1.0e-6), + 0.0, + self.sedspl, ) """ Overland flow erosion """ """ cover and management factor used in usle equation (ysed.f) """ c = exp( - (-.2231 - self.idplt_cvm) * exp(-.00115 * self.soil_cov + self.idplt_cvm) + (-0.2231 - self.idplt_cvm) * exp(-0.00115 * self.soil_cov + self.idplt_cvm) ) """ calculate shear stress (N/m2) """ - bed_shear = 9807 * (self.Runoff / 1000.) * self.Slope + bed_shear = 9807 * (self.Runoff / 1000.0) * self.Slope """ sediment yield by overland flow (kg/hour/m2) """ self.sedov = ( @@ -583,12 +587,12 @@ self.sedov = 16.667 * self.sedov * self.hru_km * self.timestepsecs / 60.0 """ Impervious area of HRU """ - self.sedov = self.sedov * (1. - self.PathFrac) + self.sedov = self.sedov * (1.0 - self.PathFrac) """ Report sediment yield """ self.hhsedy = self.dratio * (self.sedspl + self.sedov) self.hhsedy = cover( - ifthenelse(self.hhsedy < 1.e-10, 0, self.hhsedy), scalar(0.0) + ifthenelse(self.hhsedy < 1.0e-10, 0, self.hhsedy), scalar(0.0) ) # We could use accucapacityflux and link the capacity to runoff of speed self.SedRunoff = accuflux(self.TopoLdd, self.hhsedy)