def main(project_info):
    """Diagnostics and plotting script for Southern Hemisphere radiation."""

    # ESMValProject provides some easy methods to access information in
    # project_info but you can also access it directly (as in main.py)
    # First we get some general configurations (ESMValProject)
    # and then we read in the model configuration file

    E = ESMValProject(project_info)
    config_file = E.get_configfile()
    plot_dir = E.get_plot_dir()
    verbosity = E.get_verbosity()

    # A-laue_ax+
    diag_script = E.get_diag_script_name()
    res = E.write_references(
        diag_script,  # diag script name
        ["A_maek_ja"],  # authors
        ["A_eval_ma", "A_jone_co"],  # contributors
        [""],  # diag_references
        [""],  # obs_references
        ["P_embrace"],  # proj_references
        project_info,
        verbosity,
        False)
    # A-laue_ax-

    modelconfig = ConfigParser.ConfigParser()
    modelconfig.read(config_file)
    E.ensure_directory(plot_dir)

    # Check which parts of the code to run
    if (modelconfig.getboolean('general', 'plot_scatter')):
        info("Starting scatter plot", verbosity, 2)
        process_scatter(E, modelconfig)
Beispiel #2
0
def main(project_info):
    """Diagnostics and plotting script for Southern Hemisphere radiation."""

    # ESMValProject provides some easy methods to access information in
    # project_info but you can also access it directly (as in main.py)
    # First we get some general configurations (ESMValProject)
    # and then we read in the model configuration file

    E = ESMValProject(project_info)
    config_file = E.get_configfile()
    datakeys = E.get_currVars()
    plot_dir = E.get_plot_dir()
    verbosity = E.get_verbosity()

    # A-laue_ax+
    diag_script = E.get_diag_script_name()
    res = E.write_references(diag_script,              # diag script name
                             ["A_maek_ja"],            # authors
                             ["A_eval_ma", "A_jone_co"], # contributors
                             [""],                     # diag_references
                             [""],                     # obs_references
                             ["P_embrace"],            # proj_references
                             project_info,
                             verbosity,
                             False)
    # A-laue_ax-

    modelconfig = ConfigParser.ConfigParser()
    modelconfig.read(config_file)
    E.ensure_directory(plot_dir)

    # Check at which stage of the program we are
    clouds = False
    fluxes = False
    radiation = False
    if ('clt' in datakeys or 'clivi' in datakeys or 'clwvi' in datakeys):
        clouds = True
    elif ('hfls' in datakeys or 'hfss' in datakeys):
        fluxes = True
    else:
        radiation = True

    # Check which parts of the code to run
    if (modelconfig.getboolean('general', 'plot_clouds') and clouds is True):
        info("Starting to plot clouds", verbosity, 2)
        process_clouds(E, modelconfig)

    if (modelconfig.getboolean('general', 'plot_fluxes') and fluxes is True):
        info("Starting to plot turbulent fluxes", verbosity, 2)
        process_fluxes(E, modelconfig)

    if (modelconfig.getboolean('general', 'plot_radiation') and radiation is True):
        info("Starting to plot radiation graphs", verbosity, 2)
        process_radiation(E, modelconfig)
Beispiel #3
0
def main(project_info):
    """Diagnostics and plotting script for Tropical Variability.
    We use ts as a proxy for Sea Surface Temperature. """

    # ESMValProject provides some easy methods to access information in
    # project_info but you can also access it directly (as in main.py)
    # First we get some general configurations (ESMValProject)
    # and then we read in the model configuration file

    E = ESMValProject(project_info)
    config_file = E.get_configfile()
    plot_dir = E.get_plot_dir()
    verbosity = E.get_verbosity()

    # A-laue_ax+
    diag_script = E.get_diag_script_name()
    res = E.write_references(
        diag_script,  # diag script name
        ["A_maek_ja"],  # authors
        ["A_eval_ma", "A_jone_co"],  # contributors
        ["D_li14jclim"],  # diag_references
        [""],  # obs_references
        ["P_embrace"],  # proj_references
        project_info,
        verbosity,
        False)

    # A-laue_ax-

    modelconfig = ConfigParser.ConfigParser()
    modelconfig.read(config_file)
    E.ensure_directory(plot_dir)

    # Here we check and process only desired parts of the diagnostics
    if (modelconfig.getboolean('general', 'plot_zonal_means')):
        info("Starting to plot zonal means", verbosity, 2)
        process_zonal_means(E, modelconfig)

    if (modelconfig.getboolean('general', 'plot_scatter')):
        info("Starting scatterplot of temperature and precipitation",
             verbosity, 2)
        process_scatterplot(E, modelconfig)

    if (modelconfig.getboolean('general', 'plot_equatorial')):
        info("Starting to gather values for equatorial means", verbosity, 2)
        process_equatorial_means(E, modelconfig)
