예제 #1
0
def get_sic_ens_mean_fname(run_type, model, anoms=False):
    out_dir = get_output_directory(run_type, 1986, 2005)
    fng = out_dir+"/concat_sic_anoms/atlas_sic_OImon_"+model+"_"+run_type+"_ens_mean_??????-??????_1x1"
    fng += "_anoms.nc"
    print fng
    fname = glob.glob(fng)[0]
    return fname
예제 #2
0
def get_siex_anom_ts_fname(run_type, ref_start, ref_end, monthly=False):
    out_dir = get_output_directory(run_type, ref_start, ref_end)
    out_name = out_dir + "/" + out_dir.split("/")[-1] + "_siex_anom_ts"
    if monthly:
        out_name += "_mon"
    out_name += ".nc"
    return out_name
def get_Ma_syn_SST_PCs_filename(run_type, ref_start, ref_end, eof_year, ptile, monthly):
    out_dir = get_output_directory(run_type, ref_start, ref_end, eof_year) 
    fname = out_dir+"/MaSST_EOF_" + get_file_suffix(run_type, ref_start, ref_end, eof_year) + "_p"+str(ptile)+"_synth_pc"
    if monthly:
        fname += "_mon"
    fname += ".nc"
    return fname
예제 #4
0
def get_siex_anom_ts_fname(run_type, ref_start, ref_end, monthly=False):
    out_dir = get_output_directory(run_type, ref_start, ref_end)
    out_name = out_dir + "/" + out_dir.split("/")[-1] + "_siex_anom_ts"
    if monthly:
        out_name += "_mon"
    out_name += ".nc"
    return out_name
예제 #5
0
def get_sic_ens_mean_fname(run_type, model, anoms=False):
    out_dir = get_output_directory(run_type, 1986, 2005)
    fng = out_dir + "/concat_sic_anoms/atlas_sic_OImon_" + model + "_" + run_type + "_ens_mean_??????-??????_1x1"
    fng += "_anoms.nc"
    print fng
    fname = glob.glob(fng)[0]
    return fname
예제 #6
0
def plot_tas_ar5(run_type, ref_start, ref_end):
    sp = plt.subplot(111)
    Y0 = 2009.0
    Y1 = 2025.5
    Y2 = 2035
    C = 0.16

    grad0 = (0.3-C)/(Y1 - Y0)
    grad1 = (0.7-C)/(Y1 - Y0)

    ym0 = grad0*(2016-Y0)+C - 0.1
    yx0 = grad1*(2016-Y0)+C + 0.1
    ym1 = grad0*(2035-Y0)+C - 0.1
    yx1 = grad1*(2035-Y0)+C + 0.1
    
    sp.plot([2016,2035,2035,2016,2016],[ym0,ym1,yx1,yx0,ym0], 'k', lw=2.0, zorder=3)
    t_var = numpy.arange(1899,2100+1)
    print t_var.shape

    for rcp in ["rcp26", "rcp45", "rcp85"]:
        if rcp == "rcp26":
            col = '#888888'
        if rcp == "rcp45":
            col = 'r'
        if rcp == "rcp85":
            col = 'c'
        out_dir = get_output_directory(rcp, ref_start, ref_end)
        out_name = out_dir + "/" + out_dir.split("/")[1] + "_tos_tas_GM_ts.nc"

        fh = netcdf_file(out_name, 'r')
        tas = numpy.array(fh.variables["tas"][:])
        smoothed_tas = numpy.zeros(tas.shape, 'f')
        
        n_ens = tas.shape[0]
        X = numpy.arange(1899,2101)
        c = 0
        for e in range(0, n_ens):
            if tas[e,0] < 1000:
                tas_e = tas[e].byteswap().newbyteorder()
                TAS = running_gradient_3D(tas_e.reshape(tas_e.shape[0],1,1), 10)
                smoothed_tas[c] = TAS.flatten()
                c += 1
        tas_min = numpy.min(smoothed_tas[:c], axis=0)
        tas_max = numpy.max(smoothed_tas[:c], axis=0)
        tas_5 = numpy.percentile(smoothed_tas[:c], 5, axis=0)
        tas_95 = numpy.percentile(smoothed_tas[:c], 95, axis=0)
        tas_50 = numpy.percentile(smoothed_tas[:c], 50, axis=0)
        sp.plot(t_var, tas_min, '-', c=col, lw=2.0, zorder=0, alpha=0.5)
        sp.plot(t_var, tas_max, '-', c=col, lw=2.0, zorder=0, alpha=0.5)
        sp.plot(t_var, tas_50, '-', c=col, lw=2.0, zorder=2, alpha=0.5)
        sp.fill_between(t_var, tas_5, tas_95, edgecolor=col, facecolor=col, zorder=1, alpha=0.5)

    plt.gca().set_ylim([-0.5,2.5])
    plt.gca().set_xlim([1986,2050])
    f = plt.gcf()
    f.set_size_inches(10.5, 5.0)
    plt.savefig("ar5_ch11_fig25.pdf")
def get_gmt_gmsst_anom_ts_fname(run_type, ref_start, ref_end, monthly=False, lat=-1.0, lon=-1.0):
    out_dir = get_output_directory(run_type, ref_start, ref_end)
    out_name = out_dir + "/" + out_dir.split("/")[-1] + "_tos_tas_GM_ts"
    if monthly:
        out_name += "_mon"
    if lat != -1.0 and lon != -1.0:
        out_name += "_ll"+str(lat)+"N_"+str(lon)+"E"
    out_name += ".nc"
    return out_name
