def process_item(d, fname, polys, poly_dts):
lat = d['lat']
lon = -d['lon']
dt = d['image_datetime']
point = Point(lon, lat)
# # Based on photo's time, find the umbra whose center point's time is the same
# TODO(dek): fix https://b.corp.google.com/issues/64974121
pdt = dt.replace(tzinfo=None)
if pdt not in poly_dts:
print "Point outside eclipse time window:", fname, pdt, lat, lon
return None
current_poly = poly_dts[pdt][0]
if not current_poly.contains(point):
print "Point outside eclipse time window:", fname, pdt, lat,lon
return None
# Now we know this photo point/dt is in totality
# Find all umbra polys that contain this photo
x = []
for j, p in enumerate(polys):
poly, poly_centroid, poly_dt = p
if poly.contains(point):
x.append((j, (poly_centroid.distance(point), fname, lat, lon, dt)))
return x
评论列表
文章目录