Changes between Version 1 and Version 2 of FpInputMetMkavail


Ignore:
Timestamp:
Dec 7, 2015, 7:14:22 PM (8 years ago)
Author:
pesei
Comment:

put in v.005

Legend:

Unmodified
Added
Removed
Modified
  • FpInputMetMkavail

    v1 v2  
    2828    adapted and simplified version / Petra Seibert
    2929    v.004: add ERA-Interim with EI as model, proper sorting of dates if year 2000 included, option to define a path for AVAILABLE / Petra Seibert 2015-10-21
     30    v.005: check whether any files are found before opening AVAILABLE, if not issue warning and stop. / Petra Seibert 2015-12-07
    3031   
    3132QUESTIONS
     
    3435    v.003: petra.seibert at boku.ac.at
    3536    v.004: petra.seibert at boku.ac.at
     37    v.005: petra.seibert at boku.ac.at
    3638
    3739LICENSE
     
    9294    tind = M['timeindex'] #timestamp index
    9395    searchstr = os.path.join(t,prfx)
    94     #Prepare output files
    95     fout = file(os.path.join(avpath,'AVAILABLE'),'w')
    96     fout.write(AVAIL_head)
    9796    print 'searchstring:',searchstr
    9897    files = glob.glob(searchstr+'*')
     
    112111            dict_dates[dtstring] = f
    113112    dates=sorted(dict_dates.items())
     113    if len(dates) == 0:
     114      print 'no files found with this search string'
     115      print 'aborting. '
     116      sys.exit(0)
     117    else:
     118      print 'found ',len(dates),'files'
     119      #Prepare output files
     120      fout = file(os.path.join(avpath,'AVAILABLE'),'w')
     121      fout.write(AVAIL_head)
     122
    114123    for i,date in enumerate(dates): # go through dates in ascending order
    115124        f = date[1] # now we have the filename+path
     
    163172                fout.write(string)
    164173
    165     print 'Done: ',i
     174    print 'Done: ',i+1 # as i starts with 0
    166175    print 'Written:', os.path.join(avpath,'AVAILABLE')
    167176    fout.close()
     
    190199        parser.add_option ('-m', '--model',
    191200                dest='model',
    192                 default='ECMWF', help='ECMWF or GFS')
     201                default='ECMWF', help='ECMWF or ERAI or GFS')
    193202        parser.add_option ('-p', '--path',
    194203                dest='path',
     
    228237
    229238# vim:set sr et ts=4 sw=4 ft=python fenc=utf-8: // See Vim, :help 'modeline'
    230 
    231239}}}