DataverseLabs / pyinterpolate

Kriging | Poisson Kriging | Variogram Analysis
https://pyinterpolate.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
151 stars 26 forks source link

[BUG] AttributeError: 'GeoDataFrame' object has no attribute 'data' #428

Closed SimonMolinsky closed 4 months ago

SimonMolinsky commented 4 months ago

Package version 0.5.2

Describe the bug

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_14822/729262346.py in ?()
----> 1 pk_model = ptp.smooth_blocks(semivariogram_model=reg.final_theoretical_model, blocks=gdf, point_support=ps, number_of_neighbors=8)

~/miniforge3/envs/spatial/lib/python3.12/site-packages/pyinterpolate/pipelines/deconvolution.py in ?(semivariogram_model, blocks, point_support, number_of_neighbors, max_range, crs, raise_when_negative_prediction, raise_when_negative_error, err_to_nan)
     97         arr_bl = blocks
     98     else:
     99         # Here IDE (PyCharm) gets type inspection wrong...
    100         # noinspection PyTypeChecker
--> 101         arr_bl = transform_blocks_to_numpy(blocks)
    102 
    103     rarr = []
    104     block_ids = arr_bl[:, 0]

~/miniforge3/envs/spatial/lib/python3.12/site-packages/pyinterpolate/processing/transform/transform.py in ?(blocks)
    333         if not expected_cols.issubset(set(blocks.columns)):
    334             raise KeyError(f'Given dataframe doesnt have all expected columns {expected_cols}. '
    335                            f'It has {blocks.columns} instead.')
    336 
--> 337         bvalues = blocks.data[['index', 'centroid.x', 'centroid.y', 'ds']].values
    338         return bvalues
    339     else:
    340         raise TypeError(f'Blocks data type {type(blocks)} not recognized. You may use Blocks,'

~/miniforge3/envs/spatial/lib/python3.12/site-packages/pandas/core/generic.py in ?(self, name)
   6295             and name not in self._accessors
   6296             and self._info_axis._can_hold_identifiers_and_holds_name(name)
   6297         ):
   6298             return self[name]
-> 6299         return object.__getattribute__(self, name)

AttributeError: 'GeoDataFrame' object has no attribute 'data'