ppcpy.misc.helper#
Functions
Detect the type of path (Windows or Linux) based on the input. |
|
Finds the dimension of a 3D array that matches the length of the reference list. |
|
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 |
|
This function locates multiple pollyxt logbook-zip files from one day measurements, unzipps the files to output_path and merge them to one file |
|
translate {wavelength}_{total|cross|parallel|rr}_{NR|FR|DFOV} to wavelength, polarisation, telescope separataly. |
|
Convert cloud free indecis to cloud free times. |
|
Calculate the mean value of x based on the least fluctuated segment of x. |
|
remove whitespaces and replace dashes with underscores |
|
Smooths 2D array data while ignoring NaNs. |
|
Simple smoothing filter |
- ppcpy.misc.helper.detect_path_type(fullpath)[source]#
Detect the type of path (Windows or Linux) based on the input.
- 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.checking_attr(timestamp, device, raw_folder, output_path)[source]#
…
- Parameters:
timestamp –
…
device –
…
raw_folder –
…
output_path –
…
- Returns:
…
TODO (Variables ‘force’ and ‘polly_files_list’ are not defined anywhere)
- ppcpy.misc.helper.remove_whitespaces_and_replace_dash_with_underscore(string: str) str[source]#
remove whitespaces and replace dashes with underscores
- Parameters:
string (str) – String to be modified
- Returns:
new_string – Modified string
- Return type:
str
- 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.uniform_filter(x: ndarray, win: int, fill_val: float = nan) ndarray[source]#
Simple smoothing filter
The smoothing is applied without padding and the original dimension of the input is recreated by filling the reduced edges with a fill value.
- Parameters:
x ((N,) ndarray) – One dimensional input signal.
win (int) – (M,) Width of the filter.
fill_val (float, optional) – Value to be used for filling edges, in order to recreate the input dimension. Default is np.nan.
- Returns:
out (ndarray) – Smoothed signal.
History
——-
- 2026-02-02 (First edition by Buholdt)
- ppcpy.misc.helper.mean_stable(x: ndarray, win: int, minBin: int = None, maxBin: int = None, minRelStd: float = None) tuple[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)
- 2026-02-04 (Changed from scipy.ndimage.uniform_filter1d to uniform_filter)
.. Authors (- zhenping@tropos.de)
- ppcpy.misc.helper.smooth2a(matrix_in: ndarray, Nr: int, Nc: int = None) ndarray[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:
matrix_out – 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: str) tuple[source]#
translate {wavelength}_{total|cross|parallel|rr}_{NR|FR|DFOV} to wavelength, polarisation, telescope separataly.
- Parameters:
keyname (str) – e.g. 532_total_FR.
- Returns:
wavelength (str) – eg. ‘532’
polarisation (str) – eg. ‘total’
telescope (str) – eg. ‘FR’
- ppcpy.misc.helper.idx2time(cldFreeIdx: ndarray[int, int], nIdx: int, nHour: int) str[source]#
Convert cloud free indecis to cloud free times.
- Parameters:
cldFreeIdx (np.ndarray) – Cloud free group (start idx, end idx).
nIdx (int) – Number of idx / length of time dimension.
nHour (int) – Number of hours represented in the time dimension.
- Returns:
out – Time stamps of cldFreeIdx as a string (eg. 0920_1020)
- Return type:
str