Skip to content

Commit 8291334

Browse files
dependency: numpy 1.24 array() does not accept inhomogenous lists anymore
1 parent 008c8cb commit 8291334

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

climada/util/select.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ def get_attributes_with_matching_dimension(obj, dims):
4949
list_of_attrs = []
5050
for attr, value in obj.__dict__.items():
5151

52-
try:
53-
54-
if isinstance(value, list):
52+
if isinstance(value, list):
53+
try:
5554
value = np.array(value)
55+
except ValueError as verr:
56+
if "inhomogenous shape" in str(verr):
57+
continue
5658

59+
try:
5760
if all([dims.count(i) <= value.shape.count(i) for i in set(dims)]):
5861
list_of_attrs.append(attr)
59-
6062
except AttributeError:
61-
pass
63+
continue
6264

6365
return list_of_attrs

0 commit comments

Comments
 (0)