示例#1
0
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
 def landsat(self, report_id, id):
     r = Report.get(Key(report_id))
     z, x, y = Cell.cell_id(id)
     cell = Cell.get_or_default(r, x, y, z)
     bounds = cell.bounds(amazon_bounds)
     bounds = "%f,%f,%f,%f" % (bounds[1][1], bounds[1][0], bounds[0][1],
                               bounds[0][0])
     ee = EELandsat(LANDSAT7)
     d = ee.list(bounds=bounds)
     data = {}
     if len(d) >= 1:
         x = d[-1]
         img_info = x.split('/')[2][3:]
         path = img_info[:3]
         row = img_info[3:6]
         year = int(img_info[6:10])
         julian_date = img_info[10:13]
         date = date_from_julian(int(julian_date), year)
         data = {
             'info': img_info,
             'path': path,
             'row': row,
             'year': year,
             'timestamp': timestamp(date),
             'date': date.isoformat()
         }
     return Response(json.dumps(data), mimetype='application/json')
 def landsat(self, report_id, id):
     r = Report.get(Key(report_id))
     z, x, y = Cell.cell_id(id)
     cell = Cell.get_or_default(r, x, y, z)
     bounds = cell.bounds(amazon_bounds)
     bounds = "%f,%f,%f,%f" % (bounds[1][1], bounds[1][0], bounds[0][1], bounds[0][0])
     ee = EELandsat(LANDSAT7)
     d = ee.list(bounds=bounds)
     data = {}
     if len(d) >= 1:
         x = d[-1]
         img_info = x.split('/')[2][3:]
         path = img_info[:3]
         row = img_info[3:6]
         year = int(img_info[6: 10])
         julian_date =  img_info[10: 13]
         date = date_from_julian(int(julian_date), year)
         data = {
             'info': img_info,
             'path': path,
             'row': row,
             'year': year,
             'timestamp': timestamp(date),
             'date': date.isoformat()
         }
     return Response(json.dumps(data), mimetype='application/json')
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
 def landsat(self, report_id, id):
     r = Report.get(Key(report_id))
     z, x, y = Cell.cell_id(id)
     cell = Cell.get_or_default(r, x, y, z)
     bounds = cell.bounds(amazon_bounds)
     bounds = "%f,%f,%f,%f" % (bounds[1][1], bounds[1][0], bounds[0][1], bounds[0][0])
     ee = EELandsat(LANDSAT7)
     d = ee.list(bounds=bounds)
     data = {}
     if len(d) >= 1:
         x = d[-1]
         img_info = x.split("/")[2][3:]
         path = img_info[:3]
         row = img_info[3:6]
         year = int(img_info[6:10])
         julian_date = img_info[10:13]
         date = date_from_julian(int(julian_date), year)
         data = {
             "info": img_info,
             "path": path,
             "row": row,
             "year": year,
             "timestamp": timestamp(date),
             "date": date.isoformat(),
         }
     return Response(json.dumps(data), mimetype="application/json")
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