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


Python Report.current方法代码示例

本文整理汇总了Python中models.Report.current方法的典型用法代码示例。如果您正苦于以下问题:Python Report.current方法的具体用法?Python Report.current怎么用?Python Report.current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Report的用法示例。


在下文中一共展示了Report.current方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: home

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def home(cell_path=None):
    import sys
    logging.info("Version python: "+sys.version);
    
    maps = memcache.get('default_maps')

    if maps:
        maps = json.loads(maps)
    else:
        maps = default_maps()
        memcache.add(key='default_maps', value=json.dumps(maps), time=60*10)

    # send only the active report
    reports = json.dumps([Report.current().as_dict()])
    report_base = json.dumps([Report.current().previous().as_dict()])
    logging.info("Reports: "+str(reports))
    logging.info("Maps: "+str(maps))
    u = get_or_create_user()
    if not u:
        abort(403)


    logout_url = users.create_logout_url('/')
    return render_template('home.html',
            reports_json=reports,
            report_base_json=report_base,
            user=u,
            maps=maps,
            polygons_table=settings.FT_TABLE_ID,
            logout_url=logout_url)
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:32,代码来源:views.py

示例2: default_maps

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def default_maps():
    maps = []
    r = Report.current() 
    logging.info("report " + unicode(r))
    ee_resource = 'MOD09GA'
    landsat = EELandsat('LANDSAT/L7_L1T')
    ndfi = NDFI(ee_resource,
        past_month_range(r.start),
        r.range())

    d = landsat.mapid(*r.range())
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T'})
    """
    d = landsat.mapid(*past_month_range(r.start))
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T-old'})
    """
    #d = ndfi.mapid2()
    #if 'data' in d:
        #maps.append({'data' :d['data'], 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'SMA'})
    d = ndfi.rgbid()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'RGB'})
    d = ndfi.ndfi0id()
    if 'data' in d:
        maps.append({'data': d['data'], 'info': 'NDFI T0'})
    d = ndfi.ndfi1id()
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'NDFI T1'})
    return maps
开发者ID:vhlins,项目名称:DeforestationAnalysisTool,代码行数:36,代码来源:views.py

