Пример #1
0
                                rain = rain[inds, :, :]

                        # Now loop mons and seasons to get the values you want!
                        print 'Now looping mons to calculate data for each month'
                        for mn in range(len(mons)):
                            thismon = mons[mn]
                            print 'month = ' + str(thismon)

                            if charac!='meanpr':

                                print 'Getting TTTs for this month'
                                months4ttt=[thismon]
                                # selecting a specific season, subset
                                print 'Selecting month '+str(thismon)
                                dates_ddm, cXs_ddm, cYs_ddm, degs_ddm, chs_ddm, keys_ddm, daynos_ddm, tworecdt_ddm = \
                                    sset.sel_seas(months4ttt, dates_ln, cXs_ln, cYs_ln, degs_ln, chs_ln, keys_ln, daynos_ln, tworecdt_ln)
                                num4mon = len(dates_ddm)
                                print 'For this month there are ' + str(num4mon) + ' TTT dates'

                            if charac=='number':
                                print 'Saving number of TTTs in this month per year'
                                count_peryear=num4mon/nys

                                if this_c == 'hist':
                                    hist_vals[mn,do] = count_peryear
                                elif this_c == 'fut':
                                    fut_vals[mn,do] = count_peryear

                            elif charac=='relative':
                                print 'Calculating relative number of TTTs in this domain for this month'
                ths_seas = seas_picks[do]
                wlon = wlon_picks[do]
                #elon=elon_picks[do]
                elon = elon_picks[do + 1]

                if ths_seas == 'NDJFM':
                    mons = [1, 2, 3, 11, 12]
                    mon1 = 11
                    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:
Пример #3
0
                    sset.rm_dupl_dates(dates_d, cXs_d, cYs_d, degs_d, chs_d, keys_d, daynos_d, tworecdt_d)

            else:
                print 'Retaining potential duplicate dates... note they may have 2 CBs'
                dates_dd, cXs_dd, cYs_dd, degs_dd, chs_dd, keys_dd, daynos_dd, tworecdt_dd = \
                    dates_d[:], cXs_d[:], cYs_d[:], degs_d[:], chs_d[:], keys_d[:], daynos_d[:], tworecdt_d[:]

            print 'Getting x values for part a - number of TTTs'
            if all_ttt_seas == 'all':
                all_ttt_count = len(dates_dd)
            else:
                # If selecting a specific season, subset
                print 'Subsetting by season?'
                print 'Selecting months for : ' + all_ttt_seas
                dates_ddm, cXs_ddm, cYs_ddm, degs_ddm, chs_ddm, keys_ddm, daynos_ddm, tworecdt_ddm = \
                    sset.sel_seas(all_ttt_months, dates_dd, cXs_dd, cYs_dd, degs_dd, chs_dd, keys_dd, daynos_dd,
                                  tworecdt_dd)

                all_ttt_count = len(dates_ddm)

            print 'Getting x values for part b - proportion of TTTs in west'
            # First check the season
            print 'Subsetting by season?'
            print 'Selecting months for : ' + per_ttt_seas
            dates_per, cXs_per, cYs_per, degs_per, chs_per, keys_per, daynos_per, tworecdt_per = \
                sset.sel_seas(per_ttt_months, dates_dd, cXs_dd, cYs_dd, degs_dd, chs_dd, keys_dd, daynos_dd,
                              tworecdt_dd)

            # Then select the longitude
            print 'Subsetting by longitude'
            dates_west, dates_east = sset.split_by_lon(per_ttt_elon, dates_per,
                                                       cXs_per)