Skip to content

Commit 28f036b

Browse files
committed
Allow several models again
1 parent 5ee6645 commit 28f036b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

modelskill/plotting/_spatial_overview.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414

1515
def spatial_overview(
1616
obs: Observation | Iterable[Observation],
17-
mod: Optional[DfsuModelResult | GeometryFM2D] = None,
17+
mod: Optional[
18+
DfsuModelResult
19+
| GeometryFM2D
20+
| Iterable[DfsuModelResult]
21+
| Iterable[GeometryFM2D]
22+
] = None,
1823
ax=None,
1924
figsize: Optional[Tuple] = None,
2025
title: Optional[str] = None,
@@ -57,20 +62,21 @@ def spatial_overview(
5762
```
5863
"""
5964
obs = [] if obs is None else list(obs) if isinstance(obs, Iterable) else [obs] # type: ignore
65+
mods = [] if mod is None else list(mod) if isinstance(mod, Iterable) else [mod] # type: ignore
6066

6167
ax = _get_ax(ax=ax, figsize=figsize)
6268

6369
# TODO: support Gridded ModelResults
64-
if mod is not None:
65-
if isinstance(mod, (PointModelResult, TrackModelResult)):
70+
for m in mods:
71+
if isinstance(m, (PointModelResult, TrackModelResult)):
6672
raise ValueError(
67-
f"Model type {type(mod)} not supported. Only DfsuModelResult and mikeio.GeometryFM supported!"
73+
f"Model type {type(m)} not supported. Only DfsuModelResult and mikeio.GeometryFM supported!"
6874
)
69-
if hasattr(mod, "data") and hasattr(mod.data, "geometry"):
75+
if hasattr(m, "data") and hasattr(m.data, "geometry"):
7076
# mod_name = m.name # TODO: better support for multiple models
71-
g = mod.data.geometry
77+
g = m.data.geometry
7278
else:
73-
g = mod
79+
g = m
7480

7581
# TODO this is not supported for all model types
7682
g.plot.outline(ax=ax) # type: ignore

0 commit comments

Comments
 (0)