1
+ import copy
1
2
import math
3
+ import random
4
+
2
5
import numpy as np
6
+
3
7
from .load_input import load_inputs
4
- import random
5
- import copy
6
8
7
9
8
10
class Barrier3dError (Exception ):
@@ -61,7 +63,7 @@ def DuneGrowth(self, DuneDomain, t):
61
63
Qdg = 0
62
64
# Grow dune
63
65
for q in range (self ._DuneWidth ):
64
- reduc = 1 / (Cf ** q )
66
+ reduc = 1 / (Cf ** q )
65
67
G = (
66
68
self ._growthparam
67
69
* DuneDomain [t - 1 , :, q ]
@@ -197,7 +199,6 @@ def Shrubs(
197
199
self ._BarrierLength
198
200
): # Loop through each row of island width (i.e. from ocean to mainland side of island)
199
201
if 0 in ShrubDomainAll :
200
-
201
202
# For all cells with a shrub
202
203
FemaleShrubs = ShrubDomainFemale [:, k ]
203
204
fruiting_shrub = [
@@ -831,7 +832,7 @@ def __init__(self, **kwds):
831
832
832
833
if len (kwds ) > 0 :
833
834
raise ValueError (
834
- "unrecognized keywords ({0 })" .format (", " .join (kwds .keys ()))
835
+ "unrecognized keywords ({})" .format (", " .join (kwds .keys ()))
835
836
)
836
837
837
838
# ### Initialize Shrubs
@@ -927,7 +928,6 @@ def from_yaml(cls, path_to_yaml, prefix="barrier3d"):
927
928
return cls (** load_inputs (path_to_yaml , prefix = prefix , fmt = "yaml" ))
928
929
929
930
def update (self ):
930
-
931
931
# ###########################################
932
932
# ### increase sea level and start new time step
933
933
# ###########################################
@@ -1002,7 +1002,6 @@ def update(self):
1002
1002
1003
1003
# ### Individual Storm Impacts
1004
1004
for n in range (numstorm ): # Loop through each individual storm
1005
-
1006
1005
# ###########################################
1007
1006
# ### Dune Erosion
1008
1007
@@ -1013,7 +1012,7 @@ def update(self):
1013
1012
# Find overwashed dunes and gaps
1014
1013
Dow = [
1015
1014
index
1016
- for index , value in enumerate (( DuneDomainCrest + self ._BermEl ) )
1015
+ for index , value in enumerate (DuneDomainCrest + self ._BermEl )
1017
1016
if value < Rhigh [n ]
1018
1017
]
1019
1018
gaps = self .DuneGaps (
@@ -1022,7 +1021,6 @@ def update(self):
1022
1021
1023
1022
for d in range (len (Dow )): # Loop through each overwashed dune cell
1024
1023
for w in range (self ._DuneWidth ):
1025
-
1026
1024
# Calculate dune elevation loss
1027
1025
Rnorm = Rhigh [n ] / (
1028
1026
self ._DuneDomain [self ._time_index , Dow [d ], w ]
@@ -1113,11 +1111,14 @@ def update(self):
1113
1111
# Set Domain
1114
1112
duration = dur [n ] * substep
1115
1113
width = (
1116
- np .shape (self ._InteriorDomain )[0 ] + 1 + self ._bay_routing_width
1114
+ np .shape (self ._InteriorDomain )[0 ] + 1 + self ._bay_routing_width
1117
1115
) # (dam) Add one for Dunes and 25 for bay
1118
1116
Elevation = np .zeros ([duration , width , self ._BarrierLength ])
1119
1117
Dunes = Dunes_prestorm + self ._BermEl
1120
- Bay = np .ones ([self ._bay_routing_width , self ._BarrierLength ]) * - self ._BayDepth
1118
+ Bay = (
1119
+ np .ones ([self ._bay_routing_width , self ._BarrierLength ])
1120
+ * - self ._BayDepth
1121
+ )
1121
1122
Elevation [0 , :, :] = np .vstack ([Dunes , self ._InteriorDomain , Bay ])
1122
1123
1123
1124
# Initialize Memory Storage Arrays
@@ -1159,7 +1160,6 @@ def update(self):
1159
1160
1160
1161
# ### Run Flow Routing Algorithm
1161
1162
for TS in range (duration ):
1162
-
1163
1163
ShrubDomainWidth = np .shape (self ._ShrubDomainFemale )[0 ]
1164
1164
DeadDomainWidth = np .shape (self ._ShrubDomainDead )[0 ]
1165
1165
@@ -1179,7 +1179,6 @@ def update(self):
1179
1179
1180
1180
for i in range (self ._BarrierLength ):
1181
1181
if Discharge [TS , d , i ] > 0 :
1182
-
1183
1182
Q0 = Discharge [TS , d , i ]
1184
1183
1185
1184
# ### Calculate Slopes
@@ -1207,7 +1206,6 @@ def update(self):
1207
1206
# ### Calculate Discharge To Downflow Neighbors
1208
1207
# One or more slopes positive
1209
1208
if S1 > 0 or S2 > 0 or S3 > 0 :
1210
-
1211
1209
if S1 < 0 :
1212
1210
S1 = 0
1213
1211
if S2 < 0 :
@@ -1217,29 +1215,29 @@ def update(self):
1217
1215
1218
1216
Q1 = (
1219
1217
Q0
1220
- * S1 ** self ._nn
1218
+ * S1 ** self ._nn
1221
1219
/ (
1222
- S1 ** self ._nn
1223
- + S2 ** self ._nn
1224
- + S3 ** self ._nn
1220
+ S1 ** self ._nn
1221
+ + S2 ** self ._nn
1222
+ + S3 ** self ._nn
1225
1223
)
1226
1224
)
1227
1225
Q2 = (
1228
1226
Q0
1229
- * S2 ** self ._nn
1227
+ * S2 ** self ._nn
1230
1228
/ (
1231
- S1 ** self ._nn
1232
- + S2 ** self ._nn
1233
- + S3 ** self ._nn
1229
+ S1 ** self ._nn
1230
+ + S2 ** self ._nn
1231
+ + S3 ** self ._nn
1234
1232
)
1235
1233
)
1236
1234
Q3 = (
1237
1235
Q0
1238
- * S3 ** self ._nn
1236
+ * S3 ** self ._nn
1239
1237
/ (
1240
- S1 ** self ._nn
1241
- + S2 ** self ._nn
1242
- + S3 ** self ._nn
1238
+ S1 ** self ._nn
1239
+ + S2 ** self ._nn
1240
+ + S3 ** self ._nn
1243
1241
)
1244
1242
)
1245
1243
@@ -1249,7 +1247,6 @@ def update(self):
1249
1247
1250
1248
# No slopes positive, one or more equal to zero
1251
1249
elif S1 == 0 or S2 == 0 or S3 == 0 :
1252
-
1253
1250
pos = 0
1254
1251
if S1 == 0 :
1255
1252
pos += 1
@@ -1276,7 +1273,6 @@ def update(self):
1276
1273
1277
1274
# All slopes negative
1278
1275
else :
1279
-
1280
1276
Q1 = (
1281
1277
Q0
1282
1278
* abs (S1 ) ** (- self ._nn )
@@ -1490,7 +1486,6 @@ def update(self):
1490
1486
SedFluxOut [TS , d , i ] = Qs_out
1491
1487
1492
1488
else : # If cell is subaqeous, exponentially decay dep. of remaining sed across bay
1493
-
1494
1489
if inundation == 0 :
1495
1490
Cbb = self ._Cbb_r
1496
1491
else :
@@ -1654,7 +1649,6 @@ def update(self):
1654
1649
)
1655
1650
1656
1651
def update_dune_domain (self ):
1657
-
1658
1652
# ###########################################
1659
1653
# ### update dune domain (erode/prograde) based on on shoreline change
1660
1654
# ###########################################
@@ -1953,11 +1947,11 @@ def RSLR(self):
1953
1947
@RSLR .setter
1954
1948
def RSLR (self , value ):
1955
1949
self ._RSLR = value
1956
-
1950
+
1957
1951
@property
1958
1952
def SL (self ):
1959
1953
return self ._SL
1960
-
1954
+
1961
1955
@property
1962
1956
def Hd_AverageTS (self ):
1963
1957
return self ._Hd_AverageTS
0 commit comments