예제 #1
0
def view_mosaic_image_submit(rid,file_format):
    if rid in processes:
        print processes[rid]
        if processes[rid].ready():
            tmpvrt = processes[rid].get()[0]
            print tmpvrt
            rid2 = make_rid()
            print "CALLING TRANSLATE FILES"
            out_size = "5% 5%"
            out_scale = "0 4096 0 255"
            data_t = "Byte"
            band_l = [1,2,3]
            if file_format == "JPEG" or file_format == "GTiff":
                out_size = "100% 100%"
            if file_format == "GTiff":
                out_scale = None
                data_t = None
                band_l = None
            if rid in no_scale:
                out_scale = None
            processes[rid2] = chain(assemble_mosaic.s(tmpvrt),translate_files.s(file_format=file_format,output_scale=out_scale,output_size=out_size,output_datatype=data_t,output_bands=band_l,additional_arguments=None)).apply_async()
            return "{\"request\":\""+rid2+"\"}"
    return "{\"request\":\"WAIT\"}"
예제 #2
0
def mosaic_tci_w_submit(xa,ya,start,end,sats):
    rid = make_rid()
    x_arr = [int(x) for x in xa.split(',')]
    y_arr = [int(y) for y in ya.split(',')]
    s_arr = [Satellite[s] for s in sats.split(',')]
    endDate=datetime.strptime(end,"%Y-%m-%d")
    startDate=datetime.strptime(start,"%Y-%m-%d")
    
    bands=[Ls57Arg25Bands.BLUE, Ls57Arg25Bands.GREEN, Ls57Arg25Bands.RED, Ls57Arg25Bands.NEAR_INFRARED, Ls57Arg25Bands.SHORT_WAVE_INFRARED_1, Ls57Arg25Bands.SHORT_WAVE_INFRARED_2]
    expressions_list=["0.3561*band1 + 0.3972*band2 + 0.3904*band3 + 0.6966*band4 + 0.2286*band5 + 0.1596*band6",\
"-0.3344*band1 - 0.3544*band2 - 0.4556*band3 + 0.6966*band4 - 0.0242*band5 - 0.2630*band6",\
"0.2626*band1 + 0.2141*band2 + 0.0926*band3 + 0.0656*band4 - 0.7629*band5 - 0.5388*band6"]
    no_scale.append(rid)
    processes[rid]=chord(chord((obtain_cloudfree_mosaic.s(x,y,startDate,endDate, bands, s_arr,0,4000,4000,"GTiff",gdal.GDT_CInt16,None)|obtain_file_from_math.s(expressions_list=expressions_list,file_format="GTiff",data_type=gdal.GDT_CFloat32,input_ndv=-999,output_ndv=-999) for x in x_arr for y in y_arr),assemble_mosaic.s()),apply_color_table_to_files.s(output_band=3,color_table="/tilestore/colortables/wetness-color.txt")).apply_async()
    return "{\"request\":\""+rid+"\"}"
예제 #3
0
def mosaic_ndvi_submit(xa,ya,start,end,sats):
    rid = make_rid()
    x_arr = [int(x) for x in xa.split(',')]
    y_arr = [int(y) for y in ya.split(',')]
    s_arr = [Satellite[s] for s in sats.split(',')]
    endDate=datetime.strptime(end,"%Y-%m-%d")
    startDate=datetime.strptime(start,"%Y-%m-%d")

    bands=[Ls57Arg25Bands.RED, Ls57Arg25Bands.NEAR_INFRARED]
    expressions_list=["(band2 - band1) / (band2 + band1)"]
    no_scale.append(rid)
    processes[rid]=chord(chord((obtain_cloudfree_mosaic.s(x,y,startDate,endDate, bands, s_arr,0,4000,4000,"GTiff",gdal.GDT_CInt16,None)|obtain_file_from_math.s(expressions_list=expressions_list,file_format="GTiff",data_type=gdal.GDT_CFloat32,input_ndv=-999,output_ndv=-999) for x in x_arr for y in y_arr),assemble_mosaic.s()),apply_color_table_to_files.s(output_band=1,color_table="/tilestore/colortables/vegetation-color.txt")).apply_async()
    return "{\"request\":\""+rid+"\"}"
예제 #4
0
def submit_water_request(xa,ya,start,end,sats):
    rid = make_rid()
    x_arr = [int(x) for x in xa.split(',')]
    y_arr = [int(y) for y in ya.split(',')]        
    s_arr = [Satellite[s] for s in sats.split(',')]
    endDate=datetime.strptime(end,"%Y-%m-%d")
    startDate=datetime.strptime(start,"%Y-%m-%d")
    processes[rid] = chord(group(obtain_water_statistics.s(x,y,startDate,endDate,s_arr,None) for x in x_arr for y in y_arr), assemble_mosaic.s()).apply_async()
    posQ = get_queue_length()
    no_scale.append(rid)
    return "{\"request\":\""+rid+"\",\"position\":\""+str(posQ)+"\"}"
예제 #5
0
def submit_mosaic_with_months_request(xa,ya,start,end,sats,ba,ma):
    rid = make_rid()
    x_arr = [int(x) for x in xa.split(',')]
    y_arr = [int(y) for y in ya.split(',')]
    s_arr = [Satellite[s] for s in sats.split(',')]
    endDate=datetime.strptime(end,"%Y-%m-%d")
    startDate=datetime.strptime(start,"%Y-%m-%d")
    m_arr = [int(m) for m in ma.split(',')]
    b_arr = []
    be_arr = ba.split(',')
    for s in s_arr:
        for b in be_arr:
            if s ==Satellite.LS5 or s==Satellite.LS7:
                try:
                    tmp = Ls57Arg25Bands[b]
                    b_arr.append(tmp)
                except KeyError:
                    pass
            elif s==Satellite.LS8:
                try:
                    tmp = Ls8Arg25Bands[b]
                    b_arr.append(tmp)
                except KeyError:
                    pass
                    
    processes[rid] = chord(group(obtain_cloudfree_mosaic.s(x,y,startDate,endDate, b_arr, s_arr,0,4000,4000,"GTiff",gdal.GDT_CInt16,m_arr) for x in x_arr for y in y_arr ),assemble_mosaic.s()).apply_async()
    posQ = get_queue_length()
    return "{\"request\":\""+rid+"\",\"position\":\""+str(posQ)+"\"}"
예제 #6
0
def submit_preview_request(xa,ya,start,end,sats,ba):
    try:    
        rid = make_rid()
        x_arr = [int(x) for x in xa.split(',')]
        y_arr = [int(y) for y in ya.split(',')]
        s_arr = [Satellite[s] for s in sats.split(',')]
        endDate=datetime.strptime(end,"%Y-%m-%d")
        startDate=datetime.strptime(start,"%Y-%m-%d")
        b_arr = []
        be_arr = ba.split(',')
        for s in s_arr:
            for b in be_arr:
                if s ==Satellite.LS5 or s==Satellite.LS7:
                    try:
                        tmp = Ls57Arg25Bands[b]
                        b_arr.append(tmp)
                    except KeyError:
                        pass
                elif s==Satellite.LS8:
                    try:
                        tmp = Ls8Arg25Bands[b]
                        b_arr.append(tmp)
                    except KeyError:
                        pass                
        processes[rid] = chord(group(obtain_cloudfree_mosaic.s(x,y,startDate,endDate, b_arr, s_arr,5,4000,4000,"GTiff",gdal.GDT_CInt16,None) for x in x_arr for y in y_arr ),assemble_mosaic.s()).apply_async()
        return "{\"request\":\""+rid+"\"}"
    except:
        return "{\"request\":\"WAIT\"}"