Skip to content

Commit e21a751

Browse files
committed
oops update the check to work for the older version of netcdf4
1 parent a92c6c9 commit e21a751

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/wrf/util.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from types import GeneratorType
1010
import datetime as dt
1111
from inspect import getmodule
12+
from netCDF4 import Dataset
1213

1314
try:
1415
from inspect import signature
@@ -134,10 +135,11 @@ def is_multi_file(wrfin):
134135
is a single NetCDF file object.
135136
136137
"""
137-
try:
138-
iter(wrfin)
138+
if isinstance(wrfin, Dataset):
139+
is_iterable = False
140+
elif isinstance(wrfin, Iterable):
139141
is_iterable = True
140-
except Exception:
142+
else:
141143
is_iterable = False
142144

143145
return (is_iterable and not isstr(wrfin))

0 commit comments

Comments
 (0)