ExtractData#

class pia.extract_data.ExtractData(campaign, pine_id, operation_id, chamber=None, actris=False)#

Bases: object

Extracts metadata and provides functions to read raw data and level data.

Parameters:
  • campaign (str) – campaign name as used for documentation

  • pine_id (str) – PINE Id, eg: 01-A, 01-B, 04-01, AIDAm

  • operation_id (int) – Operation Id for analysis

  • chamber (int, optional) – Number of chamber if multiple chambers are used

celsius_to_kelvin(T)#

Changes temperatures from celsius to kelvin.

Parameters:

T (float)

Returns:

T + 273.15

Return type:

float

check_date()#

Checks if date and time in pfr file are valid and corrects the date if the measurement was running over night. Only necesssary for dates before 2020.

check_zero_values(instrument_data)#

Checks for zero values in all instrument data at the same time. Returns flagged data (valid: -inf).

Parameters:

instrument_data (pd.DataFrame)

Returns:

zero_test.flags

Return type:

DictOfSeries

config_info()#

Reads out the configuration parameters.

Returns:

  • version (float) – labview software version

  • opc_id (str)

  • calib_file_name (str) – name of file for mapping of size bins

  • software_type (str)

config_info_pine(path_config, filename_config)#

Configuration parameters for PINE.

Parameters:
  • path_config (pathlib.PATH)

  • filename_config (str)

Returns:

  • version (float) – labview software version

  • opc_id (str)

  • calib_file_name (str) – name of file for mapping of size bins

  • software_type (str)

config_info_pineair(path_config, filename_config)#

Configuration parameters for PINEair.

Parameters:
  • path_config (path.PATH)

  • filename_config (str)

Returns:

  • version (float) – labview software version

  • opc_id (str)

  • calib_file_name (str) – name of file for mapping of size bins

  • software_type (str)

create_filename(ending, run_id=None, chamber=False)#

Creates filenames for exported data.

Parameters:
  • ending (str) – individual naming for the files

  • run_id (int, optional) – run id for run-wise files

  • chamber (int, optional) – number of chamber if multiple chambers are used

Returns:

filename

Return type:

str

data_structure(instrument_data)#

Checks which data structure was used from the Labview program depending on the date.

Parameters:

instrument_data (pd.DataFrame)

Returns:

  • 0 (for measurements before 2020, date and time in separate columns)

  • 1 (for filenames *PINE-40x/PINE-1A*)

  • 2 (filenames changed to *PINE-04-0x/PINE-01-A/_opc*)

  • 3 (housekeeping data and opc data saved to raw_Data)

  • 4 (pfr files saved to raw_Data)

  • 5 (opc data stored in subfolders)

  • 6 (structure for new labview software)

read_concentrations(pfr_file, ref_time)#

Function to read Level 1 concentration data.

Parameters:
  • pfr_file (pd.DataFrame)

  • ref_time (datetime)

Returns:

size_distribution

Return type:

list

read_ice_data()#

Function to read Level 1 ice data.

Returns:

  • ice_data (pd.DataFrame)

  • operation_type (str)

read_ice_threshold_file(manual_ice_threshold, chamber=None)#

Function to read Level 1 ice threshold data.

Parameters:
  • manual_ice_threshold (bool) – Whether the ice threshold is set manually or not

  • chamber (int, optional) – Number of chamber if multiple chambers are used

Returns:

ice_threshold – DataFrame containing the ice threshold for each run

Return type:

pd.DataFrame

read_instrument_data()#

Reads instrument data and reports time relative to start time of operation in minutes. :returns: instrument_data :rtype: pd.DataFrame

read_pfr_file(structure)#

Reads the pfr-file for run times and parameter settings.

Parameters:

structure (int) – structure of raw data

Returns:

pfr_file

Return type:

pd.DataFrame

read_qc_data()#

Function to read flagged data.

Returns:

  • flags_instrument (pd.DataFrame)

  • flags_run (pd.DataFrame)

set_reference_time()#

Determines the reference time at the start of the operation.

Returns:

ref_time

Return type:

datetime