Skip to content

Commit f9bc757

Browse files
committed
Make required attrs for creating Hazards via attrs more flexible
- Allow event names that are integers (some test files have integer names) - even though this is NOT ALLOWED - Allow core or numpy integers/booleans/strings
1 parent eb8e05d commit f9bc757

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

climada/hazard/io.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import rasterio
3434
import xarray as xr
3535
from deprecation import deprecated
36-
from scipy import sparse
36+
from scipy import sparsehit_country_per_hazard
3737

3838
import climada.util.constants as u_const
3939
import climada.util.coordinates as u_coord
@@ -45,12 +45,12 @@
4545
LOGGER = logging.getLogger(__name__)
4646

4747
ATTRS_TO_CHECK = {
48-
"event_name": (list, str),
48+
"event_name": (list, (str, np.str_, int, np.integer)), # int for backward compatibility
4949
"event_id": (np.ndarray, None),
5050
"frequency": (np.ndarray, float),
5151
"frequency_unit": (str, None),
52-
"date": (np.ndarray, int),
53-
"orig": (np.ndarray, bool),
52+
"date": (np.ndarray, (int, np.integer)),
53+
"orig": (np.ndarray, (bool, np.bool_)),
5454
"unit": (str, None), # For backward compatibility. Replaced by units.
5555
"units": (str, None),
5656
}

0 commit comments

Comments
 (0)