import numpy as np import time,sys import requests import json import matplotlib import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import datetime import os import urllib import urllib.request import urllib.parse import base64 #import cv2 from PIL import Image import time import pymysql def img1_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img1_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/1/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img2_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/2/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img3_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/3/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img4_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.4 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/4/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/4/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/4/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t4.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img5_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.5 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/5/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/5/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/5/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t5.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img6_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.6 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/6/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/6/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/6/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t6.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img7_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.7 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/7/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/7/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/7/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t7.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img8_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.8 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/8/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/8/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/8/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t8.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img9_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.9 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/9/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/9/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c9.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/9/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t9.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = '4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img10_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.10 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/10/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/10/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c10.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/10/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t10.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img11_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.11 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/11/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/11/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c11.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/11/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t11.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img12_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.12 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/12/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/12/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c12.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/12/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t12.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img13_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.13 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/13/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/13/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c13.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/13/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t13.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img14_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.14 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/14/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/14/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c14.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/14/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t14.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img15_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.15 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/15/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/15/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c15.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/15/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t15.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img16_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.16 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/16/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/16/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c16.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/16/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t16.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img17_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.17 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/17/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/17/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c17.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/17/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t17.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img18_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.18 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/18/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/18/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c18.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/18/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t18.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm1_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.1 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/1m/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/1m/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c1m.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/1m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm1.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm2_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.2 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/2m/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/2m/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c2m.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/2m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm2.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def imgm3_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.3 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/3m/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/3m/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c3m.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/3m/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/tm3.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_1(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 1 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b1.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a1.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_1.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_2(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 2 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b2.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a2.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_2.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_3(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 3 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b3.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a3.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_3.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_4(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 4 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b4.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a4.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_4.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_5(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 5 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b5.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a5.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_5.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_6(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 6 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b6.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a6.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_6.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_7(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 7 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b7.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a7.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_7.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_8(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 8 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b8.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a8.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19_8.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') def img19_9(): try: db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame', charset='utf8') a = db.cursor() a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1") result = a.fetchall() if result ==(): s ="" else: s = "_" + result[0][3] db.close() ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn') date += s label= datetime.datetime.now().strftime('No.19 Direction 0 @%Y.%m.%d.%H.%M.%S') rgb_img0 = Image.open('/var/www/html/cust/19/c/b.tif') ir_img0 = Image.open('/var/www/html/cust/19/c/a.tif') rgb_img0.save(nt) ir_img0.save(irt) rgb_img0.save(nj,quality=95) ir_img0.save(irj,quality=95) r,_,_ = rgb_img0.split() r = np.asarray(r, dtype=float) ir,_,_ = ir_img0.split() ir = np.asarray(ir, dtype=float) ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image np.seterr(divide='ignore', invalid='ignore') ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r)) # Display the results fig, ax = plt.subplots() plt.plot(ndvi) plt.axis('off') plt.figure(figsize=(19, 10)) plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1) plt.gca().xaxis.set_major_locator(plt.NullLocator()) plt.gca().yaxis.set_major_locator(plt.NullLocator()) plt.margins(0, 0) #plt.show() plt.savefig(ndvis) plt.savefig(ndvia) plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png') plt.close('all') f = open('/var/www/html/cust/c19.txt','a') f.write(date) f.close() dress = '/var/www/html/cust/19/c/' for root, dirs, files in os.walk(dress): print('files: {}'.format(len(files))) if len(files)>=1: files.sort() for f in files: with open(os.path.join(root, f), "rb") as imageFile: str = base64.b64encode(imageFile.read()) url = 'http://60.250.156.234/cust/t19.php' values = {'data1':str, 'name':f} data1 = urllib.parse.urlencode(values) data1 = data1.encode('utf-8') req = urllib.request.Request(url, data1) req.add_header('User-Agent','Magic Browser') resp = urllib.request.urlopen(req) respdata1 = resp.read() print(os.path.join(root, f)) #print(respdata1) os.remove(os.path.join(root, f)) print("ok") except: print('error') while True: img1_1() img1_2() img1_3() img1_4() img1_5() img1_6() img1_7() img1_8() img1_9() img2_1() img2_2() img2_3() img2_4() img2_5() img2_6() img2_7() img2_8() img2_9() img3_1() img3_2() img3_3() img3_4() img3_5() img3_6() img3_7() img3_8() img3_9() img4_1() img4_2() img4_3() img4_4() img4_5() img4_6() img4_7() img4_8() img4_9() img5_1() img5_2() img5_3() img5_4() img5_5() img5_6() img5_7() img5_8() img5_9() img6_1() img6_2() img6_3() img6_4() img6_5() img6_6() img6_7() img6_8() img6_9() img7_1() img7_2() img7_3() img7_4() img7_5() img7_6() img7_7() img7_8() img7_9() img8_1() img8_2() img8_3() img8_4() img8_5() img8_6() img8_7() img8_8() img8_9() img9_1() img9_2() img9_3() img9_4() img9_5() img9_6() img9_7() img9_8() img9_9() img10_1() img10_2() img10_3() img10_4() img10_5() img10_6() img10_7() img10_8() img10_9() img11_1() img11_2() img11_3() img11_4() img11_5() img11_6() img11_7() img11_8() img11_9() img12_1() img12_2() img12_3() img12_4() img12_5() img12_6() img12_7() img12_8() img12_9() img13_1() img13_2() img13_3() img13_4() img13_5() img13_6() img13_7() img13_8() img13_9() img14_1() img14_2() img14_3() img14_4() img14_5() img14_6() img14_7() img14_8() img14_9() img15_1() img15_2() img15_3() img15_4() img15_5() img15_6() img15_7() img15_8() img15_9() img16_1() img16_2() img16_3() img16_4() img16_5() img16_6() img16_7() img16_8() img16_9() img17_1() img17_2() img17_3() img17_4() img17_5() img17_6() img17_7() img17_8() img17_9() img18_1() img18_2() img18_3() img18_4() img18_5() img18_6() img18_7() img18_8() img18_9() imgm1_1() imgm1_2() imgm1_3() imgm1_4() imgm1_5() imgm1_6() imgm1_7() imgm1_8() imgm1_9() imgm2_1() imgm2_2() imgm2_3() imgm2_4() imgm2_5() imgm2_6() imgm2_7() imgm2_8() imgm2_9() imgm3_1() imgm3_2() imgm3_3() imgm3_4() imgm3_5() imgm3_6() imgm3_7() imgm3_8() imgm3_9() img19_1() img19_2() img19_3() img19_4() img19_5() img19_6() img19_7() img19_8() img19_9()