Taylor diagram

 


Taylor diagrams

plot SUB-PROGRAM






Sub-program description:

    This program plots multiple Taylor diagrams based on comparison statistics
    between a list of model output and a data set.

    This program has three modes depending on a command line option:
        Mode 1: for one variable, plot multiple Taylor diagrams,
                one per statistical component (the default mode)
        Mode 2: for one variable, plot all statistical components
                on one Taylor diagram.
        Mode 3: for multiple variables, plot the total space-time components
                on one Taylor diagram.

    For one variable (e.g. Sea Surface Temperature), comparison statistics
    between observation data and models are read from a netCDF file.
    This file contains, for each model, comparison statistics for all
    statistical components.

    The component list is the following:

        - 1. Total space-time field
        - 2. Zonal annual mean
        - 3. Zonal monthly mean
        - 4. Zonal monthly anomaly: Monthly anomaly to zonal annual mean
        - 5. Annual mean map
        - 6. Monthly map anomaly:   Monthly anomaly to annual mean map
        - 7. Longitudinal anomaly:  Spatial anomaly to zonal monthly mean
        - 8. Annual mean longitudinal anomaly:  Annual mean longitudinal anomaly to zonal mean

    Additional points may be shown on the diagrams along with models, like
        - all models mean or median
        - additionnal data-set

    Each model is represented on the diagrams as
        - either a one-or-two letter code, optionally with a specific color.
        - or a coloured dot with a one-or-two letter code. The dot color is
          taken from a color scale varying from purple to blue and indicates
          the model bias.

    By default, model names are extracted from input NetCDF file.
    Code-letters are derived from these names and predefined colors are
    automatically assigned to them.

    An optional parameter file allows the user to change the model list
    and specify their attributes. (see usage section below)

    Output files:

    Each Taylor diagram is saved in a file. Default format is PostScript.
    Alternate option is GIF. Respective file name extension is '.ps' or '.gif'

    When running in mode 1, each file name is after the component short name
    (first listed above) with all white space replaced by underscores.
    For example:  Total_space-time_field

    Directory where these files are created is by default the current working
    directory. This may be specified differently, using a command line option.
    If the specified directory does not exist, it is created. If output files
    already exist in that directory, they are overwritten.

    When running in mode 2, output image file name is after the variable name
    from input NetCDF file and is in current working directory.
    Path and name may be specified differently using a command line option.

    When running in mode 3, output image file name is after the FIRST variable name
    from (FIRST) input NetCDF file and is in current working directory.
    Path and name may be specified differently using a command line option.



Sub-program usage:

