我正在尝试找出处理存储在多个numpy数组中的坐标和测量数据的最佳方式(最快性能)。我需要计算从每个网格点(绿色中的lot,lon,alt值)到每个测量位置(灰色中的目标范围中的纬度,经度,高度,距离)的距离。考虑到有数百个网格点和数千个测量范围需要计算每个网格点的距离,我想以最有效的方式遍历数组。
我正在尝试决定如何存储网格和测量的LLA测量值,以及根据测量范围值与实际范围之间的差异计算每个网格点的均方误差的理想方法。
任何关于最佳存储这些值的想法,以及在网格上迭代以确定来自每个测量的范围的想法都将不胜感激。谢谢!!
目前,我正在使用二维meshgrid存储网格的LLA值。
任何关于最佳存储这些值的想法,以及在网格上迭代以确定来自每个测量的范围的想法都将不胜感激。谢谢!!
目前,我正在使用二维meshgrid存储网格的LLA值。
# Create a 2D Grid that will be used to store the MSE estimations
# First, create two 1-D arrays representing the X and Y coordinates of our grid
x_delta = abs(xmax-xmin)/gridsize_x
y_delta = abs(ymax-ymin)/gridsize_y
X = np.arange(xmin,xmax+x_delta,x_delta)
Y = np.arange(ymin,ymax+y_delta,y_delta)
# Next, pass arrays to meshgrid to return 2-D coordinate matrices from the 1-D coordinate arrays
grid_lon, grid_lat = np.meshgrid(X, Y)
我有来自测量数据的LLA点和范围值存储在一个测量类中
measurement_lon = [measurement.gps.getlon() for measurement in target_measurements]
measurement_lat = [measurement.gps.getlat() for measurement in target_measurements]
measurement_range = [measurement.getrange() for measurement in target_measurements]
测量类
class RangeMeasurement:
def __init__(self, lat, lon, alt, range):
self.gps = GpsLocation(lat,lon,alt)
self.range = range
计算范围的伪代码非常糟糕(迭代和非常慢)
for i in len(grid_lon):
for j in len(measurement_lat):
range_error += distance(grid_lon[i],grid_lat[i],measurement_lon[j],measurement_lat[j])-measurement_range[j]