Functions#

This is a list of general functions used in the PIA software

SPDX-FileCopyrightText: 2021 IMKAAF/KIT

SPDX-License-Identifier: GPL-3.0-or-later

pia.functions.Saturation(T_0, T, p_0, p)#

Calculates the saturation ratio with respect to Liquid water, assuming ice saturated conditions at T_0, p_0.

Parameters:
  • T_0 (float) – Temperature at start point in Kelvin

  • T (float) – Temperature for calculations in Kelvin

  • p_0 (float) – Pressure at start point

  • p (float) – Pressure for calculations

Returns:

S

Return type:

float

pia.functions.T_adiabatic(T_0, p_0, p)#

Calculates the temperature for an adiabatic cooling.

Parameters:
  • T_0 (float) – start temperature in Kelvin

  • p_0 (float) – start pressure

  • p (float) – pressure during cooling

Returns:

T_ad

Return type:

float

pia.functions.calculate_concentration(flow, count, time_del)#

Concentration in stdL-1

Parameters:
  • flow (float)

  • count (int) – particle count

  • time_del (float) – time interval

Returns:

count / (flow * time_del / 60)

Return type:

float

pia.functions.calculate_corrected_run_modus_for_gaps(data, del_t)#

For the opc gaps test, empty bins at the begin and the end of the expansion have to be removed.

Parameters:
  • data (pd.DataFrame)

  • del_t (int)

Returns:

data

Return type:

pd.DataFrame

pia.functions.choose_time_interval(data_frame, start, stop)#

slices a time interval of a dataframe

Parameters:
  • data_frame (pd.DataFrame) – needed column: “date”

  • start (date)

  • stop (date)

Returns:

df – sliced dataframe

Return type:

pd.DataFrame

pia.functions.find_opc_gaps(saqc_data, data_df, campaign, pine_id, operation_id, calib_file_name, path_analysis, pfr_file, ref_time, df_concentrations)#

Function to find gaps in the binned opc data.

Parameters:
  • saqc_data (SaQC object)

  • data_df (pd.DataFrame)

  • campaign (str)

  • pine_id (str)

  • operation_id (int)

  • calib_file_name (str)

  • path_analysis (pathlib.Path)

  • pfr_file (pd.DataFrame)

  • ref_time (datetime)

  • df_concentrations (pd.DataFrame)

Returns:

gaps_results

Return type:

pd:DataFrame

pia.functions.make_df_grid_log(num_bins, min_d, max_d)#

Creates a logarithmic grid

Parameters:
  • num_bins (int) – number of bins

  • min_d (float) – smallest bin

  • max_d (float) – biggest bin

Returns:

  • grid (pd.DataFrame) – DataFrame with bin sizes

  • distribution_bins (list) – list with bin names

pia.functions.make_time_grid(run_t, dt)#

Creates a time grid for a time interval of length run_t with bin sizes dt

Parameters:
  • run_t (float)

  • dt (int)

Returns:

t_grid

Return type:

np.array

pia.functions.saturation_pressure_ice(T)#

Calculates the saturation vapour pressure over ice for temperature T in Kelvin.

Parameters:

T (float)

Returns:

p_ice

Return type:

float

pia.functions.saturation_pressure_liquid(T)#

Calculates the saturation vapour pressure over supercooled water for temperature in Kelvin.

Parameters:

T (float)

Returns:

p_liq

Return type:

float