本文整理汇总了Python中GPS.degrees_minutes_to_degrees方法的典型用法代码示例。如果您正苦于以下问题:Python GPS.degrees_minutes_to_degrees方法的具体用法?Python GPS.degrees_minutes_to_degrees怎么用?Python GPS.degrees_minutes_to_degrees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GPS
的用法示例。
在下文中一共展示了GPS.degrees_minutes_to_degrees方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_response_content
# 需要导入模块: import GPS [as 别名]
# 或者: from GPS import degrees_minutes_to_degrees [as 别名]
def get_response_content(fs):
# read the lat-lon points from the input
lines = Util.get_stripped_lines(fs.datalines.splitlines())
rows = parse_lines(lines)
latlon_points = []
city_names = []
for city, latd, latm, lond, lonm in rows:
lat = math.radians(GPS.degrees_minutes_to_degrees(latd, latm))
lon = math.radians(GPS.degrees_minutes_to_degrees(lond, lonm))
latlon_points.append((lat, lon))
city_names.append(city)
npoints = len(latlon_points)
# start writing the response
np.set_printoptions(linewidth=200)
out = StringIO()
radius = GPS.g_earth_radius_miles
for dfunc, name in (
(GPS.get_arc_distance, 'great arc'),
(GPS.get_euclidean_distance, 'euclidean')):
# define the edm whose elements are squared euclidean-like distances
edm = np.zeros((npoints, npoints))
D = np.zeros((npoints, npoints))
for i, pointa in enumerate(latlon_points):
for j, pointb in enumerate(latlon_points):
D[i, j] = dfunc(pointa, pointb, radius)
edm[i, j] = D[i, j]**2
print >> out, name, 'distances:'
print >> out, D
print >> out
print >> out, name, 'EDM:'
print >> out, edm
print >> out
G = Euclid.edm_to_dccov(edm)
print >> out, name, 'Gower centered matrix:'
print >> out, G
print >> out
spectrum = np.array(list(reversed(sorted(np.linalg.eigvals(G)))))
print >> out, name, 'spectrum of Gower centered matrix:'
for x in spectrum:
print >> out, x
print >> out
print >> out, name, 'rounded spectrum:'
for x in spectrum:
print >> out, '%.1f' % x
print >> out
mds_points = Euclid.edm_to_points(edm)
print >> out, '2D MDS coordinates:'
for name, mds_point in zip(city_names, mds_points):
x = mds_point[0]
y = mds_point[1]
print >> out, '\t'.join(str(x) for x in [name, x, y])
print >> out
# break between distance methods
print >> out
# return the response
return out.getvalue()