esmvaltool/diag_scripts/ocean/diagnostic_timeseries.py
def make_time_series_plots(
        cfg,
        metadata,
        filename,
):
    """
    Make a simple plot for an indivudual 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'])

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

    # Make a dict of cubes for each layer.
    cubes = diagtools.make_cube_layer_dict(cube)

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

    # Making plots for each layer
    for layer_index, (layer, cube_layer) in enumerate(cubes.items()):
        layer = str(layer)

        if multi_model:
            timeplot(cube_layer, label=metadata['dataset'], ls=':')
        else:
            timeplot(cube_layer, label=metadata['dataset'])

        # Add title, legend to plots
        title = ' '.join([metadata['dataset'], metadata['long_name']])
        if layer != '':
            if cube_layer.coords('depth'):
                z_units = cube_layer.coord('depth').units
            else:
                z_units = ''
            title = ' '.join([title, '(', layer, str(z_units), ')'])
        plt.title(title)
        plt.legend(loc='best')
        plt.ylabel(str(cube_layer.units))

        # Determine image filename:
        if multi_model:
            path = diagtools.get_image_path(
                cfg,
                metadata,
                prefix='MultiModel',
                suffix='_'.join(['timeseries', str(layer) + image_extention]),
                metadata_id_list=[
                    'field', 'short_name', 'preprocessor', 'diagnostic',
                    'start_year', 'end_year'
                ],
            )

        else:
            path = diagtools.get_image_path(
                cfg,
                metadata,
                suffix='timeseries_' + str(layer_index) + image_extention,
            )

        # Saving files:
        if cfg['write_plots']:

            logger.info('Saving plots to %s', path)
            plt.savefig(path)

        plt.close()

    Make a simple plot for an indivudual model.

    The cfg is the opened global config,
    metadata is the metadata dictionairy
    filename is the preprocessing model file.
    
Make a simple plot for an indivudual model.
The cfg is the opened global config,
metadata is the metadata dictionairy
filename is the preprocessing model file.
Make a simple plot for an indivudual model . The cfg is the opened global config metadata is the metadata dictionairy filename is the preprocessing model file .
def make_time_series_plots(
        cfg,
        metadata,
        filename,
):
    cube = iris.load_cube(filename)
    cube = diagtools.bgc_units(cube, metadata['short_name'])
    multi_model = metadata['dataset'].find('MultiModel') > -1
    cubes = diagtools.make_cube_layer_dict(cube)
    image_extention = diagtools.get_image_format(cfg)
    for layer_index, (layer, cube_layer) in enumerate(cubes.items()):
        layer = str(layer)
        if multi_model:
            timeplot(cube_layer, label=metadata['dataset'], ls=':')
        else:
            timeplot(cube_layer, label=metadata['dataset'])
        title = ' '.join([metadata['dataset'], metadata['long_name']])
        if layer != '':
            if cube_layer.coords('depth'):
                z_units = cube_layer.coord('depth').units
            else:
                z_units = ''
            title = ' '.join([title, '(', layer, str(z_units), ')'])
        plt.title(title)
        plt.legend(loc='best')
        plt.ylabel(str(cube_layer.units))
        if multi_model:
            path = diagtools.get_image_path(
                cfg,
                metadata,
                prefix='MultiModel',
                suffix='_'.join(['timeseries', str(layer) + image_extention]),
                metadata_id_list=[
                    'field', 'short_name', 'preprocessor', 'diagnostic',
                    'start_year', 'end_year'
                ],
            )
        else:
            path = diagtools.get_image_path(
                cfg,
                metadata,
                suffix='timeseries_' + str(layer_index) + image_extention,
            )
        if cfg['write_plots']:
            logger.info('Saving plots to %s', path)
            plt.savefig(path)
        plt.close()
def make_time_series_plots ( cfg , metadata , filename , ) : cube = iris . load_cube ( filename ) cube = diagtools . bgc_units ( cube , metadata [ 'short_name' ] ) multi_model = metadata [ 'dataset' ] . find ( 'MultiModel' ) > - 1 cubes = diagtools . make_cube_layer_dict ( cube ) image_extention = diagtools . get_image_format ( cfg ) for layer_index , ( layer , cube_layer ) in enumerate ( cubes . items ( ) ) : layer = str ( layer ) if multi_model : timeplot ( cube_layer , label = metadata [ 'dataset' ] , ls = ':' ) else : timeplot ( cube_layer , label = metadata [ 'dataset' ] ) title = ' ' . join ( [ metadata [ 'dataset' ] , metadata [ 'long_name' ] ] ) if layer != '' : if cube_layer . coords ( 'depth' ) : z_units = cube_layer . coord ( 'depth' ) . units else : z_units = '' title = ' ' . join ( [ title , '(' , layer , str ( z_units ) , ')' ] ) plt . title ( title ) plt . legend ( loc = 'best' ) plt . ylabel ( str ( cube_layer . units ) ) if multi_model : path = diagtools . get_image_path ( cfg , metadata , prefix = 'MultiModel' , suffix = '_' . join ( [ 'timeseries' , str ( layer ) + image_extention ] ) , metadata_id_list = [ 'field' , 'short_name' , 'preprocessor' , 'diagnostic' , 'start_year' , 'end_year' ] , ) else : path = diagtools . get_image_path ( cfg , metadata , suffix = 'timeseries_' + str ( layer_index ) + image_extention , ) if cfg [ 'write_plots' ] : logger . info ( 'Saving plots to %s' , path ) plt . savefig ( path ) plt . close ( )
Make a simple plot for an indivudual model.
Make a simple plot for an indivudual model .
"""
    Make a simple plot for an indivudual 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 # Is this data is a multi-model dataset? # Make a dict of cubes for each layer. # Load image format extention # Making plots for each layer # Add title, legend to plots # Determine image filename: # Saving files:
cfg
metadata
filename