Skip to content

Commit

Permalink
Fix #193 re. lisfiles for ambiguous cases
Browse files Browse the repository at this point in the history
  • Loading branch information
senesis committed Oct 1, 2021
1 parent bb3b9e4 commit c75877f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion climaf/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,20 +781,26 @@ def baseFiles(self, force=False, ensure_dataset=True):
for the dataset
Use cached value (i.e. attribute 'files') unless called with arg force=True
If ensure_dataset is True, forbid ambiguous datasets
"""
if (force and self.project != 'file') or self.files is None:
if ensure_dataset:
self.explore()
else:
self.explore(option='choices')
cases = self.explore(option='choices')
list_keys = [ k for k in cases if type(cases[k]) is list and k != 'period' ]
if len(list_keys) > 0:
clogger.error("The dataset is ambiguous on %s; its CRS is %s"%(cases,self))
return None
return self.files

def listfiles(self, force=False, ensure_dataset=True):
""" Returns the list of (local or remote) files which include the data
for the dataset
Use cached value unless called with arg force=True
If ensure_dataset is True, forbid ambiguous datasets
"""
return self.baseFiles(force=force, ensure_dataset=ensure_dataset)
Expand Down
5 changes: 5 additions & 0 deletions doc/news.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ What's new

Changes, newest first:

- V2.0.2:

- Fix `issue 193<https://github.com/rigoudyg/climaf/issues/193>` regarding behaviour of listfiles
for ambiguous cases

- V2.0.1:

- **Scripts can now process multiple ensembles, and ensembles which are not the first argument**:
Expand Down

0 comments on commit c75877f

Please sign in to comment.