Я рад принять небольшую ошибку в этих Расчеты, то есть, если предположить, что LAT/LON - это сетка или аналогичная. Я хочу сделать это в Python. < /P>
Я пробовал интерполяцию вдоль оси LAT и LON отдельно с 1D -кубической интерполяцией, но когда я построю точки GPS, в областях, где кабель находится кабель Увеличиваясь по одной оси намного больше, чем другая, точки не распределены равномерно. Код, который я попробовал и выходы ниже. < /p>
Код: Выделить всё
import numpy as np
import csv
import matplotlib.pyplot as plt
from scipy.interpolate import interp1d
import dascore as dc
from dascore.utils.downloader import fetch
with open("./synthetic_buried_section_08-09-23.csv", 'r') as file:
coord_array = list(csv.reader(file, delimiter=","))
coord_array = np.array(coord_array)
buried_lat = coord_array[2:42,2].astype(np.float64)
buried_lon = coord_array[2:42,1].astype(np.float64)
# Create an interpolation function
buried_interp_func_x = interp1d(np.linspace(0, 1, len(buried_lon)), buried_lon, kind='cubic')
buried_interp_func_y = interp1d(np.linspace(0, 1, len(buried_lat)), buried_lat, kind='cubic')
# Generate new evenly spaced points along the parameter t
t_new = np.linspace(0, 1, 10000)
new_buried_lon = buried_interp_func_x(t_new)
new_buried_lat = buried_interp_func_y(t_new)
#Here, I am trying to assign the 68 'channels' to a GPS location
buried_channels=68
buried_index_floats = np.linspace(0, len(new_buried_lon), buried_channels)
buried_index = np.array([round(i) for i in buried_index_floats])
buried_index[-1] = buried_index[-1]-1
buried_channel_lons = np.array([new_buried_lon[i] for i in buried_index])
buried_channel_lats = np.array([new_buried_lat[i] for i in buried_index])
plt.scatter(new_buried_lon, new_buried_lat, label="Interpolated buried Curve")
plt.scatter(buried_channel_lons,buried_channel_lats, label="Buried Channel locations")
plt.legend()
plt.xlabel("lon")
plt.ylabel("lat")
plt.grid()
plt.show()
Подробнее здесь: https://stackoverflow.com/questions/794 ... nts-so-tha