# estimate the variogram on an unstructured grid ##############################
###############################################################################

bins = np.linspace(0, 10, 50)
print('Estimating unstructured variogram')
bin_center, gamma = vario_estimate_unstructured(
    (x_u, y_u),
    herten_log_trans.reshape(-1),
    bins,
    sampling_size=2000,
    sampling_seed=19920516,
)

# fit an exponential model
fit_model = Exponential(dim=2)
fit_model.fit_variogram(bin_center, gamma, nugget=False)

pt.plot(bin_center, gamma)
plot_variogram(fit_model, x_max=bins[-1])

###############################################################################
# estimate the variogram on a structured grid #################################
###############################################################################

# estimate the variogram on a structured grid
# use only every 10th value, otherwise calculations would take very long
x_s_skip = x_s[::10]
y_s_skip = y_s[::10]
herten_trans_skip = herten_log_trans[::10, ::10]

print('Estimating structured variograms')
Beispiel #2
0
###############################################################################
# Variogram Analysis
# ^^^^^^^^^^^^^^^^^^
#
# Next, we need to compute a variogram for the temperature probe data and fit that variogram to an exponential model

bins = np.linspace(0, 12300, 1000)
bin_center, gamma = vario_estimate_unstructured(
    project["Observed Temperature"].points.T,
    project["Observed Temperature"]["temperature (C)"],
    bins,
)

fit_model = Exponential(dim=3)
fit_model.fit_variogram(bin_center, gamma, nugget=False)

plt.figure(figsize=(10, 5))
plt.plot(bin_center, gamma)
plot_variogram(fit_model, x_max=bins[-1], ax=plt.gca())
plt.xlabel("Lag Distance")
plt.ylabel("Variogram")
plt.show()

###############################################################################
# Performing the Kriging
# ^^^^^^^^^^^^^^^^^^^^^^
# Then we pass the fitted exponential model when instantiating the kriging operator from GSTools.

# Create the kriging model
krig = krige.Ordinary(