Changeset 0e29ef4 in flexpart.git for preproc


Ignore:
Timestamp:
Jan 29, 2015, 9:13:29 AM (5 years ago)
Author:
Anne Fouilloux <annefou@…>
Branches:
master, FPv9.3.1, FPv9.3.1b_testing, FPv9.3.2, dev, fp9.3.1-20161214-nc4, grib2nc4_repair, release-10, univie
Children:
3372ef9
Parents:
30006de
Message:

bug fix when looping over months/dates

Location:
preproc
Files:
2 added
3 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • preproc/python/FlexpartTools.py

    r5763793 r0e29ef4  
    353353        index_keys=["date","time","stepRange"]
    354354        indexfile="date_time_stepRange.idx"
     355        silentremove(indexfile)
    355356        grib=GribTools(inputfiles.files)
    356357        iid=grib.index(index_keys=index_keys, index_file = indexfile)
    357358
     359        print 'index done...'
    358360        silentremove("fort.10")
    359361        silentremove("fort.11")
     
    389391                step = grib_get(gid, 'stepRange')
    390392                cflextime = self.getFlexpartTime(type,step, time)
     393#                print 'cyear '+cyear+'/'+cmonth+'/'+'/EI'+cyear[2:4]+cmonth+cday+cflextime
    391394            while 1: 
    392395                if gid is None: break
     
    420423# create the corresponding output file  fort.15 (generated by CONVERT2) + fort.16 (paramId 167 and paramId 168) 
    421424                mkdir_p(outputdir+'/'+cyear+'/'+cmonth+'/')
     425                print "outputdir = " + outputdir+'/'+cyear+'/'+cmonth+'/'+'/EI'+cyear[2:4]+cmonth+cday+cflextime
    422426                fout = open(outputdir+'/'+cyear+'/'+cmonth+'/EI'+cyear[2:4]+cmonth+cday+cflextime,'wb')   
    423427                shutil.copyfileobj(open('fort.15','rb'), fout)     
     
    427431        grib_index_release(iid)
    428432
    429     def clean(self):
     433    def __del__(self):
    430434        print "clean"
    431 
     435        silentremove("fort.10")
     436        silentremove("fort.11")
     437        silentremove("fort.12")
     438        silentremove("fort.13")
     439        silentremove("fort.15")
     440        silentremove("fort.16")
     441        silentremove("fort.18")
     442        silentremove("VERTICAL.EC")
     443        silentremove("date_time_stepRange.idx")
     444
  • preproc/python/GribTools.py

    r5763793 r0e29ef4  
    118118# Create index from a list of files if it does not exist or read it
    119119    def index(self,index_keys=["mars"], index_file = "my.idx"):
     120        print "index to be done"
    120121        self.iid = None
    121122 
  • preproc/python/getEIdata.py

    r5763793 r0e29ef4  
    9292    for date in daterange( start, end ):
    9393# if new year & month then we create a new directory to store output files
    94         er_date = date
    95         if date.strftime("%Y%m") != current_ym:
    96             current_outputdir =  outputdir + "/"  + date.strftime("%Y") + '/' + date.strftime("%m") + '/'
    97             mkdir_p(current_outputdir)
    98             if current_ym != "":
     94        if date.strftime("%Y%m") != current_ym and current_ym != "":
    9995               retrieve="yes"
    10096
     
    106102                flexpart = EIFlexpart()
    107103                dates= ir_date.strftime("%Y%m%d") + "/to/" + er_date.strftime("%Y%m%d")
     104                current_outputdir =  outputdir + "/"  + ir_date.strftime("%Y") + '/' + ir_date.strftime("%m") + '/'
     105                mkdir_p(current_outputdir)
     106                print "retrieve " + dates + " in dir " + current_outputdir
    108107                flexpart.retrieve(server, dates, options.times, options.area, options.levels, current_outputdir)
    109                 ir_date = er_date
     108                ir_date = date
     109                retrieve="no"
     110
     111        er_date = date
    110112
    111113        current_ym =  date.strftime("%Y%m")
  • preproc/python/prepareFLEXPART.py

    r5763793 r0e29ef4  
    9090# data retrieved by year/month
    9191           if cyear != date.year or cmonth != date.month:
    92              print 'year : ' + str(date.year) + ' month : ', date.month
     92             print 'Prepare year : ' + str(date.year) + ' month : ', date.month
    9393             cyear = date.year
    9494             cmonth = date.month
     
    102102             flexpart = EIFlexpart()
    103103             flexpart.create(inputfiles, outputdir)
     104             
    104105
    105106if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG