GeoStat-Framework / GSTools

GSTools - A geostatistical toolbox: random fields, variogram estimation, covariance models, kriging and much more
https://geostat-framework.org
GNU Lesser General Public License v3.0
544 stars 71 forks source link

Obtain Random field of slope #352

Closed LanPeng-94 closed 1 month ago

LanPeng-94 commented 3 months ago

Dear,

I am utilizing Gstools to create a random field for a slope, and I have retrieved my grid data with coordinates X=data[:,0:1] and Y=data[:,1:2]. Assuming the generation of a random field with a saturated permeability coefficient Ks, and given it follows a lognormal distribution with a mean of (2 \times 10^{-5}) and a standard deviation of (1.6 \times 10^{-5}), it equates to a normal distribution with a mean of -11.067 and a variance of 0.495. I have composed the following code based on these assumptions.

Is this correct? Additionally, how can I manage the number of truncations for KL, and what is the default setting?

import gstools as gs

# number of fields
fields_no = 2

# model setup
model = gs.Exponential(dim=2, var=0.495, len_scale=[50, 10])
srf = gs.SRF(model, mean=-11.067)
field = srf.unstructured([data[:,0:1].ravel(), 
                          data[:,1:2].ravel()])
gs.transform.normal_to_lognormal(srf)
field_log_norm = srf.field

srf.plot()

image (Figure 1)

Below is the result I generated (Figure 1), which doesn't seem right because I have a copy of the reference solution (Figure 2). My results are much steeper. In addition, the reference solution has a truncation of 8. image (Figure 2)

LSchueler commented 3 months ago

Hi,

your field in Fig. 1 does not look lognormally distributed. Try replacing your line gs.transform.normal_to_lognormal(srf) with srf.transform('normal_to_lognormal').

Sorry, I don't know what you mean by "the number of truncations for KL".

LanPeng-94 commented 3 months ago

Hi,

Below is a new field based on "srf.transform('normal_to_lognormal')".

image