GeoStat-Framework / PyKrige

Kriging Toolkit for Python
https://pykrige.readthedocs.io
BSD 3-Clause "New" or "Revised" License
740 stars 186 forks source link

`x0` is infeasible. #271

Open jaha2600 opened 1 year ago

jaha2600 commented 1 year ago

I am trying to use pykrige to create an Ordainary Kriged map from a point shapefile. There are a few rows in the point shapefile that have 'inf' values that I remove at the start of the script, leaving a complete point shapefile.

I import the shapefile and boundary shapefile, create testing and training datasets, and create a 100 by 100 grid succesfully. However, when I go to create the Ordainary Kriging object I get the below error:

Could I get any advice as to why this is happening? I attach my complete code to the message.

ValueError Traceback (most recent call last) Cell In[89], line 3 1 #%% 2 # Generate ordinary kriging object ----> 3 OK = OrdinaryKriging( 4 np.array(x_rain_wgs), 5 np.array(y_rain_wgs), 6 value_rain, 7 variogram_model = "linear", 8 verbose = False, 9 enable_plotting = False, 10 coordinates_type = "euclidean", 11 ) 13 # Evaluate the method on grid 14 Z_pk_krig, sigma_squared_p_krig = OK.execute("grid", XX_pk_krig, YY_pk_krig)

File ~/miniconda3/envs/pykrige/lib/python3.11/site-packages/pykrige/ok.py:321, in OrdinaryKriging.init(self, x, y, z, variogram_model, variogram_parameters, v kriging.txt ariogram_function, nlags, weight, anisotropy_scaling, anisotropy_angle, verbose, enable_plotting, enable_statistics, coordinates_type, exact_values, pseudo_inv, pseudo_inv_type) 312 print("Initializing variogram model...") 314 vp_temp = _make_variogram_parameter_list( 315 self.variogram_model, variogram_parameters 316 ) 317 ( 318 self.lags, 319 self.semivariance, ... --> 818 raise ValueError("x0 is infeasible.") 820 x_scale = check_x_scale(x_scale, x0) 822 ftol, xtol, gtol = check_tolerance(ftol, xtol, gtol, method)

ValueError: x0 is infeasible.