thesekeys.append(k)
                                                edts.append(dt)
                                    elif tstep == 'mon':
                                        if int(dt[1] == mon1):
                                            thesekeys.append(k)
                                            edts.append(dt)
                                edts = np.asarray(edts)
                                yrs = np.unique(edts[:, 0])

                                # Split by domain
                                print 'selecting events for this dom group...'
                                if len(doms) == 1:
                                    keys = thesekeys
                                elif len(doms) == 4:
                                    k1, ktmp = stats.spatialsubset(s,
                                                                   thesekeys,
                                                                   cutlon=37.5)
                                    k2, k3 = stats.spatialsubset(s,
                                                                 ktmp,
                                                                 cutlon=67.5)
                                    if dom == 'All':
                                        keys = thesekeys
                                    elif dom == 'nCont':
                                        keys = k1
                                    elif dom == 'nMada':
                                        keys = k2
                                    elif dom == 'nOcea':
                                        keys = k3

                                # opening future data
                                print 'opening future metbot files'
예제 #2
0
                # Find TTT data
                outsuf = botdir + dset + "/" + name + "/" + name + "_"

                mbsfile = outsuf + thre_str + '_' + dset + "-olr-0-0.mbs"
                syfile = outsuf + thre_str + '_' + dset + '-OLR.synop'

                # using events
                if wh_count == 'event':

                    ###  Open synop file
                    s = sy.SynopticEvents((), [syfile], COL=False)

                    ### Count number of events
                    ks = s.events.keys()  # all events
                    kw, ke = stats.spatialsubset(
                        s, False,
                        cutlon=40.)  # splitting tracks west and east of 40E

                    ### Put n events into array
                    if doms[do] == 'All':
                        yvals[cnt] = len(ks)
                    elif doms[do] == 'Cont':
                        yvals[cnt] = len(kw)
                    elif doms[do] == 'Mada':
                        yvals[cnt] = len(ke)

                elif wh_count == 'blob':

                    refmbs, refmbt, refch = blb.mbopen(mbsfile)

                    blob_edts = []
                                edts.append(dt)
                        elif seas=='JF':
                            if (int(dt[1]) >= mon1) and (int(dt[1]) <= mon2):
                                thesekeys.append(k)
                                edts.append(dt)
                        elif seas=='all':
                            thesekeys.append(k)
                            edts.append(dt)
                    edts = np.asarray(edts)
                    yrs = np.unique(edts[:, 0])

                    count_fulldom=len(thesekeys)

                    # Split by domain
                    print 'selecting events for this dom group...'
                    k1, ktmp = stats.spatialsubset(s, thesekeys, cutlon=clon1)
                    k2, k3 = stats.spatialsubset(s, ktmp, cutlon=clon2)
                    count_ttt=len(k2)
                    print "Total CB events in this domain =" + str(count_ttt)

                    keys4rain=k2

                elif wh_count=='blob':
                    refmbs, refmbt, refch = blb.mbopen(mbsfile)
                    count_all=len(refmbt)

                    blob_edts = []
                    blob_edts_regsel =[]
                    for b in range(len(refmbt)):
                        date = refmbt[b]
                        mon = int(date[1])
예제 #4
0
                thisthresh = threshs[t]
                print thisthresh
                thre_str = str(int(thisthresh))
                print thre_str

                mbsfile = outsuf + thre_str + '_' + dset + "-olr-0-0.mbs"
                syfile = outsuf + thre_str + '_' + dset + '-OLR.synop'

                ### Open ttt data
                s = sy.SynopticEvents((), [syfile], COL=False)
                refmbs, refmbt, refch = blb.mbopen(mbsfile)

                ### Select events
                ks = s.events.keys()
                ks.sort()  # all
                kw, ke = stats.spatialsubset(
                    s, False, cutlon=40.)  # events west and east of 40E

                ### Count number of events
                count_all = str(int(len(ks)))
                count_cont = str(int(len(kw)))
                count_mada = str(int(len(ke)))

                ### Calc seasonal cycle
                scycle, cyclestats, yrs = stats.seasonalcycle(s, False)
                scyclew, cyclestatsw, yrsw = stats.seasonalcycle(s, kw)
                scyclee, cyclestatse, yrse = stats.seasonalcycle(s, ke)
                nNF = scycle[:, 3:7].sum(
                    1)  # summing years for months November to March

                ### PLOT TIMESERIES OF SEASONAL CYCLE
                print 'Plotting timeseries'
예제 #5
0
            print thre_str

            mbsfile = outsuf + thre_str + '_' + dset + "-olr-0-0.mbs"
            syfile = outsuf + thre_str + '_' + dset + '-OLR.synop'

            ### Open ttt data
            s = sy.SynopticEvents((), [syfile], COL=False)
            refmbs, refmbt, refch = blb.mbopen(mbsfile)

            ### Select events
            ks = s.events.keys()
            ks.sort()  # all
            count_all = str(int(len(ks)))
            print "Total CB events =" + str(count_all)
            if len(doms) == 3:
                kw, ke = stats.spatialsubset(
                    s, False, cutlon=40.)  # events west and east of 40E
                keys = [ks, kw, ke]
            elif len(doms) == 4:
                k1, ktmp = stats.spatialsubset(s, False, cutlon=37.5)
                k2, k3 = stats.spatialsubset(s, ktmp, cutlon=67.5)
                keys = [ks, k1, k2, k3]

            ### Plot olrmaps
            olrbase = olrdir + dset + "/"
            my.mkdir_p(olrbase)
            mapsuf = seasopt + '_' + sub + '_' + dset + '_' + name + '_' + thre_str + '_key' + refkey + '_4' + monmean
            if testfile or testyear:
                testq = True
            else:
                testq = freecol
예제 #6
0
                ### Open ttt data - past
                s = sy.SynopticEvents((), [syfile], COL=False)

                print dset
                print name
                print "historical"

                ### Select events - past
                ks = s.events.keys()
                ks.sort()  # all
                keything = '0'
                refkey = dset + '-olr-0-' + keything

                if len(doms) == 4:
                    k1, ktmp = stats.spatialsubset(s, ks, cutlon=37.5)
                    k2, k3 = stats.spatialsubset(s, ktmp, cutlon=67.5)
                    if dom == 'All':
                        keys = ks
                    elif dom == 'nCont':
                        keys = k1
                    elif dom == 'nMada':
                        keys = k2
                    elif dom == 'nOcea':
                        keys = k3

                edts = []
                thesekeys = []
                for k in keys:
                    e = s.events[k]
                    dts = s.blobs[refkey]['mbt'][e.ixflags]