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+"\"}"
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+"\"}"