Exemple #1
0
                                    if this_c == 'hist':
                                        hist_sc[mn,do] = rain4mon
                                    elif this_c == 'fut':
                                        fut_sc[mn,do] = rain4mon

                        if whplot != 'meanpr':

                            wlon = wlon_picks[do]
                            elon = elon_picks[do]

                            # Then subset by longitude
                            print 'Subsetting by latitude?'
                            print 'Selecting CBs between '+str(wlon)+' and '+str(elon)
                            dates_ln, cXs_ln, cYs_ln, degs_ln, chs_ln, keys_ln, daynos_ln, tworecdt_ln = \
                                sset.sel_cen_lon(wlon,elon, dates_dd, cXs_dd, cYs_dd, degs_dd, chs_dd,\
                                                 keys_dd, daynos_dd, tworecdt_dd)

                            nttt=len(dates_ln)

                            if whplot == 'number':

                                # Get seasonal cycle
                                scycle_count = anal.seas_cycle_count(mons,dates_ln)

                                if relative:
                                    if do==0:
                                        print 'Saving seasonal cycle over dom1, to calculate relative TTTs in dom2'
                                        scycle_count_d1 = scycle_count
                                    if do==1:
                                        print 'Calculating relative TTTs in dom2'
                                        scycle_count_d2 = scycle_count
                    mon2 = 3
                    nmon = len(mons)

                # First check the season
                print 'Subsetting by season?'
                print 'Selecting months for : ' + per_ttt_seas
                dates_se, cXs_se, cYs_se, degs_se, chs_se, keys_se, daynos_se, tworecdt_se = \
                    sset.sel_seas(mons, dates_dd, cXs_dd, cYs_dd, degs_dd, chs_dd, keys_dd, daynos_dd,
                                  tworecdt_dd)

                # Then subset by longitude
                print 'Subsetting by latitude?'
                print 'Selecting CBs between ' + str(wlon) + ' and ' + str(
                    elon)
                dates_ln, cXs_ln, cYs_ln, degs_ln, chs_ln, keys_ln, daynos_ln, tworecdt_ln = \
                    sset.sel_cen_lon(wlon,elon,dates_se, cXs_se, cYs_se, degs_se, \
                                     chs_se, keys_se, daynos_se, tworecdt_se)

                nttt = len(dates_ln)

                # Computing value for x axis
                print 'Getting value for x -axis'
                #        tot_ttt=len(dates_ln)
                #        if rel_picks[do]==True:
                #            tot_ttt=float(tot_ttt)/len(dates_se)*100.0
                #        else:
                #            if peryear:
                #                tot_ttt=tot_ttt/nys

                #xvals[cnt,do]=tot_ttt
                # Edit to quickly plot something
                xvals[cnt, do] = len(dates_se)
Exemple #3
0
            if weightlats:
                latr = np.deg2rad(rlat)
                weights = np.cos(latr)
                zonmean = np.nanmean(seasmean, axis=1)
                reg_mean = np.ma.average(zonmean, weights=weights)
            else:
                reg_mean = np.nanmean(seasmean)

            # Get bias
            bias = reg_mean - reg_ref_mean

            yvals[cnt] = bias

            # Finally getting intensity
            dates_int, cXs_int, cYs_int, degs_int, chs_int, keys_int, daynos_int, tworecdt_int = \
                sset.sel_cen_lon(int_ttt_wlon,int_ttt_elon,dates_per, cXs_per, cYs_per, \
                                 degs_per, chs_per, keys_per, daynos_per, tworecdt_per)

            n4int = len(dates_int)

            print 'Selecting TTTs from rain data'
            indices = []
            for dt in range(n4int):
                ix = my.ixdtimes(rdtime, [dates_int[dt][0]], \
                                 [dates_int[dt][1]], [dates_int[dt][2]], [0])
                if len(ix) >= 1:
                    indices.append(ix)

            indices = np.squeeze(np.asarray(indices))

            print 'Selecting rain on TTT days'
            rainsel = rain[indices, :, :]