from socket import * from io import BytesIO import base64 from google.cloud import storage from oauth2client.service_account import ServiceAccountCredentials from send_webhook_data import send_webhook_data import os import time import firebase_admin from firebase_admin import credentials from firebase_admin import db from PIL import Image, ImageFilter from send_notification import send_notification from sendemail import sendemail import traceback from sen_start_noti import sen_start_noti from send_sar_email import send_sar_email import json import scipy import random from gen_report_new2 import gen_report_new import time import datetime from merge_sar import merge_sar from find_sar import find_sar from merge_dem import merge_dem from find_dem import find_dem from scipy import ndimage from make_bigquery import make_bigquery from send_moni_noti import send_moni_noti from send_error_noti import send_error_noti from gmap_image import gmap_image from gmap_image_large import gmap_image_large from datetime import date, timedelta from find_img import find_img from find_img_large import find_img_large from merge_img import merge_img from all_proc import all_proc from contour_images import contour_images from send_expiring_noti import send_expiring_noti from send_expired_noti import send_expired_noti from make_trial_bigquery import make_trial_bigquery from gen_geotiff import gen_geotiff from sendgeotifs import sendgeotifs from gen_report import gen_report from get_weather_data import get_weather_data from sendonlyreport import sendonlyreport from gen_failed_report import gen_failed_report from sendfailedreport import sendfailedreport from map_coords import map_coords from search_new_sentinel import search_new_sentinel from convert_to_pdf import convert_to_pdf from latlon_jp2_to_pixel import latlon_jp2_to_pixel from gen_geotiff2 import gen_geotiff2 from search_sentinel_again import search_sentinel_again from get_prev_date import get_prev_date from make_bigquery_again import make_bigquery_again import requests import pdftotree from convert_to_html import convert_to_html from geopy.geocoders import Nominatim from firebase_admin import firestore from get_land_use import get_land_use from make_dir import make_dir import threading import pytz from create_interactive_html_report import make_interactive_html_report today = date.today() d1 = today.strftime("%Y%m%d") new_field = 0 print(d1) aqw2 = 1 cred = credentials.Certificate("servicekey.json") # os.system("rm -rf AwsData") try: firebase_admin.initialize_app( cred, {"databaseURL": "https://farmbase-b2f7e-31c0c.firebaseio.com/"} ) except: qysy = 1 dbF = firestore.client() storage_client = storage.Client(project='farmbase-b2f7e') bucket_name = "farmbase-b2f7e.appspot.com" # uids = ["qL4tgUcl1ggqLRFFgxTNbTgP3uk1","58EOGX5hGOXlQaKjQ99c3JpZxbm2", "WdSPkBXkkXcEQGU8tSFhqfAGZUf1", "9fLMcJOY9pPOMWDiQDZrxxQlRS13"] # uids = ["qL4tgUcl1ggqLRFFgxTNbTgP3uk1"] # uids = ["ipRHhCOFIDV2pxgg7Nfz1ufZBmV2"] def instant_session(): #todo a = 1 def daily_session(): while True: uid_list = db.reference('PaidMonitoredFields').child('PMF').get(False, True) for uid, val in uid_list.items(): make_interactive_html_report(uid) bucket = storage_client.get_bucket(bucket_name) blob = bucket.blob(("PaidMonitoredFields/" + uid + "/interactive_report.html")) blob.upload_from_filename((uid + "/interactive_report.html")) time.sleep(86400)