8 Verifies the fracture distribution input parameters for dfnGen.
14 Number of ellipse family distributions
16 Number of rectangle family distributions
20 def __init__(self, params, numEdistribs, numRdistribs, minFracSize):
22 global distr_helper_methods
24 self.
ellipseFamsellipseFams = distr_helper_methods.value_of(
'nFamEll')
25 self.
rectFamsrectFams = distr_helper_methods.value_of(
'nFamRect')
31 Verifies both the "ebetaDistribution" and "rBetaDistribution". If either contain any flags
32 indicating contant angle (1) then the corresponding "ebeta" and/or "rbeta" parameters are
37 Indicates shapes that the beta distribution describes. 'e' if they are ellipses, 'r' if they are rectangles.
39 shape =
"ellipse" if prefix ==
'e' else "rectangle"
41 paramName = prefix +
"betaDistribution"
43 errResult = distr_helper_methods.verify_list(
44 distr_helper_methods.value_of(paramName),
46 distr_helper_methods.verify_flag,
47 desiredLength=numFamilies)
49 distr_helper_methods.error(
"\"{}\" has defined {} value(s) but there is(are) {} {} family(ies). Need one "\
50 "flag (0 or 1) per {} family.".format(paramName, -errResult, numFamilies, shape, shape))
52 numBetas = distr_helper_methods.value_of(paramName).count(
54 if numBetas == 0:
return
56 betaParam = prefix +
"beta"
57 errResult = distr_helper_methods.verify_list(
58 distr_helper_methods.value_of(betaParam),
60 distr_helper_methods.verify_float,
61 desiredLength=numBetas)
63 distr_helper_methods.error(
"\"{}\" defined {} constant angle(s) but {} flag(s) was(were) set to 1 "\
64 "in {}. Please define one constant angle (beta value) for each flag set "\
65 "to 1 in \"{}\"".format(betaParam, -errResult, numBetas, paramName, paramName))
69 Verifies "edistr" and "rdistr" making sure one distribution is defined per family and
70 each distribution is either 1 (log-normal), 2 (Truncated Power Law), 3 (Exponential), or 4 (constant).
71 Stores how many of each distrib are in use in numEdistribs or numRdistribs lists.
73 shape =
"ellipse" if prefix ==
'e' else "rectangle"
76 paramName = prefix +
"distr"
78 errResult = distr_helper_methods.verify_list(
79 distr_helper_methods.value_of(paramName),
81 distr_helper_methods.verify_int,
82 desiredLength=numFamilies)
84 distr_helper_methods.error(
"\"{}\" has defined {} distributions but there are {} {} families. " \
85 "Need one distribution per family (1 = lognormal, 2 = Truncated Power Law, "
86 "3 = Exponential, or 4 = constant).".format(paramName, -errResult, numFamilies, shape))
88 for dist
in distr_helper_methods.value_of(paramName):
89 if int(dist) <= 0:
raise IndexError()
90 distribList[int(dist)] += 1
92 distr_helper_methods.error(
"\"{}\" contains '{}' which is not a valid distribution option. " \
93 "Only values 1 through 4 can define a family's distribution (1 = lognormal, " \
94 "2 = Truncated Power Law, 3 = Exponential, or 4 = constant).".format(paramName, dist))
98 Verifies all logNormal Parameters for ellipses and Rectangles.
100 shape =
"ellipse" if prefix ==
'e' else "rectangle"
103 prefix + name
for name
in [
"LogMean",
"sd",
"LogMin",
"LogMax"]
105 errString =
"\"{}\" has defined {} value(s) but {} lognormal distrbution(s) was(were) " \
106 "defined in \"{}\". Please define one value for each lognormal (distrib. #1) family."
108 for param
in paramNames:
109 zTmp =
True if "sd" not in param
else False
110 if "LogMean" in param:
111 errResult = distr_helper_methods.verify_list(
112 distr_helper_methods.value_of(param),
114 distr_helper_methods.verify_float,
115 desiredLength=distribList[1],
119 errResult = distr_helper_methods.verify_list(
120 distr_helper_methods.value_of(param),
122 distr_helper_methods.verify_float,
123 desiredLength=distribList[1],
127 if errResult !=
None:
128 distr_helper_methods.error(
129 errString.format(param, -errResult, distribList[1],
132 sdParam = prefix +
"sd"
133 if distr_helper_methods.zero_in_std_devs(
134 distr_helper_methods.value_of(sdParam)):
135 distr_helper_methods.error(
"\"{}\" list contains a standard deviation of 0. If this was intended, " \
136 "use the constant distribution (4) instead. Otherwise, _make sure \"{}\" " \
137 "only contains values greater than 0.".format(sdParam, sdParam))
139 distr_helper_methods.check_min_max(prefix +
"LogMin",
140 prefix +
"LogMax", shape)
141 distr_helper_methods.check_mean(prefix +
"LogMin", prefix +
"LogMax",
143 distr_helper_methods.check_min_frac_size(
144 distr_helper_methods.value_of(prefix +
"LogMin"))
148 Verifies parameters for truncated power law distribution of fractures.
150 shape =
"ellipse" if prefix ==
'e' else "rectangle"
152 paramNames = [prefix + name
for name
in [
"min",
"max",
"alpha"]]
153 errString =
"\"{}\" has defined {} value(s) but {} truncated power-law distrbution(s) was(were) " \
154 "defined in \"{}\". Please define one value for each truncated power-law (distrib. #2) family."
156 for param
in paramNames:
157 errResult = distr_helper_methods.verify_list(
158 distr_helper_methods.value_of(param),
160 distr_helper_methods.verify_float,
161 desiredLength=distribList[2],
164 if errResult !=
None:
165 distr_helper_methods.error(
166 errString.format(param, -errResult, distribList[2],
169 distr_helper_methods.check_min_max(prefix +
"min", prefix +
"max",
172 distr_helper_methods.check_min_frac_size(
173 distr_helper_methods.value_of(prefix +
"min"))
177 Verifies parameters for exponential distribution of fractures.
179 shape =
"ellipse" if prefix ==
'e' else "rectangle"
182 prefix + name
for name
in [
"ExpMean",
"ExpMin",
"ExpMax"]
184 errString =
"\"{}\" has defined {} value(s) but {} exponential distrbution(s) was(were) " \
185 "defined in \"{}\". Please define one value for each exponential (distrib. #3) family."
187 for param
in paramNames:
188 errResult = distr_helper_methods.verify_list(
189 distr_helper_methods.value_of(param),
191 distr_helper_methods.verify_float,
192 desiredLength=distribList[3],
195 if errResult !=
None:
196 distr_helper_methods.error(
197 errString.format(param, -errResult, distribList[3],
200 distr_helper_methods.check_min_max(prefix +
"ExpMin",
201 prefix +
"ExpMax", shape)
202 distr_helper_methods.check_mean(prefix +
"ExpMin", prefix +
"ExpMax",
204 distr_helper_methods.check_min_frac_size(
205 distr_helper_methods.value_of(prefix +
"ExpMin"))
209 Verifies parameters for constant distribution of fractures
211 paramName = prefix +
"const"
215 errResult = distr_helper_methods.verify_list(
216 distr_helper_methods.value_of(paramName),
218 distr_helper_methods.verify_float,
219 desiredLength=distribList[4],
222 if errResult !=
None:
223 distr_helper_methods.error(
"\"{}\" has defined {} value(s) but {} constant distrbution(s) was(were) " \
224 "defined in \"{}\". Please define one value for each family with a constant (distrib. "\
225 "#4) distribution.".format(paramName, -errResult, distribList[4], prefix +
'distr'))
227 distr_helper_methods.check_min_frac_size(
228 distr_helper_methods.value_of(paramName))
def lognormal_dist(self, prefix)
def tpl_dist(self, prefix)
def beta_distribution(self, prefix)
def constant_dist(self, prefix)
def exponential_dist(self, prefix)
def __init__(self, params, numEdistribs, numRdistribs, minFracSize)