示例3: default_maps

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def default_maps():
    maps = []
    r = Report.current()
    logging.info("report " + unicode(r))
    landsat = EELandsat(timestamp(r.start), datetime.datetime.now())
    ndfi = NDFI(past_month_range(r.start), r.range())

    logging.info('Past_month_range: '+str(past_month_range(r.start))+', Range: '+str(r.range)+', Timestamp: '+str(timestamp(r.start))+', Datetime: '+str(datetime.datetime.now()) )

    d = landsat.mapid(timestamp(r.start), datetime.datetime.now())
    maps.append({'data' :d, 'info': 'LANDSAT/LE7_L1T'})

    d = landsat.mapid_landsat8(timestamp(r.start), datetime.datetime.now())
    maps.append({'data':d, 'info': 'LANDSAT/LC8_L1T'})

    assetid = r.previous().as_dict().get('assetid')
    logging.info("Assetid :"+str(assetid))
    d = ndfi.smaid()
    if d: maps.append({'data': d, 'info': 'SMA'})    
    d = ndfi.rgb1id()
    if d: maps.append({'data': d, 'info': 'RGB'})
    d = ndfi.ndfi0id('modis')
    if d: maps.append({'data': d, 'info': 'NDFI T0 (MODIS)'})
    d = ndfi.ndfi1id('modis')
    if d: maps.append({'data' :d, 'info': 'NDFI T1 (MODIS)'})
    d = ndfi.baseline(r.base_map())
    if d: maps.append({'data' :d, 'info': 'Baseline'})
    d = ndfi.rgb0id()
    if d: maps.append({'data': d, 'info': 'Previous RGB'})
    return maps
    
    """
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:34,代码来源:views.py

示例4: tiles_sensor

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def tiles_sensor(sensor=None):
    tile_array = []
    if request.method == 'POST':
        return jsonify({'result': 'post method'})
    else:
        if sensor == 'modis':
            tile_array = [
                          { 'name': 'h10v09', 'value': 'h10v09'},
                          { 'name': 'h11v08', 'value': 'h11v08'},
                          { 'name': 'h11v09', 'value': 'h11v09'},
                          { 'name': 'h11v10', 'value': 'h11v10'}, 
                          { 'name': 'h12v08', 'value': 'h12v08'},
                          { 'name': 'h12v09', 'value': 'h12v09'},                       
                          { 'name': 'h12v10', 'value': 'h12v10'},
                          { 'name': 'h13v09', 'value': 'h13v09'},
                          { 'name': 'h13v10', 'value': 'h13v10'}
                        ]
            
            r = Report.current()
            start_date = r.start
            end_date = r.end
            #compounddate = '%04d%02d' % (start_date.year, start_date.month) 
            
            for i in range(len(tile_array)):
                image_picker = ImagePicker.find_by_period_and_cell(start_date, end_date, tile_array[i]['name'])
                if image_picker:
                    tile_array[i]['done'] = True
                else:
                    tile_array[i]['done'] = False
                

    return jsonify({'result': tile_array})
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:34,代码来源:views.py

示例5: default_maps

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def default_maps():
    maps = []
    r = Report.current() 
    logging.info("report " + unicode(r))
    landsat = EELandsat()
    ndfi = NDFI(past_month_range(r.start), r.range())

    d = landsat.mapid(*r.range())
    maps.append({'data' :d, 'info': 'LANDSAT/L7_L1T'})
    """
    d = landsat.mapid(*past_month_range(r.start))
    maps.append({'data' :d, 'info': 'LANDSAT/L7_L1T-old'})
    """
    #d = ndfi.mapid2()
    #if d: maps.append({'data' :d, 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if d: maps.append({'data': d, 'info': 'SMA'})
    d = ndfi.rgb1id()
    if d: maps.append({'data': d, 'info': 'RGB'})
    d = ndfi.ndfi0id()
    if d: maps.append({'data': d, 'info': 'NDFI T0'})
    d = ndfi.ndfi1id()
    if d: maps.append({'data' :d, 'info': 'NDFI T1'})
    d = ndfi.baseline(r.base_map())
    if d: maps.append({'data' :d, 'info': 'Baseline'})
    d = ndfi.rgb0id()
    if d: maps.append({'data': d, 'info': 'Previous RGB'})
    return maps
开发者ID:Imazon,项目名称:DeforestationAnalysisTool,代码行数:30,代码来源:views.py

示例6: home

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def home(cell_path=None):
    maps = memcache.get('default_maps')
    if maps:
        maps = json.loads(maps)
    else:
        maps = default_maps()
        memcache.add(key='default_maps', value=json.dumps(maps), time=3600*24)

    # send only the active report
    reports = json.dumps([Report.current().as_dict()])
    user = users.get_current_user()
    u = User.get_user(user)
    if not u and users.is_current_user_admin():
        u = User(user=user, role='admin')
        u.put()

    if not u:
        abort(403)

    logout_url = users.create_logout_url('/')
    return render_template('home.html',
            reports_json=reports,
            user=u,
            maps=maps,
            logout_url=logout_url)
开发者ID:netconstructor,项目名称:DeforestationAnalysisTool,代码行数:27,代码来源:views.py

示例7: default_maps

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def default_maps():
    maps = []
    r = Report.current()
    logging.info("report " + unicode(r))
    ee_resource = "MOD09GA"
    landsat = EELandsat("LANDSAT/L7_L1T")
    ndfi = NDFI(ee_resource, past_month_range(r.start), r.range())

    d = landsat.mapid(*r.range())
    if "data" in d:
        maps.append({"data": d["data"], "info": "LANDSAT/L7_L1T"})
    """
    d = landsat.mapid(*past_month_range(r.start))
    if 'data' in d:
        maps.append({'data' :d['data'], 'info': 'LANDSAT/L7_L1T-old'})
    """
    # d = ndfi.mapid2()
    # if 'data' in d:
    # maps.append({'data' :d['data'], 'info': 'ndfi difference'})
    d = ndfi.smaid()
    if "data" in d:
        maps.append({"data": d["data"], "info": "SMA"})
    d = ndfi.rgbid()
    if "data" in d:
        maps.append({"data": d["data"], "info": "RGB"})
    d = ndfi.ndfi0id()
    if "data" in d:
        maps.append({"data": d["data"], "info": "NDFI t0"})
    d = ndfi.ndfi1id()
    if "data" in d:
        maps.append({"data": d["data"], "info": "NDFI t1"})
    return maps
开发者ID:ImazonSadGoogle,项目名称:DeforestationAnalysisTool,代码行数:34,代码来源:views.py

示例8: imagepicker_tile

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def imagepicker_tile():    
       
    if request.method == 'POST' and request.form.get('list_cloud_percent') and request.form.get('date_start') and request.form.get('date_end'):
        

        date_start         = request.form.get('date_start')
        date_end           = request.form.get('date_end')
        date_start = datetime.datetime.strptime(date_start,"%d/%b/%Y")
        date_end = datetime.datetime.strptime(date_end,"%d/%b/%Y")
        
        list_cloud_percent = request.form.get('list_cloud_percent')
        list_cloud_percent = json.loads(list_cloud_percent)
        
        landstat = EELandsat(date_start, date_end)
        result = landstat.get_thumbs(list_cloud_percent)
                
        return jsonify({'result': result})
    elif request.method == 'POST' and request.form.get('thumbs_tile'):
        
        logging.info(request.form.get('thumbs_tile'))
        thumbs_tile = request.form.get('thumbs_tile')        
        thumbs_tile = thumbs_tile.split(',')
        
        date_start  = request.form.get('date_start')
        date_end    = request.form.get('date_end')
        date_start = datetime.datetime.strptime(date_start,"%d/%b/%Y")
        date_end = datetime.datetime.strptime(date_end,"%d/%b/%Y")
        
        result = ""
        sensor_date = {}
        
        for i in range(len(thumbs_tile)):
            date, tile, sensor = thumbs_tile[i].split('__')
            
            if tile not in sensor_date.keys():
                sensor_date[tile]                = {}
                sensor_date[tile]['location']    = Tile.find_geo_region(tile.replace("_", "/"))
                sensor_date[tile]['sensor_date'] = []
                sensor_date[tile]['sensor_date'].append(sensor+'__'+date)
            else:
                sensor_date[tile]['sensor_date'].append(sensor+'__'+date)
                
            

        report = Report.current()
        
        logging.info("===== sensor_date =====")
        logging.info(sensor_date)
        
        for key in sensor_date:
            imagePicker = ImagePicker(report=report, added_by= users.get_current_user(), cell=str(key.replace("_", "/")),  location=str(sensor_date[key]['location']), sensor_dates=sensor_date[key]['sensor_date'], start=date_start, end=date_end)
            result = result + imagePicker.save()
        
        return jsonify({'result': result})
    else:     
        return jsonify({'result': None})
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:58,代码来源:views.py

示例9: testing

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def testing():
    r = Report.current()
    r = Report.get(Key('ahBpbWF6b24tcHJvdG90eXBlcg4LEgZSZXBvcnQYiaECDA'))
    logging.info("report " + unicode(r))
    ee_resource = 'MOD09GA'
    ndfi = NDFI(ee_resource,
            r.comparation_range(),
            r.range())
    #return str(ndfi.mapid2())
    return str(ndfi.freeze_map(1089491, r.key().id()))
开发者ID:netconstructor,项目名称:DeforestationAnalysisTool,代码行数:12,代码来源:api.py

示例10: picker

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def picker(tile=None):
    
    if request.method == 'POST':
        logging.info(request.form.get('thumb'))

        cell   = request.form.get('tile')
        p      = re.compile('\d+')
        p      = p.findall(cell)
        cell   = 'h' + p[0] + 'v' + p[1]

        thumbs = request.form.get('thumb').split(',')
        sensor_dates = []
        for i in range(len(thumbs)):
            day, month, year = thumbs[i].split('-')
            sensor_dates.append('modis__' + year +'-'+ month +'-'+ day)

        location = get_modis_location(cell)

        report = Report.current()
        
        date_start = datetime.datetime.combine(report.start, datetime.time())
        date_end = datetime.datetime.combine(report.end, datetime.time())
        
        imagePicker = ImagePicker(report=report, added_by= users.get_current_user(), cell=str(cell),  location=location, sensor_dates=sensor_dates, start=date_start, end=date_end)
        return jsonify({'result': imagePicker.save()})

    else:
        #cell = request.args.get('cell', '')
        reports = Report.current().as_dict()
        date = time.gmtime(reports['start'] / 1000)
        year = time.strftime("%Y", date)
        month = time.strftime("%m", date)

        if tile:
            bands = 'sur_refl_b01,sur_refl_b04,sur_refl_b03'
            gain = 0.1
            results = get_modis_thumbnails_list(year, month, tile, bands, gain)
            return jsonify({'result': results})
        else:
            return jsonify({'result': []})
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:42,代码来源:views.py

示例11: home

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def home(cell_path=None):
    maps = memcache.get("default_maps")
    if maps:
        maps = json.loads(maps)
    else:
        maps = default_maps()
        memcache.add(key="default_maps", value=json.dumps(maps), time=60 * 10)

    # send only the active report
    reports = json.dumps([Report.current().as_dict()])
    u = get_or_create_user()
    if not u:
        abort(403)

    logout_url = users.create_logout_url("/")
    return render_template(
        "home.html", reports_json=reports, user=u, maps=maps, polygons_table=settings.FT_TABLE_ID, logout_url=logout_url
    )
开发者ID:ImazonSadGoogle,项目名称:DeforestationAnalysisTool,代码行数:20,代码来源:views.py

示例12: downscalling

# 需要导入模块: from models import Report [as 别名]
# 或者: from models.Report import current [as 别名]
def downscalling(tile=None):

    if request.method == 'POST':
        range3 = request.form.get('range3')
        range4 = request.form.get('range4')
        range6 = request.form.get('range6')
        range7 = request.form.get('range7')

        sill3 = request.form.get('sill3') 
        sill4 = request.form.get('sill4')
        sill6 = request.form.get('sill6')
        sill7 = request.form.get('sill7')

        nugget3 = request.form.get('nugget3')
        nugget4 = request.form.get('nugget4')
        nugget6 = request.form.get('nugget6')
        nugget7 = request.form.get('nugget7')

        cell = request.form.get('tile')
        cell = cell.upper()

        location = get_modis_location(cell.lower())

        compounddate = request.form.get('compounddate')

        report = Report.current()

        model = 'exponential'

        downscalling3 = Downscalling(report=report,
                                 added_by= users.get_current_user(),
                                 cell=str(cell),
                                 region=location,
                                 compounddate=str(compounddate),
                                 band=3,
                                 model=model,
                                 sill=long(sill3),
                                 range=long(range3),
                                 nugget=long(nugget3)
                                 )
        message1 = downscalling3.save()

        downscalling4 = Downscalling(report=report,
                                 added_by= users.get_current_user(),
                                 cell=str(cell),
                                 region=location,
                                 compounddate=str(compounddate),
                                 band=4,
                                 model=model,
                                 sill=long(sill4),
                                 range=long(range4),
                                 nugget=long(nugget4)
                                 )
        message2 = downscalling4.save()

        downscalling6 = Downscalling(report=report,
                                 added_by= users.get_current_user(),
                                 cell=str(cell),
                                 region=location,
                                 compounddate=str(compounddate),
                                 band=6,
                                 model=model,
                                 sill=long(sill6),
                                 range=long(range6),
                                 nugget=long(nugget6)
                                 )
        message3 = downscalling6.save()

        downscalling7 = Downscalling(report=report,
                                 added_by= users.get_current_user(),
                                 cell=str(cell),
                                 region=location,
                                 compounddate=str(compounddate),
                                 band=7,
                                 model=model,
                                 sill=long(sill7),
                                 range=long(range7),
                                 nugget=long(nugget7)
                                 )
        message4 = downscalling7.save()

        if message1 == message2 == message3 == message4:
            return jsonify({'result': message1})
        else:
            return jsonify({'result': 'Could not save values.'})

    else:
        result = []
        if tile:
            filter_fc = ee.Filter.eq('Cell', tile.upper())
            fc        = ee.FeatureCollection('ft:17Qn-29xy2JwFFeBam5YL_EjsvWo40zxkkOEq1Eo').filter(filter_fc)
            logging.info("==================  Aqui ================")
            logging.info(fc.getInfo())
            for feature in fc.getInfo().get('features'):
                result.append({'Band':  feature.get('properties').get('Band'),
                            'Sill':  feature.get('properties').get('Sill'),
                            'Range': feature.get('properties').get('Range'),
                            'Nugget': feature.get('properties').get('Nugget')
                            })
                logging.info(feature);
#.........这里部分代码省略.........
开发者ID:dyeden,项目名称:DeforestationAnalysisTool,代码行数:103,代码来源:views.py


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