from pathlib import Path


def get_output_stem(attributes):
    """Get output file stem, specific to HYPE."""
    short_to_stem = dict(tas="Tobs",
                         tasmin="TMINobs",
                         tasmax="TMAXobs",
                         pr="Pobs")

    shortname = attributes["short_name"]
    if shortname in short_to_stem:
        stem = Path(short_to_stem[shortname])
    else:
        stem = Path(attributes['filename']).stem + '_hype'

    stem = attributes['alias'] / stem

    return stem