예제 #8
0
def get_Ma_syn_SST_PCs_filename(run_type, ref_start, ref_end, eof_year, ptile,
                                monthly):
    out_dir = get_output_directory(run_type, ref_start, ref_end, eof_year)
    fname = out_dir + "/MaSST_EOF_" + get_file_suffix(
        run_type, ref_start, ref_end,
        eof_year) + "_p" + str(ptile) + "_synth_pc"
    if monthly:
        fname += "_mon"
    fname += ".nc"
    return fname
예제 #9
0
def get_cmip5_proj_PC_filename(run_type, ref_sy, ref_ey, year, model_mean=False, monthly=False):
    if model_mean:
        suffix = "_mm"
    else:
        suffix = ""
    out_dir = get_output_directory(run_type, ref_sy, ref_ey, year) 
    fname = out_dir+"/cmip5_EOF_" + get_file_suffix(run_type, ref_sy, ref_ey, year) + suffix + "_proj_pc"
    if monthly:
        fname += "_mon"
    fname += ".nc"
    return fname
예제 #10
0
def get_cmip5_proj_PC_scale_filename(run_type, ref_start, ref_end, eof_year, model_mean=False, monthly=False):
    out_dir = get_output_directory(run_type, ref_start, ref_end, eof_year)
    if model_mean:
        suffix = "_mm"
    else:
        suffix = ""
    fname = out_dir+"/cmip5_EOF_" + get_file_suffix(run_type, ref_start, ref_end, eof_year) + suffix + "_proj_pc_scale"
    if monthly:
        fname += "_mon"
    fname += ".nc"
    return fname
def get_gmt_gmsst_anom_ts_fname(run_type,
                                ref_start,
                                ref_end,
                                monthly=False,
                                lat=-1.0,
                                lon=-1.0):
    out_dir = get_output_directory(run_type, ref_start, ref_end)
    out_name = out_dir + "/" + out_dir.split("/")[-1] + "_tos_tas_GM_ts"
    if monthly:
        out_name += "_mon"
    if lat != -1.0 and lon != -1.0:
        out_name += "_ll" + str(lat) + "N_" + str(lon) + "E"
    out_name += ".nc"
    return out_name
예제 #12
0
def remap(model_name, var):
    sy = 2006
    ey = 2100

    if var == "tos":
        ens_fnames = get_ensemble_fnames_tos(run_type, model)
    elif var == "sic":
        ens_fnames = get_ensemble_fnames_sic(run_type, model)
    
    ens_mean_string = get_ensemble_mean_string(ens_fnames, sy, ey)
    out_dir = get_output_directory(run_type, 1986, 2005)
    run_n = ens_fnames[0].split("/")[9]
    out_ens = out_dir + "/" + ens_fnames[0].split("/")[10].replace(run_n, "ens_mean")
    cdo.ensmean(input=ens_mean_string, output=out_ens)
    remap_string, lsm_grid = get_remap_string(var)
    out_remap = out_ens[:-3] + "_1x1.nc"
    cdo.remapbil(lsm_grid, input=out_ens, output=out_remap)
    print out_remap
    os.remove(out_ens)
예제 #13
0
def remap(model_name, var):
    sy = 2006
    ey = 2100

    if var == "tos":
        ens_fnames = get_ensemble_fnames_tos(run_type, model)
    elif var == "sic":
        ens_fnames = get_ensemble_fnames_sic(run_type, model)

    ens_mean_string = get_ensemble_mean_string(ens_fnames, sy, ey)
    out_dir = get_output_directory(run_type, 1986, 2005)
    run_n = ens_fnames[0].split("/")[9]
    out_ens = out_dir + "/" + ens_fnames[0].split("/")[10].replace(
        run_n, "ens_mean")
    cdo.ensmean(input=ens_mean_string, output=out_ens)
    remap_string, lsm_grid = get_remap_string(var)
    out_remap = out_ens[:-3] + "_1x1.nc"
    cdo.remapbil(lsm_grid, input=out_ens, output=out_remap)
    print out_remap
    os.remove(out_ens)
def get_concat_sic_output_path(run_type, ref_start, ref_end):
    out_path = get_output_directory(run_type, ref_start,
                                    ref_end) + "/concat_sic_anoms/"
    if not os.path.exists(out_path):
        os.mkdir(out_path)
    return out_path
예제 #15
0
def get_cmip5_model_mean_index_filename(run_type, ref_start, ref_end):
    fname = get_output_directory(run_type, ref_start, ref_end, None)+\
            "/cmip5_" + run_type + "_" + str(ref_start) + "_" +\
            str(ref_end) + "_mm_index_mapping.txt"
    return fname
def get_concat_output_path(run_type, ref_start, ref_end):
    cmip5_out_path = get_output_directory(run_type, ref_start, ref_end)
    out_path = cmip5_out_path + "/concat_sst_anoms/"
    return out_path
def get_concat_output_path(run_type, ref_start, ref_end):
    cmip5_out_path = get_output_directory(run_type, ref_start, ref_end)
    out_path = cmip5_out_path+"/concat_sst_anoms/"
    return out_path
def get_concat_sic_output_path(run_type, ref_start, ref_end):
    out_path = get_output_directory(run_type, ref_start, ref_end)+"/concat_sic_anoms/"
    if not os.path.exists(out_path):
        os.mkdir(out_path)
    return out_path
예제 #19
0
def get_cmip5_model_mean_index_filename(run_type, ref_start, ref_end):
    fname = get_output_directory(run_type, ref_start, ref_end, None)+\
            "/cmip5_" + run_type + "_" + str(ref_start) + "_" +\
            str(ref_end) + "_mm_index_mapping.txt"
    return fname