'How to set bounds for kriging results

I am using OrdinaryKriging for surface interpolation, I wrote the following lines of code:

import pykrige

from pykrige.ok import OrdinaryKriging

#krigging with pykrige
OK = OrdinaryKriging(
    X, 
    Y, 
    E, 
    variogram_model='gaussian',
    verbose=True,
    enable_plotting=True)

gridx = np.arange(0, 1000, 1, dtype='float64')
gridy = np.arange(0, 1000, 1, dtype='float64')
zstar, ss = OK.execute("grid", gridx, gridy)
cax = plt.imshow(zstar, extent=(0, 1000, 0, 1000), origin='upper')
plt.scatter(X, Y, c='k', marker='x')
cbar=plt.colorbar(cax)
plt.title('Illuminance distribution')

X and Y define the location and E is illuminance, the quantity I want to interpolate with the algorithm from a list of known ones.

I get the following plot as the output: enter image description here

The values Im looking for must logically be greater than or equal to zero, but I am getting negative. Is there any way to define that for the algorithm?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source