Adrien
Adrien

Reputation: 1

STIF Python Package Typing Error - overload of function 'gt'

I am attempting to use the STIF (space-time interpolation and forecasting) package to do 3-D kriging with time as the 3rd dimension. I am attempting to follow the example/introduction on the STIF github (with my own data) but reach a typing error when calculating the empirical variogram. Has anyone used this package successfully or encountered this problem? What is this stemming from? I'm using Python 3.10.6.

My input data consists of Well ID names, X and Y coordinates, Date, and WSE (the variable of interest). My code:

df = pd.read_excel(r'mydata.xlsx')

columns_to_keep = ['Node', 'Well ID', 'X', 'Y', 'Date', 'Month', 'Year', 'WSE', 'Remove', 'USBREstimate']
df = df[columns_to_keep]

#Remove rows where Remove = 1, USBREstimate = 1, or data before 2013
df = df[df.Remove != 1]
df = df[df.USBREstimate != 1]
df = df[df.Year >= 2013]

df['Date'] = pd.to_datetime(df['Date'])

#geodatafame
gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df['X'], df['Y']))
gdf["FullDate"] = pd.to_datetime(gdf["Date"])
gdf["time"] = gdf["Date"].dt.floor('d')
gdf["time"] -= gdf["time"].min()
gdf.set_crs(epsg=4326, inplace=True)
print(gdf)

#create STIF object
data = Data(
    gdf,
    space_cols=["X", "Y"],
    time_col="time",
    predictand_col="WSE",
    #covariate_cols=["elevation"], #could do elevation or screen interval

)
predictor = Predictor(data)

predictor.calc_empirical_variogram() #issue here
predictor.plot_empirical_variogram()

The error I receive when calling calc_empirical_variogram is:

TypingError: No implementation of function Function(<built-in function gt>) found for signature:
 
gt(timedelta64[ns], int64)
 
There are 22 candidate implementations:
  - Of which 18 did not match due to:
  Overload of function 'gt': File: <numerous>: Line N/A.
    With argument(s): '(timedelta64[ns], int64)':
   No match.
  - Of which 2 did not match due to:
  Operator Overload in function 'gt': File: unknown: Line unknown.
    With argument(s): '(timedelta64[ns], int64)':
   No match for registered cases:
    * (bool, bool) -> bool
    * (int8, int8) -> bool
    * (int16, int16) -> bool
    * (int32, int32) -> bool
    * (int64, int64) -> bool
    * (uint8, uint8) -> bool
    * (uint16, uint16) -> bool
    * (uint32, uint32) -> bool
    * (uint64, uint64) -> bool
    * (float32, float32) -> bool
    * (float64, float64) -> bool
  - Of which 2 did not match due to:
  Overload in function 'set_gt': File: numba\cpython\setobj.py: Line 1686.
    With argument(s): '(timedelta64[ns], int64)':
   Rejected as the implementation raised a specific error:
     TypingError: All arguments must be Sets, got (timedelta64[ns], int64)

Upvotes: 0

Views: 18

Answers (0)

Related Questions