PyKrige icon indicating copy to clipboard operation
PyKrige copied to clipboard

"Initializing variogram model" stuck with large dataset

Open Thorkage opened this issue 1 year ago • 0 comments

Hi,

I need to krig a large dataset (35000 data points). I provide a variogram model which is estimated in gstools:

model_mean_rescaled = gs.Exponential(dim=2, len_scale=model_mean.len_scale, var=model_mean.var, nugget=model_mean.nugget, rescale=gs.KM_SCALE*1000, latlon=True)

OK = OrdinaryKriging(df_f['lon'],df_f['lat'], df_f['snow_depth'],
                     variogram_model=model_mean_rescaled,
                     coordinates_type='geographic',
                     exact_values=False,
                     verbose=True
                     )

z, ss = OK.execute("masked", gridlon, gridlat, mask=krig_mask)

The mask in OK.execute limits the new predicted datapoints to ~50000. I had no problems with predicted locations of this amount, but never before had that long input data (df_f).

When I run the code. I get the print out "Initializing variogram model...", but then it is stuck. I tried to test a bit why it is stuck, and seems to me like it happens in _initialize_variogram_model. My python expertise is not good enough to track the issue further down into the code. I am wondering why _initialize_variogram_model needs to be called when I am providing a variogram model?

Best, Torbjörn

Thorkage avatar Sep 11 '24 17:09 Thorkage