def get_measurement_variable(gt_id, shift=None):
    """Returns measurement variable name for the given ground truth id

    Args:
       gt_id: ground truth data string accepted by get_ground_truth
       shift: (optional) Number of days by which ground truth measurements
           should be shifted forward
    """
    suffix = "" if shift is None or shift == 0 else "_shift"+str(shift)
    valid_names = ["tmp2m", "tmin", "tmax", "precip", "sst", "icec",
                   "mei", "mjo", "sce", "sst_2010", "icec_2010"]
    for name in valid_names:
        if gt_id.endswith(name):
            return name+suffix
    # for wind or hgt variables, measurement variable name is the same as the
    # gt id
    if "hgt" in gt_id or "uwnd" in gt_id or "vwnd" in gt_id:
        return gt_id+suffix
    # for NCEP/NCAR reanalysis surface variables, remove contest_ prefix and
    # take the first part of the variable name, before the first period
    if gt_id in ["contest_slp", "contest_pr_wtr.eatm", "contest_rhum.sig995",
                 "contest_pres.sfc.gauss", "contest_pevpr.sfc.gauss"]:
        return gt_id.replace("contest_", "").split(".")[0]+suffix
    elif gt_id in ["us_slp", "us_pr_wtr.eatm", "us_rhum.sig995",
                   "us_pres.sfc.gauss", "us_pevpr.sfc.gauss"]:
        return gt_id.replace("us_", "").split(".")[0]+suffix
    raise ValueError("Unrecognized gt_id "+gt_id)