-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
Description
Describe the bug
When centroids are generated from exposure objects containing duplicates, the resulting hazard intensity matrix contains negative indices:
When running tc_pnt.intensity.indices
for the example below, it returns array([ 0, 1, 2, 4, -1, 5], dtype=int32)
To Reproduce
see example
Code example:
import numpy as np
from climada.entity import Exposures
from climada.hazard import Centroids, TCTracks, TropCyclone
latitude = np.array(
[21.899326, 21.960728, 22.220574, 22.298390, 21.787977, 21.787977, 21.981732]
)
longitude = np.array(
[88.307422, 88.565362, 88.378337, 87.806356, 88.348835, 88.348835, 89.246521]
)
values = np.array([1.0e5, 1.2e5, 1.1e5,1.1e5, 2.0e5, 2.5e5, 0.5e5])
exp_pnt = Exposures(
lat=latitude,
lon=longitude,
value=values,
value_unit="USD",
crs="epsg:4326")
centr_pnt = Centroids.from_exposures(exp_pnt)
tr_pnt = TCTracks.from_ibtracs_netcdf(storm_id="2007314N10093")
tc_pnt = TropCyclone.from_tracks(tr_pnt, centroids=centr_pnt)
tc_pnt.check()
tc_pnt.intensity.indices
Climada Version: 6.0.2.dev
System Information:
- Operating system and version: macOS 14.0
- Python version: 3.11.11
peanutfun