Exemplo n.º 1
0
def p_cent_error(run):
    
    max_rate_av, max_rate_lat_av, max_lat_av = p_cent_rate_max('sn_1.000')
    
    max_rate, max_rate_lat, max_lat = p_cent_rate_max(run, do_make_sym=False,months=[121,481])
    
    max_rate_mean = max_rate.mean(('hemisphere','year_no'))
    max_rate_lat_mean = max_rate_lat.mean(('hemisphere','year_no'))
    max_lat_mean = max_lat.mean(('hemisphere','year_no'))
    
    max_rate_se = calc_standard_error(max_rate, max_rate_mean.values)
    max_rate_lat_se = calc_standard_error(max_rate_lat, max_rate_lat_mean.values)
    max_lat_se = calc_standard_error(max_lat, max_lat_mean.values)
        
    max_rate_se = calc_standard_error(max_rate, max_rate_av.values)
    max_rate_lat_se = calc_standard_error(max_rate_lat, max_rate_lat_av.values)
    max_lat_se = calc_standard_error(max_lat, max_lat_av.values)
Exemplo n.º 2
0
    # Set figure parameters
    rcParams['figure.figsize'] = 5.5, 10
    rcParams['font.size'] = 14

    # Start figure with 4 subplots
    fig, ((ax1), (ax2), (ax3)) = plt.subplots(3, 1)

    # Set colors for lines
    colors = ['b', 'g', 'r', 'c', 'm', 'y']

    runs = ['ob_10.000', 'ob_20.000', 'sn_1.000', 'ob_30.000', 'ob_40.000']
    obs = np.array([10., 20., 23.439, 30., 40.])

    i = 0
    max_rate_ob, max_rate_lat_ob, max_lat_ob = p_cent_rate_max(runs)
    print('ob peak lat:', np.mean(max_rate_lat_ob[1:].values), '+-',
          np.std(max_rate_lat_ob[1:].values))
    dpdt_eq_ob = rate_at_eq(runs)
    for run in runs:
        if run == 'sn_1.000':
            p_cent_grad_scatter(run, color='k', ax=ax1, linewidth=2.)
        else:
            p_cent_grad_scatter(run, color=colors[i], ax=ax1, linewidth=1.)
            i = i + 1
    set_plot_features(ax1,
                      title='',
                      legend_labels=['10.', '20.', '23.439', '30.', '40.'],
                      leg_title='Obliquity')
    ax1.set_ylabel('ITCZ migration rate')
    ax1.set_xlabel('Precip centroid lat.')
from data_handling_updates import gradients as gr
from pylab import rcParams
from pcent_rate_max import p_cent_rate_max

    
# Set plotting directory
plot_dir = '/scratch/rg419/plots/paper_2_figs/'
mkdir = sh.mkdir.bake('-p')
mkdir(plot_dir)

rcParams['figure.figsize'] = 5, 6
rcParams['font.size'] = 16

runs_sn = ['sn_0.250', 'sn_0.500', 'sn_1.000', 'sn_2.000', 'sn_4.000']
days = [True, False, False, False, False]
max_rate_sn, max_rate_lat_sn = p_cent_rate_max(runs_sn, days)

runs_mld = ['mld_2.5', 'mld_5', 'sn_1.000', 'mld_15', 'mld_20']
max_rate_mld, max_rate_lat_mld = p_cent_rate_max(runs_mld)

period_fac = [0.25, 0.5, 1., 2., 4.]
mld = [2.5, 5., 10., 15., 20.]

fig, (ax1, ax2) = plt.subplots(2)

