umbra_photo.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:eclipse2017 作者: google 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号