I am trying to use the PyKrige
module in Python to interpolate via Ordinary Kriging
my XYZ dataset.
I have the below script, code taken from https://colab.research.google.com/drive/1mZDVJ-RioBc4QHHpe2HBNJrx8sJ4-1Lw?pli=1#scrollTo=6OfzYklg_Db1
import numpy as np
import matplotlib.pyplot as plt
import pykrige.kriging_tools as kt
from pykrige.ok import OrdinaryKriging
from pylab import *
import pandas as pd
x1 = np.loadtxt("c:/test_file.xyz", usecols=0, dtype='float')
y1 = np.loadtxt("c:/test_file.xyz", usecols=0, dtype='float')
z1 = np.loadtxt("c:/test_file.xyz", usecols=0, dtype='float')
x = list(x1)
y = list(y1)
z = list(z1)
cax = plt.scatter(x, y, c=z)
cbar = plt.colorbar(cax, fraction=0.03)
plt.title('DensA Points')
OK = OrdinaryKriging(
x,
y,
z,
variogram_model='gaussian',
verbose=True,
enable_plotting=False,
nlags=5,
)
OK.variogram_model_parameters
gridx = np.arange(626000, 629100, 5, dtype='float32')
gridy = np.arange(231500, 234500, 5, dtype='float32')
zstar, ss = OK.execute("grid", gridx, gridy)
print(zstar.shape)
print(ss.shape)
cax = plt.imshow(zstar, extent=(626000, 629100, 231500, 234500), origin='lower')
savefig( 'C:/users/public/test.tiff' )
print('image saved')
The code works, but my issue is the X and Y axis.
I only want the interpolated tiff image so that I can bring it into QGIS etc. However, the output is giving me an X and Y axis, and I'm not sure how to remove them without breaking the code.