GeostatsPy
GeostatsPy copied to clipboard
IndexError: index 4 is out of bounds for axis 0 with size 4
I am trying to implement the declustering function on my dataframe which consists of longitude, latitude, and sediment accumulation variables, but I am getting an out of index error. I am having trouble fixing this error myself, could someone help me figure this out? Below is the traceback:
Traceback (most recent call last):
File "", line 1, in
Okay I was able to find a solution by reducing the noff parameter to only 5. Any value greater than 5 gave me back the same error
I am also getting this error, but changing noff doesn't fix the issue for me. I'm using a geodataframe with dimension (515,20) and the following DECLUS inputs:
weights, cell_sizes, dmeans = geostats.declus(ddf,'X','Y','dZ', iminmax = 1, noff= 10, ncell=1000, cmin=1, cmax=50)
The problematic dataframe can be downloaded here (link to download gpkg from box).
I've tried resetting the dataframe index, using a different subset of rows/columns, converting to a standard Dataframe, varying the values for iminmax/noff/ncell/cmin/cmax but I haven't been able to isolate the cause.
Here is the specific error message I am getting:
IndexError Traceback (most recent call last)
Cell In [33], line 1
----> 1 weights, cell_sizes, dmeans = geostats.declus(ddf.loc[:, ['X', 'Y', 'dZ']],'X','Y','dZ',
2 iminmax = 1,
3 noff= 10, ncell=1000,
4 cmin=1, cmax=50)
6 ddf['W'] = weights
7 ddf.head()
File /srv/conda/envs/notebook/lib/python3.10/site-packages/geostatspy/geostats.py:1607, in declus(df, xcol, ycol, vcol, iminmax, noff, ncell, cmin, cmax)
1605 icell = icellx + (icelly - 1) * ncellx
1606 index[i] = icell
-> 1607 cellwt[icell] = cellwt[icell] + 1.0
1609 # The weight assigned to each datum is inversely proportional to the
1610 # number of data in the cell. We first need to get the sum of
1611 # weights so that we can normalize the weights to sum to one
1612 sumw = 0.0
IndexError: index 3109994 is out of bounds for axis 0 with size 3109994```