def read_srml(filename):
tsv_data = pd.read_csv(filename, delimiter='<STR_LIT:\t>')<EOL>data = format_index(tsv_data)<EOL>data = data[data.columns[<NUM_LIT:2>:]]<EOL>data = data.rename(columns=map_columns)<EOL>columns = data.columns<EOL>flag_label_map = {flag: columns[columns.get_loc(flag) - <NUM_LIT:1>] + '<STR_LIT>'<EOL>for flag in columns[<NUM_LIT:1>::<NUM_LIT:2>]}<EOL>data = data.rename(columns=flag_label_map)<EOL>for col in columns[::<NUM_LIT:2>]:<EOL><INDENT>missing = data[col + '<STR_LIT>'] == <NUM_LIT><EOL>data[col] = data[col].where(~(missing), np.NaN)<EOL><DEDENT>return data<EOL>
Read University of Oregon SRML[1] 1min .tsv file into pandas dataframe.

Parameters
----------
filename: str
    filepath or url to read for the tsv file.

Returns
-------
data: Dataframe
    A dataframe with datetime index and all of the variables listed
    in the `VARIABLE_MAP` dict inside of the map_columns function,
    along with their associated quality control flags.

Notes
-----
The time index is shifted back one minute to account for 2400 hours,
and to avoid time parsing errors on leap years. The returned data
values should be understood to occur during the interval from the
time of the row until the time of the next row. This is consistent
with pandas' default labeling behavior.

See SRML's `Archival Files`_ page for more information.

.. _Archival Files: http://solardat.uoregon.edu/ArchivalFiles.html

References
----------
[1] University of Oregon Solar Radiation Monitoring Laboratory
    `http://solardat.uoregon.edu/ <http://solardat.uoregon.edu/>`_