Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While doing the other PR I stumbled upon an issue with sparse 0.16, which is not yet released. In the
SpatialAverager
, when the polygon has holes, we compute the weights of the holes and then invert them. The inversion of aCOO
array also inverts itsfill_value
. Weights are float, so a fill value of0.0
gets reverted to-0.0
. It seems that up to sparse 0.15.4, this was not a problem but with 0.16, the subsequent concatenation of the weights fails. I was told that this was not a bug : pydata/sparse#802So here is a fix for that.
Also, I modified the
__del__
methods. When the__init__
of eitherRegridder
orSpatialAverager
fails before reaching thesuper().__init__
,self.grid_in
doesn't exist yet. TheAttributeError
raised when deleting the object is not raised in the main thread, but emits a warning instead. This avoids that.