Esempio n. 1
0
    print "scenario", scen

    projection_data[scen] = {}
    gmt = mag.magicc_gmt[scen]

    for i, contrib_name in enumerate(project_these):

        print "conribution", contrib_name
        calibdata = pickle.load(
            open(
                "../data/calibration/" +
                contrib_name +
                ".pkl",
                "rb"))

        proj = np.zeros([len(proj_period), nrealizations])

        for n in realizations:
            slr,driving_temp = sl.project(gmt, proj_period, calibdata, n)
            proj[:, n] = slr

        pdata = da.DimArray(proj, axes=[proj_period, realizations],
                            dims=["time", "runnumber"])
        projection_data[scen][contrib_name] = pdata

fname = "../data/projection/projected_slr_" + \
    str(nrealizations) + "samples.pkl"
print "save to pickle."
pickle.dump(projection_data, open(fname, "wb"), protocol=2)
Esempio n. 2
0
realizations = np.arange(nrealizations)

all_contributions = {}

# Monte Carlo Sampling from all the different observational datasets and
# fitting/calibrated parametes.
for i, contrib_name in enumerate(contrib_ids):

    print "conribution", contrib_name
    calibdata = pickle.load(
        open("../data/calibration/" + contrib_name + ".pkl", "rb"))

    proj = np.zeros([nrealizations, len(ggd.giss_temp.time)])

    for n in realizations:
        proj[n, :] = sl.project(ggd.giss_temp, ggd.giss_temp.time, calibdata,
                                n)

    pdata = da.DimArray(proj,
                        axes=[realizations, ggd.giss_temp.time],
                        dims=["runnumber", "time"])
    all_contributions[contrib_name] = pdata

all_contributions = da.DimArray(all_contributions,
                                dims=["contribution", "runnumber", "time"])

obs_period = np.arange(1900, 2009)

fig = plt.figure(2)
plt.clf()
ax = plt.subplot(111)
Esempio n. 3
0
    ## sampling from MAGICC 600 member ensemble as in paper
    ## (not done here as data not openly available.)
    #gmt = mag.magicc_gmt[nd[scen]]

    for i, contrib_name in enumerate(project_these):

        print "conribution", contrib_name
        calibdata = pickle.load(
            open(calibdatadir + contrib_name + ".pkl", "rb"))
        pdata = da.DimArray(None,
                            axes=[proj_period, realizations],
                            dims=["time", "runnumber"])

        for n in realizations:

            slr, gmt_i = sl.project(gmt, proj_period, calibdata, n + 1)
            pdata[:, n] = slr

        projection_data[nd[scen]][contrib_name] = pdata

### Figure 3
## Plot like Fig. 3 in the PNAS manuscript.
## Note the thinner uncertainty bands for certain contributions
## as we do not sample climate uncertainty here
## (MAGICC ensemble is not publicly available).
plt.figure(1)
plotting.fig3(projection_data)
plt.draw()
plt.show()

### Fig. 4
Esempio n. 4
0
    projection_data[nd[scen]] = {}
    gmt = tas_data[scen]
    ## sampling from MAGICC 600 member ensemble as in paper
    ## (not done here as data not openly available.)
    #gmt = mag.magicc_gmt[nd[scen]]

    for i,contrib_name in enumerate(project_these):

        print "conribution", contrib_name
        calibdata = pickle.load(open(calibdatadir+contrib_name+".pkl","rb"))
        pdata = da.DimArray(None, axes=[proj_period,realizations],
                         dims=["time","runnumber"])

        for n in realizations:

             slr,gmt_i = sl.project(gmt,proj_period,calibdata,n+1)
             pdata[:,n] = slr

        projection_data[nd[scen]][contrib_name] = pdata


### Figure 3
## Plot like Fig. 3 in the PNAS manuscript.
## Note the thinner uncertainty bands for certain contributions
## as we do not sample climate uncertainty here
## (MAGICC ensemble is not publicly available).
plt.figure(1)
plotting.fig3(projection_data)
plt.draw()
plt.show()
Esempio n. 5
0
nrealizations = 10000
realizations = np.arange(nrealizations)

all_contributions = {}

# Monte Carlo Sampling from all the different observational datasets and
# fitting/calibrated parametes.
for i, contrib_name in enumerate(contrib_ids):

    print "conribution", contrib_name
    calibdata = pickle.load(open("../data/calibration/" + contrib_name + ".pkl", "rb"))

    proj = np.zeros([nrealizations, len(ggd.giss_temp.time)])

    for n in realizations:
        proj[n, :] = sl.project(ggd.giss_temp, ggd.giss_temp.time, calibdata, n)

    pdata = da.DimArray(proj, axes=[realizations, ggd.giss_temp.time], dims=["runnumber", "time"])
    all_contributions[contrib_name] = pdata

all_contributions = da.DimArray(all_contributions, dims=["contribution", "runnumber", "time"])

obs_period = np.arange(1900, 2009)

fig = plt.figure(2)
plt.clf()
ax = plt.subplot(111)

natural_gic_contrib = gd.marzeion_gic_nat_up.mean(axis="model") / 1.0e3
# gd.
past_sl_anom = gd.church_past_sl[obs_period] - natural_gic_contrib[obs_period]
Esempio n. 6
0
projection_data = {}

for scen in ["RCP3PD", "RCP45", "RCP85"]:

    print "scenario", scen

    projection_data[scen] = {}
    gmt = mag.magicc_gmt[scen]

    for i, contrib_name in enumerate(project_these):

        print "conribution", contrib_name
        calibdata = pickle.load(
            open("../data/calibration/" + contrib_name + ".pkl", "rb"))

        proj = np.zeros([len(proj_period), nrealizations])

        for n in realizations:
            slr, driving_temp = sl.project(gmt, proj_period, calibdata, n)
            proj[:, n] = slr

        pdata = da.DimArray(proj,
                            axes=[proj_period, realizations],
                            dims=["time", "runnumber"])
        projection_data[scen][contrib_name] = pdata

fname = "../data/projection/projected_slr_" + \
    str(nrealizations) + "samples.pkl"
print "save to pickle."
pickle.dump(projection_data, open(fname, "wb"), protocol=2)