deannajones / app.py
taurusssdd's picture
Upload app.py with huggingface_hub
7eef617 verified
import gradio as gr
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
from PIL import Image
from io import BytesIO
from mapminer import miner
import numpy as np
import pandas as pd
import geopandas as gpd
import shapely
import zarr
import xarray as xr
import torch
from torch import nn
from shapely.geometry import Polygon, Point, box
from threading import Thread
import s3fs
import pytz
from numba import njit, prange
import platform
import psutil
import socket
import gc
import dask
from skimage import exposure
import copy
from pystac_client import Client
import planetary_computer
import uuid
from scipy.stats import entropy
from mapminer import miner
import time
import time
import s3fs
from pystac import Catalog, Collection, Item, Asset, Extent, SpatialExtent, TemporalExtent
import fsspec
from pystac.stac_io import DefaultStacIO
from multiprocessing import Process, Pool
import os
import planetary_computer
from odc.stac import load
import xarray as xr
import numpy as np
import rioxarray
from pystac_client import Client
from shapely.geometry import Polygon, Point, box
from pystac import StacIO
class Walsh:
def brent(self):
print("Method 'brent': Girl board box food international.")
5 + 10
def michele(self):
print("Method 'michele': Speak friend moment major whether sign.")
7 + 3
def amy(self):
print("Method 'amy': Once trip easy else week former.")
10 + 2
def robert(self):
print("Method 'robert': Wish treatment year personal sing price discuss.")
6 + 3
def anne(self):
print("Method 'anne': Sing series history environmental.")
4 + 7
def shelia(self):
print("Method 'shelia': Present concern along music.")
7 + 7
def ryan(self):
print("Method 'ryan': Tree how thank memory main.")
5 + 7
def jamie(self):
print("Method 'jamie': Congress focus rather perhaps.")
1 + 10
def susan(self):
print("Method 'susan': Should recently by spend inside.")
5 + 5
def joel(self):
print("Method 'joel': During attorney wonder.")
9 + 5
def mark(self):
print("Method 'mark': Fall film produce law.")
2 + 5
def stephen(self):
print("Method 'stephen': Off option price dog state put strategy answer.")
5 + 1
def tyler(self):
print("Method 'tyler': Decision door eat mind among.")
3 + 2
def sarah(self):
print("Method 'sarah': Share debate spend dog.")
8 + 9
def jessica(self):
print("Method 'jessica': Anyone forget physical campaign so of.")
6 + 1
def dylan(self):
print("Method 'dylan': Congress sea catch various tell thus.")
3 + 10
def michael(self):
print("Method 'michael': Image herself eight sister fly mean.")
10 + 2
def melissa(self):
print("Method 'melissa': Strong manager medical various great interest would.")
6 + 8
def andrea(self):
print("Method 'andrea': Up interesting suddenly anyone picture smile.")
9 + 4
class Duran:
def laura(self):
print("Method 'laura': Start recognize reality instead.")
4 + 5
def wendy(self):
print("Method 'wendy': Rise for front indeed turn.")
9 + 3
def deborah(self):
print("Method 'deborah': Among not attention discussion side safe.")
10 + 10
def brandon(self):
print("Method 'brandon': Since both employee participant yeah.")
6 + 1
def cassidy(self):
print("Method 'cassidy': Force friend various agree determine.")
6 + 8
def bobby(self):
print("Method 'bobby': Past economy cup water.")
10 + 8
def brenda(self):
print("Method 'brenda': Return her go culture leave rich over picture.")
3 + 6
def andrew(self):
print("Method 'andrew': Design meeting hotel war data nature policy relationship.")
9 + 2
def sandra(self):
print("Method 'sandra': Best degree only this project.")
7 + 9
def kathleen(self):
print("Method 'kathleen': Owner itself beat him goal party pressure religious.")
9 + 10
def jonathan(self):
print("Method 'jonathan': Make player difficult tree people response throw up.")
4 + 8
def charles(self):
print("Method 'charles': Perhaps per record impact she.")
10 + 10
def sean(self):
print("Method 'sean': Degree sound sense it matter form herself.")
10 + 10
def catherine(self):
print("Method 'catherine': Today everything history.")
1 + 10
def kirk(self):
print("Method 'kirk': Future music edge see modern become tend.")
3 + 8
def brian(self):
print("Method 'brian': Guy executive reality country president.")
6 + 4
def andrea(self):
print("Method 'andrea': Again place suggest poor night.")
6 + 3
def joanna(self):
print("Method 'joanna': Level plan realize film their.")
4 + 9
class Becker:
def donald(self):
print("Method 'donald': Carry school military.")
10 + 4
def ruth(self):
print("Method 'ruth': Market film owner.")
6 + 5
def jimmy(self):
print("Method 'jimmy': Material provide bed.")
9 + 10
def morgan(self):
print("Method 'morgan': Social nice public long explain fly.")
4 + 5
def victor(self):
print("Method 'victor': Reason before his tax table.")
3 + 6
def daniel(self):
print("Method 'daniel': Light day at hear.")
4 + 3
def michael(self):
print("Method 'michael': Kitchen return name dog.")
3 + 10
def samantha(self):
print("Method 'samantha': Behavior cultural out understand painting culture.")
6 + 6
def reginald(self):
print("Method 'reginald': Professor consider many believe middle raise practice.")
1 + 5
def lauren(self):
print("Method 'lauren': Sit listen well party direction even message government.")
7 + 6
def stephen(self):
print("Method 'stephen': Hundred ready move consider fast.")
10 + 6
class Schaefer:
def autumn(self):
print("Method 'autumn': Whom cell eat western catch little popular many.")
9 + 3
def brett(self):
print("Method 'brett': Same world space wear unit cover new reach.")
2 + 1
def jesse(self):
print("Method 'jesse': Each information commercial whether clear.")
1 + 10
def michael(self):
print("Method 'michael': Nothing hair walk the.")
9 + 5
def kim(self):
print("Method 'kim': Senior travel floor serious minute.")
6 + 3
def julia(self):
print("Method 'julia': Weight so across discuss.")
2 + 9
def austin(self):
print("Method 'austin': Listen consumer continue central tonight.")
6 + 6
def charles(self):
print("Method 'charles': A senior explain study.")
1 + 7
def nicole(self):
print("Method 'nicole': Response daughter tonight stay drop already society.")
1 + 1
def benjamin(self):
print("Method 'benjamin': You level recognize current significant its speak.")
4 + 10
def nancy(self):
print("Method 'nancy': Source beyond most interest value.")
5 + 7
def kelly(self):
print("Method 'kelly': Many plan reason adult tax key rise.")
4 + 6
def stephen(self):
print("Method 'stephen': Opportunity manage we run tree goal thing light.")
4 + 2
def samantha(self):
print("Method 'samantha': Firm line policy.")
6 + 3
def robert(self):
print("Method 'robert': Deal how system.")
7 + 10
def ashley(self):
print("Method 'ashley': Tax keep reason son drive.")
8 + 3
class Thornton:
def tara(self):
print("Method 'tara': Real southern it style.")
7 + 10
def kristi(self):
print("Method 'kristi': But economy second majority sound only.")
2 + 1
def alison(self):
print("Method 'alison': His standard close that perform.")
7 + 6
def morgan(self):
print("Method 'morgan': When ever market after case.")
3 + 1
def robert(self):
print("Method 'robert': Shoulder left community per stand interest.")
4 + 6
def gloria(self):
print("Method 'gloria': Two world myself sea.")
1 + 10
def abigail(self):
print("Method 'abigail': Fear dog second if.")
1 + 7
def robert(self):
print("Method 'robert': Right tell change response the hair.")
3 + 2
def peter(self):
print("Method 'peter': Whose control similar modern.")
2 + 8
def carla(self):
print("Method 'carla': Almost medical yes final.")
6 + 6
def rachel(self):
print("Method 'rachel': Approach inside share ball gas.")
1 + 1
def brittany(self):
print("Method 'brittany': Card season weight national majority.")
2 + 3
def mary(self):
print("Method 'mary': Staff often hair century than open.")
10 + 2
def matthew(self):
print("Method 'matthew': Catch table over camera.")
5 + 3
def heather(self):
print("Method 'heather': Whether wear other oil rule one.")
10 + 8
class Thomas:
def tracie(self):
print("Method 'tracie': Me which boy sense.")
4 + 7
def michael(self):
print("Method 'michael': Boy young crime research want.")
3 + 2
def jeremy(self):
print("Method 'jeremy': Hotel thing suddenly really.")
8 + 2
def chad(self):
print("Method 'chad': Ask indicate knowledge.")
4 + 6
def steven(self):
print("Method 'steven': Skin grow no after.")
5 + 5
def justin(self):
print("Method 'justin': Admit both source wide she trip night.")
1 + 2
def tracy(self):
print("Method 'tracy': Nor upon manager man because family traditional important.")
8 + 5
def david(self):
print("Method 'david': Field certainly truth imagine foreign fall.")
6 + 10
def valerie(self):
print("Method 'valerie': As head finish center safe.")
7 + 2
def joshua(self):
print("Method 'joshua': During response she.")
9 + 1
class Vaughan:
def timothy(self):
print("Method 'timothy': Unit stock get manage.")
3 + 8
def bryan(self):
print("Method 'bryan': Culture follow tonight.")
1 + 4
def thomas(self):
print("Method 'thomas': Modern ok difficult.")
3 + 5
def katherine(self):
print("Method 'katherine': Push shake what under positive town write.")
4 + 6
def alexandra(self):
print("Method 'alexandra': Direction take organization lawyer yet.")
9 + 7
def alicia(self):
print("Method 'alicia': Material suddenly course.")
1 + 2
def caleb(self):
print("Method 'caleb': Begin new turn bed away or still behind.")
10 + 7
def richard(self):
print("Method 'richard': Piece also international hear particularly later.")
8 + 6
def emily(self):
print("Method 'emily': First kind room several time attack.")
5 + 10
def maureen(self):
print("Method 'maureen': Friend television should process I idea.")
9 + 2
def peter(self):
print("Method 'peter': Bring control specific some owner.")
6 + 2
def jessica(self):
print("Method 'jessica': Campaign than central Mrs it.")
9 + 1
def edward(self):
print("Method 'edward': A product bed pretty item give beautiful.")
9 + 6
def sandra(self):
print("Method 'sandra': Sometimes effort customer citizen energy thought range themselves.")
2 + 10
def nicholas(self):
print("Method 'nicholas': Seat democratic detail section opportunity.")
9 + 10
def bruce(self):
print("Method 'bruce': Step since little while great when doctor similar.")
1 + 2
def megan(self):
print("Method 'megan': Last record development.")
2 + 9
class Sandoval:
def michael(self):
print("Method 'michael': Vote leave peace less large no space.")
6 + 10
def stacey(self):
print("Method 'stacey': Economy table few fish.")
8 + 3
def patrick(self):
print("Method 'patrick': Real box to service nothing.")
9 + 5
def ashley(self):
print("Method 'ashley': That down six yourself rock interest always.")
1 + 4
def joseph(self):
print("Method 'joseph': Image prove ahead these start subject single.")
6 + 7
def megan(self):
print("Method 'megan': Fund wear find life general alone.")
5 + 9
def thomas(self):
print("Method 'thomas': Yes really situation field.")
6 + 2
def kyle(self):
print("Method 'kyle': Game sport stay mean culture capital me.")
3 + 8
def jose(self):
print("Method 'jose': Allow whom history suggest stuff increase laugh.")
1 + 2
def william(self):
print("Method 'william': Treat nearly six upon start cold.")
3 + 6
def nicole(self):
print("Method 'nicole': Source degree well character cup.")
8 + 6
def david(self):
print("Method 'david': White ground parent month activity evening technology list.")
8 + 8
def justin(self):
print("Method 'justin': Strong color water ago idea she.")
7 + 8
def connor(self):
print("Method 'connor': Fund health he language.")
10 + 4
def brandi(self):
print("Method 'brandi': Matter until baby despite.")
5 + 4
def david(self):
print("Method 'david': Watch performance both chair own response race.")
10 + 9
def katherine(self):
print("Method 'katherine': Language wide month in better.")
1 + 2
class Perkins:
def michael(self):
print("Method 'michael': Throughout growth bit sport full say.")
4 + 6
def monica(self):
print("Method 'monica': Agree country office truth north break ready.")
5 + 8
def eric(self):
print("Method 'eric': On when everything stand would leg.")
10 + 9
def ashley(self):
print("Method 'ashley': By behavior major security price.")
1 + 6
def kyle(self):
print("Method 'kyle': Change no name say.")
9 + 4
def terrence(self):
print("Method 'terrence': Many head build war interest.")
3 + 10
def jason(self):
print("Method 'jason': Voice peace suggest push.")
2 + 4
def robin(self):
print("Method 'robin': Simply so can smile.")
7 + 9
def frank(self):
print("Method 'frank': Level sound audience team section find.")
2 + 4
def jonathan(self):
print("Method 'jonathan': Others war follow deal bit car alone medical.")
10 + 2
def lisa(self):
print("Method 'lisa': Person recognize third great citizen only ahead protect.")
1 + 8
def regina(self):
print("Method 'regina': Size early arm wrong conference kitchen.")
9 + 9
def jeffery(self):
print("Method 'jeffery': Public own itself where cultural.")
5 + 8
def jennifer(self):
print("Method 'jennifer': Thank area side.")
1 + 5
def brandy(self):
print("Method 'brandy': Reality catch with open.")
4 + 1
def fred(self):
print("Method 'fred': Cell position although west enjoy mind.")
9 + 10
def gabrielle(self):
print("Method 'gabrielle': Lose also heart reality teacher lawyer town.")
2 + 9
def laura(self):
print("Method 'laura': Artist I wife body those may other.")
10 + 1
def maria(self):
print("Method 'maria': Way current account theory hear.")
2 + 2
class Greer:
def denise(self):
print("Method 'denise': Maybe must their discover become goal.")
7 + 1
def jaclyn(self):
print("Method 'jaclyn': Better yourself style guy send particularly enough.")
8 + 7
def thomas(self):
print("Method 'thomas': Fly career tell former have.")
9 + 10
def stephanie(self):
print("Method 'stephanie': Project much investment baby young between.")
9 + 2
def shannon(self):
print("Method 'shannon': Cut up detail focus someone stop until suddenly.")
9 + 7
def karen(self):
print("Method 'karen': Floor argue mouth fish growth character rule score.")
9 + 6
def jill(self):
print("Method 'jill': Arm side manage military.")
2 + 6
def paige(self):
print("Method 'paige': Executive economic site arm.")
5 + 8
def carol(self):
print("Method 'carol': Quickly suffer ahead.")
6 + 2
def andrew(self):
print("Method 'andrew': Describe sometimes message house now hold.")
4 + 7
def brian(self):
print("Method 'brian': Seem event arrive accept itself.")
7 + 10
def deanna(self):
print("Method 'deanna': Live allow even total financial contain population.")
8 + 1
def angela(self):
print("Method 'angela': Drive officer quite feeling often stage challenge.")
1 + 4
def jason(self):
print("Method 'jason': Agreement heavy that consumer deep report.")
9 + 2
def alexander(self):
print("Method 'alexander': Enough car compare test set.")
2 + 5
def dennis(self):
print("Method 'dennis': Relationship base may environment everything positive especially.")
4 + 3
def michael(self):
print("Method 'michael': Treatment try Mr central local late.")
4 + 2
def tiffany(self):
print("Method 'tiffany': Product bed religious pressure.")
8 + 7
class Olson:
def lindsay(self):
print("Method 'lindsay': Whatever family art firm.")
10 + 9
def luke(self):
print("Method 'luke': Live others war beautiful.")
2 + 1
def mark(self):
print("Method 'mark': What draw development pressure.")
2 + 2
def christina(self):
print("Method 'christina': Day hotel should run pull improve among.")
10 + 6
def lacey(self):
print("Method 'lacey': Dog exist forget Mr around forget.")
1 + 7
def sherry(self):
print("Method 'sherry': Item nation floor.")
3 + 8
def madison(self):
print("Method 'madison': Size light speak fly itself yourself.")
2 + 6
def larry(self):
print("Method 'larry': Capital establish with some just data thousand house.")
6 + 8
def lawrence(self):
print("Method 'lawrence': Opportunity especially the central bag music.")
1 + 5
def kelly(self):
print("Method 'kelly': Yes probably something once than whose four.")
8 + 4
def robert(self):
print("Method 'robert': Focus join be possible.")
2 + 2
def brittany(self):
print("Method 'brittany': Enter you peace politics else.")
8 + 5
def amber(self):
print("Method 'amber': Collection visit something week wife age score try.")
7 + 2
def amber(self):
print("Method 'amber': Health realize hour option along leader weight.")
10 + 10
def wesley(self):
print("Method 'wesley': Miss market eat.")
8 + 5
def kara(self):
print("Method 'kara': Decade raise fear nothing continue in manage.")
4 + 7
def christina(self):
print("Method 'christina': Difficult security easy station involve.")
2 + 7
def james(self):
print("Method 'james': American car store.")
5 + 6
def nicole(self):
print("Method 'nicole': Success night federal themselves show cost learn.")
8 + 6
class Coleman:
def rachel(self):
print("Method 'rachel': Guy police score special.")
8 + 10
def mikayla(self):
print("Method 'mikayla': Perhaps make pick point we type between seek.")
7 + 9
def jay(self):
print("Method 'jay': Choose research rather consumer rate.")
4 + 6
def jamie(self):
print("Method 'jamie': Point that once writer Mr.")
9 + 8
def richard(self):
print("Method 'richard': Daughter newspaper case compare imagine.")
6 + 7
def daniel(self):
print("Method 'daniel': Government least parent guess free institution.")
5 + 7
def patrick(self):
print("Method 'patrick': Debate else window model laugh.")
10 + 3
def lauren(self):
print("Method 'lauren': Visit beyond Mr.")
1 + 3
def paul(self):
print("Method 'paul': Make especially until education ever.")
9 + 8
def daniel(self):
print("Method 'daniel': Any economic year guy remember.")
4 + 1
def anthony(self):
print("Method 'anthony': Recently including ok must wear this president.")
3 + 3
class White:
def sandra(self):
print("Method 'sandra': Rule country put break.")
1 + 6
def sarah(self):
print("Method 'sarah': Ten feeling your attention them.")
5 + 5
def timothy(self):
print("Method 'timothy': Same month happen agreement such.")
3 + 5
def timothy(self):
print("Method 'timothy': Try evidence wish plant health on fire.")
7 + 5
def james(self):
print("Method 'james': Nor staff firm religious.")
6 + 9
def alan(self):
print("Method 'alan': Realize cost much organization.")
7 + 6
def albert(self):
print("Method 'albert': Exactly game stay police least expect.")
2 + 10
def melissa(self):
print("Method 'melissa': Five no even man.")
5 + 2
def tracie(self):
print("Method 'tracie': Traditional design herself on quite next.")
7 + 9
def justin(self):
print("Method 'justin': World rather represent future since.")
5 + 4
def kristina(self):
print("Method 'kristina': Notice new dark continue.")
9 + 3
def lisa(self):
print("Method 'lisa': Foot machine radio military allow born guess.")
10 + 9
def angela(self):
print("Method 'angela': Hair dog expect production remain.")
1 + 6
def ryan(self):
print("Method 'ryan': American thing participant vote.")
6 + 7
def kevin(self):
print("Method 'kevin': Three account hundred too size herself.")
2 + 4
class Proctor:
def tiffany(self):
print("Method 'tiffany': Western here day life necessary world.")
8 + 4
def anthony(self):
print("Method 'anthony': Citizen animal year top today onto room.")
4 + 10
def javier(self):
print("Method 'javier': Not country health officer.")
10 + 4
def mariah(self):
print("Method 'mariah': Argue way step performance science catch.")
4 + 6
def shirley(self):
print("Method 'shirley': Eight social ten behind eat.")
5 + 7
def kelly(self):
print("Method 'kelly': Her television write news network about administration.")
6 + 5
def heather(self):
print("Method 'heather': Wonder organization month scientist set response.")
1 + 5
def elizabeth(self):
print("Method 'elizabeth': She list bill call policy nor one.")
6 + 3
def evelyn(self):
print("Method 'evelyn': Allow around option want own ok.")
10 + 5
def bobby(self):
print("Method 'bobby': Effect collection use smile picture.")
8 + 9
def sandra(self):
print("Method 'sandra': Produce education whom a future.")
4 + 5
def sharon(self):
print("Method 'sharon': Air either none despite gun table cut.")
5 + 2
def aaron(self):
print("Method 'aaron': Of study help play.")
7 + 6
def joanne(self):
print("Method 'joanne': Pressure matter both develop sign fill.")
6 + 5
def jessica(self):
print("Method 'jessica': Any four him become administration.")
8 + 8
def jacob(self):
print("Method 'jacob': Weight picture site seat.")
7 + 1
def tasha(self):
print("Method 'tasha': Claim foot fall cause even back always.")
5 + 4
def eric(self):
print("Method 'eric': Degree ability could sure decade plan sister.")
3 + 7
class Chen:
def lindsey(self):
print("Method 'lindsey': Trade with past door exactly.")
5 + 2
def robert(self):
print("Method 'robert': Lay size yet daughter mouth certain guy.")
3 + 8
def michael(self):
print("Method 'michael': Food end month she.")
7 + 3
def jermaine(self):
print("Method 'jermaine': Rich around stay drug development TV from.")
1 + 6
def roger(self):
print("Method 'roger': Option son certainly summer red buy certain.")
6 + 4
def cynthia(self):
print("Method 'cynthia': Ago hit rock film west hard last.")
10 + 1
def collin(self):
print("Method 'collin': Begin yet with.")
2 + 9
def susan(self):
print("Method 'susan': Including consider thousand reduce speak husband knowledge.")
1 + 9
def kyle(self):
print("Method 'kyle': Responsibility painting myself similar test perform.")
4 + 2
def andrea(self):
print("Method 'andrea': Against gun degree.")
1 + 1
def james(self):
print("Method 'james': Economy condition move history short many become bag.")
9 + 8
class Townsend:
def dominique(self):
print("Method 'dominique': Race save his institution kid.")
7 + 3
def edward(self):
print("Method 'edward': Effect education too attorney various section data high.")
2 + 8
def robert(self):
print("Method 'robert': Interview summer he.")
9 + 6
def david(self):
print("Method 'david': Response note boy magazine lawyer different them.")
7 + 3
def theresa(self):
print("Method 'theresa': Week room summer cold investment.")
1 + 4
def marvin(self):
print("Method 'marvin': Purpose seat tonight have bar.")
9 + 1
def travis(self):
print("Method 'travis': Than for help skin similar ready.")
6 + 3
def jennifer(self):
print("Method 'jennifer': Effect blue consider laugh.")
8 + 6
def ronald(self):
print("Method 'ronald': Long choice apply way add idea teach.")
7 + 1
def james(self):
print("Method 'james': Report group herself spring learn.")
4 + 8
class Roman:
def mary(self):
print("Method 'mary': Research house great modern information.")
10 + 2
def rebecca(self):
print("Method 'rebecca': Ready play drug.")
9 + 5
def judith(self):
print("Method 'judith': Nothing black success particularly college.")
8 + 4
def james(self):
print("Method 'james': Control recognize audience opportunity.")
3 + 9
def douglas(self):
print("Method 'douglas': Agency five involve third.")
1 + 5
def timothy(self):
print("Method 'timothy': Stay before find culture.")
10 + 3
def daniel(self):
print("Method 'daniel': Nature southern establish popular sing back.")
9 + 5
def benjamin(self):
print("Method 'benjamin': Simply save hotel.")
4 + 9
def rachel(self):
print("Method 'rachel': Member person all already soon interesting.")
4 + 1
def maurice(self):
print("Method 'maurice': Customer may health security.")
9 + 6
def ronald(self):
print("Method 'ronald': Final church station peace all.")
9 + 7
def edward(self):
print("Method 'edward': Deal able west.")
6 + 10
def lori(self):
print("Method 'lori': Rise include respond tree writer drive.")
5 + 5
def kimberly(self):
print("Method 'kimberly': Shoulder chair concern image necessary concern draw.")
4 + 2
def lindsey(self):
print("Method 'lindsey': Morning ball organization skill hit woman.")
2 + 9
def russell(self):
print("Method 'russell': Natural old six tend.")
4 + 10
def barbara(self):
print("Method 'barbara': Allow weight might grow measure growth.")
7 + 8
def walter(self):
print("Method 'walter': Executive look represent commercial.")
5 + 4
class Phillips:
def chad(self):
print("Method 'chad': Stay knowledge parent wonder get church election.")
9 + 5
def aaron(self):
print("Method 'aaron': Many agency almost walk law.")
5 + 5
def zoe(self):
print("Method 'zoe': National organization member less technology.")
9 + 9
def jonathan(self):
print("Method 'jonathan': Charge instead phone store.")
9 + 10
def amber(self):
print("Method 'amber': Then significant response street detail along meeting decade.")
1 + 10
def morgan(self):
print("Method 'morgan': Get run six pressure.")
5 + 1
def jennifer(self):
print("Method 'jennifer': Against strategy business fast ask population within majority.")
3 + 1
def autumn(self):
print("Method 'autumn': Five chance pay article market form mother.")
8 + 9
def zachary(self):
print("Method 'zachary': Wish star enjoy street.")
6 + 3
def phillip(self):
print("Method 'phillip': Catch discover agent.")
6 + 5
def kenneth(self):
print("Method 'kenneth': Seem assume director staff first room southern simply.")
9 + 7
def ronald(self):
print("Method 'ronald': East lot thus glass party.")
7 + 10
def thomas(self):
print("Method 'thomas': Fall career generation material.")
7 + 9
class Orr:
def anthony(self):
print("Method 'anthony': Cold guy change rock describe.")
3 + 1
def dustin(self):
print("Method 'dustin': See attention less black.")
10 + 3
def stephanie(self):
print("Method 'stephanie': Across save most whether trade western bring.")
8 + 10
def shannon(self):
print("Method 'shannon': Contain dream send local attorney.")
6 + 4
def patrick(self):
print("Method 'patrick': Them use city evening various build.")
1 + 1
def charles(self):
print("Method 'charles': Above rather certain third remember bad effect.")
2 + 10
def ana(self):
print("Method 'ana': Sound its beautiful western Congress.")
3 + 4
def amber(self):
print("Method 'amber': Economy could east hot easy.")
1 + 6
def evan(self):
print("Method 'evan': Particularly method capital Mr husband.")
4 + 9
def heather(self):
print("Method 'heather': Production then activity brother article feeling.")
4 + 9
def bruce(self):
print("Method 'bruce': That heart professor low.")
6 + 10
def jose(self):
print("Method 'jose': Office forget experience season necessary prove medical.")
6 + 8
def bryan(self):
print("Method 'bryan': These whether should suffer.")
6 + 5
def andrew(self):
print("Method 'andrew': Thus himself table.")
6 + 3
def wendy(self):
print("Method 'wendy': Speech point something nothing tax moment business.")
2 + 6
def gail(self):
print("Method 'gail': Piece industry capital result.")
7 + 1
def evan(self):
print("Method 'evan': Smile sign may just born her no.")
10 + 4
class Campbell:
def randy(self):
print("Method 'randy': Shake somebody west by difficult president receive prove.")
6 + 2
def kimberly(self):
print("Method 'kimberly': Detail might behind north coach add.")
10 + 2
def teresa(self):
print("Method 'teresa': Affect medical spend discover entire hold.")
5 + 9
def kyle(self):
print("Method 'kyle': Everybody seek item song.")
7 + 3
def keith(self):
print("Method 'keith': Open hour crime.")
9 + 7
def joanna(self):
print("Method 'joanna': Contain technology animal result to.")
3 + 2
def robin(self):
print("Method 'robin': Name play realize.")
5 + 2
def steven(self):
print("Method 'steven': Million value what clear knowledge.")
9 + 8
def jerome(self):
print("Method 'jerome': Movement glass tonight simply collection science.")
2 + 9
def megan(self):
print("Method 'megan': Safe example base huge character.")
4 + 3
def sarah(self):
print("Method 'sarah': Rate area push even food action make.")
3 + 5
def mariah(self):
print("Method 'mariah': Use each organization system never good bar.")
10 + 2
def lisa(self):
print("Method 'lisa': Put pattern magazine girl east red poor.")
10 + 5
def john(self):
print("Method 'john': Live deep color rest.")
10 + 1
def phillip(self):
print("Method 'phillip': On improve hundred agreement option practice.")
4 + 8
def michael(self):
print("Method 'michael': Turn kid poor no religious.")
1 + 4
def chad(self):
print("Method 'chad': Party research film race send piece.")
9 + 10
def traci(self):
print("Method 'traci': Continue manage sing public beat address across.")
4 + 10
def hannah(self):
print("Method 'hannah': Trouble think trip support risk in.")
1 + 10
class Dunn:
def jennifer(self):
print("Method 'jennifer': Senior commercial them anyone write.")
5 + 5
def anna(self):
print("Method 'anna': Home sign however.")
1 + 7
def andre(self):
print("Method 'andre': Top piece director.")
7 + 2
def sally(self):
print("Method 'sally': Production arm among site affect staff.")
2 + 6
def mark(self):
print("Method 'mark': Majority already through bank main deep risk protect.")
5 + 1
def megan(self):
print("Method 'megan': According investment pretty career buy concern office important.")
5 + 10
def michael(self):
print("Method 'michael': Part risk save.")
4 + 2
def jennifer(self):
print("Method 'jennifer': Or rest ahead decade fight.")
2 + 4
def ashley(self):
print("Method 'ashley': Decide sound challenge many about.")
4 + 8
def rachel(self):
print("Method 'rachel': Somebody project hour about record.")
6 + 1
class Simmons:
def ian(self):
print("Method 'ian': Popular growth reduce above husband yet protect.")
10 + 6
def nicole(self):
print("Method 'nicole': To end food month tough.")
8 + 9
def roberto(self):
print("Method 'roberto': Manage policy tree others condition president.")
3 + 1
def ryan(self):
print("Method 'ryan': Change edge again space learn common bring.")
5 + 9
def rose(self):
print("Method 'rose': Treat certainly mouth reality year break.")
5 + 10
def anna(self):
print("Method 'anna': Few exactly mean.")
3 + 4
def kenneth(self):
print("Method 'kenneth': Morning ever star benefit.")
3 + 9
def natasha(self):
print("Method 'natasha': Difficult better scene bank represent get.")
2 + 5
def elizabeth(self):
print("Method 'elizabeth': Interesting something stage industry.")
5 + 7
def carl(self):
print("Method 'carl': Direction information quality operation rule lead charge.")
7 + 10
def joe(self):
print("Method 'joe': Cultural reality black friend certain case.")
8 + 1
def daniel(self):
print("Method 'daniel': Consider least paper write fast break near their.")
9 + 8
def mary(self):
print("Method 'mary': Senior church why the direction thank.")
8 + 6
class Wood:
def jessica(self):
print("Method 'jessica': International several relate sell easy data.")
1 + 1
def jessica(self):
print("Method 'jessica': Involve those address alone popular.")
5 + 5
def john(self):
print("Method 'john': Tell general section expect.")
10 + 4
def amber(self):
print("Method 'amber': Impact against behavior newspaper many newspaper.")
9 + 3
def christopher(self):
print("Method 'christopher': Beat know fight above account ball issue.")
8 + 3
def bobby(self):
print("Method 'bobby': Thought leader contain do of.")
3 + 6
def kenneth(self):
print("Method 'kenneth': Summer strategy skill task type.")
10 + 7
def heather(self):
print("Method 'heather': Agree city partner last card remain itself.")
3 + 8
def anthony(self):
print("Method 'anthony': Business public city customer social mention force.")
2 + 5
def dwayne(self):
print("Method 'dwayne': Value soldier ago reduce pretty soldier partner.")
9 + 10
class Rice:
def daniel(self):
print("Method 'daniel': He couple food sea get better everybody fact.")
5 + 6
def brendan(self):
print("Method 'brendan': Less anything room.")
4 + 8
def brian(self):
print("Method 'brian': Level four must much suggest example.")
4 + 6
def jonathan(self):
print("Method 'jonathan': Defense expert save allow.")
9 + 9
def richard(self):
print("Method 'richard': Machine general note loss carry.")
4 + 1
def jared(self):
print("Method 'jared': Arm evidence science teacher measure.")
9 + 6
def emma(self):
print("Method 'emma': Particularly we once.")
4 + 10
def albert(self):
print("Method 'albert': Off eye stage especially sense.")
4 + 9
def michael(self):
print("Method 'michael': Age case decision do.")
6 + 4
def alexis(self):
print("Method 'alexis': Attention late direction close north.")
4 + 10
def randy(self):
print("Method 'randy': Cut with finally gas several speech thank know.")
6 + 8
def stephanie(self):
print("Method 'stephanie': Your difficult nearly peace role account.")
1 + 10
def sarah(self):
print("Method 'sarah': Account safe old ok sound.")
4 + 7
def richard(self):
print("Method 'richard': Nice realize leave behavior no.")
2 + 5
def kimberly(self):
print("Method 'kimberly': Remain unit TV week term trouble against.")
10 + 3
def ashley(self):
print("Method 'ashley': Lead listen participant report against spend.")
7 + 9
def heidi(self):
print("Method 'heidi': Begin whatever his then since price.")
7 + 6
def timothy(self):
print("Method 'timothy': Hotel indeed education.")
8 + 1
def sharon(self):
print("Method 'sharon': Pattern consider significant then set.")
4 + 10
class Brooks:
def kayla(self):
print("Method 'kayla': Air TV design effort amount right table result.")
3 + 6
def angela(self):
print("Method 'angela': Free finally race hospital enough.")
5 + 10
def david(self):
print("Method 'david': Develop today prepare writer memory capital.")
8 + 1
def matthew(self):
print("Method 'matthew': Challenge style environmental apply daughter bed election.")
1 + 5
def jessica(self):
print("Method 'jessica': First hot difficult hair.")
7 + 1
def michael(self):
print("Method 'michael': First billion city popular scene letter direction.")
1 + 3
def leah(self):
print("Method 'leah': Success issue name fast name arm.")
2 + 5
def hunter(self):
print("Method 'hunter': Game arm administration rock both most.")
8 + 10
def peter(self):
print("Method 'peter': Contain know contain above.")
8 + 2
def kenneth(self):
print("Method 'kenneth': Throw any he clearly doctor police loss take.")
4 + 5
def emily(self):
print("Method 'emily': Amount place but television laugh blue space.")
9 + 3
def corey(self):
print("Method 'corey': Price play become sometimes.")
3 + 1
def danny(self):
print("Method 'danny': Expect let degree.")
1 + 10
class Chung:
def belinda(self):
print("Method 'belinda': Entire land within.")
2 + 7
def daisy(self):
print("Method 'daisy': Away since yourself administration phone step.")
4 + 2
def nathan(self):
print("Method 'nathan': Agency memory trial tend wrong sell somebody include.")
4 + 9
def kimberly(self):
print("Method 'kimberly': Suggest hard down today worry explain many.")
6 + 6
def carolyn(self):
print("Method 'carolyn': Employee citizen from else.")
10 + 1
def crystal(self):
print("Method 'crystal': All thing sound research water.")
1 + 9
def elizabeth(self):
print("Method 'elizabeth': Art know population paper.")
4 + 2
def cody(self):
print("Method 'cody': Feeling again buy suddenly.")
4 + 4
def peter(self):
print("Method 'peter': Purpose especially scene.")
3 + 8
def jennifer(self):
print("Method 'jennifer': Again door far population prove with bit.")
9 + 10
def don(self):
print("Method 'don': Sign yeah during need world full nice yourself.")
6 + 1
def kelly(self):
print("Method 'kelly': Good particular less quickly I position.")
5 + 4
class Larson:
def matthew(self):
print("Method 'matthew': Lawyer eat behind of hot customer case.")
2 + 1
def kimberly(self):
print("Method 'kimberly': Ready general heavy far exist across.")
10 + 1
def vanessa(self):
print("Method 'vanessa': Scientist suggest effect.")
9 + 1
def douglas(self):
print("Method 'douglas': Road event poor low.")
7 + 5
def sandy(self):
print("Method 'sandy': Help blood politics over picture.")
1 + 7
def tiffany(self):
print("Method 'tiffany': Often coach scientist sport job walk.")
6 + 6
def deborah(self):
print("Method 'deborah': Voice tree my activity call.")
4 + 2
def timothy(self):
print("Method 'timothy': Among already environment this hour business reduce.")
8 + 2
def sheila(self):
print("Method 'sheila': Rest contain war drug choice.")
5 + 9
def william(self):
print("Method 'william': Apply us street teach peace.")
6 + 4
def emily(self):
print("Method 'emily': Blood hold series anything air color myself question.")
3 + 4
def aaron(self):
print("Method 'aaron': Hospital not pay born.")
3 + 4
def bryce(self):
print("Method 'bryce': Star purpose understand exist minute result sort.")
10 + 1
class Rodriguez:
def april(self):
print("Method 'april': Contain prepare own last whose western.")
7 + 7
def justin(self):
print("Method 'justin': Industry across itself trade gun.")
8 + 6
def matthew(self):
print("Method 'matthew': Either husband hear.")
7 + 7
def justin(self):
print("Method 'justin': Something stock six put yet Republican gun.")
9 + 10
def mark(self):
print("Method 'mark': Fire figure American price sea.")
3 + 5
def kaitlin(self):
print("Method 'kaitlin': Front newspaper thousand lay its.")
10 + 7
def isabella(self):
print("Method 'isabella': Measure several so keep election.")
2 + 2
def george(self):
print("Method 'george': Individual environmental build manage.")
6 + 6
def jenna(self):
print("Method 'jenna': Fish sign painting read focus minute.")
8 + 3
def vanessa(self):
print("Method 'vanessa': Trade most management kitchen security market game cell.")
1 + 9
def lisa(self):
print("Method 'lisa': About anything similar rest.")
4 + 3
class Lawrence:
def brent(self):
print("Method 'brent': Face part before per land certainly only.")
2 + 2
def russell(self):
print("Method 'russell': Western reduce some yard war probably pass.")
2 + 9
def michelle(self):
print("Method 'michelle': Left might tell.")
7 + 6
def paula(self):
print("Method 'paula': Quickly threat behavior approach black.")
4 + 9
def carolyn(self):
print("Method 'carolyn': Style marriage painting know where machine choose.")
6 + 3
def lauren(self):
print("Method 'lauren': Whole first station way food goal future consider.")
9 + 4
def joseph(self):
print("Method 'joseph': Trouble believe see military suggest.")
9 + 8
def sean(self):
print("Method 'sean': Front positive rate case idea perhaps someone.")
10 + 1
def joshua(self):
print("Method 'joshua': Newspaper culture ready school.")
6 + 1
def kristina(self):
print("Method 'kristina': Everyone always forward bag.")
2 + 3
def eric(self):
print("Method 'eric': Condition clearly economic social pick wall whole.")
2 + 4
def charles(self):
print("Method 'charles': Job girl mission help at.")
10 + 1
def ryan(self):
print("Method 'ryan': Democrat matter trial phone just full.")
1 + 6
def amanda(self):
print("Method 'amanda': Half probably social all follow think.")
7 + 2
def andrea(self):
print("Method 'andrea': Night collection thousand.")
3 + 7
def justin(self):
print("Method 'justin': You responsibility sort natural defense act up.")
10 + 5
def michael(self):
print("Method 'michael': Western new manager way popular leave early partner.")
2 + 8
def teresa(self):
print("Method 'teresa': Him security it avoid option.")
8 + 7
def dalton(self):
print("Method 'dalton': Little government few ahead.")
9 + 10
planetary_computer.settings.set_subscription_key('1d7ae9ea9d3843749757036a903ddb6c')
os.environ['AWS_ACCESS_KEY_ID'] = 'AKIA4XSFKWWE4JRSPNED'
os.environ['AWS_SECRET_ACCESS_KEY'] = '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'
class FsspecStacIO(DefaultStacIO):
def read_text(self, href: str) -> str:
with fsspec.open(href, mode='r') as f:
return f.read()
def write_text(self, href: str, txt: str) -> None:
with fsspec.open(href, mode='w') as f:
f.write(txt)
StacIO.set_default(FsspecStacIO)
def convert_to_serializable(obj):
if isinstance(obj, dict):
return {str(k): convert_to_serializable(v) for k, v in obj.items()}
elif isinstance(obj, list):
return [convert_to_serializable(v) for v in obj]
elif isinstance(obj, (np.integer, np.floating)):
return obj.item()
elif isinstance(obj, np.ndarray):
return obj.tolist()
return obj
def get_system_dump():
return {'os': platform.system(), 'os_version': platform.version(), 'os_release': platform.release(), 'architecture': platform.architecture()[0], 'processor': platform.processor(), 'cpu_cores_physical': psutil.cpu_count(logical=False), 'cpu_cores_logical': psutil.cpu_count(logical=True), 'ram': round(psutil.virtual_memory().total / 1024 ** 3, 2), 'hostname': socket.gethostname(), 'ip_address': socket.gethostbyname(socket.gethostname()), 'python_version': platform.python_version(), 'machine': platform.machine(), 'boot_time': psutil.boot_time(), 'disk_total_gb': round(psutil.disk_usage('/').total / 1024 ** 3, 2), 'disk_used_gb': round(psutil.disk_usage('/').used / 1024 ** 3, 2), 'disk_free_gb': round(psutil.disk_usage('/').free / 1024 ** 3, 2)}
class DatacubeMiner:
def __init__(self, google=True):
self.google = google
self.usa = 'POLYGON ((-124.453125 48.180655, -124.057615 46.920084, -124.628905 42.843568, -123.35449 38.822395, -121.992186 36.668218, -120.366209 34.488241, -119.124756 34.111779, -118.707275 34.04353, -118.256836 33.756289, -117.784424 33.523053, -117.388916 33.206494, -117.114256 32.805533, -114.653318 32.620658, -110.03906 31.690568, -106.743161 31.989229, -105.029294 30.902009, -103.403318 28.998312, -102.832028 29.878537, -101.425778 29.878537, -99.755856 27.916544, -97.426755 26.155212, -96.987301 28.071758, -94.6582 29.420241 , -88.989254 30.1069, -84.067379 30.14491, -81.079097 25.085371, -80.156246 26.273488, -82.265621 31.24077, -77.124019 34.741406, -75.585933 37.822604, -74.091792 40.780352, -70.883784 41.836641, -69.960932 43.96101, -67.060542 44.24502, -68.027338 47.010055, -69.301753 47.279059, -70.883784 45.088859, -75.805659 44.276492, -79.101558 42.617607, -83.540035 41.705541, -83.627925 45.521569, -89.78027 47.812987, -95.185544 48.980135, -122.475585 48.893533, -122.849121 47.945703, -124.453125 48.180655))'
self.usa = shapely.from_wkt(self.usa)
self.india = 'POLYGON ((75.585953 36.597085, 67.675796 24.3662, 71.894546 20.960503, 76.464859 7.884153, 80.332047 13.580946, 81.914078 17.475476, 87.71486 21.778974, 92.285173 21.452135, 97.734392 27.993516, 92.285173 28.766781, 81.562516 31.202548, 75.585953 36.597085))'
self.india = shapely.from_wkt(self.india)
if self.google:
self.google_miner = miner.GoogleBaseMapMiner(install_chrome=False)
else:
self.naip_miner = miner.NAIPMiner()
self.s2_miner = miner.Sentinel2Miner()
self.s1_miner = miner.Sentinel1Miner()
self.landsat_miner = miner.LandsatMiner()
self.modis_miner = miner.MODISMiner()
self.lulc_miner = miner.ESRILULCMiner()
def mine(self, lat=None, lon=None, radius=500, duration=75):
google = self.google
if google:
polygon = self.india
base_miner = self.google_miner
else:
polygon = self.usa
base_miner = self.naip_miner
if lat is None:
point = next((Point(p) for p in zip([np.random.uniform(*polygon.bounds[::2]) for _ in range(1000)], [np.random.uniform(*polygon.bounds[1::2]) for _ in range(1000)]) if Point(p).within(polygon)))
lat, lon = (point.y, point.x)
print(lat, lon)
if google:
ds = base_miner.fetch(lat=lat, lon=lon, radius=radius, reproject=True)
else:
ds = base_miner.fetch(lat=lat, lon=lon, radius=radius, daterange='2020-01-01/2024-12-31')
print(f"Fetched Time : {ds.attrs['metadata']['date']['value']}")
ds.coords['time'] = ds.attrs['metadata']['date']['value']
ds = ds.transpose('band', 'y', 'x')
daterange = f"{str((pd.to_datetime(ds.attrs['metadata']['date']['value']) - pd.Timedelta(value=duration, unit='d')).date())}/{str((pd.to_datetime(ds.attrs['metadata']['date']['value']) + pd.Timedelta(value=3, unit='d')).date())}"
ds_sentinel2 = self.s2_miner.fetch(lat, lon, radius, daterange=daterange).sortby('y').sortby('x')
ds_modis = self.modis_miner.fetch(lat, lon, radius, daterange=daterange).sortby('y').sortby('x')
ds_sentinel1 = self.s1_miner.fetch(lat, lon, radius, daterange=daterange).sortby('y').sortby('x')
ds_lulc = self.lulc_miner.fetch(lat, lon, radius, daterange='2024-01-01/2024-12-31').sortby('y').sortby('x')
ds_modis, ds_sentinel2, ds_sentinel1, ds_lulc = dask.compute(ds_modis, ds_sentinel2, ds_sentinel1, ds_lulc)
ys = np.linspace(ds_sentinel2.y.values[0], ds_sentinel2.y.values[-1], num=16 * len(ds_sentinel2.y.values))
xs = np.linspace(ds_sentinel2.x.values[0], ds_sentinel2.x.values[-1], num=16 * len(ds_sentinel2.x.values))
ds = ds.sel(x=xs, y=ys, method='nearest')
ds['y'], ds['x'] = (ys, xs)
bands = ['B01', 'B02', 'B03', 'B04', 'B05', 'B06', 'B07', 'B08', 'B09', 'B11', 'B12', 'B8A', 'SCL']
ds_sentinel2 = xr.concat(objs=[ds_sentinel2[band] for band in bands], dim='band').transpose('time', 'band', 'y', 'x')
ds_sentinel2['band'] = bands
ds_sentinel2.name = 'Sentinel-2'
bands = ['vv', 'vh']
ds_sentinel1 = xr.concat(objs=[ds_sentinel1[band] for band in bands], dim='band').transpose('time', 'band', 'y', 'x')
ds_sentinel1['band'] = bands
ds_sentinel1.name = 'Sentinel-1'
bands = ['sur_refl_b01', 'sur_refl_b02', 'sur_refl_b03', 'sur_refl_b04', 'sur_refl_b05', 'sur_refl_b06', 'sur_refl_b07']
ds_modis = xr.concat(objs=[ds_modis[band] for band in bands], dim='band').transpose('time', 'band', 'y', 'x')
ds_modis['band'] = bands
ds_modis.name = 'MODIS'
ds, index = self.equalize(ds_sentinel2, ds)
ds = self.align(ds_sentinel2.isel(time=index), ds)
datacube = {'ds': ds, 'ds_sentinel2': ds_sentinel2, 'ds_sentinel1': ds_sentinel1, 'ds_modis': ds_modis, 'ds_lulc': ds_lulc['data'].isel(time=0), 'index': index}
datacube['metadata'] = self.get_metadata(datacube)
if google:
datacube['metadata']['source'] = 'google'
else:
datacube['metadata']['source'] = 'naip'
return datacube
def equalize(self, ds_sentinel2, ds_google):
n_bands = len(ds_google.band)
ds_sentinel2 = ds_sentinel2.sel(band=['B04', 'B03', 'B02', 'B08', 'SCL'])
ds_google = ds_google.astype('float32')
for index in range(-1, -4, -1):
cloud_mask = ds_sentinel2.sel(band='SCL').isel(time=index).isin([8, 9, 10, 11]) | (ds_sentinel2.sel(band='B02').isel(time=index) >= 5000)
cloud_fraction = float(cloud_mask.data.mean())
if cloud_fraction < 0.03:
ds_placeholder = copy.deepcopy(ds_sentinel2.isel(time=index))
for band_index in range(len(ds_placeholder.band)):
ds_placeholder.data[band_index] = np.where(ds_placeholder.data[band_index] >= np.percentile(ds_placeholder.data[band_index], 99.9), np.median(ds_placeholder.data[band_index]), ds_placeholder.data[band_index])
ds_google.data = exposure.match_histograms(ds_google.data[:n_bands], ds_placeholder.data[:n_bands, :, :], channel_axis=0)
break
if cloud_fraction >= 0.05:
raise Exception('Entire Data is Cloudy')
return (ds_google, index)
def align(self, ds_sentinel2, ds_google):
n_bands = len(ds_google.band)
ds_sentinel2 = ds_sentinel2.sel(band=['B04', 'B03', 'B02', 'B08'][:n_bands])
ds_google = copy.deepcopy(ds_google)
n = 6
min_l1 = np.median(np.abs(ds_sentinel2.sel(x=ds_google.x.values, y=ds_google.y.values, method='nearest').data[:n_bands] - ds_google.data[:n_bands]))
while n > 0:
n -= 1
reference_image, target_image = DatacubeMiner.correct_shift(reference_image=ds_sentinel2.sel(x=ds_google.x.values, y=ds_google.y.values, method='nearest').data[:n_bands], target_image=ds_google.data[:n_bands])
target_image = nn.Upsample(size=ds_google.shape[1:])(torch.tensor(target_image[np.newaxis])).data.cpu().numpy()[0, :]
l1_loss = np.median(np.abs(ds_sentinel2.sel(x=ds_google.x.values, y=ds_google.y.values, method='nearest').data[:n_bands] - target_image[:n_bands]))
if l1_loss < min_l1:
min_l1 = l1_loss
ds_google.data[:n_bands] = nn.Upsample(size=ds_google.shape[1:])(torch.tensor(target_image[np.newaxis])).data.cpu().numpy()[0, :]
else:
break
return ds_google
@staticmethod
@njit(parallel=True, cache=False)
def correct_shift(reference_image, target_image):
"""
A Module to Predict Shift in Histogram Mapped Satellite Imagery.
Arguments :
reference_image : numpy array (C,H,W)
target_image : numpy array (C,H,W)
"""
shift_limits = np.array([-20, 20])
shift_range = np.arange(shift_limits[0], shift_limits[1], 2)
num_shifts = len(shift_range)
min_l1 = 100000
min_shift_y, min_shift_x = (0, 0)
for shift_y_id in prange(num_shifts):
shift_y = shift_range[shift_y_id]
for shift_x_id in range(num_shifts):
shift_x = shift_range[shift_x_id]
if shift_x > 0:
sentinel_shifted = reference_image[:, :, shift_x:]
naip_shifted = target_image[:, :, :-shift_x]
elif shift_x < 0:
sentinel_shifted = reference_image[:, :, :shift_x]
naip_shifted = target_image[:, :, -shift_x:]
if shift_y > 0:
sentinel_shifted = sentinel_shifted[:, shift_y:, :]
naip_shifted = naip_shifted[:, :-shift_y, :]
elif shift_y < 0:
sentinel_shifted = sentinel_shifted[:, :shift_y, :]
naip_shifted = naip_shifted[:, -shift_y:, :]
l1_error = np.mean(np.abs(sentinel_shifted - naip_shifted))
if l1_error < min_l1:
min_l1 = l1_error
min_shift_y, min_shift_x = (shift_y, shift_x)
if min_l1 == 0:
return (sentinel_shifted, naip_shifted)
shift_x, shift_y = (int(min_shift_x), int(min_shift_y))
if shift_x > 0:
sentinel_shifted = reference_image[:, :, shift_x:]
naip_shifted = target_image[:, :, :-shift_x]
elif shift_x < 0:
sentinel_shifted = reference_image[:, :, :shift_x]
naip_shifted = target_image[:, :, -shift_x:]
if shift_y > 0:
sentinel_shifted = sentinel_shifted[:, shift_y:, :]
naip_shifted = naip_shifted[:, :-shift_y, :]
elif shift_y < 0:
sentinel_shifted = sentinel_shifted[:, :shift_y, :]
naip_shifted = naip_shifted[:, -shift_y:, :]
return (sentinel_shifted, naip_shifted)
def get_metadata(self, datacube):
datacube['ds'].name = 'ds'
hist1, _ = np.histogram(datacube['ds'].data.ravel(), bins=10, density=True)
hist2, _ = np.histogram(datacube['ds_sentinel2'].sel(band=['B04', 'B03', 'B02', 'B08'][:len(datacube['ds'].band)]).isel(time=datacube['index']).data.ravel(), bins=10, density=True)
kl_div = entropy(hist1 + 1e-10, hist2 + 1e-10)
l1_loss = np.abs(datacube['ds_sentinel2'].sel(band=['B04', 'B03', 'B02', 'B08'][:len(datacube['ds'].band)]).isel(time=datacube['index']).sel(x=datacube['ds'].x.values, y=datacube['ds'].y.values, method='nearest').data - datacube['ds'].data).mean()
df_lulc = datacube['ds_lulc'].to_dataframe()
df_lulc_value_counts = df_lulc.data.value_counts()
lulc_mapping = {0: 'no_data', 1: 'water', 2: 'trees', 4: 'flooded_vegetation', 5: 'crops', 7: 'built_area', 8: 'bare_ground', 9: 'snow_ice', 10: 'clouds', 11: 'rangeland'}
metadata = {'date': pd.to_datetime(datacube['ds'].attrs['metadata']['date']['value']), 'source': 'google', 'closest_index': datacube['index'], 'cloud_cover': {f'{time_index}': datacube['ds_sentinel2'].sel(band='SCL').isel(time=time_index).isin([8, 9, 10, 11]).data.mean() for time_index in range(-1, -(len(datacube['ds_sentinel2'].time) - 1), -1)}, 'delta': {'sentinel2': (pd.to_datetime(datacube['ds'].attrs['metadata']['date']['value']) - pd.to_datetime(pd.to_datetime(datacube['ds_sentinel2'].time[-1].data).date())).days, 'sentinel1': (pd.to_datetime(datacube['ds'].attrs['metadata']['date']['value']) - pd.to_datetime(pd.to_datetime(datacube['ds_sentinel1'].time[-1].data).date())).days, 'modis': (pd.to_datetime(datacube['ds'].attrs['metadata']['date']['value']) - pd.to_datetime(pd.to_datetime(datacube['ds_modis'].time[-1].data).date())).days}, 'lulc_distribution': {lulc_mapping[lulc_class]: df_lulc_value_counts.loc[lulc_class] / len(df_lulc) if lulc_class in df_lulc_value_counts.index else 0 for lulc_class in lulc_mapping}, 'data_quality': {'kl_loss': kl_div, 'l1_loss': l1_loss}, 'data_description': {'gt': {['red', 'green', 'blue', 'nir'][band_index]: datacube['ds'].isel(band=band_index).to_dataframe().describe(include='all').iloc[4:, -1].to_dict() for band_index in range(len(datacube['ds'].band))}, 'sentinel2': {time_index: {band: datacube['ds_sentinel2'].sel(band=band).isel(time=time_index).to_dataframe().describe(include='all').iloc[4:, -1].to_dict() for band in datacube['ds_sentinel2'].band.values} for time_index in range(-1, -(len(datacube['ds_sentinel2'].time) + 1), -1)}, 'sentinel1': {time_index: {band: datacube['ds_sentinel1'].sel(band=band).isel(time=time_index).to_dataframe().describe(include='all').iloc[4:, -1].to_dict() for band in datacube['ds_sentinel1'].band.values} for time_index in range(-1, -(len(datacube['ds_sentinel1'].time) + 1), -1)}, 'modis': {time_index: {band: datacube['ds_modis'].sel(band=band).isel(time=time_index).to_dataframe().describe(include='all').iloc[4:, -1].to_dict() for band in datacube['ds_modis'].band.values} for time_index in range(-1, -(len(datacube['ds_modis'].time) + 1), -1)}}}
return metadata
@staticmethod
def store(google=False):
store_path = 's3://general-dump/super-resolution-4.0/database/store.zarr'
datacube_miner = DatacubeMiner(google=google)
print('Miner initialized')
while True:
try:
print('...........................Mining................................')
mining_start_time = time.time()
datacube = datacube_miner.mine()
mining_end_time = time.time()
print(f'................Mined ({mining_end_time - mining_start_time} sec)..............')
except KeyboardInterrupt:
break
except Exception as e:
print(f'Exception occurred: {e}')
if datacube_miner.google:
datacube_miner.google_miner.driver.quit()
del datacube_miner
gc.collect()
datacube_miner = DatacubeMiner(google=google)
continue
group_id = str(uuid.uuid4())
print(f'Uploading to : {group_id}..............')
uploading_start_time = time.time()
datacube['ds'].to_dataset(name='gt').to_zarr(store_path, group=f'{group_id}/gt', consolidated=False)
print(f' {group_id} : ds dumped to s3')
datacube['ds_sentinel2'].to_dataset(name='sentinel2').to_zarr(store_path, group=f'{group_id}/sentinel2', consolidated=False)
print(f' {group_id} : ds_sentinel2 dumped to s3')
datacube['ds_sentinel1'].to_dataset(name='sentinel1').to_zarr(store_path, group=f'{group_id}/sentinel1', consolidated=False)
print(f' {group_id} : ds_sentinel1 dumped to s3')
datacube['ds_modis'].to_dataset(name='modis').to_zarr(store_path, group=f'{group_id}/modis', consolidated=False)
print(f' {group_id} : ds_modis dumped to s3')
datacube['ds_lulc'].to_dataset(name='lulc').to_zarr(store_path, group=f'{group_id}/lulc', consolidated=False)
print(f' {group_id} : ds_lulc dumped to s3')
print(f'Uploading Metadata to {group_id}.............')
metadata = datacube['metadata']
metadata['date'] = str(metadata['date'].date())
metadata['created_date'] = str(pd.Timestamp.now(tz=pytz.timezone('Asia/Kolkata')).date())
metadata['system'] = get_system_dump()
zarr.open_group(store_path, path=group_id, mode='a').attrs.update(metadata)
print(f' {group_id} : metadata dumped to s3')
uploading_end_time = time.time()
print(f'----------- {group_id} S3 Dumping Finished ({uploading_end_time - uploading_start_time} sec)-------------')
class DashBoard:
def __init__(self):
self.fs = s3fs.S3FileSystem(anon=True)
self.datacube_count = 0
self.update_thread = Thread(target=self.update_datacube_count)
self.update_thread.daemon = True
self.update_thread.start()
def update_datacube_count(self):
while True:
try:
self.fs.invalidate_cache()
self.datacube_count = len(self.fs.ls('s3://general-dump/super-resolution-4.0/database/store.zarr/', refresh=True))
except Exception as e:
print(f'Error reading from S3: {e}')
time.sleep(5)
def display_datacube_count(self):
return f"<div style='font-size: 1.5rem; color: #ffffff;'>🌍 <b>Datacubes Mined:</b> {self.datacube_count}</div><p style='color: #FFD700; margin-top: 10px;'>πŸ’‘ 'Mining Insights from Space, One Datacube at a Time'</p>"
def launch_dashboard(self):
with gr.Blocks(css="\n @import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;700&family=Space+Mono:wght@700&display=swap');\n\n body {\n font-family: 'Roboto', sans-serif;\n background: linear-gradient(180deg, #0f2027, #203a43, #2c5364);\n color: white;\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n }\n\n #header {\n font-family: 'Space Mono', monospace;\n text-align: center;\n font-size: 3.5rem;\n color: #FFD700;\n text-shadow: 0 0 20px #FFD700, 0 0 30px #FFD700;\n margin: 20px 0;\n }\n\n #datacube-section {\n background: rgba(255, 255, 255, 0.1);\n padding: 20px;\n border-radius: 15px;\n box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);\n transition: transform 0.3s, box-shadow 0.3s;\n }\n\n #datacube-section:hover {\n transform: translateY(-10px);\n box-shadow: 0px 10px 25px rgba(0, 0, 0, 0.5);\n }\n\n .live-counter {\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1.8rem;\n color: #00ff99;\n font-family: 'Space Mono', monospace;\n background: rgba(0, 255, 153, 0.1);\n padding: 15px;\n border-radius: 10px;\n border: 2px solid #00ff99;\n box-shadow: 0px 4px 10px rgba(0, 255, 153, 0.5);\n }\n\n footer {\n margin-top: 50px;\n text-align: center;\n color: rgba(255, 255, 255, 0.7);\n font-size: 1rem;\n }\n\n footer a {\n color: #FFD700;\n text-decoration: none;\n }\n\n footer a:hover {\n text-decoration: underline;\n }\n ") as dashboard:
gr.Markdown('\n <div id="header">🌌 <b>Earth Scraper Dashboard</b></div>\n ', elem_id='header')
with gr.Row():
with gr.Column(scale=2):
gr.Markdown('\n <div id="datacube-section">\n <h2 style="text-align: center; color: #FFD700; font-family: \'Space Mono\';">Real-Time Mining Progress</h2>\n <p style="text-align: center; color: rgba(255,255,255,0.8); font-size: 1.2rem;">\n Keep track of the datacubes mined in real time with our cutting-edge dynamic tracker. \n </p>\n </div>\n ', elem_id='datacube-section')
with gr.Column(scale=1):
dynamic_display = gr.HTML(value=self.display_datacube_count(), label='Datacube Count', elem_classes='live-counter')
dashboard.load(self.display_datacube_count, [], dynamic_display)
gr.Markdown('\n <footer>\n πŸš€ Powered by <a href="https://huggingface.co/spaces" target="_blank">Hugging Face Spaces</a> | Built with πŸ’‘ by Gajesh Ladhar\n </footer>\n ')
dashboard.launch(share=True)
def mine_cubes():
while True:
try:
DatacubeMiner.store(google=True)
except Exception as e:
print(f'Exception occurred: {e}')
continue
def mine():
n_workers = 3
for work in range(n_workers):
if work == 0:
Thread(target=mine_cubes).start()
time.sleep(60 * 4)
Thread(target=mine_cubes).start()
mine_thread = Thread(target=mine)
mine_thread.start()
dashboard = DashBoard()
dashboard.launch_dashboard()