- Timestamp:
- Aug 30, 2016, 12:52:36 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1042 r1061 5362 5362 return runmean 5363 5363 5364 def files_folder_HMT(folder ,head,middle,tail):5364 def files_folder_HMT(folder='.',head='',middle='',tail=''): 5365 5365 """ Function to retrieve a list of files from a folder [fold] and files with [head]*[middle]*[tail] 5366 5366 >>> files_folder_HMT('.','t','wrf','mean.nc') 5367 5367 ['clt_wrfout_tmean.nc', 'tas_wrfout_tmean.nc', 'ta_wrfout_xmean.nc'] 5368 >>> files_folder_HMT(folder='/home/lluis/etudes/WRF_LMDZ/WaquaL_highres/tests/model_graphics/WRF/current', \ 5369 head='hfls', tail='.nc') 5370 ['hfls_wrfout.nc', 'hfls_wrfout_tmean.nc'] 5368 5371 """ 5369 5372 import subprocess as sub … … 5389 5392 indhead = ifile.index(head) 5390 5393 indmiddle = ifile.index(middle) 5394 if indmiddle == 0: indmiddle = indhead 5391 5395 indtail = ifile.index(tail) 5392 if indhead < indmiddle < indtail: listfiles.append(ifile) 5396 if indtail == 0: indtail = inhead + inmiddle 5397 if indhead <= indmiddle <= indtail: listfiles.append(ifile) 5393 5398 5394 5399 return listfiles
Note: See TracChangeset
for help on using the changeset viewer.