def is_in_grid(self, shp):
"""Check if arbitrary polygon is within grid bounding box.
Args:
shp (shape):
Returns:
Bool whether shp is in grid box.
Depends on self.grid_box (shapely prep type) being defined
in environment.
"""
if not hasattr(shp, 'geom_type'):
raise Exception("CoreMSR [is_in_grid] : invalid shp given")
if not isinstance(self.grid_box, type(prep(Point(0,0)))):
raise Exception("CoreMSR [is_in_grid] : invalid prep_adm0 "
"found")
return self.grid_box.contains(shp)
评论列表
文章目录