|
10 | 10 |
|
11 | 11 | import gstools as gs
|
12 | 12 |
|
13 |
| -# We start off by defining the spatial grid. |
14 |
| -L = np.array((500, 500)) |
15 |
| -x = np.linspace(0, L[0], 300) |
16 |
| -y = np.linspace(0, L[1], 200) |
| 13 | +# We start off by defining the spatial grid. As in the previous example, we do |
| 14 | +# not want to include the endpoints. |
| 15 | +L = np.array((500, 400)) |
| 16 | +x = np.linspace(0, L[0], 300, endpoint=False) |
| 17 | +y = np.linspace(0, L[1], 200, endpoint=False) |
17 | 18 |
|
18 | 19 | # Instead of using a Gaussian covariance model, we will use the much rougher
|
19 | 20 | # exponential model and we will introduce an anisotropy by using two different
|
20 |
| -# length scales in the x- and y-axes |
21 |
| -model = gs.Exponential(dim=2, var=2, len_scale=[30, 20]) |
| 21 | +# length scales in the x- and y-directions |
| 22 | +model = gs.Exponential(dim=2, var=2, len_scale=[80, 20]) |
22 | 23 |
|
23 |
| -# Same as before, we set up the spatial random field |
| 24 | +# Same as before, we set up the spatial random field. But this time, we will |
| 25 | +# use a periodicity which is equal to the domain size in x-direction, but |
| 26 | +# half the domain size in y-direction. And we will use different `mode_no` for |
| 27 | +# the different dimensions. |
24 | 28 | srf = gs.SRF(
|
25 | 29 | model,
|
26 | 30 | generator="Fourier",
|
27 |
| - mode_no=[32, 32], |
28 |
| - period=L, |
| 31 | + period=[L[0], L[1]/2], |
| 32 | + mode_no=[30, 20], |
29 | 33 | seed=1681903,
|
30 | 34 | )
|
31 | 35 | # and compute it on our spatial domain
|
32 | 36 | srf((x, y), mesh_type="structured")
|
33 | 37 |
|
34 |
| -# With the field generated, we can now apply transformations |
35 |
| -# starting with a discretization of the field into 4 different values |
| 38 | +# With the field generated, we can now apply transformations starting with a |
| 39 | +# discretization of the field into 4 different values |
36 | 40 | thresholds = np.linspace(np.min(srf.field), np.max(srf.field), 4)
|
37 | 41 | srf.transform("discrete", store="transform_discrete", values=thresholds)
|
38 | 42 | srf.plot("transform_discrete")
|
|
0 commit comments