本文整理汇总了Python中application.models.Cell.get方法的典型用法代码示例。如果您正苦于以下问题:Python Cell.get方法的具体用法?Python Cell.get怎么用?Python Cell.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.models.Cell
的用法示例。
在下文中一共展示了Cell.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ndfi_value_for_cells
# 需要导入模块: from application.models import Cell [as 别名]
# 或者: from application.models.Cell import get [as 别名]
def ndfi_value_for_cells(cell_key):
cell = Cell.get(Key(cell_key))
ndfi = NDFI('MOD09GA',
cell.report.comparation_range(),
cell.report.range())
bounds = cell.bounds(amazon_bounds)
logging.info(bounds)
ne = bounds[0]
sw = bounds[1]
polygons = [[ (sw[1], sw[0]), (sw[1], ne[0]), (ne[1], ne[0]), (ne[1], sw[0]) ]]
data = ndfi.ndfi_change_value(cell.report.base_map(), [polygons])
logging.info(data)
if 'data' not in data:
logging.error("can't get ndfi change value")
return
ndfi = data['data']['properties']['ndfiSum']['values']
for row in xrange(10):
for col in xrange(10):
idx = row*10 + col
count = float(ndfi['count'][idx])
s = float(ndfi['sum'][idx])
if count > 0.0:
ratio = s/count
else:
ratio = 0.0
ratio = ratio/10.0 #10 value is experimental
# asign to cell
logging.info('cell ndfi (%d, %d): %f' % (row, col, ratio))
c = cell.child(row, col)
c.ndfi_change_value = ratio
c.put()
示例2: ndfi_value_for_cells_dummy
# 需要导入模块: from application.models import Cell [as 别名]
# 或者: from application.models.Cell import get [as 别名]
def ndfi_value_for_cells_dummy(cell_key):
cell = Cell.get(Key(cell_key))
bounds = cell.bounds(amazon_bounds)
logging.info(bounds)
ne = bounds[0]
sw = bounds[1]
polygons = [[ sw, (sw[0], ne[1]), ne, (ne[0], sw[1]) ]]
for row in xrange(10):
for col in xrange(10):
c = cell.child(row, col)
c.ndfi_change_value = random.random()
c.put()
cell.calculate_ndfi_change_from_childs()