Beispiel #4
0
def main(project_info):

    # print(">>>>>>>> entering ww09_ESMValTool.py <<<<<<<<<<<<")

    # create instance of a wrapper that allows easy access to data
    E = ESMValProject(project_info)

    config_file = E.get_configfile()
    plot_dir = E.get_plot_dir()
    verbosity = E.get_verbosity()
    plot_type = E.get_graphic_format()
    diag_script = E.get_diag_script_name()

    res = E.write_references(diag_script,              # diag script name
                             ["A_will_ke"],            # authors
                             [""],                     # contributors
                             ["D_Williams09climdyn"],  # diag_references
                             ["E_isccp_d1"],           # obs_references
                             ["P_cmug"],               # proj_references
                             project_info,
                             verbosity,
                             False)

    modelconfig = ConfigParser.ConfigParser()
    modelconfig.read(config_file)

    # create list of model names (plot labels)
    models = []
    for model in E.project_info['MODELS']:
        models.append(model.split_entries()[1])

    # number of models
    nummod = len(E.project_info['MODELS'])
    crems = np.empty(nummod)

    # get filenames of preprocessed climatological mean files (all models)
    fn_alb = get_climo_filenames(E, variable='albisccp')
    fn_pct = get_climo_filenames(E, variable='pctisccp')
    fn_clt = get_climo_filenames(E, variable='cltisccp')
    fn_su  = get_climo_filenames(E, variable='rsut')
    fn_suc = get_climo_filenames(E, variable='rsutcs')
    fn_lu  = get_climo_filenames(E, variable='rlut')
    fn_luc = get_climo_filenames(E, variable='rlutcs')
    fn_snc = get_climo_filenames(E, variable='snc')
    fn_sic = get_climo_filenames(E, variable='sic')

    if not fn_snc:
        print("no data for variable snc found, using variable snw instead")
        fn_snw = get_climo_filenames(E, variable='snw')

    # loop over models and calulate CREM

    for i in range(nummod):

        if fn_snc:
            snc = fn_snc[i]
        else:
            snc = ""

        pointers = {'albisccp_nc': fn_alb[i],
                    'pctisccp_nc': fn_pct[i],
                    'cltisccp_nc': fn_clt[i],
                    'rsut_nc'    : fn_su[i],
                    'rsutcs_nc'  : fn_suc[i],
                    'rlut_nc'    : fn_lu[i],
                    'rlutcs_nc'  : fn_luc[i],
                    'snc_nc'     : snc,
                    'sic_nc'     : fn_sic[i]}

        if not fn_snc:
            pointers['snw_nc'] = fn_snw[i]

        # calculate CREM

        (CREMpd, __) = crem_calc(E, pointers)

        crems[i] = CREMpd

    print("------------------------------------")
    print(crems)
    print("------------------------------------")

    # plot results

    fig = plt.figure()
    ypos = np.arange(nummod)
    plt.barh(ypos, crems)
    plt.yticks(ypos + 0.5, models)
    plt.xlabel('Cloud Regime Error Metric')

    # draw observational uncertainties (dashed red line)
    plt.plot([0.96, 0.96], [0, nummod], 'r--')

    # if needed, create directory for plots
    if not os.path.exists(plot_dir):
        os.makedirs(plot_dir)

    plt.savefig(plot_dir + 'ww09_metric_multimodel.' + plot_type)
    print("Wrote " + plot_dir + "ww09_metric_multimodel." + plot_type)