You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The latest scipy version removes the _update() method from scipy.sparse.dok_matrix. This causes xdem.spatialstats.sample_empirical_variogram to throw an error, since it indirectly uses this method via skgstats.MetricSpace.
The version of scipy used by this package may need to be limited to <1.13 to avoid this.
xdem version: 0.0.18
OS: Ubuntu 22.04
Stack Trace
---------------------------------------------------------------------------AttributeErrorTraceback (mostrecentcalllast)
CellIn[8], line9185plt.legend(loc="lower right")
86plt.show()
--->91df_vgm=xdem.spatialstats.sample_empirical_variogram(
92values=z_dh.data.squeeze(),
93gsd=dh.res[0],
94subsample=300,
95n_variograms=10,
96estimator="dowd",
97random_state=42,
98 )
100func_sum_vgm, params_vgm=xdem.spatialstats.fit_sum_model_variogram(
101 ["Gaussian", "Spherical"], empirical_variogram=df_vgm102 )
103xdem.spatialstats.plot_variogram(
104df_vgm,
105xscale_range_split=[100, 1000, 10000],
106list_fit_fun=[func_sum_vgm],
107list_fit_fun_label=["Standardized double-range variogram"],
108 )
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py:1498](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py#line=1497), in sample_empirical_variogram(values, gsd, coords, subsample, subsample_method, n_variograms, n_jobs, verbose, random_state, **kwargs)1489foriinrange(n_variograms):
1491argdict= {
1492"i": i,
1493"imax": n_variograms,
(...)
1496**kwargs, # type: ignore1497 }
->1498df_run=_wrapper_get_empirical_variogram(argdict=argdict)
1500list_df_run.append(df_run)
1501else:
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py:1271](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py#line=1270), in _wrapper_get_empirical_variogram(argdict)1267argdict.pop("imax")
1269ifargdict["subsample_method"] in ["cdist_equidistant", "cdist_point"]:
1270# Simple wrapper for the skgstat Variogram function for cdist methods->1271return_get_cdist_empirical_variogram(**argdict)
1272else:
1273# Aggregating several skgstat Variogram after iterative subsampling of specific points in the Raster1274return_aggregate_pdist_empirical_variogram(**argdict)
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py:1243](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/xdem/spatialstats.py#line=1242), in _get_cdist_empirical_variogram(values, coords, subsample_method, **kwargs)1241# Filter corresponding arguments before passing to Variogram function1242filtered_var_kwargs= {k: kwargs[k] forkinvariogram_argsifkinkwargs}
->1243V=skg.Variogram(M, values=values, normalize=False, fit_method=None, **filtered_var_kwargs)
1245# Get bins, empirical variogram values, and bin count1246bins, exp=V.get_empirical(bin_center=False)
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:394](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=393), in Variogram.__init__(self, coordinates, values, estimator, model, dist_func, bin_func, normalize, fit_method, fit_sigma, use_nugget, maxlag, samples, n_lags, verbose, **kwargs)392fit_bounds=self._kwargs.get('fit_bounds') # returns None if empty393fit_p0=self._kwargs.get('fit_p0')
-->394self.fit(force=True, bounds=fit_bounds, p0=fit_p0)
396# finally check if any of the uncertainty propagation kwargs are set397self._experimental_conf_interval=NoneFile [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:1641](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=1640), in Variogram.fit(self, force, method, sigma, bounds, p0, **kwargs)1638self.cov=None1640# if force, force a clean preprocessing->1641self.preprocessing(force=force)
1643# load the data1644x=np.array(self.bins)
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:1550](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=1549), in Variogram.preprocessing(self, force)1529"""Preprocessing function 1530 1531 Prepares all input data for the fit and transform functions. Namely, (...) 1547 1548 """1549# call the _calc functions->1550self._calc_diff(force=force)
1551self._calc_groups(force=force)
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:1933](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=1932), in Variogram._calc_diff(self, force)1930return1932# format into column-stack for faster calculation->1933diffs=self._format_values_stack(self.values)
1935# check if this is a cross-variogram1936ifself.is_cross_variogram:
File [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:1879](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=1878), in Variogram._format_values_stack(self, values)1871""" 1872 Create a numpy column stack to calculate differences between two value arrays. 1873 The format function will handle sparse matrices, as these do not include (...) 1876 1877 """1878# handle sparse matrix->1879ifisinstance(self.distance_matrix, sparse.spmatrix):
1880# get triangular distance matrices1881c=r=self.triangular_distance_matrix1883# get the sparse CSR matrixFile [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py:1222](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/Variogram.py#line=1221), in Variogram.distance_matrix(self)1220 @property1221defdistance_matrix(self):
->1222returnself._X.distsFile [~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/MetricSpace.py:786](http://10.8.1.28:8888/lab/tree/Derek_big_bar/~/miniforge3/envs/derek/lib/python3.11/site-packages/skgstat/MetricSpace.py#line=785), in RasterEquidistantMetricSpace.dists(self)776# remove possible duplicates (that would be summed by default)777# from https://stackoverflow.com/questions/28677162/ignoring-duplicate-entries-in-sparse-matrix778
(...)
783# Solution 5+ times faster than the preceding, but relies on _update() which might change in scipy (which784# only has an implemented method for summing duplicates, and not ignoring them yet)785dok=sparse.dok_matrix((len(self.coords), len(self.coords)))
-->786dok._update(zip(zip(c, eq), d))
787dists=dok.tocsr()
789self._dists=distsAttributeError: 'dok_matrix'objecthasnoattribute'_update'
The text was updated successfully, but these errors were encountered:
The latest scipy version removes the
_update()
method from scipy.sparse.dok_matrix. This causesxdem.spatialstats.sample_empirical_variogram
to throw an error, since it indirectly uses this method via skgstats.MetricSpace.The version of scipy used by this package may need to be limited to <1.13 to avoid this.
xdem version: 0.0.18
OS: Ubuntu 22.04
Stack Trace
The text was updated successfully, but these errors were encountered: