Skip to content

Commit c595a3b

Browse files
committed
Generator: remove 'verbose' argument; make arguments key-word only
1 parent 83c85f8 commit c595a3b

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

src/gstools/field/generator.py

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,6 @@ class RandMeth(Generator):
124124
seed : :class:`int` or :any:`None`, optional
125125
The seed of the random number generator.
126126
If "None", a random seed is used. Default: :any:`None`
127-
verbose : :class:`bool`, optional
128-
Be chatty during the generation.
129-
Default: :any:`False`
130127
sampling : :class:`str`, optional
131128
Sampling strategy. Either
132129
@@ -169,17 +166,16 @@ class RandMeth(Generator):
169166
def __init__(
170167
self,
171168
model,
169+
*,
172170
mode_no=1000,
173171
seed=None,
174-
verbose=False,
175172
sampling="auto",
176173
**kwargs,
177174
):
178175
if kwargs:
179176
warnings.warn("gstools.RandMeth: **kwargs are ignored")
180177
# initialize attributes
181178
self._mode_no = int(mode_no)
182-
self._verbose = bool(verbose)
183179
# initialize private attributes
184180
self._model = None
185181
self._seed = None
@@ -274,15 +270,12 @@ def update(self, model=None, seed=np.nan):
274270
)
275271
# if the user tries to trick us, we beat him!
276272
elif model is None and np.isnan(seed):
277-
if (
273+
if not (
278274
isinstance(self._model, CovModel)
279275
and self._z_1 is not None
280276
and self._z_2 is not None
281277
and self._cov_sample is not None
282278
):
283-
if self.verbose:
284-
print("RandMeth.update: Nothing will be done...")
285-
else:
286279
raise ValueError(
287280
"gstools.field.generator.RandMeth: "
288281
"neither 'model' nor 'seed' given!"
@@ -381,15 +374,6 @@ def mode_no(self, mode_no):
381374
self._mode_no = int(mode_no)
382375
self.reset_seed(self._seed)
383376

384-
@property
385-
def verbose(self):
386-
""":class:`bool`: Verbosity of the generator."""
387-
return self._verbose
388-
389-
@verbose.setter
390-
def verbose(self, verbose):
391-
self._verbose = bool(verbose)
392-
393377
@property
394378
def value_type(self):
395379
""":class:`str`: Type of the field values (scalar, vector)."""
@@ -417,9 +401,6 @@ class IncomprRandMeth(RandMeth):
417401
seed : :class:`int` or :any:`None`, optional
418402
the seed of the random number generator.
419403
If "None", a random seed is used. Default: :any:`None`
420-
verbose : :class:`bool`, optional
421-
State if there should be output during the generation.
422-
Default: :any:`False`
423404
sampling : :class:`str`, optional
424405
Sampling strategy. Either
425406
@@ -464,18 +445,24 @@ class IncomprRandMeth(RandMeth):
464445
def __init__(
465446
self,
466447
model,
448+
*,
467449
mean_velocity=1.0,
468450
mode_no=1000,
469451
seed=None,
470-
verbose=False,
471452
sampling="auto",
472453
**kwargs,
473454
):
474455
if model.dim < 2 or model.dim > 3:
475456
raise ValueError(
476457
"Only 2D and 3D incompressible fields can be generated."
477458
)
478-
super().__init__(model, mode_no, seed, verbose, sampling, **kwargs)
459+
super().__init__(
460+
model=model,
461+
mode_no=mode_no,
462+
seed=seed,
463+
sampling=sampling,
464+
**kwargs,
465+
)
479466

480467
self.mean_u = mean_velocity
481468
self._value_type = "vector"

0 commit comments

Comments
 (0)