def slice_name_to_components( slice_name ):
    """
    Decomposes a slice name into a map of its unique components.  This is the
    inverse of build_slice_name().  Also handles slice_name's which have been
    converted into a path or URL as a prefix.

    Takes 1 argument:

      slice_name - String specifying the slice's name, as generated by build_slice_name().

    Returns 1 value:

      slice_map - Dictionary containing the decomposed metadata from slice_name.
                  Has the following keys:

                    "experiment":       Experiment name
                    "variable":         Variable name
                    "z_index":          XY slice index
                    "time_step_index":  Time step index

    """

    slice_components = slice_name.split( "-" )

    # handle slice names that have been turned into paths with extensions.
    if "." in slice_components[-1]:
        slice_components[-1] = slice_components[-1].split( "." )[0]

    # map the individual components to their names.
    #
    # NOTE: we use negative indexing to handle the case where the experiment
    #       name may contain one or more hyphens.
    #
    slice_map = {
        "experiment":      "-".join( slice_components[:-3] ),
        "variable":        slice_components[-3],
        "z_index":         int( slice_components[-2].split( "=" )[1] ),
        "time_step_index": int( slice_components[-1].split( "=" )[1] )
    }

    return slice_map