def main(): global settings set_settings() steric_ensembles = np.load(settings['fn_steric_ensembles'], allow_pickle=True).all() grd_ensembles = np.load(settings['fn_grd_ensembles'], allow_pickle=True).all() budget_total = steric_ensembles[ 'global'][:settings['num_ens'], :] + grd_ensembles['global'][ 'total'][:settings['num_ens'], :] budget_notws = steric_ensembles[ 'global'][:settings['num_ens'], :] + grd_ensembles['global'][ 'total'][:settings['num_ens'], :] - grd_ensembles['global'][ 'tws'][:settings['num_ens'], :] mass_frac = ['glac', 'GrIS', 'AIS', 'tws', 'total'] # Steric fractions frac_steric = estimate_fraction_from_ensemble( steric_ensembles['global'][:settings['num_ens'], :], budget_total) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'frac_steric', settings['years'], frac_steric) frac_steric_notws = estimate_fraction_from_ensemble( steric_ensembles['global'][:settings['num_ens'], :], budget_notws) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'frac_steric_notws', settings['years'], frac_steric_notws) # Mass fractions for process in mass_frac: frac_proc = estimate_fraction_from_ensemble( grd_ensembles['global'][process][:settings['num_ens'], :], budget_total) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'frac_' + process, settings['years'], frac_proc) if process == 'total': frac_proc_notws = estimate_fraction_from_ensemble( grd_ensembles['global'][process][:settings['num_ens'], :] - grd_ensembles['global']['tws'][:settings['num_ens'], :], budget_notws) else: frac_proc_notws = estimate_fraction_from_ensemble( grd_ensembles['global'][process][:settings['num_ens'], :], budget_notws) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'frac_' + process + '_notws', settings['years'], frac_proc_notws) return
def main(): settings = {} settings['dir_data'] = os.getenv('HOME') + '/Data/' settings['dir_budget'] = settings['dir_data'] + 'Budget_20c/' settings['fn_stats_ice6g'] = settings[ 'dir_budget'] + 'results/stats_basin_global_ice6g.npy' settings['fn_stats_caron'] = settings[ 'dir_budget'] + 'results/stats_basin_global.npy' settings['dir_gmt'] = os.getenv( 'HOME') + '/Scripts/GMT/Papers/Budget_20c/comp_ICE6G/' settings['years'] = np.arange(1900, 2019) stats_caron = np.load(settings['fn_stats_caron'], allow_pickle=True).all() stats_ice6g = np.load(settings['fn_stats_ice6g'], allow_pickle=True).all() # Save basin data for basin in range(6): gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'obs_caron_' + str(basin) + '_tseries', settings['years'], stats_caron['basin'][basin]['obs']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'bdg_caron_' + str(basin) + '_tseries', settings['years'], stats_caron['basin'][basin]['budget']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'gia_caron_' + str(basin) + '_tseries', settings['years'], stats_caron['basin'][basin]['gia']['tseries']) gentools.gmt_save_tseries( settings['dir_gmt'], 'obs_ice6g_' + str(basin) + '_tseries', settings['years'], stats_ice6g['basin'][basin]['obs']['tseries'][:, 1]) gentools.gmt_save_tseries( settings['dir_gmt'], 'bdg_ice6g_' + str(basin) + '_tseries', settings['years'], stats_ice6g['basin'][basin]['budget']['tseries'][:, 1]) gentools.gmt_save_tseries( settings['dir_gmt'], 'gia_ice6g_' + str(basin) + '_tseries', settings['years'], stats_ice6g['basin'][basin]['gia']['tseries'][:, 1]) # Global gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'obs_caron_glb_tseries', settings['years'], stats_caron['global']['obs']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'bdg_caron_glb_tseries', settings['years'], stats_caron['global']['budget']['tseries']) gentools.gmt_save_tseries(settings['dir_gmt'], 'obs_ice6g_glb_tseries', settings['years'], stats_ice6g['global']['obs']['tseries'][:, 1]) gentools.gmt_save_tseries(settings['dir_gmt'], 'bdg_ice6g_glb_tseries', settings['years'], stats_ice6g['global']['budget']['tseries'][:, 1]) # Plot global plt.figure(figsize=(5, 4)) plt.fill_between(settings['years'], stats_caron['global']['obs']['tseries'][:, 0], stats_caron['global']['obs']['tseries'][:, 2], color='C0', alpha=0.4) plt.fill_between(settings['years'], stats_caron['global']['budget']['tseries'][:, 0], stats_caron['global']['budget']['tseries'][:, 2], color='C1', alpha=0.4) plt.plot(settings['years'], stats_caron['global']['obs']['tseries'][:, 1], 'C0', linewidth=2, label='Observed sea level (This study)') plt.plot(settings['years'], stats_ice6g['global']['obs']['tseries'][:, 1], 'black', linestyle='--', linewidth=2, label='Observed sea level (ICE6G_D)') plt.plot(settings['years'], stats_caron['global']['budget']['tseries'][:, 1], 'C1', linewidth=2, label='Sum of processes (This study)') plt.plot(settings['years'], stats_ice6g['global']['budget']['tseries'][:, 1], 'C3', linestyle='--', linewidth=2, label='Sum of processes (ICE6G_D)') plt.xlim([1900, 2018]) plt.ylim([-220, 50]) plt.ylabel('Height (mm)', fontsize=9) plt.legend(fontsize=9) plt.xticks(fontsize=9) plt.yticks(fontsize=9) plt.title('Global', fontsize=9) plt.grid() plt.tight_layout() plt.savefig('Compare_ICE6G_D_global.png') # Plot basin region_names = [ 'Subpolar North Atlantic', 'Indian Ocean-South Pacific', 'Subtropical North Atlantic', 'East Pacific', 'South Atlantic', 'Northwest Pacific' ] plt.figure(figsize=(8, 8)) for basin in range(6): plt.subplot(3, 2, basin + 1) plt.fill_between(settings['years'], stats_caron['basin'][basin]['obs']['tseries'][:, 0], stats_caron['basin'][basin]['obs']['tseries'][:, 2], color='C0', alpha=0.4) plt.fill_between(settings['years'], stats_caron['basin'][basin]['budget']['tseries'][:, 0], stats_caron['basin'][basin]['budget']['tseries'][:, 2], color='C1', alpha=0.4) plt.plot(settings['years'], stats_caron['basin'][basin]['obs']['tseries'][:, 1], 'C0', linewidth=2, label='Observed sea level (This study)') plt.plot(settings['years'], stats_ice6g['basin'][basin]['obs']['tseries'][:, 1], 'black', linestyle='--', linewidth=2, label='Observed sea level (ICE6G_D)') plt.plot(settings['years'], stats_caron['basin'][basin]['budget']['tseries'][:, 1], 'C1', linewidth=2, label='Sum of processes (This study)') plt.plot(settings['years'], stats_ice6g['basin'][basin]['budget']['tseries'][:, 1], 'C3', linestyle='--', linewidth=2, label='Sum of processes (ICE6G_D)') plt.xlim([1900, 2018]) plt.ylim([-400, 100]) plt.ylabel('Height (mm)', fontsize=9) if basin == 0: plt.legend(fontsize=9) plt.xticks(fontsize=9) plt.yticks(fontsize=9) plt.title(region_names[basin], fontsize=9) plt.grid() plt.tight_layout() plt.savefig('Compare_ICE6G_D_basin.png') return
def save_tseries(stats, settings): # Global time series of mean and uncertainty gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'obs_glb_tseries', settings['years'], stats['global']['obs']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'alt_glb_tseries', settings['years'], stats['global']['altimetry']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'steric_glb_tseries', settings['years'], stats['global']['steric']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'grd_glb_tseries', settings['years'], stats['global']['grd_total']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'glac_glb_tseries', settings['years'], stats['global']['grd_glac']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'GrIS_glb_tseries', settings['years'], stats['global']['grd_GrIS']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'AIS_glb_tseries', settings['years'], stats['global']['grd_AIS']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'tws_glb_tseries', settings['years'], stats['global']['grd_tws']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'dam_glb_tseries', settings['years'], stats['global']['grd_tws_dam']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'gwd_glb_tseries', settings['years'], stats['global']['grd_tws_gwd']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'nat_glb_tseries', settings['years'], stats['global']['grd_tws_natural']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'budget_tseries', settings['years'], stats['global']['budget']['tseries']) return
def save_sliding_trends(stats, settings): gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'obs_glb_sliding', settings['years'], stats['global']['obs']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'steric_glb_sliding', settings['years'], stats['global']['steric']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'grd_glb_sliding', settings['years'], stats['global']['grd_total']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'glac_glb_sliding', settings['years'], stats['global']['grd_glac']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'GrIS_glb_sliding', settings['years'], stats['global']['grd_GrIS']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'AIS_glb_sliding', settings['years'], stats['global']['grd_AIS']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'tws_glb_sliding', settings['years'], stats['global']['grd_tws']['sliding_trend']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'budget_sliding', settings['years'], stats['global']['budget']['sliding_trend']) return
def save_tseries(stats, settings): # Global time series of mean and uncertainty for basin in range(6): gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'obs_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['obs']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'alt_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['altimetry']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'steric_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['steric']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'grd_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['grd_total']['tseries']) gentools.gmt_save_tseries_ci(settings['dir_gmt'], 'gia_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['gia']['tseries']) gentools.gmt_save_tseries_ci( settings['dir_gmt'], 'budget_' + str(basin) + '_tseries', settings['years'], stats['basin'][basin]['budget']['tseries']) return