olm.loggers package

The loggers package is a collection of functions for reading in data from common data logger files into “pandas” data objects, as well as a variety of functions that are useful for merging and resampling time series data obtained from data loggers. The general functionality is contained in the ‘’loggerScripts’’ submodule. The toolkit submodules contain functions for reading in data files from different specific brands of data loggers.

Submodules

olm.loggers.loggerScripts module

General functions for merging and resampling time series data.

Contains functions that are useful in general for manipulation of data logger data

olm.loggers.loggerScripts.joinAndResampleLoggers(loggerlist, interval, suffixes=[], how='inner', interpolate=False, limit=None)[source]

Joins and resamples data from DataFrame objects provided in a list.

Parameters:

loggerlist : list

List of logger pandas.core.dataframe.DataFrame objects to be joined.

interval : string

Pandas offset string (http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases) on which the DataFrames should be resampled (e.g. ‘H’=hour, ‘T’=minute, ‘D’=day).

suffixes : list

A list of strings (same length as loggerlist) that contains suffixes to be applied to each logger. This is useful if multiple loggers have the same column names.

how : string

Method for joining loggers (default = ‘inner’).

interpolate : boolean

Whether data should be interpolated to fill gaps in rows (default=False).

limit : int

Maximum number of consecutive NaNs to fill if data are interpolated.

Returns:

joined : pandas.core.dataframe.DataFrame

DataFrame Object that contains joined DataFrames.

olm.loggers.loggerScripts.joinLoggers(loggerlist, how='inner', interpolate=False)[source]

Joins the data from a list of logger DataFrame objects together.

Parameters:

loggerlist : list

A list of logger DataFrame objects to be joined.

how : string, optional

How the two DataFrames are to be joined. Default is inner.

interpolate : boolean, optional

Determines whether empty rows are to be filled with data via interpolation. Uses Pandas Dataframe.interpolate(). Default = False

Returns:

joined : pandas.DataFrame

DataFrame of joined loggers.

olm.loggers.loggerScripts.linear_correction(rawSeries, correctionSeries)[source]

Uses a Pandas Series of spot measured values to linearly correct time series data from a logger.

Parameters:

rawSeries : pandas.core.series.Series

A Pandas Series that contains the time series data to be corrected.

correctionSeries : pandas.core.series.Series

A Pandas Series that contains spot measurement data that are to be used to correct rawSeries.

Returns:

rawSeries : pandas.core.series.Series

A corrected version of the rawSeries time series data.

olm.loggers.loggerScripts.manualCompare(logger, manual, value_name='', ltag='_log', mtag='_man')[source]

Function to extract logger data with same timestamps as manual measurements for comparison. Both data sets are resampled on an hourly interval to assure alignment of indicies.

Parameters:

logger : pandas.core.series.Series

A Pandas TimeSeries containing a single column and time stamps as indices.

manual : pandas.core.series.Series

A Pandas TimeSeries containing a single variable from the manual data set

value_name : string

A string to use as the base for the collumn labels in the output DataFrame.

ltag : string

A suffix to be added to the logger column name, or used as the logger column name if value_name is not set.

mtag : string

A suffix to be added to the manual measurement column name, or used as the manual measurement column name if value_name is not set.

Returns:

joined : pandas.core.dataframe.DataFrame

A DataFrame object containing values of manual measurements and corresponding values from the logger time series using the aligned index that is resampled to the hour.

olm.loggers.CampbellToolkit module

olm.loggers.CampbellToolkit.read_dat(dat_file)[source]

Reads in data from a .dat file produced by Campbell’s data logging software.

Parameters:

dat_file : string

The name of the .dat file to read.

Returns:

df : pandas.DataFrame

DataFrame containing data from .dat file.

olm.loggers.HoboToolkit module

olm.loggers.HoboToolkit.read_hobo_csv(csv_file, all_columns=False)[source]

Reads data from a csv file exported from HOBOware.

Parameters:

csv_file : string

A string containing the file name of the csv file to be read.

all_columns : boolean (optional)

Determines whether to read in all columns or just ones that we search for and relabel (RH, DewPt, Abs Pres, Temp, Attached, Stopped, Connected, EOF, Cond High Range, Cond Low Range). Default = False

Returns:

df : pandas.DataFrame

DataFrame containing data from HOBO csv file.

olm.loggers.SchlumbergerCTDToolkit module

olm.loggers.SchlumbergerCTDToolkit.concatCTD(dflist, zero_shift=True, n_to_average=5, offset_list=[], offset_dates=[])[source]

Accepts a list of CTD DataFrames and concatenates them.

Parameters:

dflist : list

List of pandas.DataFrames to concatenate.

zero_shift : boolean

If set to True, the pressure values will be adjusted at the time of each join, assuming that flow depth before and after the join was equal. If set to False, no adjustment will be made in pressure values. This is useful when downloading the logger may have resulted in a slightly different position in the water column. (Default = True)

n_to_average : int

Number of data points to average before and after join in order to determine data offset value for pressure

offset_list : list

List of offsets to be applied manually to pressure data.

offset_dates : list

List of datetime strings corresponding to manual offsets.

Returns:

(concatenated : pandas.DataFrame, offset_list

A tuple is returned with the first item being a DataFrame object containing the concatenated data and the second item in the tuple being a DataFrame object containing offsets with datetimes of the offsets as an index.

olm.loggers.SchlumbergerCTDToolkit.readBaro(csvfile)[source]

Reads data from a CSV or MON file from a Schlumberger Baro Diver.

Parameters:

csv_file : string

A string containing the file name of the CSV or MON file to be read.

Returns:

df : pandas.DataFrame

DataFrame containing data from HOBO csv file.

olm.loggers.SchlumbergerCTDToolkit.readCTD(csvfile)[source]

Reads data from a CSV or MON file exported from a Schlumberger CTD Diver.

Parameters:

csv_file : string

A string containing the file name of the CSV or MON file to be read.

Returns:

df : pandas.DataFrame

DataFrame containing data from HOBO csv file.

olm.loggers.WTWpHToolkit module

olm.loggers.WTWpHToolkit.euroParser(datestring)[source]

Date parser for European style dates separated by ‘.’ characters.

Parameters:

datestring : string

String containing Euro style date

Returns:

dateTime : datetime object

olm.loggers.WTWpHToolkit.readpH(csvfile)[source]

Reads data from a CSV file produced by WTW-pH data loggers.

Parameters:

csvfile : string

Name of the CSV file to be read.

Returns:

df : pandas.DataFrame

DataFrame object containing pH data.

Module contents