rigoudyg / climaf

CliMAF - a Climate Model Analysis Framework - doc at : http://climaf.readthedocs.org/
Other
16 stars 7 forks source link

Cdu fix #251

Closed jservonnat closed 1 year ago

jservonnat commented 1 year ago

There was an error on cdu():

cdu()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 cdu(size='3M', count=True)

File /net/nfs/tools/Users/SU/jservon/climaf_installs/V3.0_IPSL1/climaf/cache.py:1040, in cdu(**kwargs)
   1038 kwargs['usage'] = True
   1039 kwargs['remove'] = False
-> 1040 return clist(**kwargs)

File /net/nfs/tools/Users/SU/jservon/climaf_installs/V3.0_IPSL1/climaf/cache.py:916, in clist(size, age, access, pattern, not_pattern, usage, count, remove, CRS, special)
    914 tmp = ""
    915 for crs in work_dic:
--> 916     tmp += work_dic[crs] + " "
    917 res = os.popen("du -sc %s" % tmp).read()
    919 regex = re.compile('([0-9]+)\t')

TypeError: can only concatenate tuple (not "str") to tuple

I replaced line 916 with: if isinstance(work_dic[crs], tuple): tmp += work_dic[crs][0] + " " if isinstance(work_dic[crs], str): tmp += work_dic[crs] + " "

senesis commented 1 year ago

cdu error was due to the introduction of objects costs, which lead to change the type of cache dict.