esmvaltool/diag_scripts/ocean/diagnostic_profiles.py
def make_profiles_plots(
        cfg,
        metadata,
        filename,
):
    """
    Make a simple profile plot for an individual model.

    The cfg is the opened global config,
    metadata is the metadata dictionairy
    filename is the preprocessing model file.
    """
    # Load cube and set up units
    cube = iris.load_cube(filename)
    cube = diagtools.bgc_units(cube, metadata['short_name'])

    # Make annual means from:
    cube = cube.aggregated_by('year', iris.analysis.MEAN)

    # Is this data is a multi-model dataset?
    multi_model = metadata['dataset'].find('MultiModel') > -1

    #
    times_float = diagtools.cube_time_to_float(cube)
    time_0 = times_float[0]

    cmap = plt.cm.get_cmap('jet')

    plot_details = {}
    for time_index, time in enumerate(times_float):

        color = cmap((time - time_0) / (times_float[-1] - time_0))

        qplt.plot(cube[time_index, :], cube[time_index, :].coord('depth'),
                  c=color)

        plot_details[time_index] = {'c': color, 'ls': '-', 'lw': 1,
                                    'label': str(int(time))}

    # Add title to plot
    title = ' '.join([
        metadata['dataset'],
        metadata['long_name'],
    ])
    plt.title(title)

    # Add Legend outside right.
    diagtools.add_legend_outside_right(plot_details, plt.gca())

    # Load image format extention
    image_extention = diagtools.get_image_format(cfg)

    # Determine image filename:
    if multi_model:
        path = diagtools.folder(
            cfg['plot_dir']) + os.path.basename(filename).replace(
                '.nc', '_profile' + image_extention)
    else:
        path = diagtools.get_image_path(
            cfg,
            metadata,
            suffix='profile' + image_extention,
        )

    # Saving files:
    if cfg['write_plots']:
        logger.info('Saving plots to %s', path)
        plt.savefig(path)

    plt.close()

    Make a simple profile plot for an individual model.

    The cfg is the opened global config,
    metadata is the metadata dictionairy
    filename is the preprocessing model file.
    
Make a simple profile plot for an individual model.
The cfg is the opened global config,
metadata is the metadata dictionairy
filename is the preprocessing model file.
Make a simple profile plot for an individual model . The cfg is the opened global config metadata is the metadata dictionairy filename is the preprocessing model file .
def make_profiles_plots(
        cfg,
        metadata,
        filename,
):
    cube = iris.load_cube(filename)
    cube = diagtools.bgc_units(cube, metadata['short_name'])
    cube = cube.aggregated_by('year', iris.analysis.MEAN)
    multi_model = metadata['dataset'].find('MultiModel') > -1
    times_float = diagtools.cube_time_to_float(cube)
    time_0 = times_float[0]
    cmap = plt.cm.get_cmap('jet')
    plot_details = {}
    for time_index, time in enumerate(times_float):
        color = cmap((time - time_0) / (times_float[-1] - time_0))
        qplt.plot(cube[time_index, :], cube[time_index, :].coord('depth'),
                  c=color)
        plot_details[time_index] = {'c': color, 'ls': '-', 'lw': 1,
                                    'label': str(int(time))}
     Add title to plot
    title = ' '.join([
        metadata['dataset'],
        metadata['long_name'],
    ])
    plt.title(title)
     Add Legend outside right.
    diagtools.add_legend_outside_right(plot_details, plt.gca())
     Load image format extention
    image_extention = diagtools.get_image_format(cfg)
     Determine image filename:
    if multi_model:
        path = diagtools.folder(
            cfg['plot_dir']) + os.path.basename(filename).replace(
                '.nc', '_profile' + image_extention)
    else:
        path = diagtools.get_image_path(
            cfg,
            metadata,
            suffix='profile' + image_extention,
        )
     Saving files:
    if cfg['write_plots']:
        logger.info('Saving plots to %s', path)
        plt.savefig(path)
    plt.close()
def make_profiles_plots ( cfg , metadata , filename , ) : cube = iris . load_cube ( filename ) cube = diagtools . bgc_units ( cube , metadata [ 'short_name' ] ) cube = cube . aggregated_by ( 'year' , iris . analysis . MEAN ) multi_model = metadata [ 'dataset' ] . find ( 'MultiModel' ) > - 1 times_float = diagtools . cube_time_to_float ( cube ) time_0 = times_float [ 0 ] cmap = plt . cm . get_cmap ( 'jet' ) plot_details = { } for time_index , time in enumerate ( times_float ) : color = cmap ( ( time - time_0 ) / ( times_float [ - 1 ] - time_0 ) ) qplt . plot ( cube [ time_index , : ] , cube [ time_index , : ] . coord ( 'depth' ) , c = color ) plot_details [ time_index ] = { 'c' : color , 'ls' : '-' , 'lw' : 1 , 'label' : str ( int ( time ) ) } title = ' ' . join ( [ metadata [ 'dataset' ] , metadata [ 'long_name' ] , ] ) plt . title ( title ) diagtools . add_legend_outside_right ( plot_details , plt . gca ( ) ) image_extention = diagtools . get_image_format ( cfg ) if multi_model : path = diagtools . folder ( cfg [ 'plot_dir' ] ) + os . path . basename ( filename ) . replace ( '.nc' , '_profile' + image_extention ) else : path = diagtools . get_image_path ( cfg , metadata , suffix = 'profile' + image_extention , ) if cfg [ 'write_plots' ] : logger . info ( 'Saving plots to %s' , path ) plt . savefig ( path ) plt . close ( )
Make a simple profile plot for an individual model.
Make a simple profile plot for an individual model .
"""
    Make a simple profile plot for an individual model.

    The cfg is the opened global config,
    metadata is the metadata dictionairy
    filename is the preprocessing model file.
    """ # Load cube and set up units # Make annual means from: # Is this data is a multi-model dataset? # # Add title to plot # Add Legend outside right. # Load image format extention # Determine image filename: # Saving files:
cfg
metadata
filename