当前位置: 首页>>代码示例>>Python>>正文


Python Cell.get方法代码示例

本文整理汇总了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()
开发者ID:ImazonSadGoogle,项目名称:DeforestationAnalysisTool,代码行数:36,代码来源:commands.py

示例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()
开发者ID:ImazonSadGoogle,项目名称:DeforestationAnalysisTool,代码行数:17,代码来源:commands.py


注:本文中的application.models.Cell.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。