Skip to content

Commit 29a763e

Browse files
committed
corrected handling of single granule results in ecco_access.py module
1 parent 98b5de3 commit 29a763e

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ecco_access/ecco_access.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,10 @@ def shortnames_find(query_list,grid,time_res):
275275
return_granules = True
276276
if return_granules:
277277
for shortname in granule_files.keys():
278-
if ((len(granule_files[shortname]) == 1) and (mode != 's3_open_fsspec')):
279-
# if only 1 file is downloaded, return a string of filename instead of a list
280-
granule_files[shortname] = granule_files[shortname][0]
278+
if isinstance(granule_files[shortname],list):
279+
if ((len(granule_files[shortname]) == 1) and (mode != 's3_open_fsspec')):
280+
# if only 1 file is downloaded, return a string of filename instead of a list
281+
granule_files[shortname] = granule_files[shortname][0]
281282

282283
return granule_files
283284

@@ -445,12 +446,13 @@ def ecco_podaac_to_xrdataset(query,version='v4r4',grid=None,time_res='all',\
445446
time_subind.remove(count)
446447
curr_ds = curr_ds.isel(time=time_subind)
447448
else:
449+
if not isinstance(access_out,list):
450+
access_out = [access_out]
448451
curr_ds = xr.open_mfdataset(access_out,\
449-
compat='override',data_vars='minimal',coords='minimal',\
450-
parallel=True)
452+
compat='override',data_vars='minimal',coords='minimal',\
453+
parallel=True)
451454
ds_out[shortname] = curr_ds
452455

453-
454456
# if only one ShortName is involved, then extract dataset from dictionary
455457
if len(ds_out) == 1:
456458
ds_out = list(ds_out.values())[0]

0 commit comments

Comments
 (0)