Merging Slope
Main functions
- SignalCreation.Treatment.MergingSlope.merge(s1, s2, altitude, alt_min, alt_max, method='linear', shifted_signal=0, math_operation='addition')
Main function used to merge signal s1 and s2
- Parameters:
s1 (xr.DataArray) – Signal to be considered first for merging
s2 (xr.DataArray) – Signal to be considered second for merging
altitude (np.array) – Altitude vector extracted from geoscene
alt_min (float) – Minimum signal altitude to be considered of merging interval
alt_max (float) – Maximum signal altitude to be considered of merging interval
method (str) – Method to use for merging {‘linear’, ‘cossin’}
shifted_signal (int) – Signal number to shift before calculate merging. 0 = no shift, 1 = shift applies on s1,
math_operation (str)
- Return type:
Quantity
2 = shift applies on s2 :param str math_operation: mathematical operation to use: addition or multiplication :return: the merged array :rtype: np.ndarray
Specific merging functions
- SignalCreation.Treatment.MergingSlope.linear_merging(s1, s2, altitude, alt_min, alt_max, shifted_signal=0, math_operation='addition')
Calculate merging signal using linear method :param np.array s1: Signal to be considered first for merging :param np.array s2: Signal to be considered second for merging :param np.array altitude: Altitude vector extracted from geoscene :param float alt_min: Minimum signal altitude to be considered of merging interval :param float alt_max: Maximum signal altitude to be considered of merging interval :param int shifted_signal: Signal number to shift before calculate merging. 0 = no shift, 1 = shift applies on s1, 2 = shift applies on s2 :param str math_operation: mathematical operation to use: addition or multiplication
- Returns:
- Parameters:
alt_min (float)
alt_max (float)
shifted_signal (int)
math_operation (str)
- SignalCreation.Treatment.MergingSlope.cossin_merging(s1, s2, altitude, alt_min, alt_max, shifted_signal=0, math_operation='addition')
Calculate merging signal using cossin method :param np.array s1: Signal to be considered first for merging :param np.array s2: Signal to be considered second for merging :param np.array altitude: Altitude vector extracted from geoscene :param float alt_min: Minimum signal altitude to be considered of merging interval :param float alt_max: Maximum signal altitude to be considered of merging interval :param int shifted_signal: Signal number to shift before calculate merging. 0 = no shift, 1 = shift applies on s1, 2 = shift applies on s2
- Returns:
- Parameters:
alt_min (float)
alt_max (float)
shifted_signal (int)
math_operation (str)
Tools functions
- SignalCreation.Treatment.MergingSlope.channel_shift(s_shift, s_ref, alt_min, alt_max, step=1, math_operation='addition')
Calculate the value to substract to s_shift before merging signal
- Parameters:
s_shift (np.array) – Signal that needs to be shifted
s_ref (np.array) – Reference signal
alt_min (float) – Minimum signal altitude to be considered
alt_max (float) – Maximum signal altitude to be considered
step (float) – altitude between two signal points
math_operation (str) – mathematical operation to use: addition or multiplication
- Returns:
Shift to substract to s_shift
- Return type:
float
Test process
Examples
# Input files
lidar_file = ["/home/lotto/Documents/osu_reunion/python/data/s2161614.044649",
"/home/lotto/Documents/osu_reunion/python/data/s2161614.054759"]
atmosphere_file = "/home/lotto/Documents/osu_reunion/data/2021/06/arletty_210615.txt"
cross_section_file = "/home/lotto/Documents/osu_reunion/python/data/SerdyuchenkoGorshelev5digits.dat"
# Reading Methods
lidar = ReadLidar(lidar_file, LICEL)
atmosphere = Atmosphere(atmosphere_file, ARLETTY)
ozone_cross_section = CrossSection(cross_section_file, SERDYUNCHENKO_VALUES_FILE)
# Geoscene creation
geoscene = GeoSceneLidar(lidar, atmosphere, ozone_cross_section)
# Add Altitude Vector
altitude_step = geoscene.output_dataset["Raw_Data_Range_Resolution"].data[0]
altitude_vector = np.array(range(0, geoscene.output_dataset.dims["points"] * altitude_step, altitude_step))
geoscene.output_dataset["Altitude"] = xr.DataArray(altitude_vector, dims=["points"])
# Merge variables
s1 = geoscene.output_dataset["Raw_Lidar_Data"][0]
s2 = geoscene.output_dataset["Raw_Lidar_Data"][2]
altitude = geoscene.output_dataset["Altitude"].data
alt_min = 8000 # meter
alt_max = 12000 # meter
method = "linear"
shift = 1
# Merging...
merge(s1, s2, altitude, alt_min, alt_max, method, shifted_signal=shift)