def read_midc(filename, variable_map=VARIABLE_MAP, raw_data=False):
data = pd.read_csv(filename)<EOL>if raw_data:<EOL><INDENT>data = format_index_raw(data)<EOL><DEDENT>else:<EOL><INDENT>data = format_index(data)<EOL><DEDENT>mapper = partial(map_midc_to_pvlib, variable_map)<EOL>data = data.rename(columns=mapper)<EOL>return data<EOL>
Read in National Renewable Energy Laboratory Measurement and
    Instrumentation Data Center [1]_ weather data.

    Parameters
    ----------
    filename: string
        Filename or url of data to read.
    variable_map: dictionary
        Dictionary for mapping MIDC field names to pvlib names. See variable
        `VARIABLE_MAP` for default and Notes section below for a description of
        its format.
    raw_data: boolean
        Set to true to use format_index_raw to correctly format the date/time
        columns of MIDC raw data files.

    Returns
    -------
    data: Dataframe
        A dataframe with DatetimeIndex localized to the provided timezone.

    Notes
    -----
    Keys of the `variable_map` dictionary should include the first part
    of a MIDC field name which indicates the variable being measured.

        e.g. 'Global PSP [W/m^2]' is entered as a key of 'Global'

    The 'PSP' indicating instrument is appended to the pvlib variable name
    after mapping to differentiate measurements of the same variable. For a
    full list of pvlib variable names see the `Variable Style Rules
    <https://pvlib-python.readthedocs.io/en/latest/variables_style_rules.html>`_.

    Be sure to check the units for the variables you will use on the
    `MIDC site <https://midcdmz.nrel.gov/>`_.

    References
    ----------
    .. [1] NREL: Measurement and Instrumentation Data Center
        `https://midcdmz.nrel.gov/ <https://midcdmz.nrel.gov/>`_