gstools.field¶
GStools subpackage providing tools for spatial random fields.
Subpackages¶
generator |
GStools subpackage providing generators for spatial random fields. |
upscaling |
GStools subpackage providing upscaling routines for the spatial random field. |
Spatial Random Field¶
SRF (model[, mean, upscaling, generator]) |
A class to generate spatial random fields (SRF). |
-
class
gstools.field.
SRF
(model, mean=0.0, upscaling='no_scaling', generator='RandMeth', **generator_kwargs)[source]¶ A class to generate spatial random fields (SRF).
Parameters: - model (
CovModel
) – Covariance Model to use for the field. - mean (
float
, optional) – mean value of the SRF - var_upscaling (
str
, optional) –Method to be used for upscaling the variance at each point depending on the related element volume. See the
point_volumes
keyword in theSRF.__call__
routine. At the moment, the following upscaling methods are provided:- ”no_scaling” : No upscaling is applied to the variance.
See:
var_no_scaling
- ”coarse_graining” : A volume depended variance is
calculated by the upscaling technique coarse graining.
See:
var_coarse_graining
Default: “no_scaling”
- ”no_scaling” : No upscaling is applied to the variance.
See:
- generator (
str
, optional) –Name of the generator to use for field generation. At the moment, the following generators are provided:
- ”RandMeth” : The Randomization Methode.
See:
RandMeth
Default: “RandMeth”
- ”RandMeth” : The Randomization Methode.
See:
- **generator_kwargs – keyword arguments that are forwarded to the generator in use. Have a look at the provided generators for further information.
Attributes: Methods
__call__
(pos[, seed, force_moments, …])Generate the spatial random field. set_generator
(generator, **generator_kwargs)Set the generator for the field structured
(*args, **kwargs)Generate an SRF on a structured mesh unstructured
(*args, **kwargs)Generate an SRF on an unstructured mesh upscaling_func
(*args, **kwargs)The upscaling method applied to the field variance -
__call__
(pos, seed=nan, force_moments=False, point_volumes=0.0, mesh_type='unstructured')[source]¶ Generate the spatial random field.
Parameters: - pos (
list
) – the position tuple, containing main direction and transversal directions - seed (
int
, optional) – seed for RNG for reseting. Default: keep seed from generator - force_moments (
bool
) – Force the generator to exactly match mean and variance. Default:False
- point_volumes (
float
ornumpy.ndarray
) – If your evaluation points for the field are coming from a mesh, they are probably representing a certain element volume. This volumes can be passed by point_volumes to apply the given variance upscaling. If point_volumes is0
nothing is changed. Default:0
- mesh_type (
str
) – ‘structured’ / ‘unstructured’
Returns: field – the SRF
Return type: - pos (
-
set_generator
(generator, **generator_kwargs)[source]¶ Set the generator for the field
Parameters: - generator (
str
, optional) – Name of the generator to use for field generation. Default: “RandMeth” - **generator_kwargs – keyword arguments that are forwarded to the generator in use.
- generator (
-
structured
(*args, **kwargs)[source]¶ Generate an SRF on a structured mesh
See
SRF.__call__
-
unstructured
(*args, **kwargs)[source]¶ Generate an SRF on an unstructured mesh
See
SRF.__call__
-
upscaling
¶ Name of the upscaling method for the variance at each point depending on the related element volume.
See the
point_volumes
keyword in theSRF.__call__
routine. Default: “no_scaling”Type: str
- model (