예제 #1
0
                                   mbt, chull)
                        del mbs, mbt, chull

                ### Get synop file
                if synoptics:
                    refmbstr = dset + "-olr-0-0"
                    refall = dset + "-olr-0-all"
                    reffull = dset + "-olr-0-full"
                    metblobslist = [refmbstr, refall, reffull]
                    mfilelist = [
                        outsuf + thre_str + '_' + j + '.mbs'
                        for j in metblobslist
                    ]
                    print mfilelist
                    s = sy.SynopticEvents(metblobslist,
                                          mfilelist,
                                          hrwindow=hrwindow)
                    s.buildtracks()
                    s.buildevents(basetrkkey=refmbstr)
                    u = s.uniqueevents()
                    syfile = outsuf + thre_str + '_' + dset + '-OLR.synop'
                    s.save(syfile)
                    del s

                ### Add event rain
                if addrain:

                    globp = 'pr'

                    ### Open rain data
                    if dset == 'noaa':
            thre_str = str(int(thisthresh))

            ###  Open mbs file
            mbsfile = outsuf + thre_str + '_' + dset + "-olr-0-0.mbs"
            refmbs, refmbt, refch = blb.mbopen(mbsfile)
            refmbt[:, 3] = 0

            ### Count number of TTCB days
            count_all = len(refmbt)
            print "Total CBs flagged =" + str(count_all)

            # Count number of events
            if from_event=='first':
                syfile = outsuf + thre_str + '_' + dset + '-OLR.synop'
                s = sy.SynopticEvents((), [syfile], COL=False)
                refkey = s.mbskeys[0]
                ks = s.events.keys();ks.sort()
                count_events = str(int(len(ks)))
                print "Total CB events =" + str(count_events)

                ev_dts=[]
                ev_keys=[]
                ev_cXs=[]

                for k in ks:
                    e = s.events[k]
                    dts = s.blobs[refkey]['mbt'][e.ixflags]
                    for dt in range(len(dts)):
                        x,y = e.trkcX[dt], e.trkcY[dt]
                        ev_dts.append(dts[dt])
예제 #3
0
            exec("ixt,[time,%s,dtime]=\
                  my.ixtwindow(reftime,time,hrwindow,time,%s,dtime)"\
                   %(varstr,varstr) )
            mbs, mbt, chull = blb.MetBlobs(olr,dtime,time,lat,lon,v,\
                                      sub=sub,showblobs=showblb,interact=False)
            blb.mbsave(picdir+v+".mbs",mbs,mbt,chull)
            del mbs,mbt,chull
        if noaaolrfull:
            v="noaa-olr-0-full"
            dset,varstr, lev, drv = v.split('-')
            mbs, mbt, chull = blb.MetBlobs(olr,dtime,time,lat,lon,v,\
                                      sub=sub,showblobs=showblb,interact=False)
            blb.mbsave(picdir+v+".mbs",mbs,mbt,chull)
            del mbs,mbt,chull
        
if synoptics:
    refmbstr="noaa-olr-0-0"
    refall="noaa-olr-0-all"
    reffull="noaa-olr-0-full"
    metblobslist=[refmbstr,refall,reffull]
    mfilelist=[picdir+j+'.mbs' for j in metblobslist]
    print mfilelist
    s = sy.SynopticEvents(metblobslist,mfilelist,hrwindow=hrwindow)
    s.buildtracks()
    s.buildevents()
    u = s.uniqueevents()
    s.save(picdir+'NOAA-OLR.synop')
    del s

print 'TOTAL TIME TAKEN FOR test.py is:',(tmr.time()-tstart)/60,'mins'