ax1.plot(period_fac, max_rate_sn*period_fac, 'xk', mew=2, ms=10)
ax1.set_ylabel('Max rate (scaled)')
#ax1.set_xscale('log')
#ax1.set_yscale('log')
ax1.set_xlabel('P/P$_{E}$')
ax1.set_ylim([0,1.1])
Exemplo n.º 4
0
        'rt_2.000'
    ]

    runs_5 = [
        'rt_0.500_5', 'rt_0.750_5', 'mld_5', 'rt_1.250_5', 'rt_1.500_5',
        'rt_1.750_5', 'rt_2.000_5'
    ]

    runs_15 = [
        'rt_0.500_15', 'rt_0.750_15', 'mld_15', 'rt_1.250_15', 'rt_1.500_15',
        'rt_1.750_15', 'rt_2.000_15'
    ]

    rots = np.array([0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.])

    max_rate_rot, max_rate_lat_rot, max_lat_rot = p_cent_rate_max(runs)
    max_rate_rot_5, max_rate_lat_rot_5, max_lat_rot_5 = p_cent_rate_max(runs_5)
    max_rate_rot_15, max_rate_lat_rot_15, max_lat_rot_15 = p_cent_rate_max(
        runs_15)
    print('rot peak lat:', np.mean(max_rate_lat_rot.values), '+-',
          np.std(max_rate_lat_rot.values))

    i = 0
    for run in runs_5:
        if run == 'mld_5':
            p_cent_grad_scatter(run, color='k', ax=ax1, linewidth=2.)
        else:
            p_cent_grad_scatter(run, color=colors[i], ax=ax1, linewidth=1.)
            i = i + 1
    set_plot_features(
        ax1, title='', do_legend=False
Exemplo n.º 5
0
    rcParams['figure.figsize'] = 5, 6
    rcParams['font.size'] = 16

    runs = [
        'rt_0.500', 'rt_0.750', 'sn_1.000', 'rt_1.250', 'rt_1.500', 'rt_1.750',
        'rt_2.000'
    ]

    #runs_5 = ['rt_0.500_5','rt_0.750_5', 'mld_5',
    #         'rt_1.250_5','rt_1.500_5','rt_1.750_5','rt_2.000_5']

    #runs_15 = ['rt_0.500_15','rt_0.750_15', 'mld_15',
    #         'rt_1.250_15','rt_1.500_15','rt_1.750_15','rt_2.000_15']

    fig, (ax1, ax2) = plt.subplots(2, sharex=True)
    max_rate, max_rate_lat, max_lat = p_cent_rate_max(runs)
    #max_rate_5,  max_rate_lat_5, max_lat_5 = p_cent_rate_max(runs_5)
    #max_rate_15, max_rate_lat_15, max_lat_15 = p_cent_rate_max(runs_15)

    rots = np.array([0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.])
    A = np.array([np.log(rots), np.ones(rots.shape)])
    model = sm.OLS(np.log(max_rate_lat.values), A.T)
    #A = np.array([ rots, np.ones(rots.shape) ])
    #model = sm.OLS(max_rate_lat.values, A.T)
    result = model.fit()
    consts = result.params
    std_err = result.bse
    print('=== Coeffs ===')
    print(np.exp(consts[1]), consts[0])
    #print(consts[0], consts[1])
    print('=== Std Errs ===')
Exemplo n.º 6
0
import statsmodels.api as sm

# Set plotting directory
plot_dir = '/scratch/rg419/plots/paper_2_figs/'
mkdir = sh.mkdir.bake('-p')
mkdir(plot_dir)

# Set figure parameters
rcParams['figure.figsize'] = 12, 6
rcParams['font.size'] = 16

runs_sn = [
    'sn_0.250', 'sn_0.500', 'sn_1.000', 'sn_2.000', 'sn_3.000', 'sn_4.000'
]
days = [True, False, False, False, False, False]
max_rate_sn, max_rate_lat_sn, max_lat = p_cent_rate_max(runs_sn, days=days)

runs_mld = ['mld_2.5', 'mld_5', 'sn_1.000', 'mld_15', 'mld_20']
max_rate_mld, max_rate_lat_mld, max_lat = p_cent_rate_max(runs_mld)

runs_rot = [
    'rt_0.500', 'rt_0.750', 'sn_1.000', 'rt_1.250', 'rt_1.500', 'rt_1.750',
    'rt_2.000'
]
#runs_5 = ['rt_0.500_5','rt_0.750_5', 'mld_5', 'rt_1.250_5','rt_1.500_5','rt_1.750_5','rt_2.000_5']
#runs_15 = ['rt_0.500_15','rt_0.750_15', 'mld_15', 'rt_1.250_15','rt_1.500_15','rt_1.750_15','rt_2.000_15']
max_rate_rot, max_rate_lat_rot, max_lat = p_cent_rate_max(runs_rot)
#max_rate_rot_5, max_rate_lat_rot_5, max_lat = p_cent_rate_max(runs_5)
#max_rate_rot_15, max_rate_lat_rot_15, max_lat = p_cent_rate_max(runs_15)

period_fac = np.array([0.25, 0.5, 1., 2., 3., 4.])
Exemplo n.º 7
0
        'rt_0.500', 'rt_0.750', 'sn_1.000', 'rt_1.250', 'rt_1.500', 'rt_1.750',
        'rt_2.000'
    ]

    runs_5 = [
        'rt_0.500_5', 'rt_0.750_5', 'mld_5', 'rt_1.250_5', 'rt_1.500_5',
        'rt_1.750_5', 'rt_2.000_5'
    ]

    runs_15 = [
        'rt_0.500_15', 'rt_0.750_15', 'mld_15', 'rt_1.250_15', 'rt_1.500_15',
        'rt_1.750_15', 'rt_2.000_15'
    ]

    fig, (ax1, ax2) = plt.subplots(2, sharex=True)
    max_rate, max_rate_lat, max_lat = p_cent_rate_max(runs)
    max_rate_5, max_rate_lat_5, max_lat_5 = p_cent_rate_max(runs_5)
    max_rate_15, max_rate_lat_15, max_lat_15 = p_cent_rate_max(runs_15)

    rots = np.array([0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.])
    A = np.array([np.log(rots), np.ones(rots.shape)])
    model = sm.OLS(np.log(max_rate_lat.values), A.T)
    result = model.fit()
    consts = result.params
    std_err = result.bse
    print('=== Coeffs ===')
    print(consts[0], consts[1])
    print('=== Std Errs ===')
    print(2. * std_err[1] * np.exp(consts[1]), 2 * std_err[0])

    line = np.exp(consts[1]) * rots**(consts[0])