I have a script using listfiles(ensure_dataset=False), so that I can get a list of files, even if there are some holes in the periods.
This has the side effect that I get a list of realizations instead of a list of files, when there are multiple realizations. I don't know if there is an easy way to deal with this, or even what should be done...
I would maybe expect:
an error message, if I have ensure_dataset=False but the ambiguity is on something else than period
an empty string (instead of a string with the realizations, when I'm expecting a string with all the files)
possibly a string with all the files for all the realizations and all the other possible ambiguities, but it could become a very long string (we don't want to get a listing of all the files in a project!!)
>>> my_query = ds(project='CMIP6', experiment='midHolocene', variable='tas', table='Amon', period='*', model='IPSL-CM6A-LR')
>>> my_query.listfiles()
error : "This dataset is ambiguous on attribute realization='r1i1p1f*'; please choose among : ['r1i1p1f1', 'r1i1p1f2', 'r1i1p1f3', 'r1i1p1f4'] or use either 'ensure_dataset=False' (with method baseFiles or listfiles) or 'option='choices' (with method explore)"
>>> my_query.explore('choices')
{'period': [1850-2399], 'institute': 'IPSL', 'mip': 'PMIP', 'realization': ['r1i1p1f1', 'r1i1p1f2', 'r1i1p1f3', 'r1i1p1f4'], 'grid': 'gr'}
>>> my_query.listfiles()
'r1i1p1f1 r1i1p1f2 r1i1p1f3 r1i1p1f4'
>>> my_query.listfiles(force=True, ensure_dataset=True)
error : "This dataset is ambiguous on attribute realization='r1i1p1f*'; please choose among : ['r1i1p1f1', 'r1i1p1f2', 'r1i1p1f3', 'r1i1p1f4'] or use either 'ensure_dataset=False' (with method baseFiles or listfiles) or 'option='choices' (with method explore)"
>>> my_query.listfiles(force=True, ensure_dataset=False)
'r1i1p1f1 r1i1p1f2 r1i1p1f3 r1i1p1f4'
I have a script using
listfiles(ensure_dataset=False)
, so that I can get a list of files, even if there are some holes in the periods.This has the side effect that I get a list of realizations instead of a list of files, when there are multiple realizations. I don't know if there is an easy way to deal with this, or even what should be done...
I would maybe expect:
ensure_dataset=False
but the ambiguity is on something else thanperiod