Usage: plot_taylor_diagrams.py [options] [stats-filename]

       or: plot_taylor_diagrams.py (--mix_variables | -v) [stats-filename  stats-filename2]

        stats-filename and stats-filename2 are NetCDF input file names.
        If none is given, <stats-filename> defaults to 'model_vs_data_comp_stats.nc'
        in current working directory.

    Options are:

    *** General options ***

     --help
     -h
     print out this help

     --output=<pathname>
     -o <pathname>
            Depending on whether single or multiple image file to be output,
            specify output filename or output directory pathname.
            If multiple output files, file names are fixed (not an option).

            In any case, default directory is current working directory.
            For single output file, default filename depends on chosen mode
            option (see below).

     --gif
     -g
     Output file format is GIF. File extension is '.gif'

     --portrait
     -p 
    Output image orientation is 'portrait'. (Default is 'landscape')

     --models=<model-list>
     -m <model-list>

            Comma-separated list of all models/composite-var to show
            on the diagram. Composite variables may be 'Median' or 'Mean',
            for example.
            By default, all variables present in the input NetCDF file are shown.

            Listed names must be consistent with variable ids in input NetCDF file.
            That is, when <name> appears in the list, <name>_Correlation and
            name>_StandardDeviation must exist as variables in the input file.

     --param-file=<filename>
     -f <filename>

            Specify a model parameter file that contains python statements
            defining model list and plot parameters for each models.
            Listed models must be consistent with variable ids in input file.
            See paragraph 'Model parameter file' below for more details.

            This option is incompatible with --models or -m option above.

            If neither model list nor model parameter file is specified on the
            command line, the program looks for a parameter file named
            'model_dictionary.py' in current working directory.

     --symbol-size=<size>
     -i=<size>
            Adjust size of points and associated symbols on the diagrams.
            <size> is an integer value in the range [1, 100].  Default is 50.

     --title=<title>
     -t <title>
            Add a title to the top of each Taylor diagram

     --units=<units>
     -u <units>
            Add the variable units on the standard deviation axis.


     *** Mode options ***

     --superimpose
     -s 
    Selector for mode 2. All components are superimposed on the same
            Taylor diagram. One different color of standard palette is used
            for each component. Only one image file is output.

            Default is mode 1 where each component is plot separately
            on a Taylor diagram.

     --mix-variables
     -v 
    Selector for mode 3. Main components (Total space-time field)
            of all variables are on the same Taylor diagram.
            One different color of standard palette is used for each variable.
            Only one image file is output.


     *** Miscelaneous (mode dependendant) options ***

     --components=<component-list>                 (valid only for mode 1 and 2)
     -C <component-list>
            Choose a subset of components to plot.
            <component-list> is a list of numbers corresponding to ranks
            in available component list above (from 1 to 8).
            List order is meaningless.

     --bias                                              (valid only for mode 1)
     -b
     For the main statistical component, models are represented on the
            diagram with a dot whose color is function of model bias.
            By default, models are represented with only a coloured letter-code.

     --color                                             (valid only for mode 1)
     -c
     If no option --bias or -b is used, represent models on the diagrams
            with coloured code-letter instead of black code-letter.

     --discrete                                          (valid only for mode 1)
     -d
     When using --bias or -b option, bias is represented using a limited
            number of colors instead of a continuous color scale.

     --red-blue                                          (valid only for mode 1)
     -r
     When using --bias or -b option, bias is represented using a standard
            blue to red palette centered on value 0.

    Model parameter file:

    A model parameter file is an optional python script that lists all models and
        composite vars used for comparison. It describes also, for each model/
        composite-var, the letter-code and the color that represents this model/var
        on the Taylor diagram.

    By default, the program looks for that file under the name
        'model_dictionary.py' in current working directory. User may specify
        a different one using option '-f'.

    File structure:
         It defines two Python variables named: 'model_dictionary' (mandatory, for models)
         and 'other_dictionary' (optional, for additionnal variables).

         These variables are Python dictionnaries with,
         - as keys: model or other variable names
         - as values: inner two-item dictionnaries defining
                      code-letter and color for each model/variable

         Code-letter is a string of one or more letter(s), typically 1 or 2.
         Color is a number ranging from 241 to 255. It is an index
         into the default color palette.
            color: 241   Black
            color: 242   Red
            color: 243   Green
            color: 244   Blue
            color: 245   Yellow
            color: 246   Cyan
            color: 247   Magenta
            color: 248   Orange
            color: 249   Marroon
            color: 250   Navy
            color: 251   Brown
            color: 252   Grey
            color: 253   Pale green
            color: 254   Rose
            color: 255   Light blue

        The color parameter is relevant only when using mode 1 (default)
        whith -c or --color option.

    Example:
         Let's say we deal with two models 'Model_one' and 'Model_two'
         and one additionnal data-set named 'Data'

         'model_dictionary' variable will be defined as the following:
            model_dictionary  = {\
                "Model_one":      { "code_letter": "A",  "color": 241 },  \
                "Model_two":      { "code_letter": "2",  "color": 242 },  \
                }

         'other_dictionary' variable will be defined as the following:
            other_dictionary  = {\
                "Data":     { "code_letter": "D",  "color": 244 },  \
                }