Closed bergalli closed 2 months ago
convert mask from BooleanArray to numpy before calling .nonzero()
Changes proposed in this PR:
This PR fixes #
I ran into an error when running impact.calc(exposures, if_set, tc). The variables seem properly set:
exposures <climada.entity.exposures.base.Exposures object at 0x16b601e40> exposures.gdf uid geometry value latitude longitude if_TC centr_TC 0 GACTAFG0001 POINT (68.68634 35.96580) 0.36 35.9658 68.686338 1 1939286 1 GACTALB0001 POINT (19.63345 41.83677) 0.5 41.83677 19.63345 1 1729995 2 GACTALB0002 POINT (19.74361 41.50308) 1.33 41.503079 19.743606 1 1740796 3 GACTALB0003 POINT (19.72534 41.54909) 1.4 41.549091 19.725338 1 1740796 4 GACTALB0004 POINT (20.04514 41.12010) 0.3 41.120103 20.045136 1 1755199
The error happens here:
mask = ( (self.exposures.gdf.value.values == self.exposures.gdf.value.values) # value != NaN & (self.exposures.gdf.value.values != 0) # value != 0 & (self.exposures.gdf[self.hazard.centr_exp_col].values >= 0) # centroid assigned )
where mask is of BooleanArray type, and a few lines later (where I modified), mask.nonzero() is called and fails.
develop
noticed the deprecation warning afterwards
Thank you for the proposal. Could you please explain quickly what the error is that this PR fixes? It is not clear above.
convert mask from BooleanArray to numpy before calling .nonzero()
Changes proposed in this PR:
This PR fixes #
I ran into an error when running impact.calc(exposures, if_set, tc). The variables seem properly set:
The error happens here:
where mask is of BooleanArray type, and a few lines later (where I modified), mask.nonzero() is called and fails.
PR Author Checklist
develop
)PR Reviewer Checklist