helikite.instruments

Submodules

Attributes

stap

stap_raw

mcpc

flight_computer_v1

flight_computer_v2

pico

pops

smart_tether

ozone_monitor

msems_readings

msems_inverted

msems_scan

filter

mcda

cpc

tapir

co2

maeth

Classes

Instrument

Helper class that provides a standard way to create an ABC using

Filter

Package Contents

helikite.instruments.stap
helikite.instruments.stap_raw
helikite.instruments.mcpc
helikite.instruments.flight_computer_v1
helikite.instruments.flight_computer_v2
helikite.instruments.pico
helikite.instruments.pops
helikite.instruments.smart_tether
helikite.instruments.ozone_monitor
helikite.instruments.msems_readings
helikite.instruments.msems_inverted
helikite.instruments.msems_scan
class helikite.instruments.Instrument(name: str, dtype: dict[Any, Any] = {}, na_values: list[Any] | None = None, header: int | None = 0, expected_header_value: str | None = None, delimiter: str = ',', lineterminator: str | None = None, comment: str | None = None, names: list[str] | None = None, index_col: bool | int | None = None, cols_export: list[str] = [], cols_housekeeping: list[str] = [], cols_final: list[str] | None = None, export_order: int | None = None, pressure_variable: str | None = None, temperature_variable: str | None = None, rh_variable: str | None = None, registry_name: str | None = None, coupled_columns: list[tuple[str, Ellipsis]] | None = None, rename_dict: dict[str, str] | None = None)

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

REGISTRY
name
dtype
na_values = None
header = 0
expected_header_value = None
delimiter = ','
lineterminator = None
comment = None
names = None
index_col = None
cols_export = []
cols_housekeeping = []
cols_final = None
export_order = None
pressure_variable = None
temperature_variable = None
rh_variable = None
coupled_columns = None
_rename_dict = None
filename: str | None = None
date: datetime.datetime | None = None
pressure_offset_housekeeping: float | None = None
time_offset: dict[str, int]
time_range: tuple[Any, Any] | None = None
_instantiation_info
registry_name
abstractmethod __repr__()
add_config(yaml_props: dict[str, Any])

Adds the application’s config to the Instrument class

This is called from the main() function in helikite.py

abstractmethod data_corrections(df, *args, **kwargs) pandas.DataFrame

Default callback function for data corrections.

Return with no changes

create_plots(df: pandas.DataFrame) list[plotly.graph_objects.Figure | None]

Default callback for generated figures from dataframes

Return nothing, as anything else will populate the list that is written out to HTML.

header_lines(file_path: str | pathlib.Path) list[str]
file_identifier(first_lines_of_csv: list[str]) bool

Default file identifier callback

date_extractor(first_lines_of_csv: list[str])

Returns the date of the data sample from a CSV header

Can be used for an instrument that reports the date in header instead of in the data field.

Return None if there is nothing to do here

add_device_name_to_columns(df: pandas.DataFrame) pandas.DataFrame

Updates dataframe with column names prefixed by instrument name

property housekeeping_columns: list[str]

Returns housekeeping columns, prefixed with the instrument name

If there are no housekeeping variables, return an empty list

property export_columns: list[str]

Returns export datafile columns, prefixed with the instrument name

If there are no variables, return an empty list

The export data file is a combined output, similar to housekeeping

property final_columns: list[str] | None

Returns final datafile columns, prefixed with the instrument name, if they are specified. Otherwise, returns None.

property rename_dict: dict[str, str]

Returns a dictionary of column names to rename for the final data file.

property has_size_distribution: bool
abstractmethod set_time_as_index(df: pandas.DataFrame) pandas.DataFrame

This function is used to set the date in the file to the index

By default no action is taken, but this can be overridden in the instrument class to set the date as the index.

correct_time_from_config(df: pandas.DataFrame, trim_start: pandas.Timestamp | None = None, trim_end: pandas.Timestamp | None = None) pandas.DataFrame

Correct the time offset and trim from the configuration

set_housekeeping_pressure_offset_variable(df: pandas.DataFrame, column_name=constants.HOUSEKEEPING_VAR_PRESSURE) pandas.DataFrame

Generate variable to offset pressure value for housekeeping

Using an offset in the configuration, a new variable is created that offset’s the instruments pressure variable. This is used to align the pressure value on the plot to help align pressure.

abstractmethod read_data() pandas.DataFrame

Read data into dataframe

This allows a custom read function to parse the CSV/TXT into a dataframe, for example cleaning dirty data at the end of the file in memory without altering the input file (see flight computer conf).

detect_from_folder(input_folder: str, quiet: bool = False, interactive: bool = False) list[str]

Scans an input folder for the instrument file

If there are two files that match the instrument, the function will raise an error. This is to prevent the program from trying to process the same file twice.

read_from_folder(input_folder: str, quiet: bool = False, interactive: bool = True) pandas.DataFrame

Reads the data from the detected file in the input folder

remove_duplicates(df: pandas.DataFrame) pandas.DataFrame
_get_instantiation_info() tuple[str, str | None] | None

Returns the filename and the line of the instrument instantiation

calculate_derived(df: pandas.DataFrame, verbose: bool, *args, **kwargs) pandas.DataFrame

Calculate derived data from the raw data, i.e. total concentration

normalize(df: pandas.DataFrame, reference_instrument: Instrument, verbose: bool, *args, **kwargs) pandas.DataFrame

Apply normalization to the data, i.e., normalization to STP conditions

plot_raw_and_normalized(df: pandas.DataFrame, verbose: bool, *args, **kwargs)

Plot together raw and normalized data. If only raw data is available, plot raw data.

plot_distribution(df: pandas.DataFrame, verbose: bool, time_start: datetime.datetime | None, time_end: datetime.datetime | None, *args, **kwargs)

Plot distribution of data

plot_vertical_distribution(df: pandas.DataFrame, verbose: bool, *args, **kwargs)

Plot vertical distribution of data

column_name(df: pandas.DataFrame, before_rename: str) str
class helikite.instruments.Filter(*args, **kwargs)

Bases: helikite.instruments.base.Instrument

__repr__()
property _expected_header_value_FC: str
header_lines(file_path: str | pathlib.Path) list[str]
file_identifier(first_lines_of_csv) bool
data_corrections(df, *args, **kwargs)
set_time_as_index(df: pandas.DataFrame) pandas.DataFrame

Set the DateTime as index of the dataframe

Filter instrument contains date and time separately and appears to include an extra whitespace in the field of each of those two columns

read_data() pandas.DataFrame
detect_from_folder(input_folder: str, quiet: bool = False, interactive: bool = False) list[str]
helikite.instruments.filter
helikite.instruments.mcda
helikite.instruments.cpc
helikite.instruments.tapir
helikite.instruments.co2
helikite.instruments.maeth