ppcpy.misc.helper#

Functions

add_to_list

channel_2_variable_mapping

checking_attr

checking_timestamp

checking_vars

concat_files

detect_path_type

Detect the type of path (Windows or Linux) based on the input.

find_matching_dimension

Finds the dimension of a 3D array that matches the length of the reference list.

get_input_path

get_pollyxt_files

This function locates multiple pollyxt level0 nc-zip files from one day measurements, unzipps the files to output_path and returns a list of files to be merged and the title of the new merged nc-file

get_pollyxt_logbook_files

This function locates multiple pollyxt logbook-zip files from one day measurements, unzipps the files to output_path and merge them to one file

get_wv_pol_telescope_from_dictkeyname

translate {wavelength}_{total|cross|parallel|rr}_{NR|FR|DFOV} to wavelength,polarisation,telescope separataly.

mean_stable

Calculate the mean value of x based on the least fluctuated segment of x.

os_name

remove_whitespaces_and_replace_dash_with_underscore

smooth2a

Smooths 2D array data while ignoring NaNs.

ppcpy.misc.helper.detect_path_type(fullpath)[source]#

Detect the type of path (Windows or Linux) based on the input.

ppcpy.misc.helper.os_name()[source]#
ppcpy.misc.helper.get_input_path(timestamp, device, raw_folder)[source]#
ppcpy.misc.helper.get_pollyxt_files(timestamp, device, raw_folder, output_path)[source]#

This function locates multiple pollyxt level0 nc-zip files from one day measurements, unzipps the files to output_path and returns a list of files to be merged and the title of the new merged nc-file

ppcpy.misc.helper.get_pollyxt_logbook_files(timestamp, device, raw_folder, output_path)[source]#

This function locates multiple pollyxt logbook-zip files from one day measurements, unzipps the files to output_path and merge them to one file

ppcpy.misc.helper.add_to_list(element, from_list, to_list)[source]#
ppcpy.misc.helper.checking_vars(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.checking_attr(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.checking_timestamp(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.concat_files(timestamp, device, raw_folder, output_path)[source]#
ppcpy.misc.helper.remove_whitespaces_and_replace_dash_with_underscore(string)[source]#
ppcpy.misc.helper.find_matching_dimension(array, reference_list)[source]#

Finds the dimension of a 3D array that matches the length of the reference list.

Parameters:
  • array (np.ndarray) – The 3D NumPy array to check.

  • reference_list (list) – The list to compare the dimension lengths with. This can also be a dict.

Returns:

The index of the matching dimension, or -1 if no match is found.

Return type:

int

ppcpy.misc.helper.channel_2_variable_mapping(data_retrievals, var, channeltags_dict)[source]#
ppcpy.misc.helper.mean_stable(x, win, minBin=None, maxBin=None, minRelStd=None)[source]#

Calculate the mean value of x based on the least fluctuated segment of x. The searching is based on the std inside each window of x.

Parameters:
  • x (ndarray) – Signal array.

  • win (int) – Window width for calculating the relative standard deviation.

  • minBin (int, optional) – The start index for the mean calculation (default: 1).

  • maxBin (int, optional) – The end index for the mean calculation (default: length of x).

  • minRelStd (float, optional) – Minimum relative standard deviation threshold.

Returns:

  • xStable (float) – Stable mean value.

  • xIndx (ndarray) – Index of the elements used to calculate the mean value.

  • xRelStd (float) – Relative uncertainty of the sequences used to calculate the mean values.

  • History

  • ——-

  • - 2021-05-30 (First edition by Zhenping)

  • .. Authors (- zhenping@tropos.de)

ppcpy.misc.helper.smooth2a(matrix_in, Nr, Nc=None)[source]#

Smooths 2D array data while ignoring NaNs.

This function smooths the data in matrix_in using a mean filter over a rectangle of size (2*Nr+1)-by-(2*Nc+1). Each element is replaced by the mean of the surrounding rectangle, ignoring NaN elements. If an element is NaN, it remains NaN in the output. At the edges, as much of the rectangle as fits is used.

Parameters:
  • matrix_in (ndarray) – Original matrix to be smoothed.

  • Nr (int) – Number of points used to smooth rows.

  • Nc (int, optional) – Number of points used to smooth columns. If not specified, Nc = Nr.

Returns:

Smoothed version of the input matrix.

Return type:

ndarray

References

  • Written by Greg Reeves, March 2009, Division of Biology, Caltech.

  • Inspired by “smooth2” by Kelly Hilands, October 2004, Applied Research Laboratory, Penn State University.

  • Developed from code by Olof Liungman, 1997, Dept. of Oceanography, Earth Sciences Centre, Göteborg University.

ppcpy.misc.helper.get_wv_pol_telescope_from_dictkeyname(keyname)[source]#

translate {wavelength}_{total|cross|parallel|rr}_{NR|FR|DFOV} to wavelength,polarisation,telescope separataly.

Parameters: - keyname (str): e.g.: 532_total_FR. Output: - wavelength,polarisation,telescope