Changes between Version 1 and Version 2 of FpInputMetMkavail
- Timestamp:
- Dec 7, 2015, 7:14:22 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FpInputMetMkavail
v1 v2 28 28 adapted and simplified version / Petra Seibert 29 29 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 30 31 31 32 QUESTIONS … … 34 35 v.003: petra.seibert at boku.ac.at 35 36 v.004: petra.seibert at boku.ac.at 37 v.005: petra.seibert at boku.ac.at 36 38 37 39 LICENSE … … 92 94 tind = M['timeindex'] #timestamp index 93 95 searchstr = os.path.join(t,prfx) 94 #Prepare output files95 fout = file(os.path.join(avpath,'AVAILABLE'),'w')96 fout.write(AVAIL_head)97 96 print 'searchstring:',searchstr 98 97 files = glob.glob(searchstr+'*') … … 112 111 dict_dates[dtstring] = f 113 112 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 114 123 for i,date in enumerate(dates): # go through dates in ascending order 115 124 f = date[1] # now we have the filename+path … … 163 172 fout.write(string) 164 173 165 print 'Done: ',i 174 print 'Done: ',i+1 # as i starts with 0 166 175 print 'Written:', os.path.join(avpath,'AVAILABLE') 167 176 fout.close() … … 190 199 parser.add_option ('-m', '--model', 191 200 dest='model', 192 default='ECMWF', help='ECMWF or GFS')201 default='ECMWF', help='ECMWF or ERAI or GFS') 193 202 parser.add_option ('-p', '--path', 194 203 dest='path', … … 228 237 229 238 # vim:set sr et ts=4 sw=4 ft=python fenc=utf-8: // See Vim, :help 'modeline' 230 231 239 }}}