我正在使用它,但我发现它非常不优雅。任何改进都非常受欢迎:
import numpy as np
def getCoordinate(lat1,lat2,lon1,lon2):
lat1 = np.radians(lat1)
lat2 = np.radians(lat2)
lon1 = np.radians(lon1)
lon2 = np.radians(lon2)
#......
#Use them in the rest of the function
答案 0 :(得分:1)
您可以让np.radians()
将所有值转换为序列,并使用可迭代赋值再次解压缩结果:
lat1, lat2, lon1, lon2 = np.radians((lat1, lat2, lon1, lon2))