ndvi1.py 679 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648
  1. import numpy as np
  2. import time,sys
  3. import requests
  4. import json
  5. import matplotlib
  6. import matplotlib as mpl
  7. mpl.use('Agg')
  8. import matplotlib.pyplot as plt
  9. import datetime
  10. import os
  11. import urllib
  12. import urllib.request
  13. import urllib.parse
  14. import base64
  15. #import cv2
  16. from PIL import Image
  17. import time
  18. import pymysql
  19. def img1_1():
  20. try:
  21. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  22. charset='utf8')
  23. a = db.cursor()
  24. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  25. result = a.fetchall()
  26. if result ==():
  27. s =""
  28. else:
  29. s = "_" + result[0][3]
  30. db.close()
  31. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  32. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  33. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  34. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  35. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  36. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  37. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  38. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  39. date += s
  40. label= datetime.datetime.now().strftime('No.1 Direction 1 @%Y.%m.%d.%H.%M.%S')
  41. rgb_img0 = Image.open('/var/www/html/cust/1/c/b1.tif')
  42. ir_img0 = Image.open('/var/www/html/cust/1/c/a1.tif')
  43. rgb_img0.save(nt)
  44. ir_img0.save(irt)
  45. rgb_img0.save(nj,quality=95)
  46. ir_img0.save(irj,quality=95)
  47. r,_,_ = rgb_img0.split()
  48. r = np.asarray(r, dtype=float)
  49. ir,_,_ = ir_img0.split()
  50. ir = np.asarray(ir, dtype=float)
  51. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  52. np.seterr(divide='ignore', invalid='ignore')
  53. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  54. # Display the results
  55. fig, ax = plt.subplots()
  56. plt.plot(ndvi)
  57. plt.axis('off')
  58. plt.figure(figsize=(19, 10))
  59. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  60. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  61. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  62. plt.margins(0, 0)
  63. #plt.show()
  64. plt.savefig(ndvis)
  65. plt.savefig(ndvia)
  66. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  67. plt.close('all')
  68. f = open('/var/www/html/cust/c1_1.txt','a')
  69. f.write(date)
  70. f.close()
  71. dress = '/var/www/html/cust/1/c/'
  72. for root, dirs, files in os.walk(dress):
  73. print('files: {}'.format(len(files)))
  74. if len(files)>=1:
  75. files.sort()
  76. for f in files:
  77. with open(os.path.join(root, f), "rb") as imageFile:
  78. str = base64.b64encode(imageFile.read())
  79. url = 'http://60.250.156.234/cust/t1.php'
  80. values = {'data1':str, 'name':f}
  81. data1 = urllib.parse.urlencode(values)
  82. data1 = data1.encode('utf-8')
  83. req = urllib.request.Request(url, data1)
  84. req.add_header('User-Agent','Magic Browser')
  85. resp = urllib.request.urlopen(req)
  86. respdata1 = resp.read()
  87. print(os.path.join(root, f))
  88. #print(respdata1)
  89. os.remove(os.path.join(root, f))
  90. print("ok")
  91. except:
  92. print('error')
  93. def img1_2():
  94. try:
  95. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  96. charset='utf8')
  97. a = db.cursor()
  98. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  99. result = a.fetchall()
  100. if result ==():
  101. s =""
  102. else:
  103. s = "_" + result[0][3]
  104. db.close()
  105. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  106. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  107. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  108. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  109. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  110. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  111. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  112. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  113. date += s
  114. label= datetime.datetime.now().strftime('No.1 Direction 2 @%Y.%m.%d.%H.%M.%S')
  115. rgb_img0 = Image.open('/var/www/html/cust/1/c/b2.tif')
  116. ir_img0 = Image.open('/var/www/html/cust/1/c/a2.tif')
  117. rgb_img0.save(nt)
  118. ir_img0.save(irt)
  119. rgb_img0.save(nj,quality=95)
  120. ir_img0.save(irj,quality=95)
  121. r,_,_ = rgb_img0.split()
  122. r = np.asarray(r, dtype=float)
  123. ir,_,_ = ir_img0.split()
  124. ir = np.asarray(ir, dtype=float)
  125. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  126. np.seterr(divide='ignore', invalid='ignore')
  127. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  128. # Display the results
  129. fig, ax = plt.subplots()
  130. plt.plot(ndvi)
  131. plt.axis('off')
  132. plt.figure(figsize=(19, 10))
  133. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  134. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  135. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  136. plt.margins(0, 0)
  137. #plt.show()
  138. plt.savefig(ndvis)
  139. plt.savefig(ndvia)
  140. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  141. plt.close('all')
  142. f = open('/var/www/html/cust/c1_2.txt','a')
  143. f.write(date)
  144. f.close()
  145. dress = '/var/www/html/cust/1/c/'
  146. for root, dirs, files in os.walk(dress):
  147. print('files: {}'.format(len(files)))
  148. if len(files)>=1:
  149. files.sort()
  150. for f in files:
  151. with open(os.path.join(root, f), "rb") as imageFile:
  152. str = base64.b64encode(imageFile.read())
  153. url = 'http://60.250.156.234/cust/t1.php'
  154. values = {'data1':str, 'name':f}
  155. data1 = urllib.parse.urlencode(values)
  156. data1 = data1.encode('utf-8')
  157. req = urllib.request.Request(url, data1)
  158. req.add_header('User-Agent','Magic Browser')
  159. resp = urllib.request.urlopen(req)
  160. respdata1 = resp.read()
  161. print(os.path.join(root, f))
  162. #print(respdata1)
  163. os.remove(os.path.join(root, f))
  164. print("ok")
  165. except:
  166. print('error')
  167. def img1_3():
  168. try:
  169. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  170. charset='utf8')
  171. a = db.cursor()
  172. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  173. result = a.fetchall()
  174. if result ==():
  175. s =""
  176. else:
  177. s = "_" + result[0][3]
  178. db.close()
  179. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  180. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  181. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  182. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  183. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  184. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  185. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  186. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  187. date += s
  188. label= datetime.datetime.now().strftime('No.1 Direction 3 @%Y.%m.%d.%H.%M.%S')
  189. rgb_img0 = Image.open('/var/www/html/cust/1/c/b3.tif')
  190. ir_img0 = Image.open('/var/www/html/cust/1/c/a3.tif')
  191. rgb_img0.save(nt)
  192. ir_img0.save(irt)
  193. rgb_img0.save(nj,quality=95)
  194. ir_img0.save(irj,quality=95)
  195. r,_,_ = rgb_img0.split()
  196. r = np.asarray(r, dtype=float)
  197. ir,_,_ = ir_img0.split()
  198. ir = np.asarray(ir, dtype=float)
  199. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  200. np.seterr(divide='ignore', invalid='ignore')
  201. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  202. # Display the results
  203. fig, ax = plt.subplots()
  204. plt.plot(ndvi)
  205. plt.axis('off')
  206. plt.figure(figsize=(19, 10))
  207. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  208. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  209. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  210. plt.margins(0, 0)
  211. #plt.show()
  212. plt.savefig(ndvis)
  213. plt.savefig(ndvia)
  214. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  215. plt.close('all')
  216. f = open('/var/www/html/cust/c1_3.txt','a')
  217. f.write(date)
  218. f.close()
  219. dress = '/var/www/html/cust/1/c/'
  220. for root, dirs, files in os.walk(dress):
  221. print('files: {}'.format(len(files)))
  222. if len(files)>=1:
  223. files.sort()
  224. for f in files:
  225. with open(os.path.join(root, f), "rb") as imageFile:
  226. str = base64.b64encode(imageFile.read())
  227. url = 'http://60.250.156.234/cust/t1.php'
  228. values = {'data1':str, 'name':f}
  229. data1 = urllib.parse.urlencode(values)
  230. data1 = data1.encode('utf-8')
  231. req = urllib.request.Request(url, data1)
  232. req.add_header('User-Agent','Magic Browser')
  233. resp = urllib.request.urlopen(req)
  234. respdata1 = resp.read()
  235. print(os.path.join(root, f))
  236. #print(respdata1)
  237. os.remove(os.path.join(root, f))
  238. print("ok")
  239. except:
  240. print('error')
  241. def img1_4():
  242. try:
  243. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  244. charset='utf8')
  245. a = db.cursor()
  246. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  247. result = a.fetchall()
  248. if result ==():
  249. s =""
  250. else:
  251. s = "_" + result[0][3]
  252. db.close()
  253. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  254. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  255. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  256. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  257. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  258. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  259. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  260. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  261. date += s
  262. label= datetime.datetime.now().strftime('No.1 Direction 4 @%Y.%m.%d.%H.%M.%S')
  263. rgb_img0 = Image.open('/var/www/html/cust/1/c/b4.tif')
  264. ir_img0 = Image.open('/var/www/html/cust/1/c/a4.tif')
  265. rgb_img0.save(nt)
  266. ir_img0.save(irt)
  267. rgb_img0.save(nj,quality=95)
  268. ir_img0.save(irj,quality=95)
  269. r,_,_ = rgb_img0.split()
  270. r = np.asarray(r, dtype=float)
  271. ir,_,_ = ir_img0.split()
  272. ir = np.asarray(ir, dtype=float)
  273. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  274. np.seterr(divide='ignore', invalid='ignore')
  275. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  276. # Display the results
  277. fig, ax = plt.subplots()
  278. plt.plot(ndvi)
  279. plt.axis('off')
  280. plt.figure(figsize=(19, 10))
  281. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  282. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  283. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  284. plt.margins(0, 0)
  285. #plt.show()
  286. plt.savefig(ndvis)
  287. plt.savefig(ndvia)
  288. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  289. plt.close('all')
  290. f = open('/var/www/html/cust/c1_4.txt','a')
  291. f.write(date)
  292. f.close()
  293. dress = '/var/www/html/cust/1/c/'
  294. for root, dirs, files in os.walk(dress):
  295. print('files: {}'.format(len(files)))
  296. if len(files)>=1:
  297. files.sort()
  298. for f in files:
  299. with open(os.path.join(root, f), "rb") as imageFile:
  300. str = base64.b64encode(imageFile.read())
  301. url = 'http://60.250.156.234/cust/t1.php'
  302. values = {'data1':str, 'name':f}
  303. data1 = urllib.parse.urlencode(values)
  304. data1 = data1.encode('utf-8')
  305. req = urllib.request.Request(url, data1)
  306. req.add_header('User-Agent','Magic Browser')
  307. resp = urllib.request.urlopen(req)
  308. respdata1 = resp.read()
  309. print(os.path.join(root, f))
  310. #print(respdata1)
  311. os.remove(os.path.join(root, f))
  312. print("ok")
  313. except:
  314. print('error')
  315. def img1_5():
  316. try:
  317. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  318. charset='utf8')
  319. a = db.cursor()
  320. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  321. result = a.fetchall()
  322. if result ==():
  323. s =""
  324. else:
  325. s = "_" + result[0][3]
  326. db.close()
  327. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  328. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  329. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  330. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  331. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  332. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  333. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  334. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  335. date += s
  336. label= datetime.datetime.now().strftime('No.1 Direction 5 @%Y.%m.%d.%H.%M.%S')
  337. rgb_img0 = Image.open('/var/www/html/cust/1/c/b5.tif')
  338. ir_img0 = Image.open('/var/www/html/cust/1/c/a5.tif')
  339. rgb_img0.save(nt)
  340. ir_img0.save(irt)
  341. rgb_img0.save(nj,quality=95)
  342. ir_img0.save(irj,quality=95)
  343. r,_,_ = rgb_img0.split()
  344. r = np.asarray(r, dtype=float)
  345. ir,_,_ = ir_img0.split()
  346. ir = np.asarray(ir, dtype=float)
  347. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  348. np.seterr(divide='ignore', invalid='ignore')
  349. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  350. # Display the results
  351. fig, ax = plt.subplots()
  352. plt.plot(ndvi)
  353. plt.axis('off')
  354. plt.figure(figsize=(19, 10))
  355. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  356. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  357. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  358. plt.margins(0, 0)
  359. #plt.show()
  360. plt.savefig(ndvis)
  361. plt.savefig(ndvia)
  362. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  363. plt.close('all')
  364. f = open('/var/www/html/cust/c1_5.txt','a')
  365. f.write(date)
  366. f.close()
  367. dress = '/var/www/html/cust/1/c/'
  368. for root, dirs, files in os.walk(dress):
  369. print('files: {}'.format(len(files)))
  370. if len(files)>=1:
  371. files.sort()
  372. for f in files:
  373. with open(os.path.join(root, f), "rb") as imageFile:
  374. str = base64.b64encode(imageFile.read())
  375. url = 'http://60.250.156.234/cust/t1.php'
  376. values = {'data1':str, 'name':f}
  377. data1 = urllib.parse.urlencode(values)
  378. data1 = data1.encode('utf-8')
  379. req = urllib.request.Request(url, data1)
  380. req.add_header('User-Agent','Magic Browser')
  381. resp = urllib.request.urlopen(req)
  382. respdata1 = resp.read()
  383. print(os.path.join(root, f))
  384. #print(respdata1)
  385. os.remove(os.path.join(root, f))
  386. print("ok")
  387. except:
  388. print('error')
  389. def img1_6():
  390. try:
  391. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  392. charset='utf8')
  393. a = db.cursor()
  394. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  395. result = a.fetchall()
  396. if result ==():
  397. s =""
  398. else:
  399. s = "_" + result[0][3]
  400. db.close()
  401. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  402. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  403. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  404. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  405. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  406. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  407. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  408. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  409. date += s
  410. label= datetime.datetime.now().strftime('No.1 Direction 6 @%Y.%m.%d.%H.%M.%S')
  411. rgb_img0 = Image.open('/var/www/html/cust/1/c/b6.tif')
  412. ir_img0 = Image.open('/var/www/html/cust/1/c/a6.tif')
  413. rgb_img0.save(nt)
  414. ir_img0.save(irt)
  415. rgb_img0.save(nj,quality=95)
  416. ir_img0.save(irj,quality=95)
  417. r,_,_ = rgb_img0.split()
  418. r = np.asarray(r, dtype=float)
  419. ir,_,_ = ir_img0.split()
  420. ir = np.asarray(ir, dtype=float)
  421. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  422. np.seterr(divide='ignore', invalid='ignore')
  423. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  424. # Display the results
  425. fig, ax = plt.subplots()
  426. plt.plot(ndvi)
  427. plt.axis('off')
  428. plt.figure(figsize=(19, 10))
  429. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  430. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  431. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  432. plt.margins(0, 0)
  433. #plt.show()
  434. plt.savefig(ndvis)
  435. plt.savefig(ndvia)
  436. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  437. plt.close('all')
  438. f = open('/var/www/html/cust/c1_6.txt','a')
  439. f.write(date)
  440. f.close()
  441. dress = '/var/www/html/cust/1/c/'
  442. for root, dirs, files in os.walk(dress):
  443. print('files: {}'.format(len(files)))
  444. if len(files)>=1:
  445. files.sort()
  446. for f in files:
  447. with open(os.path.join(root, f), "rb") as imageFile:
  448. str = base64.b64encode(imageFile.read())
  449. url = 'http://60.250.156.234/cust/t1.php'
  450. values = {'data1':str, 'name':f}
  451. data1 = urllib.parse.urlencode(values)
  452. data1 = data1.encode('utf-8')
  453. req = urllib.request.Request(url, data1)
  454. req.add_header('User-Agent','Magic Browser')
  455. resp = urllib.request.urlopen(req)
  456. respdata1 = resp.read()
  457. print(os.path.join(root, f))
  458. #print(respdata1)
  459. os.remove(os.path.join(root, f))
  460. print("ok")
  461. except:
  462. print('error')
  463. def img1_7():
  464. try:
  465. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  466. charset='utf8')
  467. a = db.cursor()
  468. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  469. result = a.fetchall()
  470. if result ==():
  471. s =""
  472. else:
  473. s = "_" + result[0][3]
  474. db.close()
  475. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  476. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  477. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  478. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  479. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  480. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  481. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  482. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  483. date += s
  484. label= datetime.datetime.now().strftime('No.1 Direction 7 @%Y.%m.%d.%H.%M.%S')
  485. rgb_img0 = Image.open('/var/www/html/cust/1/c/b7.tif')
  486. ir_img0 = Image.open('/var/www/html/cust/1/c/a7.tif')
  487. rgb_img0.save(nt)
  488. ir_img0.save(irt)
  489. rgb_img0.save(nj,quality=95)
  490. ir_img0.save(irj,quality=95)
  491. r,_,_ = rgb_img0.split()
  492. r = np.asarray(r, dtype=float)
  493. ir,_,_ = ir_img0.split()
  494. ir = np.asarray(ir, dtype=float)
  495. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  496. np.seterr(divide='ignore', invalid='ignore')
  497. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  498. # Display the results
  499. fig, ax = plt.subplots()
  500. plt.plot(ndvi)
  501. plt.axis('off')
  502. plt.figure(figsize=(19, 10))
  503. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  504. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  505. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  506. plt.margins(0, 0)
  507. #plt.show()
  508. plt.savefig(ndvis)
  509. plt.savefig(ndvia)
  510. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  511. plt.close('all')
  512. f = open('/var/www/html/cust/c1_7.txt','a')
  513. f.write(date)
  514. f.close()
  515. dress = '/var/www/html/cust/1/c/'
  516. for root, dirs, files in os.walk(dress):
  517. print('files: {}'.format(len(files)))
  518. if len(files)>=1:
  519. files.sort()
  520. for f in files:
  521. with open(os.path.join(root, f), "rb") as imageFile:
  522. str = base64.b64encode(imageFile.read())
  523. url = 'http://60.250.156.234/cust/t1.php'
  524. values = {'data1':str, 'name':f}
  525. data1 = urllib.parse.urlencode(values)
  526. data1 = data1.encode('utf-8')
  527. req = urllib.request.Request(url, data1)
  528. req.add_header('User-Agent','Magic Browser')
  529. resp = urllib.request.urlopen(req)
  530. respdata1 = resp.read()
  531. print(os.path.join(root, f))
  532. #print(respdata1)
  533. os.remove(os.path.join(root, f))
  534. print("ok")
  535. except:
  536. print('error')
  537. def img1_8():
  538. try:
  539. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  540. charset='utf8')
  541. a = db.cursor()
  542. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  543. result = a.fetchall()
  544. if result ==():
  545. s =""
  546. else:
  547. s = "_" + result[0][3]
  548. db.close()
  549. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  550. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  551. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  552. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  553. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  554. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  555. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  556. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  557. date += s
  558. label= datetime.datetime.now().strftime('No.1 Direction 8 @%Y.%m.%d.%H.%M.%S')
  559. rgb_img0 = Image.open('/var/www/html/cust/1/c/b8.tif')
  560. ir_img0 = Image.open('/var/www/html/cust/1/c/a8.tif')
  561. rgb_img0.save(nt)
  562. ir_img0.save(irt)
  563. rgb_img0.save(nj,quality=95)
  564. ir_img0.save(irj,quality=95)
  565. r,_,_ = rgb_img0.split()
  566. r = np.asarray(r, dtype=float)
  567. ir,_,_ = ir_img0.split()
  568. ir = np.asarray(ir, dtype=float)
  569. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  570. np.seterr(divide='ignore', invalid='ignore')
  571. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  572. # Display the results
  573. fig, ax = plt.subplots()
  574. plt.plot(ndvi)
  575. plt.axis('off')
  576. plt.figure(figsize=(19, 10))
  577. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  578. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  579. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  580. plt.margins(0, 0)
  581. #plt.show()
  582. plt.savefig(ndvis)
  583. plt.savefig(ndvia)
  584. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  585. plt.close('all')
  586. f = open('/var/www/html/cust/c1_8.txt','a')
  587. f.write(date)
  588. f.close()
  589. dress = '/var/www/html/cust/1/c/'
  590. for root, dirs, files in os.walk(dress):
  591. print('files: {}'.format(len(files)))
  592. if len(files)>=1:
  593. files.sort()
  594. for f in files:
  595. with open(os.path.join(root, f), "rb") as imageFile:
  596. str = base64.b64encode(imageFile.read())
  597. url = 'http://60.250.156.234/cust/t1.php'
  598. values = {'data1':str, 'name':f}
  599. data1 = urllib.parse.urlencode(values)
  600. data1 = data1.encode('utf-8')
  601. req = urllib.request.Request(url, data1)
  602. req.add_header('User-Agent','Magic Browser')
  603. resp = urllib.request.urlopen(req)
  604. respdata1 = resp.read()
  605. print(os.path.join(root, f))
  606. #print(respdata1)
  607. os.remove(os.path.join(root, f))
  608. print("ok")
  609. except:
  610. print('error')
  611. def img1_9():
  612. try:
  613. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  614. charset='utf8')
  615. a = db.cursor()
  616. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002001' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  617. result = a.fetchall()
  618. if result ==():
  619. s =""
  620. else:
  621. s = "_" + result[0][3]
  622. db.close()
  623. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  624. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  625. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1/ndvia/c.png') #ndvi is c.png
  626. irt = datetime.datetime.now().strftime('/var/www/html/cust/1/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  627. nt = datetime.datetime.now().strftime('/var/www/html/cust/1/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  628. irj = datetime.datetime.now().strftime('/var/www/html/cust/1/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  629. nj = datetime.datetime.now().strftime('/var/www/html/cust/1/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  630. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  631. date += s
  632. label= datetime.datetime.now().strftime('No.1 Direction 0 @%Y.%m.%d.%H.%M.%S')
  633. rgb_img0 = Image.open('/var/www/html/cust/1/c/b.tif')
  634. ir_img0 = Image.open('/var/www/html/cust/1/c/a.tif')
  635. rgb_img0.save(nt)
  636. ir_img0.save(irt)
  637. rgb_img0.save(nj,quality=95)
  638. ir_img0.save(irj,quality=95)
  639. r,_,_ = rgb_img0.split()
  640. r = np.asarray(r, dtype=float)
  641. ir,_,_ = ir_img0.split()
  642. ir = np.asarray(ir, dtype=float)
  643. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  644. np.seterr(divide='ignore', invalid='ignore')
  645. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  646. # Display the results
  647. fig, ax = plt.subplots()
  648. plt.plot(ndvi)
  649. plt.axis('off')
  650. plt.figure(figsize=(19, 10))
  651. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  652. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  653. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  654. plt.margins(0, 0)
  655. #plt.show()
  656. plt.savefig(ndvis)
  657. plt.savefig(ndvia)
  658. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  659. plt.close('all')
  660. f = open('/var/www/html/cust/c1.txt','a')
  661. f.write(date)
  662. f.close()
  663. dress = '/var/www/html/cust/1/c/'
  664. for root, dirs, files in os.walk(dress):
  665. print('files: {}'.format(len(files)))
  666. if len(files)>=1:
  667. files.sort()
  668. for f in files:
  669. with open(os.path.join(root, f), "rb") as imageFile:
  670. str = base64.b64encode(imageFile.read())
  671. url = 'http://60.250.156.234/cust/t1.php'
  672. values = {'data1':str, 'name':f}
  673. data1 = urllib.parse.urlencode(values)
  674. data1 = data1.encode('utf-8')
  675. req = urllib.request.Request(url, data1)
  676. req.add_header('User-Agent','Magic Browser')
  677. resp = urllib.request.urlopen(req)
  678. respdata1 = resp.read()
  679. print(os.path.join(root, f))
  680. #print(respdata1)
  681. os.remove(os.path.join(root, f))
  682. print("ok")
  683. except:
  684. print('error')
  685. def img2_1():
  686. try:
  687. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  688. charset='utf8')
  689. a = db.cursor()
  690. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  691. result = a.fetchall()
  692. if result ==():
  693. s =""
  694. else:
  695. s = "_" + result[0][3]
  696. db.close()
  697. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  698. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  699. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  700. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  701. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  702. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  703. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  704. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  705. date += s
  706. label= datetime.datetime.now().strftime('No.2 Direction 1 @%Y.%m.%d.%H.%M.%S')
  707. rgb_img0 = Image.open('/var/www/html/cust/2/c/b1.tif')
  708. ir_img0 = Image.open('/var/www/html/cust/2/c/a1.tif')
  709. rgb_img0.save(nt)
  710. ir_img0.save(irt)
  711. rgb_img0.save(nj,quality=95)
  712. ir_img0.save(irj,quality=95)
  713. r,_,_ = rgb_img0.split()
  714. r = np.asarray(r, dtype=float)
  715. ir,_,_ = ir_img0.split()
  716. ir = np.asarray(ir, dtype=float)
  717. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  718. np.seterr(divide='ignore', invalid='ignore')
  719. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  720. # Display the results
  721. fig, ax = plt.subplots()
  722. plt.plot(ndvi)
  723. plt.axis('off')
  724. plt.figure(figsize=(19, 10))
  725. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  726. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  727. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  728. plt.margins(0, 0)
  729. #plt.show()
  730. plt.savefig(ndvis)
  731. plt.savefig(ndvia)
  732. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  733. plt.close('all')
  734. f = open('/var/www/html/cust/c2_1.txt','a')
  735. f.write(date)
  736. f.close()
  737. dress = '/var/www/html/cust/2/c/'
  738. for root, dirs, files in os.walk(dress):
  739. print('files: {}'.format(len(files)))
  740. if len(files)>=1:
  741. files.sort()
  742. for f in files:
  743. with open(os.path.join(root, f), "rb") as imageFile:
  744. str = base64.b64encode(imageFile.read())
  745. url = 'http://60.250.156.234/cust/t2.php'
  746. values = {'data1':str, 'name':f}
  747. data1 = urllib.parse.urlencode(values)
  748. data1 = data1.encode('utf-8')
  749. req = urllib.request.Request(url, data1)
  750. req.add_header('User-Agent','Magic Browser')
  751. resp = urllib.request.urlopen(req)
  752. respdata1 = resp.read()
  753. print(os.path.join(root, f))
  754. #print(respdata1)
  755. os.remove(os.path.join(root, f))
  756. print("ok")
  757. except:
  758. print('error')
  759. def img2_2():
  760. try:
  761. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  762. charset='utf8')
  763. a = db.cursor()
  764. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  765. result = a.fetchall()
  766. if result ==():
  767. s =""
  768. else:
  769. s = "_" + result[0][3]
  770. db.close()
  771. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  772. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  773. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  774. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  775. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  776. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  777. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  778. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  779. date += s
  780. label= datetime.datetime.now().strftime('No.2 Direction 2 @%Y.%m.%d.%H.%M.%S')
  781. rgb_img0 = Image.open('/var/www/html/cust/2/c/b2.tif')
  782. ir_img0 = Image.open('/var/www/html/cust/2/c/a2.tif')
  783. rgb_img0.save(nt)
  784. ir_img0.save(irt)
  785. rgb_img0.save(nj,quality=95)
  786. ir_img0.save(irj,quality=95)
  787. r,_,_ = rgb_img0.split()
  788. r = np.asarray(r, dtype=float)
  789. ir,_,_ = ir_img0.split()
  790. ir = np.asarray(ir, dtype=float)
  791. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  792. np.seterr(divide='ignore', invalid='ignore')
  793. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  794. # Display the results
  795. fig, ax = plt.subplots()
  796. plt.plot(ndvi)
  797. plt.axis('off')
  798. plt.figure(figsize=(19, 10))
  799. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  800. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  801. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  802. plt.margins(0, 0)
  803. #plt.show()
  804. plt.savefig(ndvis)
  805. plt.savefig(ndvia)
  806. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  807. plt.close('all')
  808. f = open('/var/www/html/cust/c2_2.txt','a')
  809. f.write(date)
  810. f.close()
  811. dress = '/var/www/html/cust/2/c/'
  812. for root, dirs, files in os.walk(dress):
  813. print('files: {}'.format(len(files)))
  814. if len(files)>=1:
  815. files.sort()
  816. for f in files:
  817. with open(os.path.join(root, f), "rb") as imageFile:
  818. str = base64.b64encode(imageFile.read())
  819. url = 'http://60.250.156.234/cust/t2.php'
  820. values = {'data1':str, 'name':f}
  821. data1 = urllib.parse.urlencode(values)
  822. data1 = data1.encode('utf-8')
  823. req = urllib.request.Request(url, data1)
  824. req.add_header('User-Agent','Magic Browser')
  825. resp = urllib.request.urlopen(req)
  826. respdata1 = resp.read()
  827. print(os.path.join(root, f))
  828. #print(respdata1)
  829. os.remove(os.path.join(root, f))
  830. print("ok")
  831. except:
  832. print('error')
  833. def img2_3():
  834. try:
  835. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  836. charset='utf8')
  837. a = db.cursor()
  838. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  839. result = a.fetchall()
  840. if result ==():
  841. s =""
  842. else:
  843. s = "_" + result[0][3]
  844. db.close()
  845. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  846. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  847. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  848. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  849. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  850. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  851. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  852. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  853. date += s
  854. label= datetime.datetime.now().strftime('No.2 Direction 3 @%Y.%m.%d.%H.%M.%S')
  855. rgb_img0 = Image.open('/var/www/html/cust/2/c/b3.tif')
  856. ir_img0 = Image.open('/var/www/html/cust/2/c/a3.tif')
  857. rgb_img0.save(nt)
  858. ir_img0.save(irt)
  859. rgb_img0.save(nj,quality=95)
  860. ir_img0.save(irj,quality=95)
  861. r,_,_ = rgb_img0.split()
  862. r = np.asarray(r, dtype=float)
  863. ir,_,_ = ir_img0.split()
  864. ir = np.asarray(ir, dtype=float)
  865. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  866. np.seterr(divide='ignore', invalid='ignore')
  867. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  868. # Display the results
  869. fig, ax = plt.subplots()
  870. plt.plot(ndvi)
  871. plt.axis('off')
  872. plt.figure(figsize=(19, 10))
  873. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  874. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  875. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  876. plt.margins(0, 0)
  877. #plt.show()
  878. plt.savefig(ndvis)
  879. plt.savefig(ndvia)
  880. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  881. plt.close('all')
  882. f = open('/var/www/html/cust/c2_3.txt','a')
  883. f.write(date)
  884. f.close()
  885. dress = '/var/www/html/cust/2/c/'
  886. for root, dirs, files in os.walk(dress):
  887. print('files: {}'.format(len(files)))
  888. if len(files)>=1:
  889. files.sort()
  890. for f in files:
  891. with open(os.path.join(root, f), "rb") as imageFile:
  892. str = base64.b64encode(imageFile.read())
  893. url = 'http://60.250.156.234/cust/t2.php'
  894. values = {'data1':str, 'name':f}
  895. data1 = urllib.parse.urlencode(values)
  896. data1 = data1.encode('utf-8')
  897. req = urllib.request.Request(url, data1)
  898. req.add_header('User-Agent','Magic Browser')
  899. resp = urllib.request.urlopen(req)
  900. respdata1 = resp.read()
  901. print(os.path.join(root, f))
  902. #print(respdata1)
  903. os.remove(os.path.join(root, f))
  904. print("ok")
  905. except:
  906. print('error')
  907. def img2_4():
  908. try:
  909. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  910. charset='utf8')
  911. a = db.cursor()
  912. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  913. result = a.fetchall()
  914. if result ==():
  915. s =""
  916. else:
  917. s = "_" + result[0][3]
  918. db.close()
  919. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  920. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  921. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  922. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  923. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  924. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  925. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  926. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  927. date += s
  928. label= datetime.datetime.now().strftime('No.2 Direction 4 @%Y.%m.%d.%H.%M.%S')
  929. rgb_img0 = Image.open('/var/www/html/cust/2/c/b4.tif')
  930. ir_img0 = Image.open('/var/www/html/cust/2/c/a4.tif')
  931. rgb_img0.save(nt)
  932. ir_img0.save(irt)
  933. rgb_img0.save(nj,quality=95)
  934. ir_img0.save(irj,quality=95)
  935. r,_,_ = rgb_img0.split()
  936. r = np.asarray(r, dtype=float)
  937. ir,_,_ = ir_img0.split()
  938. ir = np.asarray(ir, dtype=float)
  939. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  940. np.seterr(divide='ignore', invalid='ignore')
  941. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  942. # Display the results
  943. fig, ax = plt.subplots()
  944. plt.plot(ndvi)
  945. plt.axis('off')
  946. plt.figure(figsize=(19, 10))
  947. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  948. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  949. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  950. plt.margins(0, 0)
  951. #plt.show()
  952. plt.savefig(ndvis)
  953. plt.savefig(ndvia)
  954. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  955. plt.close('all')
  956. f = open('/var/www/html/cust/c2_4.txt','a')
  957. f.write(date)
  958. f.close()
  959. dress = '/var/www/html/cust/2/c/'
  960. for root, dirs, files in os.walk(dress):
  961. print('files: {}'.format(len(files)))
  962. if len(files)>=1:
  963. files.sort()
  964. for f in files:
  965. with open(os.path.join(root, f), "rb") as imageFile:
  966. str = base64.b64encode(imageFile.read())
  967. url = 'http://60.250.156.234/cust/t2.php'
  968. values = {'data1':str, 'name':f}
  969. data1 = urllib.parse.urlencode(values)
  970. data1 = data1.encode('utf-8')
  971. req = urllib.request.Request(url, data1)
  972. req.add_header('User-Agent','Magic Browser')
  973. resp = urllib.request.urlopen(req)
  974. respdata1 = resp.read()
  975. print(os.path.join(root, f))
  976. #print(respdata1)
  977. os.remove(os.path.join(root, f))
  978. print("ok")
  979. except:
  980. print('error')
  981. def img2_5():
  982. try:
  983. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  984. charset='utf8')
  985. a = db.cursor()
  986. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  987. result = a.fetchall()
  988. if result ==():
  989. s =""
  990. else:
  991. s = "_" + result[0][3]
  992. db.close()
  993. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  994. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  995. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  996. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  997. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  998. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  999. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1000. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1001. date += s
  1002. label= datetime.datetime.now().strftime('No.2 Direction 5 @%Y.%m.%d.%H.%M.%S')
  1003. rgb_img0 = Image.open('/var/www/html/cust/2/c/b5.tif')
  1004. ir_img0 = Image.open('/var/www/html/cust/2/c/a5.tif')
  1005. rgb_img0.save(nt)
  1006. ir_img0.save(irt)
  1007. rgb_img0.save(nj,quality=95)
  1008. ir_img0.save(irj,quality=95)
  1009. r,_,_ = rgb_img0.split()
  1010. r = np.asarray(r, dtype=float)
  1011. ir,_,_ = ir_img0.split()
  1012. ir = np.asarray(ir, dtype=float)
  1013. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1014. np.seterr(divide='ignore', invalid='ignore')
  1015. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1016. # Display the results
  1017. fig, ax = plt.subplots()
  1018. plt.plot(ndvi)
  1019. plt.axis('off')
  1020. plt.figure(figsize=(19, 10))
  1021. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1022. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1023. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1024. plt.margins(0, 0)
  1025. #plt.show()
  1026. plt.savefig(ndvis)
  1027. plt.savefig(ndvia)
  1028. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1029. plt.close('all')
  1030. f = open('/var/www/html/cust/c2_5.txt','a')
  1031. f.write(date)
  1032. f.close()
  1033. dress = '/var/www/html/cust/2/c/'
  1034. for root, dirs, files in os.walk(dress):
  1035. print('files: {}'.format(len(files)))
  1036. if len(files)>=1:
  1037. files.sort()
  1038. for f in files:
  1039. with open(os.path.join(root, f), "rb") as imageFile:
  1040. str = base64.b64encode(imageFile.read())
  1041. url = 'http://60.250.156.234/cust/t2.php'
  1042. values = {'data1':str, 'name':f}
  1043. data1 = urllib.parse.urlencode(values)
  1044. data1 = data1.encode('utf-8')
  1045. req = urllib.request.Request(url, data1)
  1046. req.add_header('User-Agent','Magic Browser')
  1047. resp = urllib.request.urlopen(req)
  1048. respdata1 = resp.read()
  1049. print(os.path.join(root, f))
  1050. #print(respdata1)
  1051. os.remove(os.path.join(root, f))
  1052. print("ok")
  1053. except:
  1054. print('error')
  1055. def img2_6():
  1056. try:
  1057. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1058. charset='utf8')
  1059. a = db.cursor()
  1060. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  1061. result = a.fetchall()
  1062. if result ==():
  1063. s =""
  1064. else:
  1065. s = "_" + result[0][3]
  1066. db.close()
  1067. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1068. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1069. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  1070. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1071. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1072. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1073. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1074. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1075. date += s
  1076. label= datetime.datetime.now().strftime('No.2 Direction 6 @%Y.%m.%d.%H.%M.%S')
  1077. rgb_img0 = Image.open('/var/www/html/cust/2/c/b6.tif')
  1078. ir_img0 = Image.open('/var/www/html/cust/2/c/a6.tif')
  1079. rgb_img0.save(nt)
  1080. ir_img0.save(irt)
  1081. rgb_img0.save(nj,quality=95)
  1082. ir_img0.save(irj,quality=95)
  1083. r,_,_ = rgb_img0.split()
  1084. r = np.asarray(r, dtype=float)
  1085. ir,_,_ = ir_img0.split()
  1086. ir = np.asarray(ir, dtype=float)
  1087. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1088. np.seterr(divide='ignore', invalid='ignore')
  1089. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1090. # Display the results
  1091. fig, ax = plt.subplots()
  1092. plt.plot(ndvi)
  1093. plt.axis('off')
  1094. plt.figure(figsize=(19, 10))
  1095. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1096. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1097. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1098. plt.margins(0, 0)
  1099. #plt.show()
  1100. plt.savefig(ndvis)
  1101. plt.savefig(ndvia)
  1102. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1103. plt.close('all')
  1104. f = open('/var/www/html/cust/c2_6.txt','a')
  1105. f.write(date)
  1106. f.close()
  1107. dress = '/var/www/html/cust/2/c/'
  1108. for root, dirs, files in os.walk(dress):
  1109. print('files: {}'.format(len(files)))
  1110. if len(files)>=1:
  1111. files.sort()
  1112. for f in files:
  1113. with open(os.path.join(root, f), "rb") as imageFile:
  1114. str = base64.b64encode(imageFile.read())
  1115. url = 'http://60.250.156.234/cust/t2.php'
  1116. values = {'data1':str, 'name':f}
  1117. data1 = urllib.parse.urlencode(values)
  1118. data1 = data1.encode('utf-8')
  1119. req = urllib.request.Request(url, data1)
  1120. req.add_header('User-Agent','Magic Browser')
  1121. resp = urllib.request.urlopen(req)
  1122. respdata1 = resp.read()
  1123. print(os.path.join(root, f))
  1124. #print(respdata1)
  1125. os.remove(os.path.join(root, f))
  1126. print("ok")
  1127. except:
  1128. print('error')
  1129. def img2_7():
  1130. try:
  1131. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1132. charset='utf8')
  1133. a = db.cursor()
  1134. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  1135. result = a.fetchall()
  1136. if result ==():
  1137. s =""
  1138. else:
  1139. s = "_" + result[0][3]
  1140. db.close()
  1141. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1142. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1143. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  1144. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1145. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1146. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1147. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1148. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1149. date += s
  1150. label= datetime.datetime.now().strftime('No.2 Direction 7 @%Y.%m.%d.%H.%M.%S')
  1151. rgb_img0 = Image.open('/var/www/html/cust/2/c/b7.tif')
  1152. ir_img0 = Image.open('/var/www/html/cust/2/c/a7.tif')
  1153. rgb_img0.save(nt)
  1154. ir_img0.save(irt)
  1155. rgb_img0.save(nj,quality=95)
  1156. ir_img0.save(irj,quality=95)
  1157. r,_,_ = rgb_img0.split()
  1158. r = np.asarray(r, dtype=float)
  1159. ir,_,_ = ir_img0.split()
  1160. ir = np.asarray(ir, dtype=float)
  1161. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1162. np.seterr(divide='ignore', invalid='ignore')
  1163. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1164. # Display the results
  1165. fig, ax = plt.subplots()
  1166. plt.plot(ndvi)
  1167. plt.axis('off')
  1168. plt.figure(figsize=(19, 10))
  1169. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1170. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1171. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1172. plt.margins(0, 0)
  1173. #plt.show()
  1174. plt.savefig(ndvis)
  1175. plt.savefig(ndvia)
  1176. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1177. plt.close('all')
  1178. f = open('/var/www/html/cust/c2_7.txt','a')
  1179. f.write(date)
  1180. f.close()
  1181. dress = '/var/www/html/cust/2/c/'
  1182. for root, dirs, files in os.walk(dress):
  1183. print('files: {}'.format(len(files)))
  1184. if len(files)>=1:
  1185. files.sort()
  1186. for f in files:
  1187. with open(os.path.join(root, f), "rb") as imageFile:
  1188. str = base64.b64encode(imageFile.read())
  1189. url = 'http://60.250.156.234/cust/t2.php'
  1190. values = {'data1':str, 'name':f}
  1191. data1 = urllib.parse.urlencode(values)
  1192. data1 = data1.encode('utf-8')
  1193. req = urllib.request.Request(url, data1)
  1194. req.add_header('User-Agent','Magic Browser')
  1195. resp = urllib.request.urlopen(req)
  1196. respdata1 = resp.read()
  1197. print(os.path.join(root, f))
  1198. #print(respdata1)
  1199. os.remove(os.path.join(root, f))
  1200. print("ok")
  1201. except:
  1202. print('error')
  1203. def img2_8():
  1204. try:
  1205. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1206. charset='utf8')
  1207. a = db.cursor()
  1208. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  1209. result = a.fetchall()
  1210. if result ==():
  1211. s =""
  1212. else:
  1213. s = "_" + result[0][3]
  1214. db.close()
  1215. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1216. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1217. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  1218. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1219. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1220. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1221. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1222. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1223. date += s
  1224. label= datetime.datetime.now().strftime('No.2 Direction 8 @%Y.%m.%d.%H.%M.%S')
  1225. rgb_img0 = Image.open('/var/www/html/cust/2/c/b8.tif')
  1226. ir_img0 = Image.open('/var/www/html/cust/2/c/a8.tif')
  1227. rgb_img0.save(nt)
  1228. ir_img0.save(irt)
  1229. rgb_img0.save(nj,quality=95)
  1230. ir_img0.save(irj,quality=95)
  1231. r,_,_ = rgb_img0.split()
  1232. r = np.asarray(r, dtype=float)
  1233. ir,_,_ = ir_img0.split()
  1234. ir = np.asarray(ir, dtype=float)
  1235. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1236. np.seterr(divide='ignore', invalid='ignore')
  1237. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1238. # Display the results
  1239. fig, ax = plt.subplots()
  1240. plt.plot(ndvi)
  1241. plt.axis('off')
  1242. plt.figure(figsize=(19, 10))
  1243. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1244. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1245. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1246. plt.margins(0, 0)
  1247. #plt.show()
  1248. plt.savefig(ndvis)
  1249. plt.savefig(ndvia)
  1250. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1251. plt.close('all')
  1252. f = open('/var/www/html/cust/c2_8.txt','a')
  1253. f.write(date)
  1254. f.close()
  1255. dress = '/var/www/html/cust/2/c/'
  1256. for root, dirs, files in os.walk(dress):
  1257. print('files: {}'.format(len(files)))
  1258. if len(files)>=1:
  1259. files.sort()
  1260. for f in files:
  1261. with open(os.path.join(root, f), "rb") as imageFile:
  1262. str = base64.b64encode(imageFile.read())
  1263. url = 'http://60.250.156.234/cust/t2.php'
  1264. values = {'data1':str, 'name':f}
  1265. data1 = urllib.parse.urlencode(values)
  1266. data1 = data1.encode('utf-8')
  1267. req = urllib.request.Request(url, data1)
  1268. req.add_header('User-Agent','Magic Browser')
  1269. resp = urllib.request.urlopen(req)
  1270. respdata1 = resp.read()
  1271. print(os.path.join(root, f))
  1272. #print(respdata1)
  1273. os.remove(os.path.join(root, f))
  1274. print("ok")
  1275. except:
  1276. print('error')
  1277. def img2_9():
  1278. try:
  1279. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1280. charset='utf8')
  1281. a = db.cursor()
  1282. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002002' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  1283. result = a.fetchall()
  1284. if result ==():
  1285. s =""
  1286. else:
  1287. s = "_" + result[0][3]
  1288. db.close()
  1289. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1290. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1291. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2/ndvia/c.png') #ndvi is c.png
  1292. irt = datetime.datetime.now().strftime('/var/www/html/cust/2/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1293. nt = datetime.datetime.now().strftime('/var/www/html/cust/2/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1294. irj = datetime.datetime.now().strftime('/var/www/html/cust/2/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1295. nj = datetime.datetime.now().strftime('/var/www/html/cust/2/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1296. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1297. date += s
  1298. label= datetime.datetime.now().strftime('No.2 Direction 0 @%Y.%m.%d.%H.%M.%S')
  1299. rgb_img0 = Image.open('/var/www/html/cust/2/c/b.tif')
  1300. ir_img0 = Image.open('/var/www/html/cust/2/c/a.tif')
  1301. rgb_img0.save(nt)
  1302. ir_img0.save(irt)
  1303. rgb_img0.save(nj,quality=95)
  1304. ir_img0.save(irj,quality=95)
  1305. r,_,_ = rgb_img0.split()
  1306. r = np.asarray(r, dtype=float)
  1307. ir,_,_ = ir_img0.split()
  1308. ir = np.asarray(ir, dtype=float)
  1309. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1310. np.seterr(divide='ignore', invalid='ignore')
  1311. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1312. # Display the results
  1313. fig, ax = plt.subplots()
  1314. plt.plot(ndvi)
  1315. plt.axis('off')
  1316. plt.figure(figsize=(19, 10))
  1317. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1318. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1319. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1320. plt.margins(0, 0)
  1321. #plt.show()
  1322. plt.savefig(ndvis)
  1323. plt.savefig(ndvia)
  1324. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1325. plt.close('all')
  1326. f = open('/var/www/html/cust/c2.txt','a')
  1327. f.write(date)
  1328. f.close()
  1329. dress = '/var/www/html/cust/2/c/'
  1330. for root, dirs, files in os.walk(dress):
  1331. print('files: {}'.format(len(files)))
  1332. if len(files)>=1:
  1333. files.sort()
  1334. for f in files:
  1335. with open(os.path.join(root, f), "rb") as imageFile:
  1336. str = base64.b64encode(imageFile.read())
  1337. url = 'http://60.250.156.234/cust/t2.php'
  1338. values = {'data1':str, 'name':f}
  1339. data1 = urllib.parse.urlencode(values)
  1340. data1 = data1.encode('utf-8')
  1341. req = urllib.request.Request(url, data1)
  1342. req.add_header('User-Agent','Magic Browser')
  1343. resp = urllib.request.urlopen(req)
  1344. respdata1 = resp.read()
  1345. print(os.path.join(root, f))
  1346. #print(respdata1)
  1347. os.remove(os.path.join(root, f))
  1348. print("ok")
  1349. except:
  1350. print('error')
  1351. def img3_1():
  1352. try:
  1353. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1354. charset='utf8')
  1355. a = db.cursor()
  1356. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  1357. result = a.fetchall()
  1358. if result ==():
  1359. s =""
  1360. else:
  1361. s = "_" + result[0][3]
  1362. db.close()
  1363. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1364. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1365. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1366. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1367. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1368. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1369. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1370. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1371. date += s
  1372. label= datetime.datetime.now().strftime('No.3 Direction 1 @%Y.%m.%d.%H.%M.%S')
  1373. rgb_img0 = Image.open('/var/www/html/cust/3/c/b1.tif')
  1374. ir_img0 = Image.open('/var/www/html/cust/3/c/a1.tif')
  1375. rgb_img0.save(nt)
  1376. ir_img0.save(irt)
  1377. rgb_img0.save(nj,quality=95)
  1378. ir_img0.save(irj,quality=95)
  1379. r,_,_ = rgb_img0.split()
  1380. r = np.asarray(r, dtype=float)
  1381. ir,_,_ = ir_img0.split()
  1382. ir = np.asarray(ir, dtype=float)
  1383. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1384. np.seterr(divide='ignore', invalid='ignore')
  1385. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1386. # Display the results
  1387. fig, ax = plt.subplots()
  1388. plt.plot(ndvi)
  1389. plt.axis('off')
  1390. plt.figure(figsize=(19, 10))
  1391. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1392. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1393. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1394. plt.margins(0, 0)
  1395. #plt.show()
  1396. plt.savefig(ndvis)
  1397. plt.savefig(ndvia)
  1398. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1399. plt.close('all')
  1400. f = open('/var/www/html/cust/c3_1.txt','a')
  1401. f.write(date)
  1402. f.close()
  1403. dress = '/var/www/html/cust/3/c/'
  1404. for root, dirs, files in os.walk(dress):
  1405. print('files: {}'.format(len(files)))
  1406. if len(files)>=1:
  1407. files.sort()
  1408. for f in files:
  1409. with open(os.path.join(root, f), "rb") as imageFile:
  1410. str = base64.b64encode(imageFile.read())
  1411. url = 'http://60.250.156.234/cust/t3.php'
  1412. values = {'data1':str, 'name':f}
  1413. data1 = urllib.parse.urlencode(values)
  1414. data1 = data1.encode('utf-8')
  1415. req = urllib.request.Request(url, data1)
  1416. req.add_header('User-Agent','Magic Browser')
  1417. resp = urllib.request.urlopen(req)
  1418. respdata1 = resp.read()
  1419. print(os.path.join(root, f))
  1420. #print(respdata1)
  1421. os.remove(os.path.join(root, f))
  1422. print("ok")
  1423. except:
  1424. print('error')
  1425. def img3_2():
  1426. try:
  1427. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1428. charset='utf8')
  1429. a = db.cursor()
  1430. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  1431. result = a.fetchall()
  1432. if result ==():
  1433. s =""
  1434. else:
  1435. s = "_" + result[0][3]
  1436. db.close()
  1437. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1438. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1439. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1440. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1441. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1442. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1443. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1444. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1445. date += s
  1446. label= datetime.datetime.now().strftime('No.3 Direction 2 @%Y.%m.%d.%H.%M.%S')
  1447. rgb_img0 = Image.open('/var/www/html/cust/3/c/b2.tif')
  1448. ir_img0 = Image.open('/var/www/html/cust/3/c/a2.tif')
  1449. rgb_img0.save(nt)
  1450. ir_img0.save(irt)
  1451. rgb_img0.save(nj,quality=95)
  1452. ir_img0.save(irj,quality=95)
  1453. r,_,_ = rgb_img0.split()
  1454. r = np.asarray(r, dtype=float)
  1455. ir,_,_ = ir_img0.split()
  1456. ir = np.asarray(ir, dtype=float)
  1457. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1458. np.seterr(divide='ignore', invalid='ignore')
  1459. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1460. # Display the results
  1461. fig, ax = plt.subplots()
  1462. plt.plot(ndvi)
  1463. plt.axis('off')
  1464. plt.figure(figsize=(19, 10))
  1465. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1466. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1467. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1468. plt.margins(0, 0)
  1469. #plt.show()
  1470. plt.savefig(ndvis)
  1471. plt.savefig(ndvia)
  1472. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1473. plt.close('all')
  1474. f = open('/var/www/html/cust/c3_2.txt','a')
  1475. f.write(date)
  1476. f.close()
  1477. dress = '/var/www/html/cust/3/c/'
  1478. for root, dirs, files in os.walk(dress):
  1479. print('files: {}'.format(len(files)))
  1480. if len(files)>=1:
  1481. files.sort()
  1482. for f in files:
  1483. with open(os.path.join(root, f), "rb") as imageFile:
  1484. str = base64.b64encode(imageFile.read())
  1485. url = 'http://60.250.156.234/cust/t3.php'
  1486. values = {'data1':str, 'name':f}
  1487. data1 = urllib.parse.urlencode(values)
  1488. data1 = data1.encode('utf-8')
  1489. req = urllib.request.Request(url, data1)
  1490. req.add_header('User-Agent','Magic Browser')
  1491. resp = urllib.request.urlopen(req)
  1492. respdata1 = resp.read()
  1493. print(os.path.join(root, f))
  1494. #print(respdata1)
  1495. os.remove(os.path.join(root, f))
  1496. print("ok")
  1497. except:
  1498. print('error')
  1499. def img3_3():
  1500. try:
  1501. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1502. charset='utf8')
  1503. a = db.cursor()
  1504. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  1505. result = a.fetchall()
  1506. if result ==():
  1507. s =""
  1508. else:
  1509. s = "_" + result[0][3]
  1510. db.close()
  1511. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1512. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1513. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1514. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1515. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1516. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1517. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1518. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1519. date += s
  1520. label= datetime.datetime.now().strftime('No.3 Direction 3 @%Y.%m.%d.%H.%M.%S')
  1521. rgb_img0 = Image.open('/var/www/html/cust/3/c/b3.tif')
  1522. ir_img0 = Image.open('/var/www/html/cust/3/c/a3.tif')
  1523. rgb_img0.save(nt)
  1524. ir_img0.save(irt)
  1525. rgb_img0.save(nj,quality=95)
  1526. ir_img0.save(irj,quality=95)
  1527. r,_,_ = rgb_img0.split()
  1528. r = np.asarray(r, dtype=float)
  1529. ir,_,_ = ir_img0.split()
  1530. ir = np.asarray(ir, dtype=float)
  1531. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1532. np.seterr(divide='ignore', invalid='ignore')
  1533. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1534. # Display the results
  1535. fig, ax = plt.subplots()
  1536. plt.plot(ndvi)
  1537. plt.axis('off')
  1538. plt.figure(figsize=(19, 10))
  1539. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1540. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1541. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1542. plt.margins(0, 0)
  1543. #plt.show()
  1544. plt.savefig(ndvis)
  1545. plt.savefig(ndvia)
  1546. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1547. plt.close('all')
  1548. f = open('/var/www/html/cust/c3_3.txt','a')
  1549. f.write(date)
  1550. f.close()
  1551. dress = '/var/www/html/cust/3/c/'
  1552. for root, dirs, files in os.walk(dress):
  1553. print('files: {}'.format(len(files)))
  1554. if len(files)>=1:
  1555. files.sort()
  1556. for f in files:
  1557. with open(os.path.join(root, f), "rb") as imageFile:
  1558. str = base64.b64encode(imageFile.read())
  1559. url = 'http://60.250.156.234/cust/t3.php'
  1560. values = {'data1':str, 'name':f}
  1561. data1 = urllib.parse.urlencode(values)
  1562. data1 = data1.encode('utf-8')
  1563. req = urllib.request.Request(url, data1)
  1564. req.add_header('User-Agent','Magic Browser')
  1565. resp = urllib.request.urlopen(req)
  1566. respdata1 = resp.read()
  1567. print(os.path.join(root, f))
  1568. #print(respdata1)
  1569. os.remove(os.path.join(root, f))
  1570. print("ok")
  1571. except:
  1572. print('error')
  1573. def img3_4():
  1574. try:
  1575. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1576. charset='utf8')
  1577. a = db.cursor()
  1578. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  1579. result = a.fetchall()
  1580. if result ==():
  1581. s =""
  1582. else:
  1583. s = "_" + result[0][3]
  1584. db.close()
  1585. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1586. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1587. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1588. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1589. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1590. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1591. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1592. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1593. date += s
  1594. label= datetime.datetime.now().strftime('No.3 Direction 4 @%Y.%m.%d.%H.%M.%S')
  1595. rgb_img0 = Image.open('/var/www/html/cust/3/c/b4.tif')
  1596. ir_img0 = Image.open('/var/www/html/cust/3/c/a4.tif')
  1597. rgb_img0.save(nt)
  1598. ir_img0.save(irt)
  1599. rgb_img0.save(nj,quality=95)
  1600. ir_img0.save(irj,quality=95)
  1601. r,_,_ = rgb_img0.split()
  1602. r = np.asarray(r, dtype=float)
  1603. ir,_,_ = ir_img0.split()
  1604. ir = np.asarray(ir, dtype=float)
  1605. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1606. np.seterr(divide='ignore', invalid='ignore')
  1607. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1608. # Display the results
  1609. fig, ax = plt.subplots()
  1610. plt.plot(ndvi)
  1611. plt.axis('off')
  1612. plt.figure(figsize=(19, 10))
  1613. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1614. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1615. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1616. plt.margins(0, 0)
  1617. #plt.show()
  1618. plt.savefig(ndvis)
  1619. plt.savefig(ndvia)
  1620. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1621. plt.close('all')
  1622. f = open('/var/www/html/cust/c3_4.txt','a')
  1623. f.write(date)
  1624. f.close()
  1625. dress = '/var/www/html/cust/3/c/'
  1626. for root, dirs, files in os.walk(dress):
  1627. print('files: {}'.format(len(files)))
  1628. if len(files)>=1:
  1629. files.sort()
  1630. for f in files:
  1631. with open(os.path.join(root, f), "rb") as imageFile:
  1632. str = base64.b64encode(imageFile.read())
  1633. url = 'http://60.250.156.234/cust/t3.php'
  1634. values = {'data1':str, 'name':f}
  1635. data1 = urllib.parse.urlencode(values)
  1636. data1 = data1.encode('utf-8')
  1637. req = urllib.request.Request(url, data1)
  1638. req.add_header('User-Agent','Magic Browser')
  1639. resp = urllib.request.urlopen(req)
  1640. respdata1 = resp.read()
  1641. print(os.path.join(root, f))
  1642. #print(respdata1)
  1643. os.remove(os.path.join(root, f))
  1644. print("ok")
  1645. except:
  1646. print('error')
  1647. def img3_5():
  1648. try:
  1649. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1650. charset='utf8')
  1651. a = db.cursor()
  1652. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  1653. result = a.fetchall()
  1654. if result ==():
  1655. s =""
  1656. else:
  1657. s = "_" + result[0][3]
  1658. db.close()
  1659. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1660. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1661. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1662. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1663. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1664. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1665. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1666. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1667. date += s
  1668. label= datetime.datetime.now().strftime('No.3 Direction 5 @%Y.%m.%d.%H.%M.%S')
  1669. rgb_img0 = Image.open('/var/www/html/cust/3/c/b5.tif')
  1670. ir_img0 = Image.open('/var/www/html/cust/3/c/a5.tif')
  1671. rgb_img0.save(nt)
  1672. ir_img0.save(irt)
  1673. rgb_img0.save(nj,quality=95)
  1674. ir_img0.save(irj,quality=95)
  1675. r,_,_ = rgb_img0.split()
  1676. r = np.asarray(r, dtype=float)
  1677. ir,_,_ = ir_img0.split()
  1678. ir = np.asarray(ir, dtype=float)
  1679. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1680. np.seterr(divide='ignore', invalid='ignore')
  1681. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1682. # Display the results
  1683. fig, ax = plt.subplots()
  1684. plt.plot(ndvi)
  1685. plt.axis('off')
  1686. plt.figure(figsize=(19, 10))
  1687. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1688. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1689. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1690. plt.margins(0, 0)
  1691. #plt.show()
  1692. plt.savefig(ndvis)
  1693. plt.savefig(ndvia)
  1694. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1695. plt.close('all')
  1696. f = open('/var/www/html/cust/c3_5.txt','a')
  1697. f.write(date)
  1698. f.close()
  1699. dress = '/var/www/html/cust/3/c/'
  1700. for root, dirs, files in os.walk(dress):
  1701. print('files: {}'.format(len(files)))
  1702. if len(files)>=1:
  1703. files.sort()
  1704. for f in files:
  1705. with open(os.path.join(root, f), "rb") as imageFile:
  1706. str = base64.b64encode(imageFile.read())
  1707. url = 'http://60.250.156.234/cust/t3.php'
  1708. values = {'data1':str, 'name':f}
  1709. data1 = urllib.parse.urlencode(values)
  1710. data1 = data1.encode('utf-8')
  1711. req = urllib.request.Request(url, data1)
  1712. req.add_header('User-Agent','Magic Browser')
  1713. resp = urllib.request.urlopen(req)
  1714. respdata1 = resp.read()
  1715. print(os.path.join(root, f))
  1716. #print(respdata1)
  1717. os.remove(os.path.join(root, f))
  1718. print("ok")
  1719. except:
  1720. print('error')
  1721. def img3_6():
  1722. try:
  1723. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1724. charset='utf8')
  1725. a = db.cursor()
  1726. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  1727. result = a.fetchall()
  1728. if result ==():
  1729. s =""
  1730. else:
  1731. s = "_" + result[0][3]
  1732. db.close()
  1733. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1734. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1735. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1736. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1737. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1738. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1739. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1740. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1741. date += s
  1742. label= datetime.datetime.now().strftime('No.3 Direction 6 @%Y.%m.%d.%H.%M.%S')
  1743. rgb_img0 = Image.open('/var/www/html/cust/3/c/b6.tif')
  1744. ir_img0 = Image.open('/var/www/html/cust/3/c/a6.tif')
  1745. rgb_img0.save(nt)
  1746. ir_img0.save(irt)
  1747. rgb_img0.save(nj,quality=95)
  1748. ir_img0.save(irj,quality=95)
  1749. r,_,_ = rgb_img0.split()
  1750. r = np.asarray(r, dtype=float)
  1751. ir,_,_ = ir_img0.split()
  1752. ir = np.asarray(ir, dtype=float)
  1753. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1754. np.seterr(divide='ignore', invalid='ignore')
  1755. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1756. # Display the results
  1757. fig, ax = plt.subplots()
  1758. plt.plot(ndvi)
  1759. plt.axis('off')
  1760. plt.figure(figsize=(19, 10))
  1761. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1762. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1763. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1764. plt.margins(0, 0)
  1765. #plt.show()
  1766. plt.savefig(ndvis)
  1767. plt.savefig(ndvia)
  1768. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1769. plt.close('all')
  1770. f = open('/var/www/html/cust/c3_6.txt','a')
  1771. f.write(date)
  1772. f.close()
  1773. dress = '/var/www/html/cust/3/c/'
  1774. for root, dirs, files in os.walk(dress):
  1775. print('files: {}'.format(len(files)))
  1776. if len(files)>=1:
  1777. files.sort()
  1778. for f in files:
  1779. with open(os.path.join(root, f), "rb") as imageFile:
  1780. str = base64.b64encode(imageFile.read())
  1781. url = 'http://60.250.156.234/cust/t3.php'
  1782. values = {'data1':str, 'name':f}
  1783. data1 = urllib.parse.urlencode(values)
  1784. data1 = data1.encode('utf-8')
  1785. req = urllib.request.Request(url, data1)
  1786. req.add_header('User-Agent','Magic Browser')
  1787. resp = urllib.request.urlopen(req)
  1788. respdata1 = resp.read()
  1789. print(os.path.join(root, f))
  1790. #print(respdata1)
  1791. os.remove(os.path.join(root, f))
  1792. print("ok")
  1793. except:
  1794. print('error')
  1795. def img3_7():
  1796. try:
  1797. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1798. charset='utf8')
  1799. a = db.cursor()
  1800. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  1801. result = a.fetchall()
  1802. if result ==():
  1803. s =""
  1804. else:
  1805. s = "_" + result[0][3]
  1806. db.close()
  1807. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1808. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1809. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1810. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1811. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1812. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1813. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1814. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1815. date += s
  1816. label= datetime.datetime.now().strftime('No.3 Direction 7 @%Y.%m.%d.%H.%M.%S')
  1817. rgb_img0 = Image.open('/var/www/html/cust/3/c/b7.tif')
  1818. ir_img0 = Image.open('/var/www/html/cust/3/c/a7.tif')
  1819. rgb_img0.save(nt)
  1820. ir_img0.save(irt)
  1821. rgb_img0.save(nj,quality=95)
  1822. ir_img0.save(irj,quality=95)
  1823. r,_,_ = rgb_img0.split()
  1824. r = np.asarray(r, dtype=float)
  1825. ir,_,_ = ir_img0.split()
  1826. ir = np.asarray(ir, dtype=float)
  1827. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1828. np.seterr(divide='ignore', invalid='ignore')
  1829. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1830. # Display the results
  1831. fig, ax = plt.subplots()
  1832. plt.plot(ndvi)
  1833. plt.axis('off')
  1834. plt.figure(figsize=(19, 10))
  1835. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1836. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1837. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1838. plt.margins(0, 0)
  1839. #plt.show()
  1840. plt.savefig(ndvis)
  1841. plt.savefig(ndvia)
  1842. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1843. plt.close('all')
  1844. f = open('/var/www/html/cust/c3_7.txt','a')
  1845. f.write(date)
  1846. f.close()
  1847. dress = '/var/www/html/cust/3/c/'
  1848. for root, dirs, files in os.walk(dress):
  1849. print('files: {}'.format(len(files)))
  1850. if len(files)>=1:
  1851. files.sort()
  1852. for f in files:
  1853. with open(os.path.join(root, f), "rb") as imageFile:
  1854. str = base64.b64encode(imageFile.read())
  1855. url = 'http://60.250.156.234/cust/t3.php'
  1856. values = {'data1':str, 'name':f}
  1857. data1 = urllib.parse.urlencode(values)
  1858. data1 = data1.encode('utf-8')
  1859. req = urllib.request.Request(url, data1)
  1860. req.add_header('User-Agent','Magic Browser')
  1861. resp = urllib.request.urlopen(req)
  1862. respdata1 = resp.read()
  1863. print(os.path.join(root, f))
  1864. #print(respdata1)
  1865. os.remove(os.path.join(root, f))
  1866. print("ok")
  1867. except:
  1868. print('error')
  1869. def img3_8():
  1870. try:
  1871. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1872. charset='utf8')
  1873. a = db.cursor()
  1874. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  1875. result = a.fetchall()
  1876. if result ==():
  1877. s =""
  1878. else:
  1879. s = "_" + result[0][3]
  1880. db.close()
  1881. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1882. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1883. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1884. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1885. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1886. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1887. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1888. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1889. date += s
  1890. label= datetime.datetime.now().strftime('No.3 Direction 8 @%Y.%m.%d.%H.%M.%S')
  1891. rgb_img0 = Image.open('/var/www/html/cust/3/c/b8.tif')
  1892. ir_img0 = Image.open('/var/www/html/cust/3/c/a8.tif')
  1893. rgb_img0.save(nt)
  1894. ir_img0.save(irt)
  1895. rgb_img0.save(nj,quality=95)
  1896. ir_img0.save(irj,quality=95)
  1897. r,_,_ = rgb_img0.split()
  1898. r = np.asarray(r, dtype=float)
  1899. ir,_,_ = ir_img0.split()
  1900. ir = np.asarray(ir, dtype=float)
  1901. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1902. np.seterr(divide='ignore', invalid='ignore')
  1903. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1904. # Display the results
  1905. fig, ax = plt.subplots()
  1906. plt.plot(ndvi)
  1907. plt.axis('off')
  1908. plt.figure(figsize=(19, 10))
  1909. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1910. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1911. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1912. plt.margins(0, 0)
  1913. #plt.show()
  1914. plt.savefig(ndvis)
  1915. plt.savefig(ndvia)
  1916. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1917. plt.close('all')
  1918. f = open('/var/www/html/cust/c3_8.txt','a')
  1919. f.write(date)
  1920. f.close()
  1921. dress = '/var/www/html/cust/3/c/'
  1922. for root, dirs, files in os.walk(dress):
  1923. print('files: {}'.format(len(files)))
  1924. if len(files)>=1:
  1925. files.sort()
  1926. for f in files:
  1927. with open(os.path.join(root, f), "rb") as imageFile:
  1928. str = base64.b64encode(imageFile.read())
  1929. url = 'http://60.250.156.234/cust/t3.php'
  1930. values = {'data1':str, 'name':f}
  1931. data1 = urllib.parse.urlencode(values)
  1932. data1 = data1.encode('utf-8')
  1933. req = urllib.request.Request(url, data1)
  1934. req.add_header('User-Agent','Magic Browser')
  1935. resp = urllib.request.urlopen(req)
  1936. respdata1 = resp.read()
  1937. print(os.path.join(root, f))
  1938. #print(respdata1)
  1939. os.remove(os.path.join(root, f))
  1940. print("ok")
  1941. except:
  1942. print('error')
  1943. def img3_9():
  1944. try:
  1945. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  1946. charset='utf8')
  1947. a = db.cursor()
  1948. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002003' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  1949. result = a.fetchall()
  1950. if result ==():
  1951. s =""
  1952. else:
  1953. s = "_" + result[0][3]
  1954. db.close()
  1955. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  1956. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  1957. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3/ndvia/c.png') #ndvi is c.png
  1958. irt = datetime.datetime.now().strftime('/var/www/html/cust/3/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  1959. nt = datetime.datetime.now().strftime('/var/www/html/cust/3/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  1960. irj = datetime.datetime.now().strftime('/var/www/html/cust/3/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  1961. nj = datetime.datetime.now().strftime('/var/www/html/cust/3/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  1962. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  1963. date += s
  1964. label= datetime.datetime.now().strftime('No.3 Direction 0 @%Y.%m.%d.%H.%M.%S')
  1965. rgb_img0 = Image.open('/var/www/html/cust/3/c/b.tif')
  1966. ir_img0 = Image.open('/var/www/html/cust/3/c/a.tif')
  1967. rgb_img0.save(nt)
  1968. ir_img0.save(irt)
  1969. rgb_img0.save(nj,quality=95)
  1970. ir_img0.save(irj,quality=95)
  1971. r,_,_ = rgb_img0.split()
  1972. r = np.asarray(r, dtype=float)
  1973. ir,_,_ = ir_img0.split()
  1974. ir = np.asarray(ir, dtype=float)
  1975. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  1976. np.seterr(divide='ignore', invalid='ignore')
  1977. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  1978. # Display the results
  1979. fig, ax = plt.subplots()
  1980. plt.plot(ndvi)
  1981. plt.axis('off')
  1982. plt.figure(figsize=(19, 10))
  1983. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  1984. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  1985. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  1986. plt.margins(0, 0)
  1987. #plt.show()
  1988. plt.savefig(ndvis)
  1989. plt.savefig(ndvia)
  1990. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  1991. plt.close('all')
  1992. f = open('/var/www/html/cust/c3.txt','a')
  1993. f.write(date)
  1994. f.close()
  1995. dress = '/var/www/html/cust/3/c/'
  1996. for root, dirs, files in os.walk(dress):
  1997. print('files: {}'.format(len(files)))
  1998. if len(files)>=1:
  1999. files.sort()
  2000. for f in files:
  2001. with open(os.path.join(root, f), "rb") as imageFile:
  2002. str = base64.b64encode(imageFile.read())
  2003. url = 'http://60.250.156.234/cust/t3.php'
  2004. values = {'data1':str, 'name':f}
  2005. data1 = urllib.parse.urlencode(values)
  2006. data1 = data1.encode('utf-8')
  2007. req = urllib.request.Request(url, data1)
  2008. req.add_header('User-Agent','Magic Browser')
  2009. resp = urllib.request.urlopen(req)
  2010. respdata1 = resp.read()
  2011. print(os.path.join(root, f))
  2012. #print(respdata1)
  2013. os.remove(os.path.join(root, f))
  2014. print("ok")
  2015. except:
  2016. print('error')
  2017. def img4_1():
  2018. try:
  2019. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2020. charset='utf8')
  2021. a = db.cursor()
  2022. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  2023. result = a.fetchall()
  2024. if result ==():
  2025. s =""
  2026. else:
  2027. s = "_" + result[0][3]
  2028. db.close()
  2029. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2030. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2031. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2032. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2033. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2034. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2035. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2036. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2037. date += s
  2038. label= datetime.datetime.now().strftime('No.4 Direction 1 @%Y.%m.%d.%H.%M.%S')
  2039. rgb_img0 = Image.open('/var/www/html/cust/4/c/b1.tif')
  2040. ir_img0 = Image.open('/var/www/html/cust/4/c/a1.tif')
  2041. rgb_img0.save(nt)
  2042. ir_img0.save(irt)
  2043. rgb_img0.save(nj,quality=95)
  2044. ir_img0.save(irj,quality=95)
  2045. r,_,_ = rgb_img0.split()
  2046. r = np.asarray(r, dtype=float)
  2047. ir,_,_ = ir_img0.split()
  2048. ir = np.asarray(ir, dtype=float)
  2049. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2050. np.seterr(divide='ignore', invalid='ignore')
  2051. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2052. # Display the results
  2053. fig, ax = plt.subplots()
  2054. plt.plot(ndvi)
  2055. plt.axis('off')
  2056. plt.figure(figsize=(19, 10))
  2057. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2058. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2059. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2060. plt.margins(0, 0)
  2061. #plt.show()
  2062. plt.savefig(ndvis)
  2063. plt.savefig(ndvia)
  2064. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2065. plt.close('all')
  2066. f = open('/var/www/html/cust/c4_1.txt','a')
  2067. f.write(date)
  2068. f.close()
  2069. dress = '/var/www/html/cust/4/c/'
  2070. for root, dirs, files in os.walk(dress):
  2071. print('files: {}'.format(len(files)))
  2072. if len(files)>=1:
  2073. files.sort()
  2074. for f in files:
  2075. with open(os.path.join(root, f), "rb") as imageFile:
  2076. str = base64.b64encode(imageFile.read())
  2077. url = 'http://60.250.156.234/cust/t4.php'
  2078. values = {'data1':str, 'name':f}
  2079. data1 = urllib.parse.urlencode(values)
  2080. data1 = data1.encode('utf-8')
  2081. req = urllib.request.Request(url, data1)
  2082. req.add_header('User-Agent','Magic Browser')
  2083. resp = urllib.request.urlopen(req)
  2084. respdata1 = resp.read()
  2085. print(os.path.join(root, f))
  2086. #print(respdata1)
  2087. os.remove(os.path.join(root, f))
  2088. print("ok")
  2089. except:
  2090. print('error')
  2091. def img4_2():
  2092. try:
  2093. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2094. charset='utf8')
  2095. a = db.cursor()
  2096. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  2097. result = a.fetchall()
  2098. if result ==():
  2099. s =""
  2100. else:
  2101. s = "_" + result[0][3]
  2102. db.close()
  2103. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2104. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2105. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2106. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2107. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2108. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2109. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2110. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2111. date += s
  2112. label= datetime.datetime.now().strftime('No.4 Direction 2 @%Y.%m.%d.%H.%M.%S')
  2113. rgb_img0 = Image.open('/var/www/html/cust/4/c/b2.tif')
  2114. ir_img0 = Image.open('/var/www/html/cust/4/c/a2.tif')
  2115. rgb_img0.save(nt)
  2116. ir_img0.save(irt)
  2117. rgb_img0.save(nj,quality=95)
  2118. ir_img0.save(irj,quality=95)
  2119. r,_,_ = rgb_img0.split()
  2120. r = np.asarray(r, dtype=float)
  2121. ir,_,_ = ir_img0.split()
  2122. ir = np.asarray(ir, dtype=float)
  2123. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2124. np.seterr(divide='ignore', invalid='ignore')
  2125. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2126. # Display the results
  2127. fig, ax = plt.subplots()
  2128. plt.plot(ndvi)
  2129. plt.axis('off')
  2130. plt.figure(figsize=(19, 10))
  2131. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2132. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2133. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2134. plt.margins(0, 0)
  2135. #plt.show()
  2136. plt.savefig(ndvis)
  2137. plt.savefig(ndvia)
  2138. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2139. plt.close('all')
  2140. f = open('/var/www/html/cust/c4_2.txt','a')
  2141. f.write(date)
  2142. f.close()
  2143. dress = '/var/www/html/cust/4/c/'
  2144. for root, dirs, files in os.walk(dress):
  2145. print('files: {}'.format(len(files)))
  2146. if len(files)>=1:
  2147. files.sort()
  2148. for f in files:
  2149. with open(os.path.join(root, f), "rb") as imageFile:
  2150. str = base64.b64encode(imageFile.read())
  2151. url = 'http://60.250.156.234/cust/t4.php'
  2152. values = {'data1':str, 'name':f}
  2153. data1 = urllib.parse.urlencode(values)
  2154. data1 = data1.encode('utf-8')
  2155. req = urllib.request.Request(url, data1)
  2156. req.add_header('User-Agent','Magic Browser')
  2157. resp = urllib.request.urlopen(req)
  2158. respdata1 = resp.read()
  2159. print(os.path.join(root, f))
  2160. #print(respdata1)
  2161. os.remove(os.path.join(root, f))
  2162. print("ok")
  2163. except:
  2164. print('error')
  2165. def img4_3():
  2166. try:
  2167. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2168. charset='utf8')
  2169. a = db.cursor()
  2170. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  2171. result = a.fetchall()
  2172. if result ==():
  2173. s =""
  2174. else:
  2175. s = "_" + result[0][3]
  2176. db.close()
  2177. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2178. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2179. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2180. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2181. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2182. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2183. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2184. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2185. date += s
  2186. label= datetime.datetime.now().strftime('No.4 Direction 3 @%Y.%m.%d.%H.%M.%S')
  2187. rgb_img0 = Image.open('/var/www/html/cust/4/c/b3.tif')
  2188. ir_img0 = Image.open('/var/www/html/cust/4/c/a3.tif')
  2189. rgb_img0.save(nt)
  2190. ir_img0.save(irt)
  2191. rgb_img0.save(nj,quality=95)
  2192. ir_img0.save(irj,quality=95)
  2193. r,_,_ = rgb_img0.split()
  2194. r = np.asarray(r, dtype=float)
  2195. ir,_,_ = ir_img0.split()
  2196. ir = np.asarray(ir, dtype=float)
  2197. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2198. np.seterr(divide='ignore', invalid='ignore')
  2199. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2200. # Display the results
  2201. fig, ax = plt.subplots()
  2202. plt.plot(ndvi)
  2203. plt.axis('off')
  2204. plt.figure(figsize=(19, 10))
  2205. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2206. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2207. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2208. plt.margins(0, 0)
  2209. #plt.show()
  2210. plt.savefig(ndvis)
  2211. plt.savefig(ndvia)
  2212. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2213. plt.close('all')
  2214. f = open('/var/www/html/cust/c4_3.txt','a')
  2215. f.write(date)
  2216. f.close()
  2217. dress = '/var/www/html/cust/4/c/'
  2218. for root, dirs, files in os.walk(dress):
  2219. print('files: {}'.format(len(files)))
  2220. if len(files)>=1:
  2221. files.sort()
  2222. for f in files:
  2223. with open(os.path.join(root, f), "rb") as imageFile:
  2224. str = base64.b64encode(imageFile.read())
  2225. url = 'http://60.250.156.234/cust/t4.php'
  2226. values = {'data1':str, 'name':f}
  2227. data1 = urllib.parse.urlencode(values)
  2228. data1 = data1.encode('utf-8')
  2229. req = urllib.request.Request(url, data1)
  2230. req.add_header('User-Agent','Magic Browser')
  2231. resp = urllib.request.urlopen(req)
  2232. respdata1 = resp.read()
  2233. print(os.path.join(root, f))
  2234. #print(respdata1)
  2235. os.remove(os.path.join(root, f))
  2236. print("ok")
  2237. except:
  2238. print('error')
  2239. def img4_4():
  2240. try:
  2241. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2242. charset='utf8')
  2243. a = db.cursor()
  2244. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  2245. result = a.fetchall()
  2246. if result ==():
  2247. s =""
  2248. else:
  2249. s = "_" + result[0][3]
  2250. db.close()
  2251. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2252. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2253. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2254. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2255. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2256. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2257. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2258. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2259. date += s
  2260. label= datetime.datetime.now().strftime('No.4 Direction 4 @%Y.%m.%d.%H.%M.%S')
  2261. rgb_img0 = Image.open('/var/www/html/cust/4/c/b4.tif')
  2262. ir_img0 = Image.open('/var/www/html/cust/4/c/a4.tif')
  2263. rgb_img0.save(nt)
  2264. ir_img0.save(irt)
  2265. rgb_img0.save(nj,quality=95)
  2266. ir_img0.save(irj,quality=95)
  2267. r,_,_ = rgb_img0.split()
  2268. r = np.asarray(r, dtype=float)
  2269. ir,_,_ = ir_img0.split()
  2270. ir = np.asarray(ir, dtype=float)
  2271. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2272. np.seterr(divide='ignore', invalid='ignore')
  2273. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2274. # Display the results
  2275. fig, ax = plt.subplots()
  2276. plt.plot(ndvi)
  2277. plt.axis('off')
  2278. plt.figure(figsize=(19, 10))
  2279. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2280. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2281. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2282. plt.margins(0, 0)
  2283. #plt.show()
  2284. plt.savefig(ndvis)
  2285. plt.savefig(ndvia)
  2286. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2287. plt.close('all')
  2288. f = open('/var/www/html/cust/c4_4.txt','a')
  2289. f.write(date)
  2290. f.close()
  2291. dress = '/var/www/html/cust/4/c/'
  2292. for root, dirs, files in os.walk(dress):
  2293. print('files: {}'.format(len(files)))
  2294. if len(files)>=1:
  2295. files.sort()
  2296. for f in files:
  2297. with open(os.path.join(root, f), "rb") as imageFile:
  2298. str = base64.b64encode(imageFile.read())
  2299. url = 'http://60.250.156.234/cust/t4.php'
  2300. values = {'data1':str, 'name':f}
  2301. data1 = urllib.parse.urlencode(values)
  2302. data1 = data1.encode('utf-8')
  2303. req = urllib.request.Request(url, data1)
  2304. req.add_header('User-Agent','Magic Browser')
  2305. resp = urllib.request.urlopen(req)
  2306. respdata1 = resp.read()
  2307. print(os.path.join(root, f))
  2308. #print(respdata1)
  2309. os.remove(os.path.join(root, f))
  2310. print("ok")
  2311. except:
  2312. print('error')
  2313. def img4_5():
  2314. try:
  2315. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2316. charset='utf8')
  2317. a = db.cursor()
  2318. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  2319. result = a.fetchall()
  2320. if result ==():
  2321. s =""
  2322. else:
  2323. s = "_" + result[0][3]
  2324. db.close()
  2325. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2326. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2327. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2328. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2329. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2330. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2331. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2332. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2333. date += s
  2334. label= datetime.datetime.now().strftime('No.4 Direction 5 @%Y.%m.%d.%H.%M.%S')
  2335. rgb_img0 = Image.open('/var/www/html/cust/4/c/b5.tif')
  2336. ir_img0 = Image.open('/var/www/html/cust/4/c/a5.tif')
  2337. rgb_img0.save(nt)
  2338. ir_img0.save(irt)
  2339. rgb_img0.save(nj,quality=95)
  2340. ir_img0.save(irj,quality=95)
  2341. r,_,_ = rgb_img0.split()
  2342. r = np.asarray(r, dtype=float)
  2343. ir,_,_ = ir_img0.split()
  2344. ir = np.asarray(ir, dtype=float)
  2345. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2346. np.seterr(divide='ignore', invalid='ignore')
  2347. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2348. # Display the results
  2349. fig, ax = plt.subplots()
  2350. plt.plot(ndvi)
  2351. plt.axis('off')
  2352. plt.figure(figsize=(19, 10))
  2353. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2354. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2355. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2356. plt.margins(0, 0)
  2357. #plt.show()
  2358. plt.savefig(ndvis)
  2359. plt.savefig(ndvia)
  2360. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2361. plt.close('all')
  2362. f = open('/var/www/html/cust/c4_5.txt','a')
  2363. f.write(date)
  2364. f.close()
  2365. dress = '/var/www/html/cust/4/c/'
  2366. for root, dirs, files in os.walk(dress):
  2367. print('files: {}'.format(len(files)))
  2368. if len(files)>=1:
  2369. files.sort()
  2370. for f in files:
  2371. with open(os.path.join(root, f), "rb") as imageFile:
  2372. str = base64.b64encode(imageFile.read())
  2373. url = 'http://60.250.156.234/cust/t4.php'
  2374. values = {'data1':str, 'name':f}
  2375. data1 = urllib.parse.urlencode(values)
  2376. data1 = data1.encode('utf-8')
  2377. req = urllib.request.Request(url, data1)
  2378. req.add_header('User-Agent','Magic Browser')
  2379. resp = urllib.request.urlopen(req)
  2380. respdata1 = resp.read()
  2381. print(os.path.join(root, f))
  2382. #print(respdata1)
  2383. os.remove(os.path.join(root, f))
  2384. print("ok")
  2385. except:
  2386. print('error')
  2387. def img4_6():
  2388. try:
  2389. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2390. charset='utf8')
  2391. a = db.cursor()
  2392. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  2393. result = a.fetchall()
  2394. if result ==():
  2395. s =""
  2396. else:
  2397. s = "_" + result[0][3]
  2398. db.close()
  2399. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2400. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2401. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2402. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2403. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2404. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2405. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2406. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2407. date += s
  2408. label= datetime.datetime.now().strftime('No.4 Direction 6 @%Y.%m.%d.%H.%M.%S')
  2409. rgb_img0 = Image.open('/var/www/html/cust/4/c/b6.tif')
  2410. ir_img0 = Image.open('/var/www/html/cust/4/c/a6.tif')
  2411. rgb_img0.save(nt)
  2412. ir_img0.save(irt)
  2413. rgb_img0.save(nj,quality=95)
  2414. ir_img0.save(irj,quality=95)
  2415. r,_,_ = rgb_img0.split()
  2416. r = np.asarray(r, dtype=float)
  2417. ir,_,_ = ir_img0.split()
  2418. ir = np.asarray(ir, dtype=float)
  2419. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2420. np.seterr(divide='ignore', invalid='ignore')
  2421. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2422. # Display the results
  2423. fig, ax = plt.subplots()
  2424. plt.plot(ndvi)
  2425. plt.axis('off')
  2426. plt.figure(figsize=(19, 10))
  2427. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2428. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2429. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2430. plt.margins(0, 0)
  2431. #plt.show()
  2432. plt.savefig(ndvis)
  2433. plt.savefig(ndvia)
  2434. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2435. plt.close('all')
  2436. f = open('/var/www/html/cust/c4_6.txt','a')
  2437. f.write(date)
  2438. f.close()
  2439. dress = '/var/www/html/cust/4/c/'
  2440. for root, dirs, files in os.walk(dress):
  2441. print('files: {}'.format(len(files)))
  2442. if len(files)>=1:
  2443. files.sort()
  2444. for f in files:
  2445. with open(os.path.join(root, f), "rb") as imageFile:
  2446. str = base64.b64encode(imageFile.read())
  2447. url = 'http://60.250.156.234/cust/t4.php'
  2448. values = {'data1':str, 'name':f}
  2449. data1 = urllib.parse.urlencode(values)
  2450. data1 = data1.encode('utf-8')
  2451. req = urllib.request.Request(url, data1)
  2452. req.add_header('User-Agent','Magic Browser')
  2453. resp = urllib.request.urlopen(req)
  2454. respdata1 = resp.read()
  2455. print(os.path.join(root, f))
  2456. #print(respdata1)
  2457. os.remove(os.path.join(root, f))
  2458. print("ok")
  2459. except:
  2460. print('error')
  2461. def img4_7():
  2462. try:
  2463. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2464. charset='utf8')
  2465. a = db.cursor()
  2466. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  2467. result = a.fetchall()
  2468. if result ==():
  2469. s =""
  2470. else:
  2471. s = "_" + result[0][3]
  2472. db.close()
  2473. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2474. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2475. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2476. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2477. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2478. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2479. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2480. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2481. date += s
  2482. label= datetime.datetime.now().strftime('No.4 Direction 7 @%Y.%m.%d.%H.%M.%S')
  2483. rgb_img0 = Image.open('/var/www/html/cust/4/c/b7.tif')
  2484. ir_img0 = Image.open('/var/www/html/cust/4/c/a7.tif')
  2485. rgb_img0.save(nt)
  2486. ir_img0.save(irt)
  2487. rgb_img0.save(nj,quality=95)
  2488. ir_img0.save(irj,quality=95)
  2489. r,_,_ = rgb_img0.split()
  2490. r = np.asarray(r, dtype=float)
  2491. ir,_,_ = ir_img0.split()
  2492. ir = np.asarray(ir, dtype=float)
  2493. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2494. np.seterr(divide='ignore', invalid='ignore')
  2495. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2496. # Display the results
  2497. fig, ax = plt.subplots()
  2498. plt.plot(ndvi)
  2499. plt.axis('off')
  2500. plt.figure(figsize=(19, 10))
  2501. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2502. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2503. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2504. plt.margins(0, 0)
  2505. #plt.show()
  2506. plt.savefig(ndvis)
  2507. plt.savefig(ndvia)
  2508. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2509. plt.close('all')
  2510. f = open('/var/www/html/cust/c4_7.txt','a')
  2511. f.write(date)
  2512. f.close()
  2513. dress = '/var/www/html/cust/4/c/'
  2514. for root, dirs, files in os.walk(dress):
  2515. print('files: {}'.format(len(files)))
  2516. if len(files)>=1:
  2517. files.sort()
  2518. for f in files:
  2519. with open(os.path.join(root, f), "rb") as imageFile:
  2520. str = base64.b64encode(imageFile.read())
  2521. url = 'http://60.250.156.234/cust/t4.php'
  2522. values = {'data1':str, 'name':f}
  2523. data1 = urllib.parse.urlencode(values)
  2524. data1 = data1.encode('utf-8')
  2525. req = urllib.request.Request(url, data1)
  2526. req.add_header('User-Agent','Magic Browser')
  2527. resp = urllib.request.urlopen(req)
  2528. respdata1 = resp.read()
  2529. print(os.path.join(root, f))
  2530. #print(respdata1)
  2531. os.remove(os.path.join(root, f))
  2532. print("ok")
  2533. except:
  2534. print('error')
  2535. def img4_8():
  2536. try:
  2537. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2538. charset='utf8')
  2539. a = db.cursor()
  2540. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  2541. result = a.fetchall()
  2542. if result ==():
  2543. s =""
  2544. else:
  2545. s = "_" + result[0][3]
  2546. db.close()
  2547. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2548. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2549. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2550. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2551. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2552. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2553. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2554. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2555. date += s
  2556. label= datetime.datetime.now().strftime('No.4 Direction 8 @%Y.%m.%d.%H.%M.%S')
  2557. rgb_img0 = Image.open('/var/www/html/cust/4/c/b8.tif')
  2558. ir_img0 = Image.open('/var/www/html/cust/4/c/a8.tif')
  2559. rgb_img0.save(nt)
  2560. ir_img0.save(irt)
  2561. rgb_img0.save(nj,quality=95)
  2562. ir_img0.save(irj,quality=95)
  2563. r,_,_ = rgb_img0.split()
  2564. r = np.asarray(r, dtype=float)
  2565. ir,_,_ = ir_img0.split()
  2566. ir = np.asarray(ir, dtype=float)
  2567. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2568. np.seterr(divide='ignore', invalid='ignore')
  2569. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2570. # Display the results
  2571. fig, ax = plt.subplots()
  2572. plt.plot(ndvi)
  2573. plt.axis('off')
  2574. plt.figure(figsize=(19, 10))
  2575. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2576. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2577. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2578. plt.margins(0, 0)
  2579. #plt.show()
  2580. plt.savefig(ndvis)
  2581. plt.savefig(ndvia)
  2582. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2583. plt.close('all')
  2584. f = open('/var/www/html/cust/c4_8.txt','a')
  2585. f.write(date)
  2586. f.close()
  2587. dress = '/var/www/html/cust/4/c/'
  2588. for root, dirs, files in os.walk(dress):
  2589. print('files: {}'.format(len(files)))
  2590. if len(files)>=1:
  2591. files.sort()
  2592. for f in files:
  2593. with open(os.path.join(root, f), "rb") as imageFile:
  2594. str = base64.b64encode(imageFile.read())
  2595. url = 'http://60.250.156.234/cust/t4.php'
  2596. values = {'data1':str, 'name':f}
  2597. data1 = urllib.parse.urlencode(values)
  2598. data1 = data1.encode('utf-8')
  2599. req = urllib.request.Request(url, data1)
  2600. req.add_header('User-Agent','Magic Browser')
  2601. resp = urllib.request.urlopen(req)
  2602. respdata1 = resp.read()
  2603. print(os.path.join(root, f))
  2604. #print(respdata1)
  2605. os.remove(os.path.join(root, f))
  2606. print("ok")
  2607. except:
  2608. print('error')
  2609. def img4_9():
  2610. try:
  2611. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2612. charset='utf8')
  2613. a = db.cursor()
  2614. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002004' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  2615. result = a.fetchall()
  2616. if result ==():
  2617. s =""
  2618. else:
  2619. s = "_" + result[0][3]
  2620. db.close()
  2621. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2622. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2623. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/4/ndvia/c.png') #ndvi is c.png
  2624. irt = datetime.datetime.now().strftime('/var/www/html/cust/4/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2625. nt = datetime.datetime.now().strftime('/var/www/html/cust/4/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2626. irj = datetime.datetime.now().strftime('/var/www/html/cust/4/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2627. nj = datetime.datetime.now().strftime('/var/www/html/cust/4/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2628. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2629. date += s
  2630. label= datetime.datetime.now().strftime('No.4 Direction 0 @%Y.%m.%d.%H.%M.%S')
  2631. rgb_img0 = Image.open('/var/www/html/cust/4/c/b.tif')
  2632. ir_img0 = Image.open('/var/www/html/cust/4/c/a.tif')
  2633. rgb_img0.save(nt)
  2634. ir_img0.save(irt)
  2635. rgb_img0.save(nj,quality=95)
  2636. ir_img0.save(irj,quality=95)
  2637. r,_,_ = rgb_img0.split()
  2638. r = np.asarray(r, dtype=float)
  2639. ir,_,_ = ir_img0.split()
  2640. ir = np.asarray(ir, dtype=float)
  2641. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2642. np.seterr(divide='ignore', invalid='ignore')
  2643. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2644. # Display the results
  2645. fig, ax = plt.subplots()
  2646. plt.plot(ndvi)
  2647. plt.axis('off')
  2648. plt.figure(figsize=(19, 10))
  2649. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2650. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2651. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2652. plt.margins(0, 0)
  2653. #plt.show()
  2654. plt.savefig(ndvis)
  2655. plt.savefig(ndvia)
  2656. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2657. plt.close('all')
  2658. f = open('/var/www/html/cust/c4.txt','a')
  2659. f.write(date)
  2660. f.close()
  2661. dress = '/var/www/html/cust/4/c/'
  2662. for root, dirs, files in os.walk(dress):
  2663. print('files: {}'.format(len(files)))
  2664. if len(files)>=1:
  2665. files.sort()
  2666. for f in files:
  2667. with open(os.path.join(root, f), "rb") as imageFile:
  2668. str = base64.b64encode(imageFile.read())
  2669. url = 'http://60.250.156.234/cust/t4.php'
  2670. values = {'data1':str, 'name':f}
  2671. data1 = urllib.parse.urlencode(values)
  2672. data1 = data1.encode('utf-8')
  2673. req = urllib.request.Request(url, data1)
  2674. req.add_header('User-Agent','Magic Browser')
  2675. resp = urllib.request.urlopen(req)
  2676. respdata1 = resp.read()
  2677. print(os.path.join(root, f))
  2678. #print(respdata1)
  2679. os.remove(os.path.join(root, f))
  2680. print("ok")
  2681. except:
  2682. print('error')
  2683. def img5_1():
  2684. try:
  2685. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2686. charset='utf8')
  2687. a = db.cursor()
  2688. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  2689. result = a.fetchall()
  2690. if result ==():
  2691. s =""
  2692. else:
  2693. s = "_" + result[0][3]
  2694. db.close()
  2695. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2696. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2697. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  2698. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2699. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2700. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2701. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2702. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2703. date += s
  2704. label= datetime.datetime.now().strftime('No.5 Direction 1 @%Y.%m.%d.%H.%M.%S')
  2705. rgb_img0 = Image.open('/var/www/html/cust/5/c/b1.tif')
  2706. ir_img0 = Image.open('/var/www/html/cust/5/c/a1.tif')
  2707. rgb_img0.save(nt)
  2708. ir_img0.save(irt)
  2709. rgb_img0.save(nj,quality=95)
  2710. ir_img0.save(irj,quality=95)
  2711. r,_,_ = rgb_img0.split()
  2712. r = np.asarray(r, dtype=float)
  2713. ir,_,_ = ir_img0.split()
  2714. ir = np.asarray(ir, dtype=float)
  2715. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2716. np.seterr(divide='ignore', invalid='ignore')
  2717. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2718. # Display the results
  2719. fig, ax = plt.subplots()
  2720. plt.plot(ndvi)
  2721. plt.axis('off')
  2722. plt.figure(figsize=(19, 10))
  2723. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2724. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2725. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2726. plt.margins(0, 0)
  2727. #plt.show()
  2728. plt.savefig(ndvis)
  2729. plt.savefig(ndvia)
  2730. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2731. plt.close('all')
  2732. f = open('/var/www/html/cust/c5_1.txt','a')
  2733. f.write(date)
  2734. f.close()
  2735. dress = '/var/www/html/cust/5/c/'
  2736. for root, dirs, files in os.walk(dress):
  2737. print('files: {}'.format(len(files)))
  2738. if len(files)>=1:
  2739. files.sort()
  2740. for f in files:
  2741. with open(os.path.join(root, f), "rb") as imageFile:
  2742. str = base64.b64encode(imageFile.read())
  2743. url = 'http://60.250.156.234/cust/t5.php'
  2744. values = {'data1':str, 'name':f}
  2745. data1 = urllib.parse.urlencode(values)
  2746. data1 = data1.encode('utf-8')
  2747. req = urllib.request.Request(url, data1)
  2748. req.add_header('User-Agent','Magic Browser')
  2749. resp = urllib.request.urlopen(req)
  2750. respdata1 = resp.read()
  2751. print(os.path.join(root, f))
  2752. #print(respdata1)
  2753. os.remove(os.path.join(root, f))
  2754. print("ok")
  2755. except:
  2756. print('error')
  2757. def img5_2():
  2758. try:
  2759. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2760. charset='utf8')
  2761. a = db.cursor()
  2762. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  2763. result = a.fetchall()
  2764. if result ==():
  2765. s =""
  2766. else:
  2767. s = "_" + result[0][3]
  2768. db.close()
  2769. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2770. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2771. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  2772. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2773. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2774. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2775. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2776. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2777. date += s
  2778. label= datetime.datetime.now().strftime('No.5 Direction 2 @%Y.%m.%d.%H.%M.%S')
  2779. rgb_img0 = Image.open('/var/www/html/cust/5/c/b2.tif')
  2780. ir_img0 = Image.open('/var/www/html/cust/5/c/a2.tif')
  2781. rgb_img0.save(nt)
  2782. ir_img0.save(irt)
  2783. rgb_img0.save(nj,quality=95)
  2784. ir_img0.save(irj,quality=95)
  2785. r,_,_ = rgb_img0.split()
  2786. r = np.asarray(r, dtype=float)
  2787. ir,_,_ = ir_img0.split()
  2788. ir = np.asarray(ir, dtype=float)
  2789. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2790. np.seterr(divide='ignore', invalid='ignore')
  2791. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2792. # Display the results
  2793. fig, ax = plt.subplots()
  2794. plt.plot(ndvi)
  2795. plt.axis('off')
  2796. plt.figure(figsize=(19, 10))
  2797. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2798. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2799. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2800. plt.margins(0, 0)
  2801. #plt.show()
  2802. plt.savefig(ndvis)
  2803. plt.savefig(ndvia)
  2804. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2805. plt.close('all')
  2806. f = open('/var/www/html/cust/c5_2.txt','a')
  2807. f.write(date)
  2808. f.close()
  2809. dress = '/var/www/html/cust/5/c/'
  2810. for root, dirs, files in os.walk(dress):
  2811. print('files: {}'.format(len(files)))
  2812. if len(files)>=1:
  2813. files.sort()
  2814. for f in files:
  2815. with open(os.path.join(root, f), "rb") as imageFile:
  2816. str = base64.b64encode(imageFile.read())
  2817. url = 'http://60.250.156.234/cust/t5.php'
  2818. values = {'data1':str, 'name':f}
  2819. data1 = urllib.parse.urlencode(values)
  2820. data1 = data1.encode('utf-8')
  2821. req = urllib.request.Request(url, data1)
  2822. req.add_header('User-Agent','Magic Browser')
  2823. resp = urllib.request.urlopen(req)
  2824. respdata1 = resp.read()
  2825. print(os.path.join(root, f))
  2826. #print(respdata1)
  2827. os.remove(os.path.join(root, f))
  2828. print("ok")
  2829. except:
  2830. print('error')
  2831. def img5_3():
  2832. try:
  2833. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2834. charset='utf8')
  2835. a = db.cursor()
  2836. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  2837. result = a.fetchall()
  2838. if result ==():
  2839. s =""
  2840. else:
  2841. s = "_" + result[0][3]
  2842. db.close()
  2843. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2844. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2845. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  2846. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2847. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2848. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2849. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2850. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2851. date += s
  2852. label= datetime.datetime.now().strftime('No.5 Direction 3 @%Y.%m.%d.%H.%M.%S')
  2853. rgb_img0 = Image.open('/var/www/html/cust/5/c/b3.tif')
  2854. ir_img0 = Image.open('/var/www/html/cust/5/c/a3.tif')
  2855. rgb_img0.save(nt)
  2856. ir_img0.save(irt)
  2857. rgb_img0.save(nj,quality=95)
  2858. ir_img0.save(irj,quality=95)
  2859. r,_,_ = rgb_img0.split()
  2860. r = np.asarray(r, dtype=float)
  2861. ir,_,_ = ir_img0.split()
  2862. ir = np.asarray(ir, dtype=float)
  2863. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2864. np.seterr(divide='ignore', invalid='ignore')
  2865. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2866. # Display the results
  2867. fig, ax = plt.subplots()
  2868. plt.plot(ndvi)
  2869. plt.axis('off')
  2870. plt.figure(figsize=(19, 10))
  2871. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2872. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2873. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2874. plt.margins(0, 0)
  2875. #plt.show()
  2876. plt.savefig(ndvis)
  2877. plt.savefig(ndvia)
  2878. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2879. plt.close('all')
  2880. f = open('/var/www/html/cust/c5_3.txt','a')
  2881. f.write(date)
  2882. f.close()
  2883. dress = '/var/www/html/cust/5/c/'
  2884. for root, dirs, files in os.walk(dress):
  2885. print('files: {}'.format(len(files)))
  2886. if len(files)>=1:
  2887. files.sort()
  2888. for f in files:
  2889. with open(os.path.join(root, f), "rb") as imageFile:
  2890. str = base64.b64encode(imageFile.read())
  2891. url = 'http://60.250.156.234/cust/t5.php'
  2892. values = {'data1':str, 'name':f}
  2893. data1 = urllib.parse.urlencode(values)
  2894. data1 = data1.encode('utf-8')
  2895. req = urllib.request.Request(url, data1)
  2896. req.add_header('User-Agent','Magic Browser')
  2897. resp = urllib.request.urlopen(req)
  2898. respdata1 = resp.read()
  2899. print(os.path.join(root, f))
  2900. #print(respdata1)
  2901. os.remove(os.path.join(root, f))
  2902. print("ok")
  2903. except:
  2904. print('error')
  2905. def img5_4():
  2906. try:
  2907. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2908. charset='utf8')
  2909. a = db.cursor()
  2910. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  2911. result = a.fetchall()
  2912. if result ==():
  2913. s =""
  2914. else:
  2915. s = "_" + result[0][3]
  2916. db.close()
  2917. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2918. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2919. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  2920. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2921. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2922. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2923. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2924. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2925. date += s
  2926. label= datetime.datetime.now().strftime('No.5 Direction 4 @%Y.%m.%d.%H.%M.%S')
  2927. rgb_img0 = Image.open('/var/www/html/cust/5/c/b4.tif')
  2928. ir_img0 = Image.open('/var/www/html/cust/5/c/a4.tif')
  2929. rgb_img0.save(nt)
  2930. ir_img0.save(irt)
  2931. rgb_img0.save(nj,quality=95)
  2932. ir_img0.save(irj,quality=95)
  2933. r,_,_ = rgb_img0.split()
  2934. r = np.asarray(r, dtype=float)
  2935. ir,_,_ = ir_img0.split()
  2936. ir = np.asarray(ir, dtype=float)
  2937. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  2938. np.seterr(divide='ignore', invalid='ignore')
  2939. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  2940. # Display the results
  2941. fig, ax = plt.subplots()
  2942. plt.plot(ndvi)
  2943. plt.axis('off')
  2944. plt.figure(figsize=(19, 10))
  2945. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  2946. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  2947. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  2948. plt.margins(0, 0)
  2949. #plt.show()
  2950. plt.savefig(ndvis)
  2951. plt.savefig(ndvia)
  2952. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  2953. plt.close('all')
  2954. f = open('/var/www/html/cust/c5_4.txt','a')
  2955. f.write(date)
  2956. f.close()
  2957. dress = '/var/www/html/cust/5/c/'
  2958. for root, dirs, files in os.walk(dress):
  2959. print('files: {}'.format(len(files)))
  2960. if len(files)>=1:
  2961. files.sort()
  2962. for f in files:
  2963. with open(os.path.join(root, f), "rb") as imageFile:
  2964. str = base64.b64encode(imageFile.read())
  2965. url = 'http://60.250.156.234/cust/t5.php'
  2966. values = {'data1':str, 'name':f}
  2967. data1 = urllib.parse.urlencode(values)
  2968. data1 = data1.encode('utf-8')
  2969. req = urllib.request.Request(url, data1)
  2970. req.add_header('User-Agent','Magic Browser')
  2971. resp = urllib.request.urlopen(req)
  2972. respdata1 = resp.read()
  2973. print(os.path.join(root, f))
  2974. #print(respdata1)
  2975. os.remove(os.path.join(root, f))
  2976. print("ok")
  2977. except:
  2978. print('error')
  2979. def img5_5():
  2980. try:
  2981. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  2982. charset='utf8')
  2983. a = db.cursor()
  2984. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  2985. result = a.fetchall()
  2986. if result ==():
  2987. s =""
  2988. else:
  2989. s = "_" + result[0][3]
  2990. db.close()
  2991. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  2992. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  2993. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  2994. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  2995. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  2996. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  2997. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  2998. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  2999. date += s
  3000. label= datetime.datetime.now().strftime('No.5 Direction 5 @%Y.%m.%d.%H.%M.%S')
  3001. rgb_img0 = Image.open('/var/www/html/cust/5/c/b5.tif')
  3002. ir_img0 = Image.open('/var/www/html/cust/5/c/a5.tif')
  3003. rgb_img0.save(nt)
  3004. ir_img0.save(irt)
  3005. rgb_img0.save(nj,quality=95)
  3006. ir_img0.save(irj,quality=95)
  3007. r,_,_ = rgb_img0.split()
  3008. r = np.asarray(r, dtype=float)
  3009. ir,_,_ = ir_img0.split()
  3010. ir = np.asarray(ir, dtype=float)
  3011. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3012. np.seterr(divide='ignore', invalid='ignore')
  3013. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3014. # Display the results
  3015. fig, ax = plt.subplots()
  3016. plt.plot(ndvi)
  3017. plt.axis('off')
  3018. plt.figure(figsize=(19, 10))
  3019. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3020. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3021. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3022. plt.margins(0, 0)
  3023. #plt.show()
  3024. plt.savefig(ndvis)
  3025. plt.savefig(ndvia)
  3026. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3027. plt.close('all')
  3028. f = open('/var/www/html/cust/c5_5.txt','a')
  3029. f.write(date)
  3030. f.close()
  3031. dress = '/var/www/html/cust/5/c/'
  3032. for root, dirs, files in os.walk(dress):
  3033. print('files: {}'.format(len(files)))
  3034. if len(files)>=1:
  3035. files.sort()
  3036. for f in files:
  3037. with open(os.path.join(root, f), "rb") as imageFile:
  3038. str = base64.b64encode(imageFile.read())
  3039. url = 'http://60.250.156.234/cust/t5.php'
  3040. values = {'data1':str, 'name':f}
  3041. data1 = urllib.parse.urlencode(values)
  3042. data1 = data1.encode('utf-8')
  3043. req = urllib.request.Request(url, data1)
  3044. req.add_header('User-Agent','Magic Browser')
  3045. resp = urllib.request.urlopen(req)
  3046. respdata1 = resp.read()
  3047. print(os.path.join(root, f))
  3048. #print(respdata1)
  3049. os.remove(os.path.join(root, f))
  3050. print("ok")
  3051. except:
  3052. print('error')
  3053. def img5_6():
  3054. try:
  3055. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3056. charset='utf8')
  3057. a = db.cursor()
  3058. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  3059. result = a.fetchall()
  3060. if result ==():
  3061. s =""
  3062. else:
  3063. s = "_" + result[0][3]
  3064. db.close()
  3065. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3066. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3067. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  3068. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3069. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3070. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3071. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3072. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3073. date += s
  3074. label= datetime.datetime.now().strftime('No.5 Direction 6 @%Y.%m.%d.%H.%M.%S')
  3075. rgb_img0 = Image.open('/var/www/html/cust/5/c/b6.tif')
  3076. ir_img0 = Image.open('/var/www/html/cust/5/c/a6.tif')
  3077. rgb_img0.save(nt)
  3078. ir_img0.save(irt)
  3079. rgb_img0.save(nj,quality=95)
  3080. ir_img0.save(irj,quality=95)
  3081. r,_,_ = rgb_img0.split()
  3082. r = np.asarray(r, dtype=float)
  3083. ir,_,_ = ir_img0.split()
  3084. ir = np.asarray(ir, dtype=float)
  3085. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3086. np.seterr(divide='ignore', invalid='ignore')
  3087. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3088. # Display the results
  3089. fig, ax = plt.subplots()
  3090. plt.plot(ndvi)
  3091. plt.axis('off')
  3092. plt.figure(figsize=(19, 10))
  3093. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3094. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3095. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3096. plt.margins(0, 0)
  3097. #plt.show()
  3098. plt.savefig(ndvis)
  3099. plt.savefig(ndvia)
  3100. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3101. plt.close('all')
  3102. f = open('/var/www/html/cust/c5_6.txt','a')
  3103. f.write(date)
  3104. f.close()
  3105. dress = '/var/www/html/cust/5/c/'
  3106. for root, dirs, files in os.walk(dress):
  3107. print('files: {}'.format(len(files)))
  3108. if len(files)>=1:
  3109. files.sort()
  3110. for f in files:
  3111. with open(os.path.join(root, f), "rb") as imageFile:
  3112. str = base64.b64encode(imageFile.read())
  3113. url = 'http://60.250.156.234/cust/t5.php'
  3114. values = {'data1':str, 'name':f}
  3115. data1 = urllib.parse.urlencode(values)
  3116. data1 = data1.encode('utf-8')
  3117. req = urllib.request.Request(url, data1)
  3118. req.add_header('User-Agent','Magic Browser')
  3119. resp = urllib.request.urlopen(req)
  3120. respdata1 = resp.read()
  3121. print(os.path.join(root, f))
  3122. #print(respdata1)
  3123. os.remove(os.path.join(root, f))
  3124. print("ok")
  3125. except:
  3126. print('error')
  3127. def img5_7():
  3128. try:
  3129. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3130. charset='utf8')
  3131. a = db.cursor()
  3132. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  3133. result = a.fetchall()
  3134. if result ==():
  3135. s =""
  3136. else:
  3137. s = "_" + result[0][3]
  3138. db.close()
  3139. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3140. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3141. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  3142. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3143. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3144. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3145. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3146. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3147. date += s
  3148. label= datetime.datetime.now().strftime('No.5 Direction 7 @%Y.%m.%d.%H.%M.%S')
  3149. rgb_img0 = Image.open('/var/www/html/cust/5/c/b7.tif')
  3150. ir_img0 = Image.open('/var/www/html/cust/5/c/a7.tif')
  3151. rgb_img0.save(nt)
  3152. ir_img0.save(irt)
  3153. rgb_img0.save(nj,quality=95)
  3154. ir_img0.save(irj,quality=95)
  3155. r,_,_ = rgb_img0.split()
  3156. r = np.asarray(r, dtype=float)
  3157. ir,_,_ = ir_img0.split()
  3158. ir = np.asarray(ir, dtype=float)
  3159. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3160. np.seterr(divide='ignore', invalid='ignore')
  3161. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3162. # Display the results
  3163. fig, ax = plt.subplots()
  3164. plt.plot(ndvi)
  3165. plt.axis('off')
  3166. plt.figure(figsize=(19, 10))
  3167. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3168. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3169. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3170. plt.margins(0, 0)
  3171. #plt.show()
  3172. plt.savefig(ndvis)
  3173. plt.savefig(ndvia)
  3174. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3175. plt.close('all')
  3176. f = open('/var/www/html/cust/c5_7.txt','a')
  3177. f.write(date)
  3178. f.close()
  3179. dress = '/var/www/html/cust/5/c/'
  3180. for root, dirs, files in os.walk(dress):
  3181. print('files: {}'.format(len(files)))
  3182. if len(files)>=1:
  3183. files.sort()
  3184. for f in files:
  3185. with open(os.path.join(root, f), "rb") as imageFile:
  3186. str = base64.b64encode(imageFile.read())
  3187. url = 'http://60.250.156.234/cust/t5.php'
  3188. values = {'data1':str, 'name':f}
  3189. data1 = urllib.parse.urlencode(values)
  3190. data1 = data1.encode('utf-8')
  3191. req = urllib.request.Request(url, data1)
  3192. req.add_header('User-Agent','Magic Browser')
  3193. resp = urllib.request.urlopen(req)
  3194. respdata1 = resp.read()
  3195. print(os.path.join(root, f))
  3196. #print(respdata1)
  3197. os.remove(os.path.join(root, f))
  3198. print("ok")
  3199. except:
  3200. print('error')
  3201. def img5_8():
  3202. try:
  3203. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3204. charset='utf8')
  3205. a = db.cursor()
  3206. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  3207. result = a.fetchall()
  3208. if result ==():
  3209. s =""
  3210. else:
  3211. s = "_" + result[0][3]
  3212. db.close()
  3213. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3214. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3215. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  3216. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3217. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3218. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3219. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3220. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3221. date += s
  3222. label= datetime.datetime.now().strftime('No.5 Direction 8 @%Y.%m.%d.%H.%M.%S')
  3223. rgb_img0 = Image.open('/var/www/html/cust/5/c/b8.tif')
  3224. ir_img0 = Image.open('/var/www/html/cust/5/c/a8.tif')
  3225. rgb_img0.save(nt)
  3226. ir_img0.save(irt)
  3227. rgb_img0.save(nj,quality=95)
  3228. ir_img0.save(irj,quality=95)
  3229. r,_,_ = rgb_img0.split()
  3230. r = np.asarray(r, dtype=float)
  3231. ir,_,_ = ir_img0.split()
  3232. ir = np.asarray(ir, dtype=float)
  3233. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3234. np.seterr(divide='ignore', invalid='ignore')
  3235. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3236. # Display the results
  3237. fig, ax = plt.subplots()
  3238. plt.plot(ndvi)
  3239. plt.axis('off')
  3240. plt.figure(figsize=(19, 10))
  3241. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3242. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3243. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3244. plt.margins(0, 0)
  3245. #plt.show()
  3246. plt.savefig(ndvis)
  3247. plt.savefig(ndvia)
  3248. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3249. plt.close('all')
  3250. f = open('/var/www/html/cust/c5_8.txt','a')
  3251. f.write(date)
  3252. f.close()
  3253. dress = '/var/www/html/cust/5/c/'
  3254. for root, dirs, files in os.walk(dress):
  3255. print('files: {}'.format(len(files)))
  3256. if len(files)>=1:
  3257. files.sort()
  3258. for f in files:
  3259. with open(os.path.join(root, f), "rb") as imageFile:
  3260. str = base64.b64encode(imageFile.read())
  3261. url = 'http://60.250.156.234/cust/t5.php'
  3262. values = {'data1':str, 'name':f}
  3263. data1 = urllib.parse.urlencode(values)
  3264. data1 = data1.encode('utf-8')
  3265. req = urllib.request.Request(url, data1)
  3266. req.add_header('User-Agent','Magic Browser')
  3267. resp = urllib.request.urlopen(req)
  3268. respdata1 = resp.read()
  3269. print(os.path.join(root, f))
  3270. #print(respdata1)
  3271. os.remove(os.path.join(root, f))
  3272. print("ok")
  3273. except:
  3274. print('error')
  3275. def img5_9():
  3276. try:
  3277. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3278. charset='utf8')
  3279. a = db.cursor()
  3280. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002005' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  3281. result = a.fetchall()
  3282. if result ==():
  3283. s =""
  3284. else:
  3285. s = "_" + result[0][3]
  3286. db.close()
  3287. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3288. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3289. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/5/ndvia/c.png') #ndvi is c.png
  3290. irt = datetime.datetime.now().strftime('/var/www/html/cust/5/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3291. nt = datetime.datetime.now().strftime('/var/www/html/cust/5/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3292. irj = datetime.datetime.now().strftime('/var/www/html/cust/5/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3293. nj = datetime.datetime.now().strftime('/var/www/html/cust/5/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3294. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3295. date += s
  3296. label= datetime.datetime.now().strftime('No.5 Direction 0 @%Y.%m.%d.%H.%M.%S')
  3297. rgb_img0 = Image.open('/var/www/html/cust/5/c/b.tif')
  3298. ir_img0 = Image.open('/var/www/html/cust/5/c/a.tif')
  3299. rgb_img0.save(nt)
  3300. ir_img0.save(irt)
  3301. rgb_img0.save(nj,quality=95)
  3302. ir_img0.save(irj,quality=95)
  3303. r,_,_ = rgb_img0.split()
  3304. r = np.asarray(r, dtype=float)
  3305. ir,_,_ = ir_img0.split()
  3306. ir = np.asarray(ir, dtype=float)
  3307. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3308. np.seterr(divide='ignore', invalid='ignore')
  3309. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3310. # Display the results
  3311. fig, ax = plt.subplots()
  3312. plt.plot(ndvi)
  3313. plt.axis('off')
  3314. plt.figure(figsize=(19, 10))
  3315. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3316. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3317. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3318. plt.margins(0, 0)
  3319. #plt.show()
  3320. plt.savefig(ndvis)
  3321. plt.savefig(ndvia)
  3322. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3323. plt.close('all')
  3324. f = open('/var/www/html/cust/c5.txt','a')
  3325. f.write(date)
  3326. f.close()
  3327. dress = '/var/www/html/cust/5/c/'
  3328. for root, dirs, files in os.walk(dress):
  3329. print('files: {}'.format(len(files)))
  3330. if len(files)>=1:
  3331. files.sort()
  3332. for f in files:
  3333. with open(os.path.join(root, f), "rb") as imageFile:
  3334. str = base64.b64encode(imageFile.read())
  3335. url = 'http://60.250.156.234/cust/t5.php'
  3336. values = {'data1':str, 'name':f}
  3337. data1 = urllib.parse.urlencode(values)
  3338. data1 = data1.encode('utf-8')
  3339. req = urllib.request.Request(url, data1)
  3340. req.add_header('User-Agent','Magic Browser')
  3341. resp = urllib.request.urlopen(req)
  3342. respdata1 = resp.read()
  3343. print(os.path.join(root, f))
  3344. #print(respdata1)
  3345. os.remove(os.path.join(root, f))
  3346. print("ok")
  3347. except:
  3348. print('error')
  3349. def img6_1():
  3350. try:
  3351. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3352. charset='utf8')
  3353. a = db.cursor()
  3354. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  3355. result = a.fetchall()
  3356. if result ==():
  3357. s =""
  3358. else:
  3359. s = "_" + result[0][3]
  3360. db.close()
  3361. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3362. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3363. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3364. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3365. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3366. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3367. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3368. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3369. date += s
  3370. label= datetime.datetime.now().strftime('No.6 Direction 1 @%Y.%m.%d.%H.%M.%S')
  3371. rgb_img0 = Image.open('/var/www/html/cust/6/c/b1.tif')
  3372. ir_img0 = Image.open('/var/www/html/cust/6/c/a1.tif')
  3373. rgb_img0.save(nt)
  3374. ir_img0.save(irt)
  3375. rgb_img0.save(nj,quality=95)
  3376. ir_img0.save(irj,quality=95)
  3377. r,_,_ = rgb_img0.split()
  3378. r = np.asarray(r, dtype=float)
  3379. ir,_,_ = ir_img0.split()
  3380. ir = np.asarray(ir, dtype=float)
  3381. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3382. np.seterr(divide='ignore', invalid='ignore')
  3383. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3384. # Display the results
  3385. fig, ax = plt.subplots()
  3386. plt.plot(ndvi)
  3387. plt.axis('off')
  3388. plt.figure(figsize=(19, 10))
  3389. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3390. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3391. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3392. plt.margins(0, 0)
  3393. #plt.show()
  3394. plt.savefig(ndvis)
  3395. plt.savefig(ndvia)
  3396. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3397. plt.close('all')
  3398. f = open('/var/www/html/cust/c6_1.txt','a')
  3399. f.write(date)
  3400. f.close()
  3401. dress = '/var/www/html/cust/6/c/'
  3402. for root, dirs, files in os.walk(dress):
  3403. print('files: {}'.format(len(files)))
  3404. if len(files)>=1:
  3405. files.sort()
  3406. for f in files:
  3407. with open(os.path.join(root, f), "rb") as imageFile:
  3408. str = base64.b64encode(imageFile.read())
  3409. url = 'http://60.250.156.234/cust/t6.php'
  3410. values = {'data1':str, 'name':f}
  3411. data1 = urllib.parse.urlencode(values)
  3412. data1 = data1.encode('utf-8')
  3413. req = urllib.request.Request(url, data1)
  3414. req.add_header('User-Agent','Magic Browser')
  3415. resp = urllib.request.urlopen(req)
  3416. respdata1 = resp.read()
  3417. print(os.path.join(root, f))
  3418. #print(respdata1)
  3419. os.remove(os.path.join(root, f))
  3420. print("ok")
  3421. except:
  3422. print('error')
  3423. def img6_2():
  3424. try:
  3425. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3426. charset='utf8')
  3427. a = db.cursor()
  3428. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  3429. result = a.fetchall()
  3430. if result ==():
  3431. s =""
  3432. else:
  3433. s = "_" + result[0][3]
  3434. db.close()
  3435. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3436. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3437. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3438. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3439. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3440. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3441. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3442. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3443. date += s
  3444. label= datetime.datetime.now().strftime('No.6 Direction 2 @%Y.%m.%d.%H.%M.%S')
  3445. rgb_img0 = Image.open('/var/www/html/cust/6/c/b2.tif')
  3446. ir_img0 = Image.open('/var/www/html/cust/6/c/a2.tif')
  3447. rgb_img0.save(nt)
  3448. ir_img0.save(irt)
  3449. rgb_img0.save(nj,quality=95)
  3450. ir_img0.save(irj,quality=95)
  3451. r,_,_ = rgb_img0.split()
  3452. r = np.asarray(r, dtype=float)
  3453. ir,_,_ = ir_img0.split()
  3454. ir = np.asarray(ir, dtype=float)
  3455. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3456. np.seterr(divide='ignore', invalid='ignore')
  3457. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3458. # Display the results
  3459. fig, ax = plt.subplots()
  3460. plt.plot(ndvi)
  3461. plt.axis('off')
  3462. plt.figure(figsize=(19, 10))
  3463. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3464. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3465. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3466. plt.margins(0, 0)
  3467. #plt.show()
  3468. plt.savefig(ndvis)
  3469. plt.savefig(ndvia)
  3470. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3471. plt.close('all')
  3472. f = open('/var/www/html/cust/c6_2.txt','a')
  3473. f.write(date)
  3474. f.close()
  3475. dress = '/var/www/html/cust/6/c/'
  3476. for root, dirs, files in os.walk(dress):
  3477. print('files: {}'.format(len(files)))
  3478. if len(files)>=1:
  3479. files.sort()
  3480. for f in files:
  3481. with open(os.path.join(root, f), "rb") as imageFile:
  3482. str = base64.b64encode(imageFile.read())
  3483. url = 'http://60.250.156.234/cust/t6.php'
  3484. values = {'data1':str, 'name':f}
  3485. data1 = urllib.parse.urlencode(values)
  3486. data1 = data1.encode('utf-8')
  3487. req = urllib.request.Request(url, data1)
  3488. req.add_header('User-Agent','Magic Browser')
  3489. resp = urllib.request.urlopen(req)
  3490. respdata1 = resp.read()
  3491. print(os.path.join(root, f))
  3492. #print(respdata1)
  3493. os.remove(os.path.join(root, f))
  3494. print("ok")
  3495. except:
  3496. print('error')
  3497. def img6_3():
  3498. try:
  3499. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3500. charset='utf8')
  3501. a = db.cursor()
  3502. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  3503. result = a.fetchall()
  3504. if result ==():
  3505. s =""
  3506. else:
  3507. s = "_" + result[0][3]
  3508. db.close()
  3509. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3510. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3511. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3512. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3513. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3514. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3515. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3516. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3517. date += s
  3518. label= datetime.datetime.now().strftime('No.6 Direction 3 @%Y.%m.%d.%H.%M.%S')
  3519. rgb_img0 = Image.open('/var/www/html/cust/6/c/b3.tif')
  3520. ir_img0 = Image.open('/var/www/html/cust/6/c/a3.tif')
  3521. rgb_img0.save(nt)
  3522. ir_img0.save(irt)
  3523. rgb_img0.save(nj,quality=95)
  3524. ir_img0.save(irj,quality=95)
  3525. r,_,_ = rgb_img0.split()
  3526. r = np.asarray(r, dtype=float)
  3527. ir,_,_ = ir_img0.split()
  3528. ir = np.asarray(ir, dtype=float)
  3529. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3530. np.seterr(divide='ignore', invalid='ignore')
  3531. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3532. # Display the results
  3533. fig, ax = plt.subplots()
  3534. plt.plot(ndvi)
  3535. plt.axis('off')
  3536. plt.figure(figsize=(19, 10))
  3537. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3538. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3539. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3540. plt.margins(0, 0)
  3541. #plt.show()
  3542. plt.savefig(ndvis)
  3543. plt.savefig(ndvia)
  3544. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3545. plt.close('all')
  3546. f = open('/var/www/html/cust/c6_3.txt','a')
  3547. f.write(date)
  3548. f.close()
  3549. dress = '/var/www/html/cust/6/c/'
  3550. for root, dirs, files in os.walk(dress):
  3551. print('files: {}'.format(len(files)))
  3552. if len(files)>=1:
  3553. files.sort()
  3554. for f in files:
  3555. with open(os.path.join(root, f), "rb") as imageFile:
  3556. str = base64.b64encode(imageFile.read())
  3557. url = 'http://60.250.156.234/cust/t6.php'
  3558. values = {'data1':str, 'name':f}
  3559. data1 = urllib.parse.urlencode(values)
  3560. data1 = data1.encode('utf-8')
  3561. req = urllib.request.Request(url, data1)
  3562. req.add_header('User-Agent','Magic Browser')
  3563. resp = urllib.request.urlopen(req)
  3564. respdata1 = resp.read()
  3565. print(os.path.join(root, f))
  3566. #print(respdata1)
  3567. os.remove(os.path.join(root, f))
  3568. print("ok")
  3569. except:
  3570. print('error')
  3571. def img6_4():
  3572. try:
  3573. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3574. charset='utf8')
  3575. a = db.cursor()
  3576. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  3577. result = a.fetchall()
  3578. if result ==():
  3579. s =""
  3580. else:
  3581. s = "_" + result[0][3]
  3582. db.close()
  3583. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3584. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3585. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3586. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3587. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3588. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3589. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3590. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3591. date += s
  3592. label= datetime.datetime.now().strftime('No.6 Direction 4 @%Y.%m.%d.%H.%M.%S')
  3593. rgb_img0 = Image.open('/var/www/html/cust/6/c/b4.tif')
  3594. ir_img0 = Image.open('/var/www/html/cust/6/c/a4.tif')
  3595. rgb_img0.save(nt)
  3596. ir_img0.save(irt)
  3597. rgb_img0.save(nj,quality=95)
  3598. ir_img0.save(irj,quality=95)
  3599. r,_,_ = rgb_img0.split()
  3600. r = np.asarray(r, dtype=float)
  3601. ir,_,_ = ir_img0.split()
  3602. ir = np.asarray(ir, dtype=float)
  3603. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3604. np.seterr(divide='ignore', invalid='ignore')
  3605. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3606. # Display the results
  3607. fig, ax = plt.subplots()
  3608. plt.plot(ndvi)
  3609. plt.axis('off')
  3610. plt.figure(figsize=(19, 10))
  3611. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3612. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3613. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3614. plt.margins(0, 0)
  3615. #plt.show()
  3616. plt.savefig(ndvis)
  3617. plt.savefig(ndvia)
  3618. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3619. plt.close('all')
  3620. f = open('/var/www/html/cust/c6_4.txt','a')
  3621. f.write(date)
  3622. f.close()
  3623. dress = '/var/www/html/cust/6/c/'
  3624. for root, dirs, files in os.walk(dress):
  3625. print('files: {}'.format(len(files)))
  3626. if len(files)>=1:
  3627. files.sort()
  3628. for f in files:
  3629. with open(os.path.join(root, f), "rb") as imageFile:
  3630. str = base64.b64encode(imageFile.read())
  3631. url = 'http://60.250.156.234/cust/t6.php'
  3632. values = {'data1':str, 'name':f}
  3633. data1 = urllib.parse.urlencode(values)
  3634. data1 = data1.encode('utf-8')
  3635. req = urllib.request.Request(url, data1)
  3636. req.add_header('User-Agent','Magic Browser')
  3637. resp = urllib.request.urlopen(req)
  3638. respdata1 = resp.read()
  3639. print(os.path.join(root, f))
  3640. #print(respdata1)
  3641. os.remove(os.path.join(root, f))
  3642. print("ok")
  3643. except:
  3644. print('error')
  3645. def img6_5():
  3646. try:
  3647. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3648. charset='utf8')
  3649. a = db.cursor()
  3650. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  3651. result = a.fetchall()
  3652. if result ==():
  3653. s =""
  3654. else:
  3655. s = "_" + result[0][3]
  3656. db.close()
  3657. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3658. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3659. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3660. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3661. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3662. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3663. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3664. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3665. date += s
  3666. label= datetime.datetime.now().strftime('No.6 Direction 5 @%Y.%m.%d.%H.%M.%S')
  3667. rgb_img0 = Image.open('/var/www/html/cust/6/c/b5.tif')
  3668. ir_img0 = Image.open('/var/www/html/cust/6/c/a5.tif')
  3669. rgb_img0.save(nt)
  3670. ir_img0.save(irt)
  3671. rgb_img0.save(nj,quality=95)
  3672. ir_img0.save(irj,quality=95)
  3673. r,_,_ = rgb_img0.split()
  3674. r = np.asarray(r, dtype=float)
  3675. ir,_,_ = ir_img0.split()
  3676. ir = np.asarray(ir, dtype=float)
  3677. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3678. np.seterr(divide='ignore', invalid='ignore')
  3679. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3680. # Display the results
  3681. fig, ax = plt.subplots()
  3682. plt.plot(ndvi)
  3683. plt.axis('off')
  3684. plt.figure(figsize=(19, 10))
  3685. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3686. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3687. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3688. plt.margins(0, 0)
  3689. #plt.show()
  3690. plt.savefig(ndvis)
  3691. plt.savefig(ndvia)
  3692. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3693. plt.close('all')
  3694. f = open('/var/www/html/cust/c6_5.txt','a')
  3695. f.write(date)
  3696. f.close()
  3697. dress = '/var/www/html/cust/6/c/'
  3698. for root, dirs, files in os.walk(dress):
  3699. print('files: {}'.format(len(files)))
  3700. if len(files)>=1:
  3701. files.sort()
  3702. for f in files:
  3703. with open(os.path.join(root, f), "rb") as imageFile:
  3704. str = base64.b64encode(imageFile.read())
  3705. url = 'http://60.250.156.234/cust/t6.php'
  3706. values = {'data1':str, 'name':f}
  3707. data1 = urllib.parse.urlencode(values)
  3708. data1 = data1.encode('utf-8')
  3709. req = urllib.request.Request(url, data1)
  3710. req.add_header('User-Agent','Magic Browser')
  3711. resp = urllib.request.urlopen(req)
  3712. respdata1 = resp.read()
  3713. print(os.path.join(root, f))
  3714. #print(respdata1)
  3715. os.remove(os.path.join(root, f))
  3716. print("ok")
  3717. except:
  3718. print('error')
  3719. def img6_6():
  3720. try:
  3721. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3722. charset='utf8')
  3723. a = db.cursor()
  3724. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  3725. result = a.fetchall()
  3726. if result ==():
  3727. s =""
  3728. else:
  3729. s = "_" + result[0][3]
  3730. db.close()
  3731. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3732. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3733. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3734. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3735. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3736. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3737. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3738. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3739. date += s
  3740. label= datetime.datetime.now().strftime('No.6 Direction 6 @%Y.%m.%d.%H.%M.%S')
  3741. rgb_img0 = Image.open('/var/www/html/cust/6/c/b6.tif')
  3742. ir_img0 = Image.open('/var/www/html/cust/6/c/a6.tif')
  3743. rgb_img0.save(nt)
  3744. ir_img0.save(irt)
  3745. rgb_img0.save(nj,quality=95)
  3746. ir_img0.save(irj,quality=95)
  3747. r,_,_ = rgb_img0.split()
  3748. r = np.asarray(r, dtype=float)
  3749. ir,_,_ = ir_img0.split()
  3750. ir = np.asarray(ir, dtype=float)
  3751. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3752. np.seterr(divide='ignore', invalid='ignore')
  3753. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3754. # Display the results
  3755. fig, ax = plt.subplots()
  3756. plt.plot(ndvi)
  3757. plt.axis('off')
  3758. plt.figure(figsize=(19, 10))
  3759. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3760. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3761. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3762. plt.margins(0, 0)
  3763. #plt.show()
  3764. plt.savefig(ndvis)
  3765. plt.savefig(ndvia)
  3766. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3767. plt.close('all')
  3768. f = open('/var/www/html/cust/c6_6.txt','a')
  3769. f.write(date)
  3770. f.close()
  3771. dress = '/var/www/html/cust/6/c/'
  3772. for root, dirs, files in os.walk(dress):
  3773. print('files: {}'.format(len(files)))
  3774. if len(files)>=1:
  3775. files.sort()
  3776. for f in files:
  3777. with open(os.path.join(root, f), "rb") as imageFile:
  3778. str = base64.b64encode(imageFile.read())
  3779. url = 'http://60.250.156.234/cust/t6.php'
  3780. values = {'data1':str, 'name':f}
  3781. data1 = urllib.parse.urlencode(values)
  3782. data1 = data1.encode('utf-8')
  3783. req = urllib.request.Request(url, data1)
  3784. req.add_header('User-Agent','Magic Browser')
  3785. resp = urllib.request.urlopen(req)
  3786. respdata1 = resp.read()
  3787. print(os.path.join(root, f))
  3788. #print(respdata1)
  3789. os.remove(os.path.join(root, f))
  3790. print("ok")
  3791. except:
  3792. print('error')
  3793. def img6_7():
  3794. try:
  3795. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3796. charset='utf8')
  3797. a = db.cursor()
  3798. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  3799. result = a.fetchall()
  3800. if result ==():
  3801. s =""
  3802. else:
  3803. s = "_" + result[0][3]
  3804. db.close()
  3805. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3806. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3807. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3808. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3809. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3810. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3811. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3812. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3813. date += s
  3814. label= datetime.datetime.now().strftime('No.6 Direction 7 @%Y.%m.%d.%H.%M.%S')
  3815. rgb_img0 = Image.open('/var/www/html/cust/6/c/b7.tif')
  3816. ir_img0 = Image.open('/var/www/html/cust/6/c/a7.tif')
  3817. rgb_img0.save(nt)
  3818. ir_img0.save(irt)
  3819. rgb_img0.save(nj,quality=95)
  3820. ir_img0.save(irj,quality=95)
  3821. r,_,_ = rgb_img0.split()
  3822. r = np.asarray(r, dtype=float)
  3823. ir,_,_ = ir_img0.split()
  3824. ir = np.asarray(ir, dtype=float)
  3825. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3826. np.seterr(divide='ignore', invalid='ignore')
  3827. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3828. # Display the results
  3829. fig, ax = plt.subplots()
  3830. plt.plot(ndvi)
  3831. plt.axis('off')
  3832. plt.figure(figsize=(19, 10))
  3833. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3834. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3835. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3836. plt.margins(0, 0)
  3837. #plt.show()
  3838. plt.savefig(ndvis)
  3839. plt.savefig(ndvia)
  3840. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3841. plt.close('all')
  3842. f = open('/var/www/html/cust/c6_7.txt','a')
  3843. f.write(date)
  3844. f.close()
  3845. dress = '/var/www/html/cust/6/c/'
  3846. for root, dirs, files in os.walk(dress):
  3847. print('files: {}'.format(len(files)))
  3848. if len(files)>=1:
  3849. files.sort()
  3850. for f in files:
  3851. with open(os.path.join(root, f), "rb") as imageFile:
  3852. str = base64.b64encode(imageFile.read())
  3853. url = 'http://60.250.156.234/cust/t6.php'
  3854. values = {'data1':str, 'name':f}
  3855. data1 = urllib.parse.urlencode(values)
  3856. data1 = data1.encode('utf-8')
  3857. req = urllib.request.Request(url, data1)
  3858. req.add_header('User-Agent','Magic Browser')
  3859. resp = urllib.request.urlopen(req)
  3860. respdata1 = resp.read()
  3861. print(os.path.join(root, f))
  3862. #print(respdata1)
  3863. os.remove(os.path.join(root, f))
  3864. print("ok")
  3865. except:
  3866. print('error')
  3867. def img6_8():
  3868. try:
  3869. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3870. charset='utf8')
  3871. a = db.cursor()
  3872. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  3873. result = a.fetchall()
  3874. if result ==():
  3875. s =""
  3876. else:
  3877. s = "_" + result[0][3]
  3878. db.close()
  3879. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3880. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3881. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3882. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3883. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3884. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3885. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3886. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3887. date += s
  3888. label= datetime.datetime.now().strftime('No.6 Direction 8 @%Y.%m.%d.%H.%M.%S')
  3889. rgb_img0 = Image.open('/var/www/html/cust/6/c/b8.tif')
  3890. ir_img0 = Image.open('/var/www/html/cust/6/c/a8.tif')
  3891. rgb_img0.save(nt)
  3892. ir_img0.save(irt)
  3893. rgb_img0.save(nj,quality=95)
  3894. ir_img0.save(irj,quality=95)
  3895. r,_,_ = rgb_img0.split()
  3896. r = np.asarray(r, dtype=float)
  3897. ir,_,_ = ir_img0.split()
  3898. ir = np.asarray(ir, dtype=float)
  3899. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3900. np.seterr(divide='ignore', invalid='ignore')
  3901. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3902. # Display the results
  3903. fig, ax = plt.subplots()
  3904. plt.plot(ndvi)
  3905. plt.axis('off')
  3906. plt.figure(figsize=(19, 10))
  3907. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3908. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3909. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3910. plt.margins(0, 0)
  3911. #plt.show()
  3912. plt.savefig(ndvis)
  3913. plt.savefig(ndvia)
  3914. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3915. plt.close('all')
  3916. f = open('/var/www/html/cust/c6_8.txt','a')
  3917. f.write(date)
  3918. f.close()
  3919. dress = '/var/www/html/cust/6/c/'
  3920. for root, dirs, files in os.walk(dress):
  3921. print('files: {}'.format(len(files)))
  3922. if len(files)>=1:
  3923. files.sort()
  3924. for f in files:
  3925. with open(os.path.join(root, f), "rb") as imageFile:
  3926. str = base64.b64encode(imageFile.read())
  3927. url = 'http://60.250.156.234/cust/t6.php'
  3928. values = {'data1':str, 'name':f}
  3929. data1 = urllib.parse.urlencode(values)
  3930. data1 = data1.encode('utf-8')
  3931. req = urllib.request.Request(url, data1)
  3932. req.add_header('User-Agent','Magic Browser')
  3933. resp = urllib.request.urlopen(req)
  3934. respdata1 = resp.read()
  3935. print(os.path.join(root, f))
  3936. #print(respdata1)
  3937. os.remove(os.path.join(root, f))
  3938. print("ok")
  3939. except:
  3940. print('error')
  3941. def img6_9():
  3942. try:
  3943. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  3944. charset='utf8')
  3945. a = db.cursor()
  3946. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002006' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  3947. result = a.fetchall()
  3948. if result ==():
  3949. s =""
  3950. else:
  3951. s = "_" + result[0][3]
  3952. db.close()
  3953. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  3954. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  3955. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/6/ndvia/c.png') #ndvi is c.png
  3956. irt = datetime.datetime.now().strftime('/var/www/html/cust/6/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  3957. nt = datetime.datetime.now().strftime('/var/www/html/cust/6/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  3958. irj = datetime.datetime.now().strftime('/var/www/html/cust/6/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  3959. nj = datetime.datetime.now().strftime('/var/www/html/cust/6/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  3960. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  3961. date += s
  3962. label= datetime.datetime.now().strftime('No.6 Direction 0 @%Y.%m.%d.%H.%M.%S')
  3963. rgb_img0 = Image.open('/var/www/html/cust/6/c/b.tif')
  3964. ir_img0 = Image.open('/var/www/html/cust/6/c/a.tif')
  3965. rgb_img0.save(nt)
  3966. ir_img0.save(irt)
  3967. rgb_img0.save(nj,quality=95)
  3968. ir_img0.save(irj,quality=95)
  3969. r,_,_ = rgb_img0.split()
  3970. r = np.asarray(r, dtype=float)
  3971. ir,_,_ = ir_img0.split()
  3972. ir = np.asarray(ir, dtype=float)
  3973. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  3974. np.seterr(divide='ignore', invalid='ignore')
  3975. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  3976. # Display the results
  3977. fig, ax = plt.subplots()
  3978. plt.plot(ndvi)
  3979. plt.axis('off')
  3980. plt.figure(figsize=(19, 10))
  3981. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  3982. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  3983. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  3984. plt.margins(0, 0)
  3985. #plt.show()
  3986. plt.savefig(ndvis)
  3987. plt.savefig(ndvia)
  3988. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  3989. plt.close('all')
  3990. f = open('/var/www/html/cust/c6.txt','a')
  3991. f.write(date)
  3992. f.close()
  3993. dress = '/var/www/html/cust/6/c/'
  3994. for root, dirs, files in os.walk(dress):
  3995. print('files: {}'.format(len(files)))
  3996. if len(files)>=1:
  3997. files.sort()
  3998. for f in files:
  3999. with open(os.path.join(root, f), "rb") as imageFile:
  4000. str = base64.b64encode(imageFile.read())
  4001. url = 'http://60.250.156.234/cust/t6.php'
  4002. values = {'data1':str, 'name':f}
  4003. data1 = urllib.parse.urlencode(values)
  4004. data1 = data1.encode('utf-8')
  4005. req = urllib.request.Request(url, data1)
  4006. req.add_header('User-Agent','Magic Browser')
  4007. resp = urllib.request.urlopen(req)
  4008. respdata1 = resp.read()
  4009. print(os.path.join(root, f))
  4010. #print(respdata1)
  4011. os.remove(os.path.join(root, f))
  4012. print("ok")
  4013. except:
  4014. print('error')
  4015. def img7_1():
  4016. try:
  4017. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4018. charset='utf8')
  4019. a = db.cursor()
  4020. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  4021. result = a.fetchall()
  4022. if result ==():
  4023. s =""
  4024. else:
  4025. s = "_" + result[0][3]
  4026. db.close()
  4027. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4028. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4029. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4030. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4031. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4032. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4033. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4034. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4035. date += s
  4036. label= datetime.datetime.now().strftime('No.7 Direction 1 @%Y.%m.%d.%H.%M.%S')
  4037. rgb_img0 = Image.open('/var/www/html/cust/7/c/b1.tif')
  4038. ir_img0 = Image.open('/var/www/html/cust/7/c/a1.tif')
  4039. rgb_img0.save(nt)
  4040. ir_img0.save(irt)
  4041. rgb_img0.save(nj,quality=95)
  4042. ir_img0.save(irj,quality=95)
  4043. r,_,_ = rgb_img0.split()
  4044. r = np.asarray(r, dtype=float)
  4045. ir,_,_ = ir_img0.split()
  4046. ir = np.asarray(ir, dtype=float)
  4047. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4048. np.seterr(divide='ignore', invalid='ignore')
  4049. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4050. # Display the results
  4051. fig, ax = plt.subplots()
  4052. plt.plot(ndvi)
  4053. plt.axis('off')
  4054. plt.figure(figsize=(19, 10))
  4055. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4056. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4057. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4058. plt.margins(0, 0)
  4059. #plt.show()
  4060. plt.savefig(ndvis)
  4061. plt.savefig(ndvia)
  4062. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4063. plt.close('all')
  4064. f = open('/var/www/html/cust/c7_1.txt','a')
  4065. f.write(date)
  4066. f.close()
  4067. dress = '/var/www/html/cust/7/c/'
  4068. for root, dirs, files in os.walk(dress):
  4069. print('files: {}'.format(len(files)))
  4070. if len(files)>=1:
  4071. files.sort()
  4072. for f in files:
  4073. with open(os.path.join(root, f), "rb") as imageFile:
  4074. str = base64.b64encode(imageFile.read())
  4075. url = 'http://60.250.156.234/cust/t7.php'
  4076. values = {'data1':str, 'name':f}
  4077. data1 = urllib.parse.urlencode(values)
  4078. data1 = data1.encode('utf-8')
  4079. req = urllib.request.Request(url, data1)
  4080. req.add_header('User-Agent','Magic Browser')
  4081. resp = urllib.request.urlopen(req)
  4082. respdata1 = resp.read()
  4083. print(os.path.join(root, f))
  4084. #print(respdata1)
  4085. os.remove(os.path.join(root, f))
  4086. print("ok")
  4087. except:
  4088. print('error')
  4089. def img7_2():
  4090. try:
  4091. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4092. charset='utf8')
  4093. a = db.cursor()
  4094. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  4095. result = a.fetchall()
  4096. if result ==():
  4097. s =""
  4098. else:
  4099. s = "_" + result[0][3]
  4100. db.close()
  4101. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4102. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4103. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4104. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4105. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4106. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4107. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4108. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4109. date += s
  4110. label= datetime.datetime.now().strftime('No.7 Direction 2 @%Y.%m.%d.%H.%M.%S')
  4111. rgb_img0 = Image.open('/var/www/html/cust/7/c/b2.tif')
  4112. ir_img0 = Image.open('/var/www/html/cust/7/c/a2.tif')
  4113. rgb_img0.save(nt)
  4114. ir_img0.save(irt)
  4115. rgb_img0.save(nj,quality=95)
  4116. ir_img0.save(irj,quality=95)
  4117. r,_,_ = rgb_img0.split()
  4118. r = np.asarray(r, dtype=float)
  4119. ir,_,_ = ir_img0.split()
  4120. ir = np.asarray(ir, dtype=float)
  4121. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4122. np.seterr(divide='ignore', invalid='ignore')
  4123. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4124. # Display the results
  4125. fig, ax = plt.subplots()
  4126. plt.plot(ndvi)
  4127. plt.axis('off')
  4128. plt.figure(figsize=(19, 10))
  4129. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4130. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4131. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4132. plt.margins(0, 0)
  4133. #plt.show()
  4134. plt.savefig(ndvis)
  4135. plt.savefig(ndvia)
  4136. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4137. plt.close('all')
  4138. f = open('/var/www/html/cust/c7_2.txt','a')
  4139. f.write(date)
  4140. f.close()
  4141. dress = '/var/www/html/cust/7/c/'
  4142. for root, dirs, files in os.walk(dress):
  4143. print('files: {}'.format(len(files)))
  4144. if len(files)>=1:
  4145. files.sort()
  4146. for f in files:
  4147. with open(os.path.join(root, f), "rb") as imageFile:
  4148. str = base64.b64encode(imageFile.read())
  4149. url = 'http://60.250.156.234/cust/t7.php'
  4150. values = {'data1':str, 'name':f}
  4151. data1 = urllib.parse.urlencode(values)
  4152. data1 = data1.encode('utf-8')
  4153. req = urllib.request.Request(url, data1)
  4154. req.add_header('User-Agent','Magic Browser')
  4155. resp = urllib.request.urlopen(req)
  4156. respdata1 = resp.read()
  4157. print(os.path.join(root, f))
  4158. #print(respdata1)
  4159. os.remove(os.path.join(root, f))
  4160. print("ok")
  4161. except:
  4162. print('error')
  4163. def img7_3():
  4164. try:
  4165. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4166. charset='utf8')
  4167. a = db.cursor()
  4168. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  4169. result = a.fetchall()
  4170. if result ==():
  4171. s =""
  4172. else:
  4173. s = "_" + result[0][3]
  4174. db.close()
  4175. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4176. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4177. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4178. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4179. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4180. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4181. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4182. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4183. date += s
  4184. label= datetime.datetime.now().strftime('No.7 Direction 3 @%Y.%m.%d.%H.%M.%S')
  4185. rgb_img0 = Image.open('/var/www/html/cust/7/c/b3.tif')
  4186. ir_img0 = Image.open('/var/www/html/cust/7/c/a3.tif')
  4187. rgb_img0.save(nt)
  4188. ir_img0.save(irt)
  4189. rgb_img0.save(nj,quality=95)
  4190. ir_img0.save(irj,quality=95)
  4191. r,_,_ = rgb_img0.split()
  4192. r = np.asarray(r, dtype=float)
  4193. ir,_,_ = ir_img0.split()
  4194. ir = np.asarray(ir, dtype=float)
  4195. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4196. np.seterr(divide='ignore', invalid='ignore')
  4197. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4198. # Display the results
  4199. fig, ax = plt.subplots()
  4200. plt.plot(ndvi)
  4201. plt.axis('off')
  4202. plt.figure(figsize=(19, 10))
  4203. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4204. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4205. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4206. plt.margins(0, 0)
  4207. #plt.show()
  4208. plt.savefig(ndvis)
  4209. plt.savefig(ndvia)
  4210. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4211. plt.close('all')
  4212. f = open('/var/www/html/cust/c7_3.txt','a')
  4213. f.write(date)
  4214. f.close()
  4215. dress = '/var/www/html/cust/7/c/'
  4216. for root, dirs, files in os.walk(dress):
  4217. print('files: {}'.format(len(files)))
  4218. if len(files)>=1:
  4219. files.sort()
  4220. for f in files:
  4221. with open(os.path.join(root, f), "rb") as imageFile:
  4222. str = base64.b64encode(imageFile.read())
  4223. url = 'http://60.250.156.234/cust/t7.php'
  4224. values = {'data1':str, 'name':f}
  4225. data1 = urllib.parse.urlencode(values)
  4226. data1 = data1.encode('utf-8')
  4227. req = urllib.request.Request(url, data1)
  4228. req.add_header('User-Agent','Magic Browser')
  4229. resp = urllib.request.urlopen(req)
  4230. respdata1 = resp.read()
  4231. print(os.path.join(root, f))
  4232. #print(respdata1)
  4233. os.remove(os.path.join(root, f))
  4234. print("ok")
  4235. except:
  4236. print('error')
  4237. def img7_4():
  4238. try:
  4239. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4240. charset='utf8')
  4241. a = db.cursor()
  4242. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  4243. result = a.fetchall()
  4244. if result ==():
  4245. s =""
  4246. else:
  4247. s = "_" + result[0][3]
  4248. db.close()
  4249. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4250. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4251. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4252. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4253. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4254. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4255. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4256. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4257. date += s
  4258. label= datetime.datetime.now().strftime('No.7 Direction 4 @%Y.%m.%d.%H.%M.%S')
  4259. rgb_img0 = Image.open('/var/www/html/cust/7/c/b4.tif')
  4260. ir_img0 = Image.open('/var/www/html/cust/7/c/a4.tif')
  4261. rgb_img0.save(nt)
  4262. ir_img0.save(irt)
  4263. rgb_img0.save(nj,quality=95)
  4264. ir_img0.save(irj,quality=95)
  4265. r,_,_ = rgb_img0.split()
  4266. r = np.asarray(r, dtype=float)
  4267. ir,_,_ = ir_img0.split()
  4268. ir = np.asarray(ir, dtype=float)
  4269. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4270. np.seterr(divide='ignore', invalid='ignore')
  4271. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4272. # Display the results
  4273. fig, ax = plt.subplots()
  4274. plt.plot(ndvi)
  4275. plt.axis('off')
  4276. plt.figure(figsize=(19, 10))
  4277. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4278. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4279. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4280. plt.margins(0, 0)
  4281. #plt.show()
  4282. plt.savefig(ndvis)
  4283. plt.savefig(ndvia)
  4284. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4285. plt.close('all')
  4286. f = open('/var/www/html/cust/c7_4.txt','a')
  4287. f.write(date)
  4288. f.close()
  4289. dress = '/var/www/html/cust/7/c/'
  4290. for root, dirs, files in os.walk(dress):
  4291. print('files: {}'.format(len(files)))
  4292. if len(files)>=1:
  4293. files.sort()
  4294. for f in files:
  4295. with open(os.path.join(root, f), "rb") as imageFile:
  4296. str = base64.b64encode(imageFile.read())
  4297. url = 'http://60.250.156.234/cust/t7.php'
  4298. values = {'data1':str, 'name':f}
  4299. data1 = urllib.parse.urlencode(values)
  4300. data1 = data1.encode('utf-8')
  4301. req = urllib.request.Request(url, data1)
  4302. req.add_header('User-Agent','Magic Browser')
  4303. resp = urllib.request.urlopen(req)
  4304. respdata1 = resp.read()
  4305. print(os.path.join(root, f))
  4306. #print(respdata1)
  4307. os.remove(os.path.join(root, f))
  4308. print("ok")
  4309. except:
  4310. print('error')
  4311. def img7_5():
  4312. try:
  4313. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4314. charset='utf8')
  4315. a = db.cursor()
  4316. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  4317. result = a.fetchall()
  4318. if result ==():
  4319. s =""
  4320. else:
  4321. s = "_" + result[0][3]
  4322. db.close()
  4323. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4324. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4325. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4326. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4327. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4328. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4329. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4330. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4331. date += s
  4332. label= datetime.datetime.now().strftime('No.7 Direction 5 @%Y.%m.%d.%H.%M.%S')
  4333. rgb_img0 = Image.open('/var/www/html/cust/7/c/b5.tif')
  4334. ir_img0 = Image.open('/var/www/html/cust/7/c/a5.tif')
  4335. rgb_img0.save(nt)
  4336. ir_img0.save(irt)
  4337. rgb_img0.save(nj,quality=95)
  4338. ir_img0.save(irj,quality=95)
  4339. r,_,_ = rgb_img0.split()
  4340. r = np.asarray(r, dtype=float)
  4341. ir,_,_ = ir_img0.split()
  4342. ir = np.asarray(ir, dtype=float)
  4343. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4344. np.seterr(divide='ignore', invalid='ignore')
  4345. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4346. # Display the results
  4347. fig, ax = plt.subplots()
  4348. plt.plot(ndvi)
  4349. plt.axis('off')
  4350. plt.figure(figsize=(19, 10))
  4351. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4352. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4353. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4354. plt.margins(0, 0)
  4355. #plt.show()
  4356. plt.savefig(ndvis)
  4357. plt.savefig(ndvia)
  4358. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4359. plt.close('all')
  4360. f = open('/var/www/html/cust/c7_5.txt','a')
  4361. f.write(date)
  4362. f.close()
  4363. dress = '/var/www/html/cust/7/c/'
  4364. for root, dirs, files in os.walk(dress):
  4365. print('files: {}'.format(len(files)))
  4366. if len(files)>=1:
  4367. files.sort()
  4368. for f in files:
  4369. with open(os.path.join(root, f), "rb") as imageFile:
  4370. str = base64.b64encode(imageFile.read())
  4371. url = 'http://60.250.156.234/cust/t7.php'
  4372. values = {'data1':str, 'name':f}
  4373. data1 = urllib.parse.urlencode(values)
  4374. data1 = data1.encode('utf-8')
  4375. req = urllib.request.Request(url, data1)
  4376. req.add_header('User-Agent','Magic Browser')
  4377. resp = urllib.request.urlopen(req)
  4378. respdata1 = resp.read()
  4379. print(os.path.join(root, f))
  4380. #print(respdata1)
  4381. os.remove(os.path.join(root, f))
  4382. print("ok")
  4383. except:
  4384. print('error')
  4385. def img7_6():
  4386. try:
  4387. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4388. charset='utf8')
  4389. a = db.cursor()
  4390. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  4391. result = a.fetchall()
  4392. if result ==():
  4393. s =""
  4394. else:
  4395. s = "_" + result[0][3]
  4396. db.close()
  4397. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4398. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4399. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4400. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4401. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4402. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4403. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4404. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4405. date += s
  4406. label= datetime.datetime.now().strftime('No.7 Direction 6 @%Y.%m.%d.%H.%M.%S')
  4407. rgb_img0 = Image.open('/var/www/html/cust/7/c/b6.tif')
  4408. ir_img0 = Image.open('/var/www/html/cust/7/c/a6.tif')
  4409. rgb_img0.save(nt)
  4410. ir_img0.save(irt)
  4411. rgb_img0.save(nj,quality=95)
  4412. ir_img0.save(irj,quality=95)
  4413. r,_,_ = rgb_img0.split()
  4414. r = np.asarray(r, dtype=float)
  4415. ir,_,_ = ir_img0.split()
  4416. ir = np.asarray(ir, dtype=float)
  4417. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4418. np.seterr(divide='ignore', invalid='ignore')
  4419. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4420. # Display the results
  4421. fig, ax = plt.subplots()
  4422. plt.plot(ndvi)
  4423. plt.axis('off')
  4424. plt.figure(figsize=(19, 10))
  4425. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4426. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4427. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4428. plt.margins(0, 0)
  4429. #plt.show()
  4430. plt.savefig(ndvis)
  4431. plt.savefig(ndvia)
  4432. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4433. plt.close('all')
  4434. f = open('/var/www/html/cust/c7_6.txt','a')
  4435. f.write(date)
  4436. f.close()
  4437. dress = '/var/www/html/cust/7/c/'
  4438. for root, dirs, files in os.walk(dress):
  4439. print('files: {}'.format(len(files)))
  4440. if len(files)>=1:
  4441. files.sort()
  4442. for f in files:
  4443. with open(os.path.join(root, f), "rb") as imageFile:
  4444. str = base64.b64encode(imageFile.read())
  4445. url = 'http://60.250.156.234/cust/t7.php'
  4446. values = {'data1':str, 'name':f}
  4447. data1 = urllib.parse.urlencode(values)
  4448. data1 = data1.encode('utf-8')
  4449. req = urllib.request.Request(url, data1)
  4450. req.add_header('User-Agent','Magic Browser')
  4451. resp = urllib.request.urlopen(req)
  4452. respdata1 = resp.read()
  4453. print(os.path.join(root, f))
  4454. #print(respdata1)
  4455. os.remove(os.path.join(root, f))
  4456. print("ok")
  4457. except:
  4458. print('error')
  4459. def img7_7():
  4460. try:
  4461. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4462. charset='utf8')
  4463. a = db.cursor()
  4464. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  4465. result = a.fetchall()
  4466. if result ==():
  4467. s =""
  4468. else:
  4469. s = "_" + result[0][3]
  4470. db.close()
  4471. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4472. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4473. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4474. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4475. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4476. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4477. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4478. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4479. date += s
  4480. label= datetime.datetime.now().strftime('No.7 Direction 7 @%Y.%m.%d.%H.%M.%S')
  4481. rgb_img0 = Image.open('/var/www/html/cust/7/c/b7.tif')
  4482. ir_img0 = Image.open('/var/www/html/cust/7/c/a7.tif')
  4483. rgb_img0.save(nt)
  4484. ir_img0.save(irt)
  4485. rgb_img0.save(nj,quality=95)
  4486. ir_img0.save(irj,quality=95)
  4487. r,_,_ = rgb_img0.split()
  4488. r = np.asarray(r, dtype=float)
  4489. ir,_,_ = ir_img0.split()
  4490. ir = np.asarray(ir, dtype=float)
  4491. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4492. np.seterr(divide='ignore', invalid='ignore')
  4493. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4494. # Display the results
  4495. fig, ax = plt.subplots()
  4496. plt.plot(ndvi)
  4497. plt.axis('off')
  4498. plt.figure(figsize=(19, 10))
  4499. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4500. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4501. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4502. plt.margins(0, 0)
  4503. #plt.show()
  4504. plt.savefig(ndvis)
  4505. plt.savefig(ndvia)
  4506. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4507. plt.close('all')
  4508. f = open('/var/www/html/cust/c7_7.txt','a')
  4509. f.write(date)
  4510. f.close()
  4511. dress = '/var/www/html/cust/7/c/'
  4512. for root, dirs, files in os.walk(dress):
  4513. print('files: {}'.format(len(files)))
  4514. if len(files)>=1:
  4515. files.sort()
  4516. for f in files:
  4517. with open(os.path.join(root, f), "rb") as imageFile:
  4518. str = base64.b64encode(imageFile.read())
  4519. url = 'http://60.250.156.234/cust/t7.php'
  4520. values = {'data1':str, 'name':f}
  4521. data1 = urllib.parse.urlencode(values)
  4522. data1 = data1.encode('utf-8')
  4523. req = urllib.request.Request(url, data1)
  4524. req.add_header('User-Agent','Magic Browser')
  4525. resp = urllib.request.urlopen(req)
  4526. respdata1 = resp.read()
  4527. print(os.path.join(root, f))
  4528. #print(respdata1)
  4529. os.remove(os.path.join(root, f))
  4530. print("ok")
  4531. except:
  4532. print('error')
  4533. def img7_8():
  4534. try:
  4535. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4536. charset='utf8')
  4537. a = db.cursor()
  4538. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  4539. result = a.fetchall()
  4540. if result ==():
  4541. s =""
  4542. else:
  4543. s = "_" + result[0][3]
  4544. db.close()
  4545. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4546. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4547. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4548. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4549. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4550. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4551. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4552. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4553. date += s
  4554. label= datetime.datetime.now().strftime('No.7 Direction 8 @%Y.%m.%d.%H.%M.%S')
  4555. rgb_img0 = Image.open('/var/www/html/cust/7/c/b8.tif')
  4556. ir_img0 = Image.open('/var/www/html/cust/7/c/a8.tif')
  4557. rgb_img0.save(nt)
  4558. ir_img0.save(irt)
  4559. rgb_img0.save(nj,quality=95)
  4560. ir_img0.save(irj,quality=95)
  4561. r,_,_ = rgb_img0.split()
  4562. r = np.asarray(r, dtype=float)
  4563. ir,_,_ = ir_img0.split()
  4564. ir = np.asarray(ir, dtype=float)
  4565. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4566. np.seterr(divide='ignore', invalid='ignore')
  4567. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4568. # Display the results
  4569. fig, ax = plt.subplots()
  4570. plt.plot(ndvi)
  4571. plt.axis('off')
  4572. plt.figure(figsize=(19, 10))
  4573. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4574. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4575. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4576. plt.margins(0, 0)
  4577. #plt.show()
  4578. plt.savefig(ndvis)
  4579. plt.savefig(ndvia)
  4580. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4581. plt.close('all')
  4582. f = open('/var/www/html/cust/c7_8.txt','a')
  4583. f.write(date)
  4584. f.close()
  4585. dress = '/var/www/html/cust/7/c/'
  4586. for root, dirs, files in os.walk(dress):
  4587. print('files: {}'.format(len(files)))
  4588. if len(files)>=1:
  4589. files.sort()
  4590. for f in files:
  4591. with open(os.path.join(root, f), "rb") as imageFile:
  4592. str = base64.b64encode(imageFile.read())
  4593. url = 'http://60.250.156.234/cust/t7.php'
  4594. values = {'data1':str, 'name':f}
  4595. data1 = urllib.parse.urlencode(values)
  4596. data1 = data1.encode('utf-8')
  4597. req = urllib.request.Request(url, data1)
  4598. req.add_header('User-Agent','Magic Browser')
  4599. resp = urllib.request.urlopen(req)
  4600. respdata1 = resp.read()
  4601. print(os.path.join(root, f))
  4602. #print(respdata1)
  4603. os.remove(os.path.join(root, f))
  4604. print("ok")
  4605. except:
  4606. print('error')
  4607. def img7_9():
  4608. try:
  4609. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4610. charset='utf8')
  4611. a = db.cursor()
  4612. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002007' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  4613. result = a.fetchall()
  4614. if result ==():
  4615. s =""
  4616. else:
  4617. s = "_" + result[0][3]
  4618. db.close()
  4619. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4620. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4621. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/7/ndvia/c.png') #ndvi is c.png
  4622. irt = datetime.datetime.now().strftime('/var/www/html/cust/7/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4623. nt = datetime.datetime.now().strftime('/var/www/html/cust/7/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4624. irj = datetime.datetime.now().strftime('/var/www/html/cust/7/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4625. nj = datetime.datetime.now().strftime('/var/www/html/cust/7/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4626. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4627. date += s
  4628. label= datetime.datetime.now().strftime('No.7 Direction 0 @%Y.%m.%d.%H.%M.%S')
  4629. rgb_img0 = Image.open('/var/www/html/cust/7/c/b.tif')
  4630. ir_img0 = Image.open('/var/www/html/cust/7/c/a.tif')
  4631. rgb_img0.save(nt)
  4632. ir_img0.save(irt)
  4633. rgb_img0.save(nj,quality=95)
  4634. ir_img0.save(irj,quality=95)
  4635. r,_,_ = rgb_img0.split()
  4636. r = np.asarray(r, dtype=float)
  4637. ir,_,_ = ir_img0.split()
  4638. ir = np.asarray(ir, dtype=float)
  4639. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4640. np.seterr(divide='ignore', invalid='ignore')
  4641. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4642. # Display the results
  4643. fig, ax = plt.subplots()
  4644. plt.plot(ndvi)
  4645. plt.axis('off')
  4646. plt.figure(figsize=(19, 10))
  4647. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4648. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4649. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4650. plt.margins(0, 0)
  4651. #plt.show()
  4652. plt.savefig(ndvis)
  4653. plt.savefig(ndvia)
  4654. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4655. plt.close('all')
  4656. f = open('/var/www/html/cust/c7.txt','a')
  4657. f.write(date)
  4658. f.close()
  4659. dress = '/var/www/html/cust/7/c/'
  4660. for root, dirs, files in os.walk(dress):
  4661. print('files: {}'.format(len(files)))
  4662. if len(files)>=1:
  4663. files.sort()
  4664. for f in files:
  4665. with open(os.path.join(root, f), "rb") as imageFile:
  4666. str = base64.b64encode(imageFile.read())
  4667. url = 'http://60.250.156.234/cust/t7.php'
  4668. values = {'data1':str, 'name':f}
  4669. data1 = urllib.parse.urlencode(values)
  4670. data1 = data1.encode('utf-8')
  4671. req = urllib.request.Request(url, data1)
  4672. req.add_header('User-Agent','Magic Browser')
  4673. resp = urllib.request.urlopen(req)
  4674. respdata1 = resp.read()
  4675. print(os.path.join(root, f))
  4676. #print(respdata1)
  4677. os.remove(os.path.join(root, f))
  4678. print("ok")
  4679. except:
  4680. print('error')
  4681. def img8_1():
  4682. try:
  4683. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4684. charset='utf8')
  4685. a = db.cursor()
  4686. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  4687. result = a.fetchall()
  4688. if result ==():
  4689. s =""
  4690. else:
  4691. s = "_" + result[0][3]
  4692. db.close()
  4693. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4694. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4695. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  4696. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4697. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4698. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4699. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4700. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4701. date += s
  4702. label= datetime.datetime.now().strftime('No.8 Direction 1 @%Y.%m.%d.%H.%M.%S')
  4703. rgb_img0 = Image.open('/var/www/html/cust/8/c/b1.tif')
  4704. ir_img0 = Image.open('/var/www/html/cust/8/c/a1.tif')
  4705. rgb_img0.save(nt)
  4706. ir_img0.save(irt)
  4707. rgb_img0.save(nj,quality=95)
  4708. ir_img0.save(irj,quality=95)
  4709. r,_,_ = rgb_img0.split()
  4710. r = np.asarray(r, dtype=float)
  4711. ir,_,_ = ir_img0.split()
  4712. ir = np.asarray(ir, dtype=float)
  4713. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4714. np.seterr(divide='ignore', invalid='ignore')
  4715. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4716. # Display the results
  4717. fig, ax = plt.subplots()
  4718. plt.plot(ndvi)
  4719. plt.axis('off')
  4720. plt.figure(figsize=(19, 10))
  4721. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4722. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4723. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4724. plt.margins(0, 0)
  4725. #plt.show()
  4726. plt.savefig(ndvis)
  4727. plt.savefig(ndvia)
  4728. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4729. plt.close('all')
  4730. f = open('/var/www/html/cust/c8_1.txt','a')
  4731. f.write(date)
  4732. f.close()
  4733. dress = '/var/www/html/cust/8/c/'
  4734. for root, dirs, files in os.walk(dress):
  4735. print('files: {}'.format(len(files)))
  4736. if len(files)>=1:
  4737. files.sort()
  4738. for f in files:
  4739. with open(os.path.join(root, f), "rb") as imageFile:
  4740. str = base64.b64encode(imageFile.read())
  4741. url = 'http://60.250.156.234/cust/t8.php'
  4742. values = {'data1':str, 'name':f}
  4743. data1 = urllib.parse.urlencode(values)
  4744. data1 = data1.encode('utf-8')
  4745. req = urllib.request.Request(url, data1)
  4746. req.add_header('User-Agent','Magic Browser')
  4747. resp = urllib.request.urlopen(req)
  4748. respdata1 = resp.read()
  4749. print(os.path.join(root, f))
  4750. #print(respdata1)
  4751. os.remove(os.path.join(root, f))
  4752. print("ok")
  4753. except:
  4754. print('error')
  4755. def img8_2():
  4756. try:
  4757. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4758. charset='utf8')
  4759. a = db.cursor()
  4760. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  4761. result = a.fetchall()
  4762. if result ==():
  4763. s =""
  4764. else:
  4765. s = "_" + result[0][3]
  4766. db.close()
  4767. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4768. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4769. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  4770. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4771. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4772. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4773. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4774. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4775. date += s
  4776. label= datetime.datetime.now().strftime('No.8 Direction 2 @%Y.%m.%d.%H.%M.%S')
  4777. rgb_img0 = Image.open('/var/www/html/cust/8/c/b2.tif')
  4778. ir_img0 = Image.open('/var/www/html/cust/8/c/a2.tif')
  4779. rgb_img0.save(nt)
  4780. ir_img0.save(irt)
  4781. rgb_img0.save(nj,quality=95)
  4782. ir_img0.save(irj,quality=95)
  4783. r,_,_ = rgb_img0.split()
  4784. r = np.asarray(r, dtype=float)
  4785. ir,_,_ = ir_img0.split()
  4786. ir = np.asarray(ir, dtype=float)
  4787. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4788. np.seterr(divide='ignore', invalid='ignore')
  4789. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4790. # Display the results
  4791. fig, ax = plt.subplots()
  4792. plt.plot(ndvi)
  4793. plt.axis('off')
  4794. plt.figure(figsize=(19, 10))
  4795. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4796. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4797. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4798. plt.margins(0, 0)
  4799. #plt.show()
  4800. plt.savefig(ndvis)
  4801. plt.savefig(ndvia)
  4802. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4803. plt.close('all')
  4804. f = open('/var/www/html/cust/c8_2.txt','a')
  4805. f.write(date)
  4806. f.close()
  4807. dress = '/var/www/html/cust/8/c/'
  4808. for root, dirs, files in os.walk(dress):
  4809. print('files: {}'.format(len(files)))
  4810. if len(files)>=1:
  4811. files.sort()
  4812. for f in files:
  4813. with open(os.path.join(root, f), "rb") as imageFile:
  4814. str = base64.b64encode(imageFile.read())
  4815. url = 'http://60.250.156.234/cust/t8.php'
  4816. values = {'data1':str, 'name':f}
  4817. data1 = urllib.parse.urlencode(values)
  4818. data1 = data1.encode('utf-8')
  4819. req = urllib.request.Request(url, data1)
  4820. req.add_header('User-Agent','Magic Browser')
  4821. resp = urllib.request.urlopen(req)
  4822. respdata1 = resp.read()
  4823. print(os.path.join(root, f))
  4824. #print(respdata1)
  4825. os.remove(os.path.join(root, f))
  4826. print("ok")
  4827. except:
  4828. print('error')
  4829. def img8_3():
  4830. try:
  4831. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4832. charset='utf8')
  4833. a = db.cursor()
  4834. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  4835. result = a.fetchall()
  4836. if result ==():
  4837. s =""
  4838. else:
  4839. s = "_" + result[0][3]
  4840. db.close()
  4841. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4842. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4843. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  4844. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4845. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4846. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4847. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4848. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4849. date += s
  4850. label= datetime.datetime.now().strftime('No.8 Direction 3 @%Y.%m.%d.%H.%M.%S')
  4851. rgb_img0 = Image.open('/var/www/html/cust/8/c/b3.tif')
  4852. ir_img0 = Image.open('/var/www/html/cust/8/c/a3.tif')
  4853. rgb_img0.save(nt)
  4854. ir_img0.save(irt)
  4855. rgb_img0.save(nj,quality=95)
  4856. ir_img0.save(irj,quality=95)
  4857. r,_,_ = rgb_img0.split()
  4858. r = np.asarray(r, dtype=float)
  4859. ir,_,_ = ir_img0.split()
  4860. ir = np.asarray(ir, dtype=float)
  4861. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4862. np.seterr(divide='ignore', invalid='ignore')
  4863. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4864. # Display the results
  4865. fig, ax = plt.subplots()
  4866. plt.plot(ndvi)
  4867. plt.axis('off')
  4868. plt.figure(figsize=(19, 10))
  4869. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4870. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4871. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4872. plt.margins(0, 0)
  4873. #plt.show()
  4874. plt.savefig(ndvis)
  4875. plt.savefig(ndvia)
  4876. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4877. plt.close('all')
  4878. f = open('/var/www/html/cust/c8_3.txt','a')
  4879. f.write(date)
  4880. f.close()
  4881. dress = '/var/www/html/cust/8/c/'
  4882. for root, dirs, files in os.walk(dress):
  4883. print('files: {}'.format(len(files)))
  4884. if len(files)>=1:
  4885. files.sort()
  4886. for f in files:
  4887. with open(os.path.join(root, f), "rb") as imageFile:
  4888. str = base64.b64encode(imageFile.read())
  4889. url = 'http://60.250.156.234/cust/t8.php'
  4890. values = {'data1':str, 'name':f}
  4891. data1 = urllib.parse.urlencode(values)
  4892. data1 = data1.encode('utf-8')
  4893. req = urllib.request.Request(url, data1)
  4894. req.add_header('User-Agent','Magic Browser')
  4895. resp = urllib.request.urlopen(req)
  4896. respdata1 = resp.read()
  4897. print(os.path.join(root, f))
  4898. #print(respdata1)
  4899. os.remove(os.path.join(root, f))
  4900. print("ok")
  4901. except:
  4902. print('error')
  4903. def img8_4():
  4904. try:
  4905. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4906. charset='utf8')
  4907. a = db.cursor()
  4908. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  4909. result = a.fetchall()
  4910. if result ==():
  4911. s =""
  4912. else:
  4913. s = "_" + result[0][3]
  4914. db.close()
  4915. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4916. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4917. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  4918. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4919. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4920. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4921. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4922. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4923. date += s
  4924. label= datetime.datetime.now().strftime('No.8 Direction 4 @%Y.%m.%d.%H.%M.%S')
  4925. rgb_img0 = Image.open('/var/www/html/cust/8/c/b4.tif')
  4926. ir_img0 = Image.open('/var/www/html/cust/8/c/a4.tif')
  4927. rgb_img0.save(nt)
  4928. ir_img0.save(irt)
  4929. rgb_img0.save(nj,quality=95)
  4930. ir_img0.save(irj,quality=95)
  4931. r,_,_ = rgb_img0.split()
  4932. r = np.asarray(r, dtype=float)
  4933. ir,_,_ = ir_img0.split()
  4934. ir = np.asarray(ir, dtype=float)
  4935. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  4936. np.seterr(divide='ignore', invalid='ignore')
  4937. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  4938. # Display the results
  4939. fig, ax = plt.subplots()
  4940. plt.plot(ndvi)
  4941. plt.axis('off')
  4942. plt.figure(figsize=(19, 10))
  4943. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  4944. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  4945. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  4946. plt.margins(0, 0)
  4947. #plt.show()
  4948. plt.savefig(ndvis)
  4949. plt.savefig(ndvia)
  4950. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  4951. plt.close('all')
  4952. f = open('/var/www/html/cust/c8_4.txt','a')
  4953. f.write(date)
  4954. f.close()
  4955. dress = '/var/www/html/cust/8/c/'
  4956. for root, dirs, files in os.walk(dress):
  4957. print('files: {}'.format(len(files)))
  4958. if len(files)>=1:
  4959. files.sort()
  4960. for f in files:
  4961. with open(os.path.join(root, f), "rb") as imageFile:
  4962. str = base64.b64encode(imageFile.read())
  4963. url = 'http://60.250.156.234/cust/t8.php'
  4964. values = {'data1':str, 'name':f}
  4965. data1 = urllib.parse.urlencode(values)
  4966. data1 = data1.encode('utf-8')
  4967. req = urllib.request.Request(url, data1)
  4968. req.add_header('User-Agent','Magic Browser')
  4969. resp = urllib.request.urlopen(req)
  4970. respdata1 = resp.read()
  4971. print(os.path.join(root, f))
  4972. #print(respdata1)
  4973. os.remove(os.path.join(root, f))
  4974. print("ok")
  4975. except:
  4976. print('error')
  4977. def img8_5():
  4978. try:
  4979. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  4980. charset='utf8')
  4981. a = db.cursor()
  4982. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  4983. result = a.fetchall()
  4984. if result ==():
  4985. s =""
  4986. else:
  4987. s = "_" + result[0][3]
  4988. db.close()
  4989. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  4990. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  4991. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  4992. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  4993. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  4994. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  4995. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  4996. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  4997. date += s
  4998. label= datetime.datetime.now().strftime('No.8 Direction 5 @%Y.%m.%d.%H.%M.%S')
  4999. rgb_img0 = Image.open('/var/www/html/cust/8/c/b5.tif')
  5000. ir_img0 = Image.open('/var/www/html/cust/8/c/a5.tif')
  5001. rgb_img0.save(nt)
  5002. ir_img0.save(irt)
  5003. rgb_img0.save(nj,quality=95)
  5004. ir_img0.save(irj,quality=95)
  5005. r,_,_ = rgb_img0.split()
  5006. r = np.asarray(r, dtype=float)
  5007. ir,_,_ = ir_img0.split()
  5008. ir = np.asarray(ir, dtype=float)
  5009. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5010. np.seterr(divide='ignore', invalid='ignore')
  5011. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5012. # Display the results
  5013. fig, ax = plt.subplots()
  5014. plt.plot(ndvi)
  5015. plt.axis('off')
  5016. plt.figure(figsize=(19, 10))
  5017. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5018. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5019. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5020. plt.margins(0, 0)
  5021. #plt.show()
  5022. plt.savefig(ndvis)
  5023. plt.savefig(ndvia)
  5024. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5025. plt.close('all')
  5026. f = open('/var/www/html/cust/c8_5.txt','a')
  5027. f.write(date)
  5028. f.close()
  5029. dress = '/var/www/html/cust/8/c/'
  5030. for root, dirs, files in os.walk(dress):
  5031. print('files: {}'.format(len(files)))
  5032. if len(files)>=1:
  5033. files.sort()
  5034. for f in files:
  5035. with open(os.path.join(root, f), "rb") as imageFile:
  5036. str = base64.b64encode(imageFile.read())
  5037. url = 'http://60.250.156.234/cust/t8.php'
  5038. values = {'data1':str, 'name':f}
  5039. data1 = urllib.parse.urlencode(values)
  5040. data1 = data1.encode('utf-8')
  5041. req = urllib.request.Request(url, data1)
  5042. req.add_header('User-Agent','Magic Browser')
  5043. resp = urllib.request.urlopen(req)
  5044. respdata1 = resp.read()
  5045. print(os.path.join(root, f))
  5046. #print(respdata1)
  5047. os.remove(os.path.join(root, f))
  5048. print("ok")
  5049. except:
  5050. print('error')
  5051. def img8_6():
  5052. try:
  5053. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5054. charset='utf8')
  5055. a = db.cursor()
  5056. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  5057. result = a.fetchall()
  5058. if result ==():
  5059. s =""
  5060. else:
  5061. s = "_" + result[0][3]
  5062. db.close()
  5063. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5064. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5065. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  5066. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5067. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5068. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5069. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5070. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5071. date += s
  5072. label= datetime.datetime.now().strftime('No.8 Direction 6 @%Y.%m.%d.%H.%M.%S')
  5073. rgb_img0 = Image.open('/var/www/html/cust/8/c/b6.tif')
  5074. ir_img0 = Image.open('/var/www/html/cust/8/c/a6.tif')
  5075. rgb_img0.save(nt)
  5076. ir_img0.save(irt)
  5077. rgb_img0.save(nj,quality=95)
  5078. ir_img0.save(irj,quality=95)
  5079. r,_,_ = rgb_img0.split()
  5080. r = np.asarray(r, dtype=float)
  5081. ir,_,_ = ir_img0.split()
  5082. ir = np.asarray(ir, dtype=float)
  5083. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5084. np.seterr(divide='ignore', invalid='ignore')
  5085. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5086. # Display the results
  5087. fig, ax = plt.subplots()
  5088. plt.plot(ndvi)
  5089. plt.axis('off')
  5090. plt.figure(figsize=(19, 10))
  5091. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5092. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5093. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5094. plt.margins(0, 0)
  5095. #plt.show()
  5096. plt.savefig(ndvis)
  5097. plt.savefig(ndvia)
  5098. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5099. plt.close('all')
  5100. f = open('/var/www/html/cust/c8_6.txt','a')
  5101. f.write(date)
  5102. f.close()
  5103. dress = '/var/www/html/cust/8/c/'
  5104. for root, dirs, files in os.walk(dress):
  5105. print('files: {}'.format(len(files)))
  5106. if len(files)>=1:
  5107. files.sort()
  5108. for f in files:
  5109. with open(os.path.join(root, f), "rb") as imageFile:
  5110. str = base64.b64encode(imageFile.read())
  5111. url = 'http://60.250.156.234/cust/t8.php'
  5112. values = {'data1':str, 'name':f}
  5113. data1 = urllib.parse.urlencode(values)
  5114. data1 = data1.encode('utf-8')
  5115. req = urllib.request.Request(url, data1)
  5116. req.add_header('User-Agent','Magic Browser')
  5117. resp = urllib.request.urlopen(req)
  5118. respdata1 = resp.read()
  5119. print(os.path.join(root, f))
  5120. #print(respdata1)
  5121. os.remove(os.path.join(root, f))
  5122. print("ok")
  5123. except:
  5124. print('error')
  5125. def img8_7():
  5126. try:
  5127. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5128. charset='utf8')
  5129. a = db.cursor()
  5130. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  5131. result = a.fetchall()
  5132. if result ==():
  5133. s =""
  5134. else:
  5135. s = "_" + result[0][3]
  5136. db.close()
  5137. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5138. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5139. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  5140. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5141. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5142. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5143. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5144. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5145. date += s
  5146. label= datetime.datetime.now().strftime('No.8 Direction 7 @%Y.%m.%d.%H.%M.%S')
  5147. rgb_img0 = Image.open('/var/www/html/cust/8/c/b7.tif')
  5148. ir_img0 = Image.open('/var/www/html/cust/8/c/a7.tif')
  5149. rgb_img0.save(nt)
  5150. ir_img0.save(irt)
  5151. rgb_img0.save(nj,quality=95)
  5152. ir_img0.save(irj,quality=95)
  5153. r,_,_ = rgb_img0.split()
  5154. r = np.asarray(r, dtype=float)
  5155. ir,_,_ = ir_img0.split()
  5156. ir = np.asarray(ir, dtype=float)
  5157. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5158. np.seterr(divide='ignore', invalid='ignore')
  5159. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5160. # Display the results
  5161. fig, ax = plt.subplots()
  5162. plt.plot(ndvi)
  5163. plt.axis('off')
  5164. plt.figure(figsize=(19, 10))
  5165. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5166. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5167. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5168. plt.margins(0, 0)
  5169. #plt.show()
  5170. plt.savefig(ndvis)
  5171. plt.savefig(ndvia)
  5172. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5173. plt.close('all')
  5174. f = open('/var/www/html/cust/c8_7.txt','a')
  5175. f.write(date)
  5176. f.close()
  5177. dress = '/var/www/html/cust/8/c/'
  5178. for root, dirs, files in os.walk(dress):
  5179. print('files: {}'.format(len(files)))
  5180. if len(files)>=1:
  5181. files.sort()
  5182. for f in files:
  5183. with open(os.path.join(root, f), "rb") as imageFile:
  5184. str = base64.b64encode(imageFile.read())
  5185. url = 'http://60.250.156.234/cust/t8.php'
  5186. values = {'data1':str, 'name':f}
  5187. data1 = urllib.parse.urlencode(values)
  5188. data1 = data1.encode('utf-8')
  5189. req = urllib.request.Request(url, data1)
  5190. req.add_header('User-Agent','Magic Browser')
  5191. resp = urllib.request.urlopen(req)
  5192. respdata1 = resp.read()
  5193. print(os.path.join(root, f))
  5194. #print(respdata1)
  5195. os.remove(os.path.join(root, f))
  5196. print("ok")
  5197. except:
  5198. print('error')
  5199. def img8_8():
  5200. try:
  5201. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5202. charset='utf8')
  5203. a = db.cursor()
  5204. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  5205. result = a.fetchall()
  5206. if result ==():
  5207. s =""
  5208. else:
  5209. s = "_" + result[0][3]
  5210. db.close()
  5211. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5212. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5213. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  5214. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5215. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5216. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5217. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5218. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5219. date += s
  5220. label= datetime.datetime.now().strftime('No.8 Direction 8 @%Y.%m.%d.%H.%M.%S')
  5221. rgb_img0 = Image.open('/var/www/html/cust/8/c/b8.tif')
  5222. ir_img0 = Image.open('/var/www/html/cust/8/c/a8.tif')
  5223. rgb_img0.save(nt)
  5224. ir_img0.save(irt)
  5225. rgb_img0.save(nj,quality=95)
  5226. ir_img0.save(irj,quality=95)
  5227. r,_,_ = rgb_img0.split()
  5228. r = np.asarray(r, dtype=float)
  5229. ir,_,_ = ir_img0.split()
  5230. ir = np.asarray(ir, dtype=float)
  5231. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5232. np.seterr(divide='ignore', invalid='ignore')
  5233. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5234. # Display the results
  5235. fig, ax = plt.subplots()
  5236. plt.plot(ndvi)
  5237. plt.axis('off')
  5238. plt.figure(figsize=(19, 10))
  5239. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5240. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5241. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5242. plt.margins(0, 0)
  5243. #plt.show()
  5244. plt.savefig(ndvis)
  5245. plt.savefig(ndvia)
  5246. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5247. plt.close('all')
  5248. f = open('/var/www/html/cust/c8_8.txt','a')
  5249. f.write(date)
  5250. f.close()
  5251. dress = '/var/www/html/cust/8/c/'
  5252. for root, dirs, files in os.walk(dress):
  5253. print('files: {}'.format(len(files)))
  5254. if len(files)>=1:
  5255. files.sort()
  5256. for f in files:
  5257. with open(os.path.join(root, f), "rb") as imageFile:
  5258. str = base64.b64encode(imageFile.read())
  5259. url = 'http://60.250.156.234/cust/t8.php'
  5260. values = {'data1':str, 'name':f}
  5261. data1 = urllib.parse.urlencode(values)
  5262. data1 = data1.encode('utf-8')
  5263. req = urllib.request.Request(url, data1)
  5264. req.add_header('User-Agent','Magic Browser')
  5265. resp = urllib.request.urlopen(req)
  5266. respdata1 = resp.read()
  5267. print(os.path.join(root, f))
  5268. #print(respdata1)
  5269. os.remove(os.path.join(root, f))
  5270. print("ok")
  5271. except:
  5272. print('error')
  5273. def img8_9():
  5274. try:
  5275. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5276. charset='utf8')
  5277. a = db.cursor()
  5278. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002008' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  5279. result = a.fetchall()
  5280. if result ==():
  5281. s =""
  5282. else:
  5283. s = "_" + result[0][3]
  5284. db.close()
  5285. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5286. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5287. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/8/ndvia/c.png') #ndvi is c.png
  5288. irt = datetime.datetime.now().strftime('/var/www/html/cust/8/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5289. nt = datetime.datetime.now().strftime('/var/www/html/cust/8/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5290. irj = datetime.datetime.now().strftime('/var/www/html/cust/8/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5291. nj = datetime.datetime.now().strftime('/var/www/html/cust/8/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5292. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5293. date += s
  5294. label= datetime.datetime.now().strftime('No.8 Direction 0 @%Y.%m.%d.%H.%M.%S')
  5295. rgb_img0 = Image.open('/var/www/html/cust/8/c/b.tif')
  5296. ir_img0 = Image.open('/var/www/html/cust/8/c/a.tif')
  5297. rgb_img0.save(nt)
  5298. ir_img0.save(irt)
  5299. rgb_img0.save(nj,quality=95)
  5300. ir_img0.save(irj,quality=95)
  5301. r,_,_ = rgb_img0.split()
  5302. r = np.asarray(r, dtype=float)
  5303. ir,_,_ = ir_img0.split()
  5304. ir = np.asarray(ir, dtype=float)
  5305. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5306. np.seterr(divide='ignore', invalid='ignore')
  5307. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5308. # Display the results
  5309. fig, ax = plt.subplots()
  5310. plt.plot(ndvi)
  5311. plt.axis('off')
  5312. plt.figure(figsize=(19, 10))
  5313. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5314. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5315. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5316. plt.margins(0, 0)
  5317. #plt.show()
  5318. plt.savefig(ndvis)
  5319. plt.savefig(ndvia)
  5320. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5321. plt.close('all')
  5322. f = open('/var/www/html/cust/c8.txt','a')
  5323. f.write(date)
  5324. f.close()
  5325. dress = '/var/www/html/cust/8/c/'
  5326. for root, dirs, files in os.walk(dress):
  5327. print('files: {}'.format(len(files)))
  5328. if len(files)>=1:
  5329. files.sort()
  5330. for f in files:
  5331. with open(os.path.join(root, f), "rb") as imageFile:
  5332. str = base64.b64encode(imageFile.read())
  5333. url = 'http://60.250.156.234/cust/t8.php'
  5334. values = {'data1':str, 'name':f}
  5335. data1 = urllib.parse.urlencode(values)
  5336. data1 = data1.encode('utf-8')
  5337. req = urllib.request.Request(url, data1)
  5338. req.add_header('User-Agent','Magic Browser')
  5339. resp = urllib.request.urlopen(req)
  5340. respdata1 = resp.read()
  5341. print(os.path.join(root, f))
  5342. #print(respdata1)
  5343. os.remove(os.path.join(root, f))
  5344. print("ok")
  5345. except:
  5346. print('error')
  5347. def img9_1():
  5348. try:
  5349. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5350. charset='utf8')
  5351. a = db.cursor()
  5352. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  5353. result = a.fetchall()
  5354. if result ==():
  5355. s =""
  5356. else:
  5357. s = "_" + result[0][3]
  5358. db.close()
  5359. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5360. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5361. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5362. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5363. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5364. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5365. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5366. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5367. date += s
  5368. label= datetime.datetime.now().strftime('No.9 Direction 1 @%Y.%m.%d.%H.%M.%S')
  5369. rgb_img0 = Image.open('/var/www/html/cust/9/c/b1.tif')
  5370. ir_img0 = Image.open('/var/www/html/cust/9/c/a1.tif')
  5371. rgb_img0.save(nt)
  5372. ir_img0.save(irt)
  5373. rgb_img0.save(nj,quality=95)
  5374. ir_img0.save(irj,quality=95)
  5375. r,_,_ = rgb_img0.split()
  5376. r = np.asarray(r, dtype=float)
  5377. ir,_,_ = ir_img0.split()
  5378. ir = np.asarray(ir, dtype=float)
  5379. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5380. np.seterr(divide='ignore', invalid='ignore')
  5381. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5382. # Display the results
  5383. fig, ax = plt.subplots()
  5384. plt.plot(ndvi)
  5385. plt.axis('off')
  5386. plt.figure(figsize=(19, 10))
  5387. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5388. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5389. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5390. plt.margins(0, 0)
  5391. #plt.show()
  5392. plt.savefig(ndvis)
  5393. plt.savefig(ndvia)
  5394. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5395. plt.close('all')
  5396. f = open('/var/www/html/cust/c9_1.txt','a')
  5397. f.write(date)
  5398. f.close()
  5399. dress = '/var/www/html/cust/9/c/'
  5400. for root, dirs, files in os.walk(dress):
  5401. print('files: {}'.format(len(files)))
  5402. if len(files)>=1:
  5403. files.sort()
  5404. for f in files:
  5405. with open(os.path.join(root, f), "rb") as imageFile:
  5406. str = base64.b64encode(imageFile.read())
  5407. url = 'http://60.250.156.234/cust/t9.php'
  5408. values = {'data1':str, 'name':f}
  5409. data1 = urllib.parse.urlencode(values)
  5410. data1 = data1.encode('utf-8')
  5411. req = urllib.request.Request(url, data1)
  5412. req.add_header('User-Agent','Magic Browser')
  5413. resp = urllib.request.urlopen(req)
  5414. respdata1 = resp.read()
  5415. print(os.path.join(root, f))
  5416. #print(respdata1)
  5417. os.remove(os.path.join(root, f))
  5418. print("ok")
  5419. except:
  5420. print('error')
  5421. def img9_2():
  5422. try:
  5423. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5424. charset='utf8')
  5425. a = db.cursor()
  5426. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  5427. result = a.fetchall()
  5428. if result ==():
  5429. s =""
  5430. else:
  5431. s = "_" + result[0][3]
  5432. db.close()
  5433. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5434. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5435. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5436. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5437. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5438. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5439. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5440. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5441. date += s
  5442. label= datetime.datetime.now().strftime('No.9 Direction 2 @%Y.%m.%d.%H.%M.%S')
  5443. rgb_img0 = Image.open('/var/www/html/cust/9/c/b2.tif')
  5444. ir_img0 = Image.open('/var/www/html/cust/9/c/a2.tif')
  5445. rgb_img0.save(nt)
  5446. ir_img0.save(irt)
  5447. rgb_img0.save(nj,quality=95)
  5448. ir_img0.save(irj,quality=95)
  5449. r,_,_ = rgb_img0.split()
  5450. r = np.asarray(r, dtype=float)
  5451. ir,_,_ = ir_img0.split()
  5452. ir = np.asarray(ir, dtype=float)
  5453. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5454. np.seterr(divide='ignore', invalid='ignore')
  5455. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5456. # Display the results
  5457. fig, ax = plt.subplots()
  5458. plt.plot(ndvi)
  5459. plt.axis('off')
  5460. plt.figure(figsize=(19, 10))
  5461. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5462. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5463. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5464. plt.margins(0, 0)
  5465. #plt.show()
  5466. plt.savefig(ndvis)
  5467. plt.savefig(ndvia)
  5468. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5469. plt.close('all')
  5470. f = open('/var/www/html/cust/c9_2.txt','a')
  5471. f.write(date)
  5472. f.close()
  5473. dress = '/var/www/html/cust/9/c/'
  5474. for root, dirs, files in os.walk(dress):
  5475. print('files: {}'.format(len(files)))
  5476. if len(files)>=1:
  5477. files.sort()
  5478. for f in files:
  5479. with open(os.path.join(root, f), "rb") as imageFile:
  5480. str = base64.b64encode(imageFile.read())
  5481. url = 'http://60.250.156.234/cust/t9.php'
  5482. values = {'data1':str, 'name':f}
  5483. data1 = urllib.parse.urlencode(values)
  5484. data1 = data1.encode('utf-8')
  5485. req = urllib.request.Request(url, data1)
  5486. req.add_header('User-Agent','Magic Browser')
  5487. resp = urllib.request.urlopen(req)
  5488. respdata1 = resp.read()
  5489. print(os.path.join(root, f))
  5490. #print(respdata1)
  5491. os.remove(os.path.join(root, f))
  5492. print("ok")
  5493. except:
  5494. print('error')
  5495. def img9_3():
  5496. try:
  5497. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5498. charset='utf8')
  5499. a = db.cursor()
  5500. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  5501. result = a.fetchall()
  5502. if result ==():
  5503. s =""
  5504. else:
  5505. s = "_" + result[0][3]
  5506. db.close()
  5507. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5508. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5509. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5510. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5511. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5512. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5513. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5514. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5515. date += s
  5516. label= datetime.datetime.now().strftime('No.9 Direction 3 @%Y.%m.%d.%H.%M.%S')
  5517. rgb_img0 = Image.open('/var/www/html/cust/9/c/b3.tif')
  5518. ir_img0 = Image.open('/var/www/html/cust/9/c/a3.tif')
  5519. rgb_img0.save(nt)
  5520. ir_img0.save(irt)
  5521. rgb_img0.save(nj,quality=95)
  5522. ir_img0.save(irj,quality=95)
  5523. r,_,_ = rgb_img0.split()
  5524. r = np.asarray(r, dtype=float)
  5525. ir,_,_ = ir_img0.split()
  5526. ir = np.asarray(ir, dtype=float)
  5527. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5528. np.seterr(divide='ignore', invalid='ignore')
  5529. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5530. # Display the results
  5531. fig, ax = plt.subplots()
  5532. plt.plot(ndvi)
  5533. plt.axis('off')
  5534. plt.figure(figsize=(19, 10))
  5535. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5536. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5537. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5538. plt.margins(0, 0)
  5539. #plt.show()
  5540. plt.savefig(ndvis)
  5541. plt.savefig(ndvia)
  5542. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5543. plt.close('all')
  5544. f = open('/var/www/html/cust/c9_3.txt','a')
  5545. f.write(date)
  5546. f.close()
  5547. dress = '/var/www/html/cust/9/c/'
  5548. for root, dirs, files in os.walk(dress):
  5549. print('files: {}'.format(len(files)))
  5550. if len(files)>=1:
  5551. files.sort()
  5552. for f in files:
  5553. with open(os.path.join(root, f), "rb") as imageFile:
  5554. str = base64.b64encode(imageFile.read())
  5555. url = 'http://60.250.156.234/cust/t9.php'
  5556. values = {'data1':str, 'name':f}
  5557. data1 = urllib.parse.urlencode(values)
  5558. data1 = data1.encode('utf-8')
  5559. req = urllib.request.Request(url, data1)
  5560. req.add_header('User-Agent','Magic Browser')
  5561. resp = urllib.request.urlopen(req)
  5562. respdata1 = resp.read()
  5563. print(os.path.join(root, f))
  5564. #print(respdata1)
  5565. os.remove(os.path.join(root, f))
  5566. print("ok")
  5567. except:
  5568. print('error')
  5569. def img9_4():
  5570. try:
  5571. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5572. charset='utf8')
  5573. a = db.cursor()
  5574. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  5575. result = a.fetchall()
  5576. if result ==():
  5577. s =""
  5578. else:
  5579. s = "_" + result[0][3]
  5580. db.close()
  5581. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5582. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5583. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5584. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5585. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5586. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5587. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5588. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5589. date += s
  5590. label= datetime.datetime.now().strftime('No.9 Direction 4 @%Y.%m.%d.%H.%M.%S')
  5591. rgb_img0 = Image.open('/var/www/html/cust/9/c/b4.tif')
  5592. ir_img0 = Image.open('/var/www/html/cust/9/c/a4.tif')
  5593. rgb_img0.save(nt)
  5594. ir_img0.save(irt)
  5595. rgb_img0.save(nj,quality=95)
  5596. ir_img0.save(irj,quality=95)
  5597. r,_,_ = rgb_img0.split()
  5598. r = np.asarray(r, dtype=float)
  5599. ir,_,_ = ir_img0.split()
  5600. ir = np.asarray(ir, dtype=float)
  5601. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5602. np.seterr(divide='ignore', invalid='ignore')
  5603. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5604. # Display the results
  5605. fig, ax = plt.subplots()
  5606. plt.plot(ndvi)
  5607. plt.axis('off')
  5608. plt.figure(figsize=(19, 10))
  5609. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5610. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5611. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5612. plt.margins(0, 0)
  5613. #plt.show()
  5614. plt.savefig(ndvis)
  5615. plt.savefig(ndvia)
  5616. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5617. plt.close('all')
  5618. f = open('/var/www/html/cust/c9_4.txt','a')
  5619. f.write(date)
  5620. f.close()
  5621. dress = '/var/www/html/cust/9/c/'
  5622. for root, dirs, files in os.walk(dress):
  5623. print('files: {}'.format(len(files)))
  5624. if len(files)>=1:
  5625. files.sort()
  5626. for f in files:
  5627. with open(os.path.join(root, f), "rb") as imageFile:
  5628. str = base64.b64encode(imageFile.read())
  5629. url = 'http://60.250.156.234/cust/t9.php'
  5630. values = {'data1':str, 'name':f}
  5631. data1 = urllib.parse.urlencode(values)
  5632. data1 = data1.encode('utf-8')
  5633. req = urllib.request.Request(url, data1)
  5634. req.add_header('User-Agent','Magic Browser')
  5635. resp = urllib.request.urlopen(req)
  5636. respdata1 = resp.read()
  5637. print(os.path.join(root, f))
  5638. #print(respdata1)
  5639. os.remove(os.path.join(root, f))
  5640. print("ok")
  5641. except:
  5642. print('error')
  5643. def img9_5():
  5644. try:
  5645. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5646. charset='utf8')
  5647. a = db.cursor()
  5648. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  5649. result = a.fetchall()
  5650. if result ==():
  5651. s =""
  5652. else:
  5653. s = "_" + result[0][3]
  5654. db.close()
  5655. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5656. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5657. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5658. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5659. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5660. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5661. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5662. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5663. date += s
  5664. label= datetime.datetime.now().strftime('No.9 Direction 5 @%Y.%m.%d.%H.%M.%S')
  5665. rgb_img0 = Image.open('/var/www/html/cust/9/c/b5.tif')
  5666. ir_img0 = Image.open('/var/www/html/cust/9/c/a5.tif')
  5667. rgb_img0.save(nt)
  5668. ir_img0.save(irt)
  5669. rgb_img0.save(nj,quality=95)
  5670. ir_img0.save(irj,quality=95)
  5671. r,_,_ = rgb_img0.split()
  5672. r = np.asarray(r, dtype=float)
  5673. ir,_,_ = ir_img0.split()
  5674. ir = np.asarray(ir, dtype=float)
  5675. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5676. np.seterr(divide='ignore', invalid='ignore')
  5677. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5678. # Display the results
  5679. fig, ax = plt.subplots()
  5680. plt.plot(ndvi)
  5681. plt.axis('off')
  5682. plt.figure(figsize=(19, 10))
  5683. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5684. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5685. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5686. plt.margins(0, 0)
  5687. #plt.show()
  5688. plt.savefig(ndvis)
  5689. plt.savefig(ndvia)
  5690. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5691. plt.close('all')
  5692. f = open('/var/www/html/cust/c9_5.txt','a')
  5693. f.write(date)
  5694. f.close()
  5695. dress = '/var/www/html/cust/9/c/'
  5696. for root, dirs, files in os.walk(dress):
  5697. print('files: {}'.format(len(files)))
  5698. if len(files)>=1:
  5699. files.sort()
  5700. for f in files:
  5701. with open(os.path.join(root, f), "rb") as imageFile:
  5702. str = base64.b64encode(imageFile.read())
  5703. url = 'http://60.250.156.234/cust/t9.php'
  5704. values = {'data1':str, 'name':f}
  5705. data1 = urllib.parse.urlencode(values)
  5706. data1 = data1.encode('utf-8')
  5707. req = urllib.request.Request(url, data1)
  5708. req.add_header('User-Agent','Magic Browser')
  5709. resp = urllib.request.urlopen(req)
  5710. respdata1 = resp.read()
  5711. print(os.path.join(root, f))
  5712. #print(respdata1)
  5713. os.remove(os.path.join(root, f))
  5714. print("ok")
  5715. except:
  5716. print('error')
  5717. def img9_6():
  5718. try:
  5719. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5720. charset='utf8')
  5721. a = db.cursor()
  5722. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  5723. result = a.fetchall()
  5724. if result ==():
  5725. s =""
  5726. else:
  5727. s = "_" + result[0][3]
  5728. db.close()
  5729. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5730. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5731. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5732. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5733. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5734. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5735. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5736. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5737. date += s
  5738. label= datetime.datetime.now().strftime('No.9 Direction 6 @%Y.%m.%d.%H.%M.%S')
  5739. rgb_img0 = Image.open('/var/www/html/cust/9/c/b6.tif')
  5740. ir_img0 = Image.open('/var/www/html/cust/9/c/a6.tif')
  5741. rgb_img0.save(nt)
  5742. ir_img0.save(irt)
  5743. rgb_img0.save(nj,quality=95)
  5744. ir_img0.save(irj,quality=95)
  5745. r,_,_ = rgb_img0.split()
  5746. r = np.asarray(r, dtype=float)
  5747. ir,_,_ = ir_img0.split()
  5748. ir = np.asarray(ir, dtype=float)
  5749. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5750. np.seterr(divide='ignore', invalid='ignore')
  5751. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5752. # Display the results
  5753. fig, ax = plt.subplots()
  5754. plt.plot(ndvi)
  5755. plt.axis('off')
  5756. plt.figure(figsize=(19, 10))
  5757. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5758. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5759. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5760. plt.margins(0, 0)
  5761. #plt.show()
  5762. plt.savefig(ndvis)
  5763. plt.savefig(ndvia)
  5764. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5765. plt.close('all')
  5766. f = open('/var/www/html/cust/c9_6.txt','a')
  5767. f.write(date)
  5768. f.close()
  5769. dress = '/var/www/html/cust/9/c/'
  5770. for root, dirs, files in os.walk(dress):
  5771. print('files: {}'.format(len(files)))
  5772. if len(files)>=1:
  5773. files.sort()
  5774. for f in files:
  5775. with open(os.path.join(root, f), "rb") as imageFile:
  5776. str = base64.b64encode(imageFile.read())
  5777. url = 'http://60.250.156.234/cust/t9.php'
  5778. values = {'data1':str, 'name':f}
  5779. data1 = urllib.parse.urlencode(values)
  5780. data1 = data1.encode('utf-8')
  5781. req = urllib.request.Request(url, data1)
  5782. req.add_header('User-Agent','Magic Browser')
  5783. resp = urllib.request.urlopen(req)
  5784. respdata1 = resp.read()
  5785. print(os.path.join(root, f))
  5786. #print(respdata1)
  5787. os.remove(os.path.join(root, f))
  5788. print("ok")
  5789. except:
  5790. print('error')
  5791. def img9_7():
  5792. try:
  5793. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5794. charset='utf8')
  5795. a = db.cursor()
  5796. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  5797. result = a.fetchall()
  5798. if result ==():
  5799. s =""
  5800. else:
  5801. s = "_" + result[0][3]
  5802. db.close()
  5803. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5804. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5805. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5806. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5807. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5808. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5809. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5810. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5811. date += s
  5812. label= datetime.datetime.now().strftime('No.9 Direction 7 @%Y.%m.%d.%H.%M.%S')
  5813. rgb_img0 = Image.open('/var/www/html/cust/9/c/b7.tif')
  5814. ir_img0 = Image.open('/var/www/html/cust/9/c/a7.tif')
  5815. rgb_img0.save(nt)
  5816. ir_img0.save(irt)
  5817. rgb_img0.save(nj,quality=95)
  5818. ir_img0.save(irj,quality=95)
  5819. r,_,_ = rgb_img0.split()
  5820. r = np.asarray(r, dtype=float)
  5821. ir,_,_ = ir_img0.split()
  5822. ir = np.asarray(ir, dtype=float)
  5823. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5824. np.seterr(divide='ignore', invalid='ignore')
  5825. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5826. # Display the results
  5827. fig, ax = plt.subplots()
  5828. plt.plot(ndvi)
  5829. plt.axis('off')
  5830. plt.figure(figsize=(19, 10))
  5831. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5832. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5833. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5834. plt.margins(0, 0)
  5835. #plt.show()
  5836. plt.savefig(ndvis)
  5837. plt.savefig(ndvia)
  5838. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5839. plt.close('all')
  5840. f = open('/var/www/html/cust/c9_7.txt','a')
  5841. f.write(date)
  5842. f.close()
  5843. dress = '/var/www/html/cust/9/c/'
  5844. for root, dirs, files in os.walk(dress):
  5845. print('files: {}'.format(len(files)))
  5846. if len(files)>=1:
  5847. files.sort()
  5848. for f in files:
  5849. with open(os.path.join(root, f), "rb") as imageFile:
  5850. str = base64.b64encode(imageFile.read())
  5851. url = 'http://60.250.156.234/cust/t9.php'
  5852. values = {'data1':str, 'name':f}
  5853. data1 = urllib.parse.urlencode(values)
  5854. data1 = data1.encode('utf-8')
  5855. req = urllib.request.Request(url, data1)
  5856. req.add_header('User-Agent','Magic Browser')
  5857. resp = urllib.request.urlopen(req)
  5858. respdata1 = resp.read()
  5859. print(os.path.join(root, f))
  5860. #print(respdata1)
  5861. os.remove(os.path.join(root, f))
  5862. print("ok")
  5863. except:
  5864. print('error')
  5865. def img9_8():
  5866. try:
  5867. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5868. charset='utf8')
  5869. a = db.cursor()
  5870. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  5871. result = a.fetchall()
  5872. if result ==():
  5873. s =""
  5874. else:
  5875. s = "_" + result[0][3]
  5876. db.close()
  5877. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5878. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5879. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5880. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5881. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5882. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5883. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5884. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5885. date += s
  5886. label= datetime.datetime.now().strftime('No.9 Direction 8 @%Y.%m.%d.%H.%M.%S')
  5887. rgb_img0 = Image.open('/var/www/html/cust/9/c/b8.tif')
  5888. ir_img0 = Image.open('/var/www/html/cust/9/c/a8.tif')
  5889. rgb_img0.save(nt)
  5890. ir_img0.save(irt)
  5891. rgb_img0.save(nj,quality=95)
  5892. ir_img0.save(irj,quality=95)
  5893. r,_,_ = rgb_img0.split()
  5894. r = np.asarray(r, dtype=float)
  5895. ir,_,_ = ir_img0.split()
  5896. ir = np.asarray(ir, dtype=float)
  5897. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5898. np.seterr(divide='ignore', invalid='ignore')
  5899. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5900. # Display the results
  5901. fig, ax = plt.subplots()
  5902. plt.plot(ndvi)
  5903. plt.axis('off')
  5904. plt.figure(figsize=(19, 10))
  5905. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5906. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5907. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5908. plt.margins(0, 0)
  5909. #plt.show()
  5910. plt.savefig(ndvis)
  5911. plt.savefig(ndvia)
  5912. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5913. plt.close('all')
  5914. f = open('/var/www/html/cust/c9_8.txt','a')
  5915. f.write(date)
  5916. f.close()
  5917. dress = '/var/www/html/cust/9/c/'
  5918. for root, dirs, files in os.walk(dress):
  5919. print('files: {}'.format(len(files)))
  5920. if len(files)>=1:
  5921. files.sort()
  5922. for f in files:
  5923. with open(os.path.join(root, f), "rb") as imageFile:
  5924. str = base64.b64encode(imageFile.read())
  5925. url = 'http://60.250.156.234/cust/t9.php'
  5926. values = {'data1':str, 'name':f}
  5927. data1 = urllib.parse.urlencode(values)
  5928. data1 = data1.encode('utf-8')
  5929. req = urllib.request.Request(url, data1)
  5930. req.add_header('User-Agent','Magic Browser')
  5931. resp = urllib.request.urlopen(req)
  5932. respdata1 = resp.read()
  5933. print(os.path.join(root, f))
  5934. #print(respdata1)
  5935. os.remove(os.path.join(root, f))
  5936. print("ok")
  5937. except:
  5938. print('error')
  5939. def img9_9():
  5940. try:
  5941. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  5942. charset='utf8')
  5943. a = db.cursor()
  5944. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002009' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  5945. result = a.fetchall()
  5946. if result ==():
  5947. s =""
  5948. else:
  5949. s = "_" + result[0][3]
  5950. db.close()
  5951. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  5952. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  5953. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/9/ndvia/c.png') #ndvi is c.png
  5954. irt = datetime.datetime.now().strftime('/var/www/html/cust/9/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  5955. nt = datetime.datetime.now().strftime('/var/www/html/cust/9/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  5956. irj = datetime.datetime.now().strftime('/var/www/html/cust/9/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  5957. nj = datetime.datetime.now().strftime('/var/www/html/cust/9/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  5958. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  5959. date += s
  5960. label= datetime.datetime.now().strftime('No.9 Direction 0 @%Y.%m.%d.%H.%M.%S')
  5961. rgb_img0 = Image.open('/var/www/html/cust/9/c/b.tif')
  5962. ir_img0 = Image.open('/var/www/html/cust/9/c/a.tif')
  5963. rgb_img0.save(nt)
  5964. ir_img0.save(irt)
  5965. rgb_img0.save(nj,quality=95)
  5966. ir_img0.save(irj,quality=95)
  5967. r,_,_ = rgb_img0.split()
  5968. r = np.asarray(r, dtype=float)
  5969. ir,_,_ = ir_img0.split()
  5970. ir = np.asarray(ir, dtype=float)
  5971. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  5972. np.seterr(divide='ignore', invalid='ignore')
  5973. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  5974. # Display the results
  5975. fig, ax = plt.subplots()
  5976. plt.plot(ndvi)
  5977. plt.axis('off')
  5978. plt.figure(figsize=(19, 10))
  5979. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  5980. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  5981. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  5982. plt.margins(0, 0)
  5983. #plt.show()
  5984. plt.savefig(ndvis)
  5985. plt.savefig(ndvia)
  5986. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  5987. plt.close('all')
  5988. f = open('/var/www/html/cust/c9.txt','a')
  5989. f.write(date)
  5990. f.close()
  5991. dress = '/var/www/html/cust/9/c/'
  5992. for root, dirs, files in os.walk(dress):
  5993. print('files: {}'.format(len(files)))
  5994. if len(files)>=1:
  5995. files.sort()
  5996. for f in files:
  5997. with open(os.path.join(root, f), "rb") as imageFile:
  5998. str = base64.b64encode(imageFile.read())
  5999. url = 'http://60.250.156.234/cust/t9.php'
  6000. values = {'data1':str, 'name':f}
  6001. data1 = urllib.parse.urlencode(values)
  6002. data1 = data1.encode('utf-8')
  6003. req = urllib.request.Request(url, data1)
  6004. req.add_header('User-Agent','Magic Browser')
  6005. resp = urllib.request.urlopen(req)
  6006. respdata1 = resp.read()
  6007. print(os.path.join(root, f))
  6008. #print(respdata1)
  6009. os.remove(os.path.join(root, f))
  6010. print("ok")
  6011. except:
  6012. print('error')
  6013. def img10_1():
  6014. try:
  6015. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6016. charset='utf8')
  6017. a = db.cursor()
  6018. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  6019. result = a.fetchall()
  6020. if result ==():
  6021. s =""
  6022. else:
  6023. s = "_" + result[0][3]
  6024. db.close()
  6025. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6026. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6027. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6028. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6029. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6030. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6031. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6032. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6033. date += s
  6034. label= datetime.datetime.now().strftime('No.10 Direction 1 @%Y.%m.%d.%H.%M.%S')
  6035. rgb_img0 = Image.open('/var/www/html/cust/10/c/b1.tif')
  6036. ir_img0 = Image.open('/var/www/html/cust/10/c/a1.tif')
  6037. rgb_img0.save(nt)
  6038. ir_img0.save(irt)
  6039. rgb_img0.save(nj,quality=95)
  6040. ir_img0.save(irj,quality=95)
  6041. r,_,_ = rgb_img0.split()
  6042. r = np.asarray(r, dtype=float)
  6043. ir,_,_ = ir_img0.split()
  6044. ir = np.asarray(ir, dtype=float)
  6045. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6046. np.seterr(divide='ignore', invalid='ignore')
  6047. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6048. # Display the results
  6049. fig, ax = plt.subplots()
  6050. plt.plot(ndvi)
  6051. plt.axis('off')
  6052. plt.figure(figsize=(19, 10))
  6053. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6054. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6055. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6056. plt.margins(0, 0)
  6057. #plt.show()
  6058. plt.savefig(ndvis)
  6059. plt.savefig(ndvia)
  6060. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6061. plt.close('all')
  6062. f = open('/var/www/html/cust/c10_1.txt','a')
  6063. f.write(date)
  6064. f.close()
  6065. dress = '/var/www/html/cust/10/c/'
  6066. for root, dirs, files in os.walk(dress):
  6067. print('files: {}'.format(len(files)))
  6068. if len(files)>=1:
  6069. files.sort()
  6070. for f in files:
  6071. with open(os.path.join(root, f), "rb") as imageFile:
  6072. str = base64.b64encode(imageFile.read())
  6073. url = 'http://60.250.156.234/cust/t10.php'
  6074. values = {'data1':str, 'name':f}
  6075. data1 = urllib.parse.urlencode(values)
  6076. data1 = data1.encode('utf-8')
  6077. req = urllib.request.Request(url, data1)
  6078. req.add_header('User-Agent','Magic Browser')
  6079. resp = urllib.request.urlopen(req)
  6080. respdata1 = resp.read()
  6081. print(os.path.join(root, f))
  6082. #print(respdata1)
  6083. os.remove(os.path.join(root, f))
  6084. print("ok")
  6085. except:
  6086. print('error')
  6087. def img10_2():
  6088. try:
  6089. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6090. charset='utf8')
  6091. a = db.cursor()
  6092. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  6093. result = a.fetchall()
  6094. if result ==():
  6095. s =""
  6096. else:
  6097. s = "_" + result[0][3]
  6098. db.close()
  6099. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6100. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6101. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6102. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6103. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6104. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6105. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6106. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6107. date += s
  6108. label= datetime.datetime.now().strftime('No.10 Direction 2 @%Y.%m.%d.%H.%M.%S')
  6109. rgb_img0 = Image.open('/var/www/html/cust/10/c/b2.tif')
  6110. ir_img0 = Image.open('/var/www/html/cust/10/c/a2.tif')
  6111. rgb_img0.save(nt)
  6112. ir_img0.save(irt)
  6113. rgb_img0.save(nj,quality=95)
  6114. ir_img0.save(irj,quality=95)
  6115. r,_,_ = rgb_img0.split()
  6116. r = np.asarray(r, dtype=float)
  6117. ir,_,_ = ir_img0.split()
  6118. ir = np.asarray(ir, dtype=float)
  6119. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6120. np.seterr(divide='ignore', invalid='ignore')
  6121. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6122. # Display the results
  6123. fig, ax = plt.subplots()
  6124. plt.plot(ndvi)
  6125. plt.axis('off')
  6126. plt.figure(figsize=(19, 10))
  6127. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6128. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6129. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6130. plt.margins(0, 0)
  6131. #plt.show()
  6132. plt.savefig(ndvis)
  6133. plt.savefig(ndvia)
  6134. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6135. plt.close('all')
  6136. f = open('/var/www/html/cust/c10_2.txt','a')
  6137. f.write(date)
  6138. f.close()
  6139. dress = '/var/www/html/cust/10/c/'
  6140. for root, dirs, files in os.walk(dress):
  6141. print('files: {}'.format(len(files)))
  6142. if len(files)>=1:
  6143. files.sort()
  6144. for f in files:
  6145. with open(os.path.join(root, f), "rb") as imageFile:
  6146. str = base64.b64encode(imageFile.read())
  6147. url = 'http://60.250.156.234/cust/t10.php'
  6148. values = {'data1':str, 'name':f}
  6149. data1 = urllib.parse.urlencode(values)
  6150. data1 = data1.encode('utf-8')
  6151. req = urllib.request.Request(url, data1)
  6152. req.add_header('User-Agent','Magic Browser')
  6153. resp = urllib.request.urlopen(req)
  6154. respdata1 = resp.read()
  6155. print(os.path.join(root, f))
  6156. #print(respdata1)
  6157. os.remove(os.path.join(root, f))
  6158. print("ok")
  6159. except:
  6160. print('error')
  6161. def img10_3():
  6162. try:
  6163. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6164. charset='utf8')
  6165. a = db.cursor()
  6166. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  6167. result = a.fetchall()
  6168. if result ==():
  6169. s =""
  6170. else:
  6171. s = "_" + result[0][3]
  6172. db.close()
  6173. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6174. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6175. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6176. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6177. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6178. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6179. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6180. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6181. date += s
  6182. label= datetime.datetime.now().strftime('No.10 Direction 3 @%Y.%m.%d.%H.%M.%S')
  6183. rgb_img0 = Image.open('/var/www/html/cust/10/c/b3.tif')
  6184. ir_img0 = Image.open('/var/www/html/cust/10/c/a3.tif')
  6185. rgb_img0.save(nt)
  6186. ir_img0.save(irt)
  6187. rgb_img0.save(nj,quality=95)
  6188. ir_img0.save(irj,quality=95)
  6189. r,_,_ = rgb_img0.split()
  6190. r = np.asarray(r, dtype=float)
  6191. ir,_,_ = ir_img0.split()
  6192. ir = np.asarray(ir, dtype=float)
  6193. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6194. np.seterr(divide='ignore', invalid='ignore')
  6195. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6196. # Display the results
  6197. fig, ax = plt.subplots()
  6198. plt.plot(ndvi)
  6199. plt.axis('off')
  6200. plt.figure(figsize=(19, 10))
  6201. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6202. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6203. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6204. plt.margins(0, 0)
  6205. #plt.show()
  6206. plt.savefig(ndvis)
  6207. plt.savefig(ndvia)
  6208. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6209. plt.close('all')
  6210. f = open('/var/www/html/cust/c10_3.txt','a')
  6211. f.write(date)
  6212. f.close()
  6213. dress = '/var/www/html/cust/10/c/'
  6214. for root, dirs, files in os.walk(dress):
  6215. print('files: {}'.format(len(files)))
  6216. if len(files)>=1:
  6217. files.sort()
  6218. for f in files:
  6219. with open(os.path.join(root, f), "rb") as imageFile:
  6220. str = base64.b64encode(imageFile.read())
  6221. url = 'http://60.250.156.234/cust/t10.php'
  6222. values = {'data1':str, 'name':f}
  6223. data1 = urllib.parse.urlencode(values)
  6224. data1 = data1.encode('utf-8')
  6225. req = urllib.request.Request(url, data1)
  6226. req.add_header('User-Agent','Magic Browser')
  6227. resp = urllib.request.urlopen(req)
  6228. respdata1 = resp.read()
  6229. print(os.path.join(root, f))
  6230. #print(respdata1)
  6231. os.remove(os.path.join(root, f))
  6232. print("ok")
  6233. except:
  6234. print('error')
  6235. def img10_4():
  6236. try:
  6237. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6238. charset='utf8')
  6239. a = db.cursor()
  6240. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = '4' ORDER BY datetime DESC LIMIT 0 , 1")
  6241. result = a.fetchall()
  6242. if result ==():
  6243. s =""
  6244. else:
  6245. s = "_" + result[0][3]
  6246. db.close()
  6247. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6248. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6249. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6250. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6251. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6252. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6253. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6254. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6255. date += s
  6256. label= datetime.datetime.now().strftime('No.10 Direction 4 @%Y.%m.%d.%H.%M.%S')
  6257. rgb_img0 = Image.open('/var/www/html/cust/10/c/b4.tif')
  6258. ir_img0 = Image.open('/var/www/html/cust/10/c/a4.tif')
  6259. rgb_img0.save(nt)
  6260. ir_img0.save(irt)
  6261. rgb_img0.save(nj,quality=95)
  6262. ir_img0.save(irj,quality=95)
  6263. r,_,_ = rgb_img0.split()
  6264. r = np.asarray(r, dtype=float)
  6265. ir,_,_ = ir_img0.split()
  6266. ir = np.asarray(ir, dtype=float)
  6267. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6268. np.seterr(divide='ignore', invalid='ignore')
  6269. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6270. # Display the results
  6271. fig, ax = plt.subplots()
  6272. plt.plot(ndvi)
  6273. plt.axis('off')
  6274. plt.figure(figsize=(19, 10))
  6275. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6276. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6277. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6278. plt.margins(0, 0)
  6279. #plt.show()
  6280. plt.savefig(ndvis)
  6281. plt.savefig(ndvia)
  6282. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6283. plt.close('all')
  6284. f = open('/var/www/html/cust/c10_4.txt','a')
  6285. f.write(date)
  6286. f.close()
  6287. dress = '/var/www/html/cust/10/c/'
  6288. for root, dirs, files in os.walk(dress):
  6289. print('files: {}'.format(len(files)))
  6290. if len(files)>=1:
  6291. files.sort()
  6292. for f in files:
  6293. with open(os.path.join(root, f), "rb") as imageFile:
  6294. str = base64.b64encode(imageFile.read())
  6295. url = 'http://60.250.156.234/cust/t10.php'
  6296. values = {'data1':str, 'name':f}
  6297. data1 = urllib.parse.urlencode(values)
  6298. data1 = data1.encode('utf-8')
  6299. req = urllib.request.Request(url, data1)
  6300. req.add_header('User-Agent','Magic Browser')
  6301. resp = urllib.request.urlopen(req)
  6302. respdata1 = resp.read()
  6303. print(os.path.join(root, f))
  6304. #print(respdata1)
  6305. os.remove(os.path.join(root, f))
  6306. print("ok")
  6307. except:
  6308. print('error')
  6309. def img10_5():
  6310. try:
  6311. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6312. charset='utf8')
  6313. a = db.cursor()
  6314. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  6315. result = a.fetchall()
  6316. if result ==():
  6317. s =""
  6318. else:
  6319. s = "_" + result[0][3]
  6320. db.close()
  6321. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6322. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6323. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6324. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6325. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6326. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6327. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6328. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6329. date += s
  6330. label= datetime.datetime.now().strftime('No.10 Direction 5 @%Y.%m.%d.%H.%M.%S')
  6331. rgb_img0 = Image.open('/var/www/html/cust/10/c/b5.tif')
  6332. ir_img0 = Image.open('/var/www/html/cust/10/c/a5.tif')
  6333. rgb_img0.save(nt)
  6334. ir_img0.save(irt)
  6335. rgb_img0.save(nj,quality=95)
  6336. ir_img0.save(irj,quality=95)
  6337. r,_,_ = rgb_img0.split()
  6338. r = np.asarray(r, dtype=float)
  6339. ir,_,_ = ir_img0.split()
  6340. ir = np.asarray(ir, dtype=float)
  6341. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6342. np.seterr(divide='ignore', invalid='ignore')
  6343. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6344. # Display the results
  6345. fig, ax = plt.subplots()
  6346. plt.plot(ndvi)
  6347. plt.axis('off')
  6348. plt.figure(figsize=(19, 10))
  6349. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6350. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6351. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6352. plt.margins(0, 0)
  6353. #plt.show()
  6354. plt.savefig(ndvis)
  6355. plt.savefig(ndvia)
  6356. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6357. plt.close('all')
  6358. f = open('/var/www/html/cust/c10_5.txt','a')
  6359. f.write(date)
  6360. f.close()
  6361. dress = '/var/www/html/cust/10/c/'
  6362. for root, dirs, files in os.walk(dress):
  6363. print('files: {}'.format(len(files)))
  6364. if len(files)>=1:
  6365. files.sort()
  6366. for f in files:
  6367. with open(os.path.join(root, f), "rb") as imageFile:
  6368. str = base64.b64encode(imageFile.read())
  6369. url = 'http://60.250.156.234/cust/t10.php'
  6370. values = {'data1':str, 'name':f}
  6371. data1 = urllib.parse.urlencode(values)
  6372. data1 = data1.encode('utf-8')
  6373. req = urllib.request.Request(url, data1)
  6374. req.add_header('User-Agent','Magic Browser')
  6375. resp = urllib.request.urlopen(req)
  6376. respdata1 = resp.read()
  6377. print(os.path.join(root, f))
  6378. #print(respdata1)
  6379. os.remove(os.path.join(root, f))
  6380. print("ok")
  6381. except:
  6382. print('error')
  6383. def img10_6():
  6384. try:
  6385. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6386. charset='utf8')
  6387. a = db.cursor()
  6388. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  6389. result = a.fetchall()
  6390. if result ==():
  6391. s =""
  6392. else:
  6393. s = "_" + result[0][3]
  6394. db.close()
  6395. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6396. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6397. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6398. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6399. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6400. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6401. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6402. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6403. date += s
  6404. label= datetime.datetime.now().strftime('No.10 Direction 6 @%Y.%m.%d.%H.%M.%S')
  6405. rgb_img0 = Image.open('/var/www/html/cust/10/c/b6.tif')
  6406. ir_img0 = Image.open('/var/www/html/cust/10/c/a6.tif')
  6407. rgb_img0.save(nt)
  6408. ir_img0.save(irt)
  6409. rgb_img0.save(nj,quality=95)
  6410. ir_img0.save(irj,quality=95)
  6411. r,_,_ = rgb_img0.split()
  6412. r = np.asarray(r, dtype=float)
  6413. ir,_,_ = ir_img0.split()
  6414. ir = np.asarray(ir, dtype=float)
  6415. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6416. np.seterr(divide='ignore', invalid='ignore')
  6417. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6418. # Display the results
  6419. fig, ax = plt.subplots()
  6420. plt.plot(ndvi)
  6421. plt.axis('off')
  6422. plt.figure(figsize=(19, 10))
  6423. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6424. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6425. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6426. plt.margins(0, 0)
  6427. #plt.show()
  6428. plt.savefig(ndvis)
  6429. plt.savefig(ndvia)
  6430. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6431. plt.close('all')
  6432. f = open('/var/www/html/cust/c10_6.txt','a')
  6433. f.write(date)
  6434. f.close()
  6435. dress = '/var/www/html/cust/10/c/'
  6436. for root, dirs, files in os.walk(dress):
  6437. print('files: {}'.format(len(files)))
  6438. if len(files)>=1:
  6439. files.sort()
  6440. for f in files:
  6441. with open(os.path.join(root, f), "rb") as imageFile:
  6442. str = base64.b64encode(imageFile.read())
  6443. url = 'http://60.250.156.234/cust/t10.php'
  6444. values = {'data1':str, 'name':f}
  6445. data1 = urllib.parse.urlencode(values)
  6446. data1 = data1.encode('utf-8')
  6447. req = urllib.request.Request(url, data1)
  6448. req.add_header('User-Agent','Magic Browser')
  6449. resp = urllib.request.urlopen(req)
  6450. respdata1 = resp.read()
  6451. print(os.path.join(root, f))
  6452. #print(respdata1)
  6453. os.remove(os.path.join(root, f))
  6454. print("ok")
  6455. except:
  6456. print('error')
  6457. def img10_7():
  6458. try:
  6459. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6460. charset='utf8')
  6461. a = db.cursor()
  6462. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  6463. result = a.fetchall()
  6464. if result ==():
  6465. s =""
  6466. else:
  6467. s = "_" + result[0][3]
  6468. db.close()
  6469. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6470. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6471. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6472. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6473. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6474. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6475. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6476. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6477. date += s
  6478. label= datetime.datetime.now().strftime('No.10 Direction 7 @%Y.%m.%d.%H.%M.%S')
  6479. rgb_img0 = Image.open('/var/www/html/cust/10/c/b7.tif')
  6480. ir_img0 = Image.open('/var/www/html/cust/10/c/a7.tif')
  6481. rgb_img0.save(nt)
  6482. ir_img0.save(irt)
  6483. rgb_img0.save(nj,quality=95)
  6484. ir_img0.save(irj,quality=95)
  6485. r,_,_ = rgb_img0.split()
  6486. r = np.asarray(r, dtype=float)
  6487. ir,_,_ = ir_img0.split()
  6488. ir = np.asarray(ir, dtype=float)
  6489. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6490. np.seterr(divide='ignore', invalid='ignore')
  6491. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6492. # Display the results
  6493. fig, ax = plt.subplots()
  6494. plt.plot(ndvi)
  6495. plt.axis('off')
  6496. plt.figure(figsize=(19, 10))
  6497. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6498. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6499. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6500. plt.margins(0, 0)
  6501. #plt.show()
  6502. plt.savefig(ndvis)
  6503. plt.savefig(ndvia)
  6504. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6505. plt.close('all')
  6506. f = open('/var/www/html/cust/c10_7.txt','a')
  6507. f.write(date)
  6508. f.close()
  6509. dress = '/var/www/html/cust/10/c/'
  6510. for root, dirs, files in os.walk(dress):
  6511. print('files: {}'.format(len(files)))
  6512. if len(files)>=1:
  6513. files.sort()
  6514. for f in files:
  6515. with open(os.path.join(root, f), "rb") as imageFile:
  6516. str = base64.b64encode(imageFile.read())
  6517. url = 'http://60.250.156.234/cust/t10.php'
  6518. values = {'data1':str, 'name':f}
  6519. data1 = urllib.parse.urlencode(values)
  6520. data1 = data1.encode('utf-8')
  6521. req = urllib.request.Request(url, data1)
  6522. req.add_header('User-Agent','Magic Browser')
  6523. resp = urllib.request.urlopen(req)
  6524. respdata1 = resp.read()
  6525. print(os.path.join(root, f))
  6526. #print(respdata1)
  6527. os.remove(os.path.join(root, f))
  6528. print("ok")
  6529. except:
  6530. print('error')
  6531. def img10_8():
  6532. try:
  6533. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6534. charset='utf8')
  6535. a = db.cursor()
  6536. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  6537. result = a.fetchall()
  6538. if result ==():
  6539. s =""
  6540. else:
  6541. s = "_" + result[0][3]
  6542. db.close()
  6543. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6544. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6545. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6546. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6547. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6548. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6549. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6550. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6551. date += s
  6552. label= datetime.datetime.now().strftime('No.10 Direction 8 @%Y.%m.%d.%H.%M.%S')
  6553. rgb_img0 = Image.open('/var/www/html/cust/10/c/b8.tif')
  6554. ir_img0 = Image.open('/var/www/html/cust/10/c/a8.tif')
  6555. rgb_img0.save(nt)
  6556. ir_img0.save(irt)
  6557. rgb_img0.save(nj,quality=95)
  6558. ir_img0.save(irj,quality=95)
  6559. r,_,_ = rgb_img0.split()
  6560. r = np.asarray(r, dtype=float)
  6561. ir,_,_ = ir_img0.split()
  6562. ir = np.asarray(ir, dtype=float)
  6563. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6564. np.seterr(divide='ignore', invalid='ignore')
  6565. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6566. # Display the results
  6567. fig, ax = plt.subplots()
  6568. plt.plot(ndvi)
  6569. plt.axis('off')
  6570. plt.figure(figsize=(19, 10))
  6571. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6572. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6573. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6574. plt.margins(0, 0)
  6575. #plt.show()
  6576. plt.savefig(ndvis)
  6577. plt.savefig(ndvia)
  6578. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6579. plt.close('all')
  6580. f = open('/var/www/html/cust/c10_8.txt','a')
  6581. f.write(date)
  6582. f.close()
  6583. dress = '/var/www/html/cust/10/c/'
  6584. for root, dirs, files in os.walk(dress):
  6585. print('files: {}'.format(len(files)))
  6586. if len(files)>=1:
  6587. files.sort()
  6588. for f in files:
  6589. with open(os.path.join(root, f), "rb") as imageFile:
  6590. str = base64.b64encode(imageFile.read())
  6591. url = 'http://60.250.156.234/cust/t10.php'
  6592. values = {'data1':str, 'name':f}
  6593. data1 = urllib.parse.urlencode(values)
  6594. data1 = data1.encode('utf-8')
  6595. req = urllib.request.Request(url, data1)
  6596. req.add_header('User-Agent','Magic Browser')
  6597. resp = urllib.request.urlopen(req)
  6598. respdata1 = resp.read()
  6599. print(os.path.join(root, f))
  6600. #print(respdata1)
  6601. os.remove(os.path.join(root, f))
  6602. print("ok")
  6603. except:
  6604. print('error')
  6605. def img10_9():
  6606. try:
  6607. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6608. charset='utf8')
  6609. a = db.cursor()
  6610. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002010' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  6611. result = a.fetchall()
  6612. if result ==():
  6613. s =""
  6614. else:
  6615. s = "_" + result[0][3]
  6616. db.close()
  6617. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6618. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6619. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/10/ndvia/c.png') #ndvi is c.png
  6620. irt = datetime.datetime.now().strftime('/var/www/html/cust/10/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6621. nt = datetime.datetime.now().strftime('/var/www/html/cust/10/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6622. irj = datetime.datetime.now().strftime('/var/www/html/cust/10/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6623. nj = datetime.datetime.now().strftime('/var/www/html/cust/10/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6624. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6625. date += s
  6626. label= datetime.datetime.now().strftime('No.10 Direction 0 @%Y.%m.%d.%H.%M.%S')
  6627. rgb_img0 = Image.open('/var/www/html/cust/10/c/b.tif')
  6628. ir_img0 = Image.open('/var/www/html/cust/10/c/a.tif')
  6629. rgb_img0.save(nt)
  6630. ir_img0.save(irt)
  6631. rgb_img0.save(nj,quality=95)
  6632. ir_img0.save(irj,quality=95)
  6633. r,_,_ = rgb_img0.split()
  6634. r = np.asarray(r, dtype=float)
  6635. ir,_,_ = ir_img0.split()
  6636. ir = np.asarray(ir, dtype=float)
  6637. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6638. np.seterr(divide='ignore', invalid='ignore')
  6639. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6640. # Display the results
  6641. fig, ax = plt.subplots()
  6642. plt.plot(ndvi)
  6643. plt.axis('off')
  6644. plt.figure(figsize=(19, 10))
  6645. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6646. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6647. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6648. plt.margins(0, 0)
  6649. #plt.show()
  6650. plt.savefig(ndvis)
  6651. plt.savefig(ndvia)
  6652. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6653. plt.close('all')
  6654. f = open('/var/www/html/cust/c10.txt','a')
  6655. f.write(date)
  6656. f.close()
  6657. dress = '/var/www/html/cust/10/c/'
  6658. for root, dirs, files in os.walk(dress):
  6659. print('files: {}'.format(len(files)))
  6660. if len(files)>=1:
  6661. files.sort()
  6662. for f in files:
  6663. with open(os.path.join(root, f), "rb") as imageFile:
  6664. str = base64.b64encode(imageFile.read())
  6665. url = 'http://60.250.156.234/cust/t10.php'
  6666. values = {'data1':str, 'name':f}
  6667. data1 = urllib.parse.urlencode(values)
  6668. data1 = data1.encode('utf-8')
  6669. req = urllib.request.Request(url, data1)
  6670. req.add_header('User-Agent','Magic Browser')
  6671. resp = urllib.request.urlopen(req)
  6672. respdata1 = resp.read()
  6673. print(os.path.join(root, f))
  6674. #print(respdata1)
  6675. os.remove(os.path.join(root, f))
  6676. print("ok")
  6677. except:
  6678. print('error')
  6679. def img11_1():
  6680. try:
  6681. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6682. charset='utf8')
  6683. a = db.cursor()
  6684. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  6685. result = a.fetchall()
  6686. if result ==():
  6687. s =""
  6688. else:
  6689. s = "_" + result[0][3]
  6690. db.close()
  6691. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6692. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6693. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  6694. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6695. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6696. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6697. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6698. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6699. date += s
  6700. label= datetime.datetime.now().strftime('No.11 Direction 1 @%Y.%m.%d.%H.%M.%S')
  6701. rgb_img0 = Image.open('/var/www/html/cust/11/c/b1.tif')
  6702. ir_img0 = Image.open('/var/www/html/cust/11/c/a1.tif')
  6703. rgb_img0.save(nt)
  6704. ir_img0.save(irt)
  6705. rgb_img0.save(nj,quality=95)
  6706. ir_img0.save(irj,quality=95)
  6707. r,_,_ = rgb_img0.split()
  6708. r = np.asarray(r, dtype=float)
  6709. ir,_,_ = ir_img0.split()
  6710. ir = np.asarray(ir, dtype=float)
  6711. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6712. np.seterr(divide='ignore', invalid='ignore')
  6713. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6714. # Display the results
  6715. fig, ax = plt.subplots()
  6716. plt.plot(ndvi)
  6717. plt.axis('off')
  6718. plt.figure(figsize=(19, 10))
  6719. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6720. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6721. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6722. plt.margins(0, 0)
  6723. #plt.show()
  6724. plt.savefig(ndvis)
  6725. plt.savefig(ndvia)
  6726. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6727. plt.close('all')
  6728. f = open('/var/www/html/cust/c11_1.txt','a')
  6729. f.write(date)
  6730. f.close()
  6731. dress = '/var/www/html/cust/11/c/'
  6732. for root, dirs, files in os.walk(dress):
  6733. print('files: {}'.format(len(files)))
  6734. if len(files)>=1:
  6735. files.sort()
  6736. for f in files:
  6737. with open(os.path.join(root, f), "rb") as imageFile:
  6738. str = base64.b64encode(imageFile.read())
  6739. url = 'http://60.250.156.234/cust/t11.php'
  6740. values = {'data1':str, 'name':f}
  6741. data1 = urllib.parse.urlencode(values)
  6742. data1 = data1.encode('utf-8')
  6743. req = urllib.request.Request(url, data1)
  6744. req.add_header('User-Agent','Magic Browser')
  6745. resp = urllib.request.urlopen(req)
  6746. respdata1 = resp.read()
  6747. print(os.path.join(root, f))
  6748. #print(respdata1)
  6749. os.remove(os.path.join(root, f))
  6750. print("ok")
  6751. except:
  6752. print('error')
  6753. def img11_2():
  6754. try:
  6755. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6756. charset='utf8')
  6757. a = db.cursor()
  6758. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  6759. result = a.fetchall()
  6760. if result ==():
  6761. s =""
  6762. else:
  6763. s = "_" + result[0][3]
  6764. db.close()
  6765. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6766. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6767. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  6768. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6769. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6770. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6771. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6772. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6773. date += s
  6774. label= datetime.datetime.now().strftime('No.11 Direction 2 @%Y.%m.%d.%H.%M.%S')
  6775. rgb_img0 = Image.open('/var/www/html/cust/11/c/b2.tif')
  6776. ir_img0 = Image.open('/var/www/html/cust/11/c/a2.tif')
  6777. rgb_img0.save(nt)
  6778. ir_img0.save(irt)
  6779. rgb_img0.save(nj,quality=95)
  6780. ir_img0.save(irj,quality=95)
  6781. r,_,_ = rgb_img0.split()
  6782. r = np.asarray(r, dtype=float)
  6783. ir,_,_ = ir_img0.split()
  6784. ir = np.asarray(ir, dtype=float)
  6785. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6786. np.seterr(divide='ignore', invalid='ignore')
  6787. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6788. # Display the results
  6789. fig, ax = plt.subplots()
  6790. plt.plot(ndvi)
  6791. plt.axis('off')
  6792. plt.figure(figsize=(19, 10))
  6793. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6794. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6795. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6796. plt.margins(0, 0)
  6797. #plt.show()
  6798. plt.savefig(ndvis)
  6799. plt.savefig(ndvia)
  6800. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6801. plt.close('all')
  6802. f = open('/var/www/html/cust/c11_2.txt','a')
  6803. f.write(date)
  6804. f.close()
  6805. dress = '/var/www/html/cust/11/c/'
  6806. for root, dirs, files in os.walk(dress):
  6807. print('files: {}'.format(len(files)))
  6808. if len(files)>=1:
  6809. files.sort()
  6810. for f in files:
  6811. with open(os.path.join(root, f), "rb") as imageFile:
  6812. str = base64.b64encode(imageFile.read())
  6813. url = 'http://60.250.156.234/cust/t11.php'
  6814. values = {'data1':str, 'name':f}
  6815. data1 = urllib.parse.urlencode(values)
  6816. data1 = data1.encode('utf-8')
  6817. req = urllib.request.Request(url, data1)
  6818. req.add_header('User-Agent','Magic Browser')
  6819. resp = urllib.request.urlopen(req)
  6820. respdata1 = resp.read()
  6821. print(os.path.join(root, f))
  6822. #print(respdata1)
  6823. os.remove(os.path.join(root, f))
  6824. print("ok")
  6825. except:
  6826. print('error')
  6827. def img11_3():
  6828. try:
  6829. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6830. charset='utf8')
  6831. a = db.cursor()
  6832. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  6833. result = a.fetchall()
  6834. if result ==():
  6835. s =""
  6836. else:
  6837. s = "_" + result[0][3]
  6838. db.close()
  6839. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6840. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6841. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  6842. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6843. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6844. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6845. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6846. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6847. date += s
  6848. label= datetime.datetime.now().strftime('No.11 Direction 3 @%Y.%m.%d.%H.%M.%S')
  6849. rgb_img0 = Image.open('/var/www/html/cust/11/c/b3.tif')
  6850. ir_img0 = Image.open('/var/www/html/cust/11/c/a3.tif')
  6851. rgb_img0.save(nt)
  6852. ir_img0.save(irt)
  6853. rgb_img0.save(nj,quality=95)
  6854. ir_img0.save(irj,quality=95)
  6855. r,_,_ = rgb_img0.split()
  6856. r = np.asarray(r, dtype=float)
  6857. ir,_,_ = ir_img0.split()
  6858. ir = np.asarray(ir, dtype=float)
  6859. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6860. np.seterr(divide='ignore', invalid='ignore')
  6861. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6862. # Display the results
  6863. fig, ax = plt.subplots()
  6864. plt.plot(ndvi)
  6865. plt.axis('off')
  6866. plt.figure(figsize=(19, 10))
  6867. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6868. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6869. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6870. plt.margins(0, 0)
  6871. #plt.show()
  6872. plt.savefig(ndvis)
  6873. plt.savefig(ndvia)
  6874. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6875. plt.close('all')
  6876. f = open('/var/www/html/cust/c11_3.txt','a')
  6877. f.write(date)
  6878. f.close()
  6879. dress = '/var/www/html/cust/11/c/'
  6880. for root, dirs, files in os.walk(dress):
  6881. print('files: {}'.format(len(files)))
  6882. if len(files)>=1:
  6883. files.sort()
  6884. for f in files:
  6885. with open(os.path.join(root, f), "rb") as imageFile:
  6886. str = base64.b64encode(imageFile.read())
  6887. url = 'http://60.250.156.234/cust/t11.php'
  6888. values = {'data1':str, 'name':f}
  6889. data1 = urllib.parse.urlencode(values)
  6890. data1 = data1.encode('utf-8')
  6891. req = urllib.request.Request(url, data1)
  6892. req.add_header('User-Agent','Magic Browser')
  6893. resp = urllib.request.urlopen(req)
  6894. respdata1 = resp.read()
  6895. print(os.path.join(root, f))
  6896. #print(respdata1)
  6897. os.remove(os.path.join(root, f))
  6898. print("ok")
  6899. except:
  6900. print('error')
  6901. def img11_4():
  6902. try:
  6903. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6904. charset='utf8')
  6905. a = db.cursor()
  6906. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  6907. result = a.fetchall()
  6908. if result ==():
  6909. s =""
  6910. else:
  6911. s = "_" + result[0][3]
  6912. db.close()
  6913. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6914. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6915. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  6916. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6917. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6918. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6919. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6920. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6921. date += s
  6922. label= datetime.datetime.now().strftime('No.11 Direction 4 @%Y.%m.%d.%H.%M.%S')
  6923. rgb_img0 = Image.open('/var/www/html/cust/11/c/b4.tif')
  6924. ir_img0 = Image.open('/var/www/html/cust/11/c/a4.tif')
  6925. rgb_img0.save(nt)
  6926. ir_img0.save(irt)
  6927. rgb_img0.save(nj,quality=95)
  6928. ir_img0.save(irj,quality=95)
  6929. r,_,_ = rgb_img0.split()
  6930. r = np.asarray(r, dtype=float)
  6931. ir,_,_ = ir_img0.split()
  6932. ir = np.asarray(ir, dtype=float)
  6933. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  6934. np.seterr(divide='ignore', invalid='ignore')
  6935. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  6936. # Display the results
  6937. fig, ax = plt.subplots()
  6938. plt.plot(ndvi)
  6939. plt.axis('off')
  6940. plt.figure(figsize=(19, 10))
  6941. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  6942. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  6943. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  6944. plt.margins(0, 0)
  6945. #plt.show()
  6946. plt.savefig(ndvis)
  6947. plt.savefig(ndvia)
  6948. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  6949. plt.close('all')
  6950. f = open('/var/www/html/cust/c11_4.txt','a')
  6951. f.write(date)
  6952. f.close()
  6953. dress = '/var/www/html/cust/11/c/'
  6954. for root, dirs, files in os.walk(dress):
  6955. print('files: {}'.format(len(files)))
  6956. if len(files)>=1:
  6957. files.sort()
  6958. for f in files:
  6959. with open(os.path.join(root, f), "rb") as imageFile:
  6960. str = base64.b64encode(imageFile.read())
  6961. url = 'http://60.250.156.234/cust/t11.php'
  6962. values = {'data1':str, 'name':f}
  6963. data1 = urllib.parse.urlencode(values)
  6964. data1 = data1.encode('utf-8')
  6965. req = urllib.request.Request(url, data1)
  6966. req.add_header('User-Agent','Magic Browser')
  6967. resp = urllib.request.urlopen(req)
  6968. respdata1 = resp.read()
  6969. print(os.path.join(root, f))
  6970. #print(respdata1)
  6971. os.remove(os.path.join(root, f))
  6972. print("ok")
  6973. except:
  6974. print('error')
  6975. def img11_5():
  6976. try:
  6977. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  6978. charset='utf8')
  6979. a = db.cursor()
  6980. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  6981. result = a.fetchall()
  6982. if result ==():
  6983. s =""
  6984. else:
  6985. s = "_" + result[0][3]
  6986. db.close()
  6987. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  6988. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  6989. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  6990. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  6991. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  6992. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  6993. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  6994. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  6995. date += s
  6996. label= datetime.datetime.now().strftime('No.11 Direction 5 @%Y.%m.%d.%H.%M.%S')
  6997. rgb_img0 = Image.open('/var/www/html/cust/11/c/b5.tif')
  6998. ir_img0 = Image.open('/var/www/html/cust/11/c/a5.tif')
  6999. rgb_img0.save(nt)
  7000. ir_img0.save(irt)
  7001. rgb_img0.save(nj,quality=95)
  7002. ir_img0.save(irj,quality=95)
  7003. r,_,_ = rgb_img0.split()
  7004. r = np.asarray(r, dtype=float)
  7005. ir,_,_ = ir_img0.split()
  7006. ir = np.asarray(ir, dtype=float)
  7007. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7008. np.seterr(divide='ignore', invalid='ignore')
  7009. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7010. # Display the results
  7011. fig, ax = plt.subplots()
  7012. plt.plot(ndvi)
  7013. plt.axis('off')
  7014. plt.figure(figsize=(19, 10))
  7015. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7016. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7017. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7018. plt.margins(0, 0)
  7019. #plt.show()
  7020. plt.savefig(ndvis)
  7021. plt.savefig(ndvia)
  7022. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7023. plt.close('all')
  7024. f = open('/var/www/html/cust/c11_5.txt','a')
  7025. f.write(date)
  7026. f.close()
  7027. dress = '/var/www/html/cust/11/c/'
  7028. for root, dirs, files in os.walk(dress):
  7029. print('files: {}'.format(len(files)))
  7030. if len(files)>=1:
  7031. files.sort()
  7032. for f in files:
  7033. with open(os.path.join(root, f), "rb") as imageFile:
  7034. str = base64.b64encode(imageFile.read())
  7035. url = 'http://60.250.156.234/cust/t11.php'
  7036. values = {'data1':str, 'name':f}
  7037. data1 = urllib.parse.urlencode(values)
  7038. data1 = data1.encode('utf-8')
  7039. req = urllib.request.Request(url, data1)
  7040. req.add_header('User-Agent','Magic Browser')
  7041. resp = urllib.request.urlopen(req)
  7042. respdata1 = resp.read()
  7043. print(os.path.join(root, f))
  7044. #print(respdata1)
  7045. os.remove(os.path.join(root, f))
  7046. print("ok")
  7047. except:
  7048. print('error')
  7049. def img11_6():
  7050. try:
  7051. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7052. charset='utf8')
  7053. a = db.cursor()
  7054. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  7055. result = a.fetchall()
  7056. if result ==():
  7057. s =""
  7058. else:
  7059. s = "_" + result[0][3]
  7060. db.close()
  7061. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7062. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7063. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  7064. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7065. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7066. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7067. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7068. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7069. date += s
  7070. label= datetime.datetime.now().strftime('No.11 Direction 6 @%Y.%m.%d.%H.%M.%S')
  7071. rgb_img0 = Image.open('/var/www/html/cust/11/c/b6.tif')
  7072. ir_img0 = Image.open('/var/www/html/cust/11/c/a6.tif')
  7073. rgb_img0.save(nt)
  7074. ir_img0.save(irt)
  7075. rgb_img0.save(nj,quality=95)
  7076. ir_img0.save(irj,quality=95)
  7077. r,_,_ = rgb_img0.split()
  7078. r = np.asarray(r, dtype=float)
  7079. ir,_,_ = ir_img0.split()
  7080. ir = np.asarray(ir, dtype=float)
  7081. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7082. np.seterr(divide='ignore', invalid='ignore')
  7083. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7084. # Display the results
  7085. fig, ax = plt.subplots()
  7086. plt.plot(ndvi)
  7087. plt.axis('off')
  7088. plt.figure(figsize=(19, 10))
  7089. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7090. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7091. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7092. plt.margins(0, 0)
  7093. #plt.show()
  7094. plt.savefig(ndvis)
  7095. plt.savefig(ndvia)
  7096. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7097. plt.close('all')
  7098. f = open('/var/www/html/cust/c11_6.txt','a')
  7099. f.write(date)
  7100. f.close()
  7101. dress = '/var/www/html/cust/11/c/'
  7102. for root, dirs, files in os.walk(dress):
  7103. print('files: {}'.format(len(files)))
  7104. if len(files)>=1:
  7105. files.sort()
  7106. for f in files:
  7107. with open(os.path.join(root, f), "rb") as imageFile:
  7108. str = base64.b64encode(imageFile.read())
  7109. url = 'http://60.250.156.234/cust/t11.php'
  7110. values = {'data1':str, 'name':f}
  7111. data1 = urllib.parse.urlencode(values)
  7112. data1 = data1.encode('utf-8')
  7113. req = urllib.request.Request(url, data1)
  7114. req.add_header('User-Agent','Magic Browser')
  7115. resp = urllib.request.urlopen(req)
  7116. respdata1 = resp.read()
  7117. print(os.path.join(root, f))
  7118. #print(respdata1)
  7119. os.remove(os.path.join(root, f))
  7120. print("ok")
  7121. except:
  7122. print('error')
  7123. def img11_7():
  7124. try:
  7125. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7126. charset='utf8')
  7127. a = db.cursor()
  7128. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  7129. result = a.fetchall()
  7130. if result ==():
  7131. s =""
  7132. else:
  7133. s = "_" + result[0][3]
  7134. db.close()
  7135. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7136. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7137. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  7138. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7139. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7140. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7141. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7142. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7143. date += s
  7144. label= datetime.datetime.now().strftime('No.11 Direction 7 @%Y.%m.%d.%H.%M.%S')
  7145. rgb_img0 = Image.open('/var/www/html/cust/11/c/b7.tif')
  7146. ir_img0 = Image.open('/var/www/html/cust/11/c/a7.tif')
  7147. rgb_img0.save(nt)
  7148. ir_img0.save(irt)
  7149. rgb_img0.save(nj,quality=95)
  7150. ir_img0.save(irj,quality=95)
  7151. r,_,_ = rgb_img0.split()
  7152. r = np.asarray(r, dtype=float)
  7153. ir,_,_ = ir_img0.split()
  7154. ir = np.asarray(ir, dtype=float)
  7155. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7156. np.seterr(divide='ignore', invalid='ignore')
  7157. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7158. # Display the results
  7159. fig, ax = plt.subplots()
  7160. plt.plot(ndvi)
  7161. plt.axis('off')
  7162. plt.figure(figsize=(19, 10))
  7163. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7164. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7165. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7166. plt.margins(0, 0)
  7167. #plt.show()
  7168. plt.savefig(ndvis)
  7169. plt.savefig(ndvia)
  7170. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7171. plt.close('all')
  7172. f = open('/var/www/html/cust/c11_7.txt','a')
  7173. f.write(date)
  7174. f.close()
  7175. dress = '/var/www/html/cust/11/c/'
  7176. for root, dirs, files in os.walk(dress):
  7177. print('files: {}'.format(len(files)))
  7178. if len(files)>=1:
  7179. files.sort()
  7180. for f in files:
  7181. with open(os.path.join(root, f), "rb") as imageFile:
  7182. str = base64.b64encode(imageFile.read())
  7183. url = 'http://60.250.156.234/cust/t11.php'
  7184. values = {'data1':str, 'name':f}
  7185. data1 = urllib.parse.urlencode(values)
  7186. data1 = data1.encode('utf-8')
  7187. req = urllib.request.Request(url, data1)
  7188. req.add_header('User-Agent','Magic Browser')
  7189. resp = urllib.request.urlopen(req)
  7190. respdata1 = resp.read()
  7191. print(os.path.join(root, f))
  7192. #print(respdata1)
  7193. os.remove(os.path.join(root, f))
  7194. print("ok")
  7195. except:
  7196. print('error')
  7197. def img11_8():
  7198. try:
  7199. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7200. charset='utf8')
  7201. a = db.cursor()
  7202. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  7203. result = a.fetchall()
  7204. if result ==():
  7205. s =""
  7206. else:
  7207. s = "_" + result[0][3]
  7208. db.close()
  7209. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7210. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7211. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  7212. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7213. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7214. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7215. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7216. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7217. date += s
  7218. label= datetime.datetime.now().strftime('No.11 Direction 8 @%Y.%m.%d.%H.%M.%S')
  7219. rgb_img0 = Image.open('/var/www/html/cust/11/c/b8.tif')
  7220. ir_img0 = Image.open('/var/www/html/cust/11/c/a8.tif')
  7221. rgb_img0.save(nt)
  7222. ir_img0.save(irt)
  7223. rgb_img0.save(nj,quality=95)
  7224. ir_img0.save(irj,quality=95)
  7225. r,_,_ = rgb_img0.split()
  7226. r = np.asarray(r, dtype=float)
  7227. ir,_,_ = ir_img0.split()
  7228. ir = np.asarray(ir, dtype=float)
  7229. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7230. np.seterr(divide='ignore', invalid='ignore')
  7231. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7232. # Display the results
  7233. fig, ax = plt.subplots()
  7234. plt.plot(ndvi)
  7235. plt.axis('off')
  7236. plt.figure(figsize=(19, 10))
  7237. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7238. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7239. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7240. plt.margins(0, 0)
  7241. #plt.show()
  7242. plt.savefig(ndvis)
  7243. plt.savefig(ndvia)
  7244. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7245. plt.close('all')
  7246. f = open('/var/www/html/cust/c11_8.txt','a')
  7247. f.write(date)
  7248. f.close()
  7249. dress = '/var/www/html/cust/11/c/'
  7250. for root, dirs, files in os.walk(dress):
  7251. print('files: {}'.format(len(files)))
  7252. if len(files)>=1:
  7253. files.sort()
  7254. for f in files:
  7255. with open(os.path.join(root, f), "rb") as imageFile:
  7256. str = base64.b64encode(imageFile.read())
  7257. url = 'http://60.250.156.234/cust/t11.php'
  7258. values = {'data1':str, 'name':f}
  7259. data1 = urllib.parse.urlencode(values)
  7260. data1 = data1.encode('utf-8')
  7261. req = urllib.request.Request(url, data1)
  7262. req.add_header('User-Agent','Magic Browser')
  7263. resp = urllib.request.urlopen(req)
  7264. respdata1 = resp.read()
  7265. print(os.path.join(root, f))
  7266. #print(respdata1)
  7267. os.remove(os.path.join(root, f))
  7268. print("ok")
  7269. except:
  7270. print('error')
  7271. def img11_9():
  7272. try:
  7273. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7274. charset='utf8')
  7275. a = db.cursor()
  7276. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002011' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  7277. result = a.fetchall()
  7278. if result ==():
  7279. s =""
  7280. else:
  7281. s = "_" + result[0][3]
  7282. db.close()
  7283. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7284. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7285. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/11/ndvia/c.png') #ndvi is c.png
  7286. irt = datetime.datetime.now().strftime('/var/www/html/cust/11/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7287. nt = datetime.datetime.now().strftime('/var/www/html/cust/11/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7288. irj = datetime.datetime.now().strftime('/var/www/html/cust/11/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7289. nj = datetime.datetime.now().strftime('/var/www/html/cust/11/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7290. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7291. date += s
  7292. label= datetime.datetime.now().strftime('No.11 Direction 0 @%Y.%m.%d.%H.%M.%S')
  7293. rgb_img0 = Image.open('/var/www/html/cust/11/c/b.tif')
  7294. ir_img0 = Image.open('/var/www/html/cust/11/c/a.tif')
  7295. rgb_img0.save(nt)
  7296. ir_img0.save(irt)
  7297. rgb_img0.save(nj,quality=95)
  7298. ir_img0.save(irj,quality=95)
  7299. r,_,_ = rgb_img0.split()
  7300. r = np.asarray(r, dtype=float)
  7301. ir,_,_ = ir_img0.split()
  7302. ir = np.asarray(ir, dtype=float)
  7303. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7304. np.seterr(divide='ignore', invalid='ignore')
  7305. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7306. # Display the results
  7307. fig, ax = plt.subplots()
  7308. plt.plot(ndvi)
  7309. plt.axis('off')
  7310. plt.figure(figsize=(19, 10))
  7311. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7312. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7313. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7314. plt.margins(0, 0)
  7315. #plt.show()
  7316. plt.savefig(ndvis)
  7317. plt.savefig(ndvia)
  7318. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7319. plt.close('all')
  7320. f = open('/var/www/html/cust/c11.txt','a')
  7321. f.write(date)
  7322. f.close()
  7323. dress = '/var/www/html/cust/11/c/'
  7324. for root, dirs, files in os.walk(dress):
  7325. print('files: {}'.format(len(files)))
  7326. if len(files)>=1:
  7327. files.sort()
  7328. for f in files:
  7329. with open(os.path.join(root, f), "rb") as imageFile:
  7330. str = base64.b64encode(imageFile.read())
  7331. url = 'http://60.250.156.234/cust/t11.php'
  7332. values = {'data1':str, 'name':f}
  7333. data1 = urllib.parse.urlencode(values)
  7334. data1 = data1.encode('utf-8')
  7335. req = urllib.request.Request(url, data1)
  7336. req.add_header('User-Agent','Magic Browser')
  7337. resp = urllib.request.urlopen(req)
  7338. respdata1 = resp.read()
  7339. print(os.path.join(root, f))
  7340. #print(respdata1)
  7341. os.remove(os.path.join(root, f))
  7342. print("ok")
  7343. except:
  7344. print('error')
  7345. def img12_1():
  7346. try:
  7347. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7348. charset='utf8')
  7349. a = db.cursor()
  7350. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  7351. result = a.fetchall()
  7352. if result ==():
  7353. s =""
  7354. else:
  7355. s = "_" + result[0][3]
  7356. db.close()
  7357. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7358. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7359. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7360. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7361. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7362. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7363. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7364. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7365. date += s
  7366. label= datetime.datetime.now().strftime('No.12 Direction 1 @%Y.%m.%d.%H.%M.%S')
  7367. rgb_img0 = Image.open('/var/www/html/cust/12/c/b1.tif')
  7368. ir_img0 = Image.open('/var/www/html/cust/12/c/a1.tif')
  7369. rgb_img0.save(nt)
  7370. ir_img0.save(irt)
  7371. rgb_img0.save(nj,quality=95)
  7372. ir_img0.save(irj,quality=95)
  7373. r,_,_ = rgb_img0.split()
  7374. r = np.asarray(r, dtype=float)
  7375. ir,_,_ = ir_img0.split()
  7376. ir = np.asarray(ir, dtype=float)
  7377. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7378. np.seterr(divide='ignore', invalid='ignore')
  7379. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7380. # Display the results
  7381. fig, ax = plt.subplots()
  7382. plt.plot(ndvi)
  7383. plt.axis('off')
  7384. plt.figure(figsize=(19, 10))
  7385. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7386. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7387. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7388. plt.margins(0, 0)
  7389. #plt.show()
  7390. plt.savefig(ndvis)
  7391. plt.savefig(ndvia)
  7392. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7393. plt.close('all')
  7394. f = open('/var/www/html/cust/c12_1.txt','a')
  7395. f.write(date)
  7396. f.close()
  7397. dress = '/var/www/html/cust/12/c/'
  7398. for root, dirs, files in os.walk(dress):
  7399. print('files: {}'.format(len(files)))
  7400. if len(files)>=1:
  7401. files.sort()
  7402. for f in files:
  7403. with open(os.path.join(root, f), "rb") as imageFile:
  7404. str = base64.b64encode(imageFile.read())
  7405. url = 'http://60.250.156.234/cust/t12.php'
  7406. values = {'data1':str, 'name':f}
  7407. data1 = urllib.parse.urlencode(values)
  7408. data1 = data1.encode('utf-8')
  7409. req = urllib.request.Request(url, data1)
  7410. req.add_header('User-Agent','Magic Browser')
  7411. resp = urllib.request.urlopen(req)
  7412. respdata1 = resp.read()
  7413. print(os.path.join(root, f))
  7414. #print(respdata1)
  7415. os.remove(os.path.join(root, f))
  7416. print("ok")
  7417. except:
  7418. print('error')
  7419. def img12_2():
  7420. try:
  7421. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7422. charset='utf8')
  7423. a = db.cursor()
  7424. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  7425. result = a.fetchall()
  7426. if result ==():
  7427. s =""
  7428. else:
  7429. s = "_" + result[0][3]
  7430. db.close()
  7431. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7432. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7433. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7434. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7435. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7436. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7437. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7438. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7439. date += s
  7440. label= datetime.datetime.now().strftime('No.12 Direction 2 @%Y.%m.%d.%H.%M.%S')
  7441. rgb_img0 = Image.open('/var/www/html/cust/12/c/b2.tif')
  7442. ir_img0 = Image.open('/var/www/html/cust/12/c/a2.tif')
  7443. rgb_img0.save(nt)
  7444. ir_img0.save(irt)
  7445. rgb_img0.save(nj,quality=95)
  7446. ir_img0.save(irj,quality=95)
  7447. r,_,_ = rgb_img0.split()
  7448. r = np.asarray(r, dtype=float)
  7449. ir,_,_ = ir_img0.split()
  7450. ir = np.asarray(ir, dtype=float)
  7451. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7452. np.seterr(divide='ignore', invalid='ignore')
  7453. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7454. # Display the results
  7455. fig, ax = plt.subplots()
  7456. plt.plot(ndvi)
  7457. plt.axis('off')
  7458. plt.figure(figsize=(19, 10))
  7459. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7460. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7461. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7462. plt.margins(0, 0)
  7463. #plt.show()
  7464. plt.savefig(ndvis)
  7465. plt.savefig(ndvia)
  7466. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7467. plt.close('all')
  7468. f = open('/var/www/html/cust/c12_2.txt','a')
  7469. f.write(date)
  7470. f.close()
  7471. dress = '/var/www/html/cust/12/c/'
  7472. for root, dirs, files in os.walk(dress):
  7473. print('files: {}'.format(len(files)))
  7474. if len(files)>=1:
  7475. files.sort()
  7476. for f in files:
  7477. with open(os.path.join(root, f), "rb") as imageFile:
  7478. str = base64.b64encode(imageFile.read())
  7479. url = 'http://60.250.156.234/cust/t12.php'
  7480. values = {'data1':str, 'name':f}
  7481. data1 = urllib.parse.urlencode(values)
  7482. data1 = data1.encode('utf-8')
  7483. req = urllib.request.Request(url, data1)
  7484. req.add_header('User-Agent','Magic Browser')
  7485. resp = urllib.request.urlopen(req)
  7486. respdata1 = resp.read()
  7487. print(os.path.join(root, f))
  7488. #print(respdata1)
  7489. os.remove(os.path.join(root, f))
  7490. print("ok")
  7491. except:
  7492. print('error')
  7493. def img12_3():
  7494. try:
  7495. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7496. charset='utf8')
  7497. a = db.cursor()
  7498. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  7499. result = a.fetchall()
  7500. if result ==():
  7501. s =""
  7502. else:
  7503. s = "_" + result[0][3]
  7504. db.close()
  7505. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7506. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7507. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7508. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7509. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7510. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7511. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7512. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7513. date += s
  7514. label= datetime.datetime.now().strftime('No.12 Direction 3 @%Y.%m.%d.%H.%M.%S')
  7515. rgb_img0 = Image.open('/var/www/html/cust/12/c/b3.tif')
  7516. ir_img0 = Image.open('/var/www/html/cust/12/c/a3.tif')
  7517. rgb_img0.save(nt)
  7518. ir_img0.save(irt)
  7519. rgb_img0.save(nj,quality=95)
  7520. ir_img0.save(irj,quality=95)
  7521. r,_,_ = rgb_img0.split()
  7522. r = np.asarray(r, dtype=float)
  7523. ir,_,_ = ir_img0.split()
  7524. ir = np.asarray(ir, dtype=float)
  7525. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7526. np.seterr(divide='ignore', invalid='ignore')
  7527. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7528. # Display the results
  7529. fig, ax = plt.subplots()
  7530. plt.plot(ndvi)
  7531. plt.axis('off')
  7532. plt.figure(figsize=(19, 10))
  7533. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7534. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7535. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7536. plt.margins(0, 0)
  7537. #plt.show()
  7538. plt.savefig(ndvis)
  7539. plt.savefig(ndvia)
  7540. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7541. plt.close('all')
  7542. f = open('/var/www/html/cust/c12_3.txt','a')
  7543. f.write(date)
  7544. f.close()
  7545. dress = '/var/www/html/cust/12/c/'
  7546. for root, dirs, files in os.walk(dress):
  7547. print('files: {}'.format(len(files)))
  7548. if len(files)>=1:
  7549. files.sort()
  7550. for f in files:
  7551. with open(os.path.join(root, f), "rb") as imageFile:
  7552. str = base64.b64encode(imageFile.read())
  7553. url = 'http://60.250.156.234/cust/t12.php'
  7554. values = {'data1':str, 'name':f}
  7555. data1 = urllib.parse.urlencode(values)
  7556. data1 = data1.encode('utf-8')
  7557. req = urllib.request.Request(url, data1)
  7558. req.add_header('User-Agent','Magic Browser')
  7559. resp = urllib.request.urlopen(req)
  7560. respdata1 = resp.read()
  7561. print(os.path.join(root, f))
  7562. #print(respdata1)
  7563. os.remove(os.path.join(root, f))
  7564. print("ok")
  7565. except:
  7566. print('error')
  7567. def img12_4():
  7568. try:
  7569. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7570. charset='utf8')
  7571. a = db.cursor()
  7572. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  7573. result = a.fetchall()
  7574. if result ==():
  7575. s =""
  7576. else:
  7577. s = "_" + result[0][3]
  7578. db.close()
  7579. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7580. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7581. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7582. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7583. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7584. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7585. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7586. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7587. date += s
  7588. label= datetime.datetime.now().strftime('No.12 Direction 4 @%Y.%m.%d.%H.%M.%S')
  7589. rgb_img0 = Image.open('/var/www/html/cust/12/c/b4.tif')
  7590. ir_img0 = Image.open('/var/www/html/cust/12/c/a4.tif')
  7591. rgb_img0.save(nt)
  7592. ir_img0.save(irt)
  7593. rgb_img0.save(nj,quality=95)
  7594. ir_img0.save(irj,quality=95)
  7595. r,_,_ = rgb_img0.split()
  7596. r = np.asarray(r, dtype=float)
  7597. ir,_,_ = ir_img0.split()
  7598. ir = np.asarray(ir, dtype=float)
  7599. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7600. np.seterr(divide='ignore', invalid='ignore')
  7601. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7602. # Display the results
  7603. fig, ax = plt.subplots()
  7604. plt.plot(ndvi)
  7605. plt.axis('off')
  7606. plt.figure(figsize=(19, 10))
  7607. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7608. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7609. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7610. plt.margins(0, 0)
  7611. #plt.show()
  7612. plt.savefig(ndvis)
  7613. plt.savefig(ndvia)
  7614. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7615. plt.close('all')
  7616. f = open('/var/www/html/cust/c12_4.txt','a')
  7617. f.write(date)
  7618. f.close()
  7619. dress = '/var/www/html/cust/12/c/'
  7620. for root, dirs, files in os.walk(dress):
  7621. print('files: {}'.format(len(files)))
  7622. if len(files)>=1:
  7623. files.sort()
  7624. for f in files:
  7625. with open(os.path.join(root, f), "rb") as imageFile:
  7626. str = base64.b64encode(imageFile.read())
  7627. url = 'http://60.250.156.234/cust/t12.php'
  7628. values = {'data1':str, 'name':f}
  7629. data1 = urllib.parse.urlencode(values)
  7630. data1 = data1.encode('utf-8')
  7631. req = urllib.request.Request(url, data1)
  7632. req.add_header('User-Agent','Magic Browser')
  7633. resp = urllib.request.urlopen(req)
  7634. respdata1 = resp.read()
  7635. print(os.path.join(root, f))
  7636. #print(respdata1)
  7637. os.remove(os.path.join(root, f))
  7638. print("ok")
  7639. except:
  7640. print('error')
  7641. def img12_5():
  7642. try:
  7643. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7644. charset='utf8')
  7645. a = db.cursor()
  7646. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  7647. result = a.fetchall()
  7648. if result ==():
  7649. s =""
  7650. else:
  7651. s = "_" + result[0][3]
  7652. db.close()
  7653. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7654. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7655. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7656. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7657. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7658. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7659. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7660. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7661. date += s
  7662. label= datetime.datetime.now().strftime('No.12 Direction 5 @%Y.%m.%d.%H.%M.%S')
  7663. rgb_img0 = Image.open('/var/www/html/cust/12/c/b5.tif')
  7664. ir_img0 = Image.open('/var/www/html/cust/12/c/a5.tif')
  7665. rgb_img0.save(nt)
  7666. ir_img0.save(irt)
  7667. rgb_img0.save(nj,quality=95)
  7668. ir_img0.save(irj,quality=95)
  7669. r,_,_ = rgb_img0.split()
  7670. r = np.asarray(r, dtype=float)
  7671. ir,_,_ = ir_img0.split()
  7672. ir = np.asarray(ir, dtype=float)
  7673. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7674. np.seterr(divide='ignore', invalid='ignore')
  7675. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7676. # Display the results
  7677. fig, ax = plt.subplots()
  7678. plt.plot(ndvi)
  7679. plt.axis('off')
  7680. plt.figure(figsize=(19, 10))
  7681. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7682. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7683. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7684. plt.margins(0, 0)
  7685. #plt.show()
  7686. plt.savefig(ndvis)
  7687. plt.savefig(ndvia)
  7688. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7689. plt.close('all')
  7690. f = open('/var/www/html/cust/c12_5.txt','a')
  7691. f.write(date)
  7692. f.close()
  7693. dress = '/var/www/html/cust/12/c/'
  7694. for root, dirs, files in os.walk(dress):
  7695. print('files: {}'.format(len(files)))
  7696. if len(files)>=1:
  7697. files.sort()
  7698. for f in files:
  7699. with open(os.path.join(root, f), "rb") as imageFile:
  7700. str = base64.b64encode(imageFile.read())
  7701. url = 'http://60.250.156.234/cust/t12.php'
  7702. values = {'data1':str, 'name':f}
  7703. data1 = urllib.parse.urlencode(values)
  7704. data1 = data1.encode('utf-8')
  7705. req = urllib.request.Request(url, data1)
  7706. req.add_header('User-Agent','Magic Browser')
  7707. resp = urllib.request.urlopen(req)
  7708. respdata1 = resp.read()
  7709. print(os.path.join(root, f))
  7710. #print(respdata1)
  7711. os.remove(os.path.join(root, f))
  7712. print("ok")
  7713. except:
  7714. print('error')
  7715. def img12_6():
  7716. try:
  7717. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7718. charset='utf8')
  7719. a = db.cursor()
  7720. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  7721. result = a.fetchall()
  7722. if result ==():
  7723. s =""
  7724. else:
  7725. s = "_" + result[0][3]
  7726. db.close()
  7727. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7728. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7729. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7730. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7731. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7732. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7733. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7734. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7735. date += s
  7736. label= datetime.datetime.now().strftime('No.12 Direction 6 @%Y.%m.%d.%H.%M.%S')
  7737. rgb_img0 = Image.open('/var/www/html/cust/12/c/b6.tif')
  7738. ir_img0 = Image.open('/var/www/html/cust/12/c/a6.tif')
  7739. rgb_img0.save(nt)
  7740. ir_img0.save(irt)
  7741. rgb_img0.save(nj,quality=95)
  7742. ir_img0.save(irj,quality=95)
  7743. r,_,_ = rgb_img0.split()
  7744. r = np.asarray(r, dtype=float)
  7745. ir,_,_ = ir_img0.split()
  7746. ir = np.asarray(ir, dtype=float)
  7747. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7748. np.seterr(divide='ignore', invalid='ignore')
  7749. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7750. # Display the results
  7751. fig, ax = plt.subplots()
  7752. plt.plot(ndvi)
  7753. plt.axis('off')
  7754. plt.figure(figsize=(19, 10))
  7755. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7756. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7757. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7758. plt.margins(0, 0)
  7759. #plt.show()
  7760. plt.savefig(ndvis)
  7761. plt.savefig(ndvia)
  7762. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7763. plt.close('all')
  7764. f = open('/var/www/html/cust/c12_6.txt','a')
  7765. f.write(date)
  7766. f.close()
  7767. dress = '/var/www/html/cust/12/c/'
  7768. for root, dirs, files in os.walk(dress):
  7769. print('files: {}'.format(len(files)))
  7770. if len(files)>=1:
  7771. files.sort()
  7772. for f in files:
  7773. with open(os.path.join(root, f), "rb") as imageFile:
  7774. str = base64.b64encode(imageFile.read())
  7775. url = 'http://60.250.156.234/cust/t12.php'
  7776. values = {'data1':str, 'name':f}
  7777. data1 = urllib.parse.urlencode(values)
  7778. data1 = data1.encode('utf-8')
  7779. req = urllib.request.Request(url, data1)
  7780. req.add_header('User-Agent','Magic Browser')
  7781. resp = urllib.request.urlopen(req)
  7782. respdata1 = resp.read()
  7783. print(os.path.join(root, f))
  7784. #print(respdata1)
  7785. os.remove(os.path.join(root, f))
  7786. print("ok")
  7787. except:
  7788. print('error')
  7789. def img12_7():
  7790. try:
  7791. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7792. charset='utf8')
  7793. a = db.cursor()
  7794. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  7795. result = a.fetchall()
  7796. if result ==():
  7797. s =""
  7798. else:
  7799. s = "_" + result[0][3]
  7800. db.close()
  7801. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7802. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7803. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7804. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7805. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7806. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7807. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7808. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7809. date += s
  7810. label= datetime.datetime.now().strftime('No.12 Direction 7 @%Y.%m.%d.%H.%M.%S')
  7811. rgb_img0 = Image.open('/var/www/html/cust/12/c/b7.tif')
  7812. ir_img0 = Image.open('/var/www/html/cust/12/c/a7.tif')
  7813. rgb_img0.save(nt)
  7814. ir_img0.save(irt)
  7815. rgb_img0.save(nj,quality=95)
  7816. ir_img0.save(irj,quality=95)
  7817. r,_,_ = rgb_img0.split()
  7818. r = np.asarray(r, dtype=float)
  7819. ir,_,_ = ir_img0.split()
  7820. ir = np.asarray(ir, dtype=float)
  7821. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7822. np.seterr(divide='ignore', invalid='ignore')
  7823. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7824. # Display the results
  7825. fig, ax = plt.subplots()
  7826. plt.plot(ndvi)
  7827. plt.axis('off')
  7828. plt.figure(figsize=(19, 10))
  7829. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7830. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7831. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7832. plt.margins(0, 0)
  7833. #plt.show()
  7834. plt.savefig(ndvis)
  7835. plt.savefig(ndvia)
  7836. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7837. plt.close('all')
  7838. f = open('/var/www/html/cust/c12_7.txt','a')
  7839. f.write(date)
  7840. f.close()
  7841. dress = '/var/www/html/cust/12/c/'
  7842. for root, dirs, files in os.walk(dress):
  7843. print('files: {}'.format(len(files)))
  7844. if len(files)>=1:
  7845. files.sort()
  7846. for f in files:
  7847. with open(os.path.join(root, f), "rb") as imageFile:
  7848. str = base64.b64encode(imageFile.read())
  7849. url = 'http://60.250.156.234/cust/t12.php'
  7850. values = {'data1':str, 'name':f}
  7851. data1 = urllib.parse.urlencode(values)
  7852. data1 = data1.encode('utf-8')
  7853. req = urllib.request.Request(url, data1)
  7854. req.add_header('User-Agent','Magic Browser')
  7855. resp = urllib.request.urlopen(req)
  7856. respdata1 = resp.read()
  7857. print(os.path.join(root, f))
  7858. #print(respdata1)
  7859. os.remove(os.path.join(root, f))
  7860. print("ok")
  7861. except:
  7862. print('error')
  7863. def img12_8():
  7864. try:
  7865. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7866. charset='utf8')
  7867. a = db.cursor()
  7868. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  7869. result = a.fetchall()
  7870. if result ==():
  7871. s =""
  7872. else:
  7873. s = "_" + result[0][3]
  7874. db.close()
  7875. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7876. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7877. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7878. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7879. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7880. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7881. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7882. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7883. date += s
  7884. label= datetime.datetime.now().strftime('No.12 Direction 8 @%Y.%m.%d.%H.%M.%S')
  7885. rgb_img0 = Image.open('/var/www/html/cust/12/c/b8.tif')
  7886. ir_img0 = Image.open('/var/www/html/cust/12/c/a8.tif')
  7887. rgb_img0.save(nt)
  7888. ir_img0.save(irt)
  7889. rgb_img0.save(nj,quality=95)
  7890. ir_img0.save(irj,quality=95)
  7891. r,_,_ = rgb_img0.split()
  7892. r = np.asarray(r, dtype=float)
  7893. ir,_,_ = ir_img0.split()
  7894. ir = np.asarray(ir, dtype=float)
  7895. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7896. np.seterr(divide='ignore', invalid='ignore')
  7897. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7898. # Display the results
  7899. fig, ax = plt.subplots()
  7900. plt.plot(ndvi)
  7901. plt.axis('off')
  7902. plt.figure(figsize=(19, 10))
  7903. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7904. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7905. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7906. plt.margins(0, 0)
  7907. #plt.show()
  7908. plt.savefig(ndvis)
  7909. plt.savefig(ndvia)
  7910. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7911. plt.close('all')
  7912. f = open('/var/www/html/cust/c12_8.txt','a')
  7913. f.write(date)
  7914. f.close()
  7915. dress = '/var/www/html/cust/12/c/'
  7916. for root, dirs, files in os.walk(dress):
  7917. print('files: {}'.format(len(files)))
  7918. if len(files)>=1:
  7919. files.sort()
  7920. for f in files:
  7921. with open(os.path.join(root, f), "rb") as imageFile:
  7922. str = base64.b64encode(imageFile.read())
  7923. url = 'http://60.250.156.234/cust/t12.php'
  7924. values = {'data1':str, 'name':f}
  7925. data1 = urllib.parse.urlencode(values)
  7926. data1 = data1.encode('utf-8')
  7927. req = urllib.request.Request(url, data1)
  7928. req.add_header('User-Agent','Magic Browser')
  7929. resp = urllib.request.urlopen(req)
  7930. respdata1 = resp.read()
  7931. print(os.path.join(root, f))
  7932. #print(respdata1)
  7933. os.remove(os.path.join(root, f))
  7934. print("ok")
  7935. except:
  7936. print('error')
  7937. def img12_9():
  7938. try:
  7939. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  7940. charset='utf8')
  7941. a = db.cursor()
  7942. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002012' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  7943. result = a.fetchall()
  7944. if result ==():
  7945. s =""
  7946. else:
  7947. s = "_" + result[0][3]
  7948. db.close()
  7949. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  7950. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  7951. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/12/ndvia/c.png') #ndvi is c.png
  7952. irt = datetime.datetime.now().strftime('/var/www/html/cust/12/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  7953. nt = datetime.datetime.now().strftime('/var/www/html/cust/12/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  7954. irj = datetime.datetime.now().strftime('/var/www/html/cust/12/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  7955. nj = datetime.datetime.now().strftime('/var/www/html/cust/12/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  7956. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  7957. date += s
  7958. label= datetime.datetime.now().strftime('No.12 Direction 0 @%Y.%m.%d.%H.%M.%S')
  7959. rgb_img0 = Image.open('/var/www/html/cust/12/c/b.tif')
  7960. ir_img0 = Image.open('/var/www/html/cust/12/c/a.tif')
  7961. rgb_img0.save(nt)
  7962. ir_img0.save(irt)
  7963. rgb_img0.save(nj,quality=95)
  7964. ir_img0.save(irj,quality=95)
  7965. r,_,_ = rgb_img0.split()
  7966. r = np.asarray(r, dtype=float)
  7967. ir,_,_ = ir_img0.split()
  7968. ir = np.asarray(ir, dtype=float)
  7969. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  7970. np.seterr(divide='ignore', invalid='ignore')
  7971. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  7972. # Display the results
  7973. fig, ax = plt.subplots()
  7974. plt.plot(ndvi)
  7975. plt.axis('off')
  7976. plt.figure(figsize=(19, 10))
  7977. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  7978. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  7979. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  7980. plt.margins(0, 0)
  7981. #plt.show()
  7982. plt.savefig(ndvis)
  7983. plt.savefig(ndvia)
  7984. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  7985. plt.close('all')
  7986. f = open('/var/www/html/cust/c12.txt','a')
  7987. f.write(date)
  7988. f.close()
  7989. dress = '/var/www/html/cust/12/c/'
  7990. for root, dirs, files in os.walk(dress):
  7991. print('files: {}'.format(len(files)))
  7992. if len(files)>=1:
  7993. files.sort()
  7994. for f in files:
  7995. with open(os.path.join(root, f), "rb") as imageFile:
  7996. str = base64.b64encode(imageFile.read())
  7997. url = 'http://60.250.156.234/cust/t12.php'
  7998. values = {'data1':str, 'name':f}
  7999. data1 = urllib.parse.urlencode(values)
  8000. data1 = data1.encode('utf-8')
  8001. req = urllib.request.Request(url, data1)
  8002. req.add_header('User-Agent','Magic Browser')
  8003. resp = urllib.request.urlopen(req)
  8004. respdata1 = resp.read()
  8005. print(os.path.join(root, f))
  8006. #print(respdata1)
  8007. os.remove(os.path.join(root, f))
  8008. print("ok")
  8009. except:
  8010. print('error')
  8011. def img13_1():
  8012. try:
  8013. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8014. charset='utf8')
  8015. a = db.cursor()
  8016. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  8017. result = a.fetchall()
  8018. if result ==():
  8019. s =""
  8020. else:
  8021. s = "_" + result[0][3]
  8022. db.close()
  8023. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8024. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8025. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8026. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8027. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8028. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8029. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8030. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8031. date += s
  8032. label= datetime.datetime.now().strftime('No.13 Direction 1 @%Y.%m.%d.%H.%M.%S')
  8033. rgb_img0 = Image.open('/var/www/html/cust/13/c/b1.tif')
  8034. ir_img0 = Image.open('/var/www/html/cust/13/c/a1.tif')
  8035. rgb_img0.save(nt)
  8036. ir_img0.save(irt)
  8037. rgb_img0.save(nj,quality=95)
  8038. ir_img0.save(irj,quality=95)
  8039. r,_,_ = rgb_img0.split()
  8040. r = np.asarray(r, dtype=float)
  8041. ir,_,_ = ir_img0.split()
  8042. ir = np.asarray(ir, dtype=float)
  8043. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8044. np.seterr(divide='ignore', invalid='ignore')
  8045. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8046. # Display the results
  8047. fig, ax = plt.subplots()
  8048. plt.plot(ndvi)
  8049. plt.axis('off')
  8050. plt.figure(figsize=(19, 10))
  8051. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8052. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8053. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8054. plt.margins(0, 0)
  8055. #plt.show()
  8056. plt.savefig(ndvis)
  8057. plt.savefig(ndvia)
  8058. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8059. plt.close('all')
  8060. f = open('/var/www/html/cust/c13_1.txt','a')
  8061. f.write(date)
  8062. f.close()
  8063. dress = '/var/www/html/cust/13/c/'
  8064. for root, dirs, files in os.walk(dress):
  8065. print('files: {}'.format(len(files)))
  8066. if len(files)>=1:
  8067. files.sort()
  8068. for f in files:
  8069. with open(os.path.join(root, f), "rb") as imageFile:
  8070. str = base64.b64encode(imageFile.read())
  8071. url = 'http://60.250.156.234/cust/t13.php'
  8072. values = {'data1':str, 'name':f}
  8073. data1 = urllib.parse.urlencode(values)
  8074. data1 = data1.encode('utf-8')
  8075. req = urllib.request.Request(url, data1)
  8076. req.add_header('User-Agent','Magic Browser')
  8077. resp = urllib.request.urlopen(req)
  8078. respdata1 = resp.read()
  8079. print(os.path.join(root, f))
  8080. #print(respdata1)
  8081. os.remove(os.path.join(root, f))
  8082. print("ok")
  8083. except:
  8084. print('error')
  8085. def img13_2():
  8086. try:
  8087. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8088. charset='utf8')
  8089. a = db.cursor()
  8090. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  8091. result = a.fetchall()
  8092. if result ==():
  8093. s =""
  8094. else:
  8095. s = "_" + result[0][3]
  8096. db.close()
  8097. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8098. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8099. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8100. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8101. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8102. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8103. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8104. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8105. date += s
  8106. label= datetime.datetime.now().strftime('No.13 Direction 2 @%Y.%m.%d.%H.%M.%S')
  8107. rgb_img0 = Image.open('/var/www/html/cust/13/c/b2.tif')
  8108. ir_img0 = Image.open('/var/www/html/cust/13/c/a2.tif')
  8109. rgb_img0.save(nt)
  8110. ir_img0.save(irt)
  8111. rgb_img0.save(nj,quality=95)
  8112. ir_img0.save(irj,quality=95)
  8113. r,_,_ = rgb_img0.split()
  8114. r = np.asarray(r, dtype=float)
  8115. ir,_,_ = ir_img0.split()
  8116. ir = np.asarray(ir, dtype=float)
  8117. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8118. np.seterr(divide='ignore', invalid='ignore')
  8119. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8120. # Display the results
  8121. fig, ax = plt.subplots()
  8122. plt.plot(ndvi)
  8123. plt.axis('off')
  8124. plt.figure(figsize=(19, 10))
  8125. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8126. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8127. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8128. plt.margins(0, 0)
  8129. #plt.show()
  8130. plt.savefig(ndvis)
  8131. plt.savefig(ndvia)
  8132. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8133. plt.close('all')
  8134. f = open('/var/www/html/cust/c13_2.txt','a')
  8135. f.write(date)
  8136. f.close()
  8137. dress = '/var/www/html/cust/13/c/'
  8138. for root, dirs, files in os.walk(dress):
  8139. print('files: {}'.format(len(files)))
  8140. if len(files)>=1:
  8141. files.sort()
  8142. for f in files:
  8143. with open(os.path.join(root, f), "rb") as imageFile:
  8144. str = base64.b64encode(imageFile.read())
  8145. url = 'http://60.250.156.234/cust/t13.php'
  8146. values = {'data1':str, 'name':f}
  8147. data1 = urllib.parse.urlencode(values)
  8148. data1 = data1.encode('utf-8')
  8149. req = urllib.request.Request(url, data1)
  8150. req.add_header('User-Agent','Magic Browser')
  8151. resp = urllib.request.urlopen(req)
  8152. respdata1 = resp.read()
  8153. print(os.path.join(root, f))
  8154. #print(respdata1)
  8155. os.remove(os.path.join(root, f))
  8156. print("ok")
  8157. except:
  8158. print('error')
  8159. def img13_3():
  8160. try:
  8161. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8162. charset='utf8')
  8163. a = db.cursor()
  8164. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  8165. result = a.fetchall()
  8166. if result ==():
  8167. s =""
  8168. else:
  8169. s = "_" + result[0][3]
  8170. db.close()
  8171. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8172. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8173. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8174. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8175. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8176. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8177. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8178. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8179. date += s
  8180. label= datetime.datetime.now().strftime('No.13 Direction 3 @%Y.%m.%d.%H.%M.%S')
  8181. rgb_img0 = Image.open('/var/www/html/cust/13/c/b3.tif')
  8182. ir_img0 = Image.open('/var/www/html/cust/13/c/a3.tif')
  8183. rgb_img0.save(nt)
  8184. ir_img0.save(irt)
  8185. rgb_img0.save(nj,quality=95)
  8186. ir_img0.save(irj,quality=95)
  8187. r,_,_ = rgb_img0.split()
  8188. r = np.asarray(r, dtype=float)
  8189. ir,_,_ = ir_img0.split()
  8190. ir = np.asarray(ir, dtype=float)
  8191. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8192. np.seterr(divide='ignore', invalid='ignore')
  8193. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8194. # Display the results
  8195. fig, ax = plt.subplots()
  8196. plt.plot(ndvi)
  8197. plt.axis('off')
  8198. plt.figure(figsize=(19, 10))
  8199. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8200. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8201. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8202. plt.margins(0, 0)
  8203. #plt.show()
  8204. plt.savefig(ndvis)
  8205. plt.savefig(ndvia)
  8206. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8207. plt.close('all')
  8208. f = open('/var/www/html/cust/c13_3.txt','a')
  8209. f.write(date)
  8210. f.close()
  8211. dress = '/var/www/html/cust/13/c/'
  8212. for root, dirs, files in os.walk(dress):
  8213. print('files: {}'.format(len(files)))
  8214. if len(files)>=1:
  8215. files.sort()
  8216. for f in files:
  8217. with open(os.path.join(root, f), "rb") as imageFile:
  8218. str = base64.b64encode(imageFile.read())
  8219. url = 'http://60.250.156.234/cust/t13.php'
  8220. values = {'data1':str, 'name':f}
  8221. data1 = urllib.parse.urlencode(values)
  8222. data1 = data1.encode('utf-8')
  8223. req = urllib.request.Request(url, data1)
  8224. req.add_header('User-Agent','Magic Browser')
  8225. resp = urllib.request.urlopen(req)
  8226. respdata1 = resp.read()
  8227. print(os.path.join(root, f))
  8228. #print(respdata1)
  8229. os.remove(os.path.join(root, f))
  8230. print("ok")
  8231. except:
  8232. print('error')
  8233. def img13_4():
  8234. try:
  8235. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8236. charset='utf8')
  8237. a = db.cursor()
  8238. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  8239. result = a.fetchall()
  8240. if result ==():
  8241. s =""
  8242. else:
  8243. s = "_" + result[0][3]
  8244. db.close()
  8245. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8246. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8247. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8248. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8249. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8250. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8251. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8252. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8253. date += s
  8254. label= datetime.datetime.now().strftime('No.13 Direction 4 @%Y.%m.%d.%H.%M.%S')
  8255. rgb_img0 = Image.open('/var/www/html/cust/13/c/b4.tif')
  8256. ir_img0 = Image.open('/var/www/html/cust/13/c/a4.tif')
  8257. rgb_img0.save(nt)
  8258. ir_img0.save(irt)
  8259. rgb_img0.save(nj,quality=95)
  8260. ir_img0.save(irj,quality=95)
  8261. r,_,_ = rgb_img0.split()
  8262. r = np.asarray(r, dtype=float)
  8263. ir,_,_ = ir_img0.split()
  8264. ir = np.asarray(ir, dtype=float)
  8265. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8266. np.seterr(divide='ignore', invalid='ignore')
  8267. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8268. # Display the results
  8269. fig, ax = plt.subplots()
  8270. plt.plot(ndvi)
  8271. plt.axis('off')
  8272. plt.figure(figsize=(19, 10))
  8273. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8274. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8275. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8276. plt.margins(0, 0)
  8277. #plt.show()
  8278. plt.savefig(ndvis)
  8279. plt.savefig(ndvia)
  8280. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8281. plt.close('all')
  8282. f = open('/var/www/html/cust/c13_4.txt','a')
  8283. f.write(date)
  8284. f.close()
  8285. dress = '/var/www/html/cust/13/c/'
  8286. for root, dirs, files in os.walk(dress):
  8287. print('files: {}'.format(len(files)))
  8288. if len(files)>=1:
  8289. files.sort()
  8290. for f in files:
  8291. with open(os.path.join(root, f), "rb") as imageFile:
  8292. str = base64.b64encode(imageFile.read())
  8293. url = 'http://60.250.156.234/cust/t13.php'
  8294. values = {'data1':str, 'name':f}
  8295. data1 = urllib.parse.urlencode(values)
  8296. data1 = data1.encode('utf-8')
  8297. req = urllib.request.Request(url, data1)
  8298. req.add_header('User-Agent','Magic Browser')
  8299. resp = urllib.request.urlopen(req)
  8300. respdata1 = resp.read()
  8301. print(os.path.join(root, f))
  8302. #print(respdata1)
  8303. os.remove(os.path.join(root, f))
  8304. print("ok")
  8305. except:
  8306. print('error')
  8307. def img13_5():
  8308. try:
  8309. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8310. charset='utf8')
  8311. a = db.cursor()
  8312. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  8313. result = a.fetchall()
  8314. if result ==():
  8315. s =""
  8316. else:
  8317. s = "_" + result[0][3]
  8318. db.close()
  8319. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8320. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8321. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8322. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8323. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8324. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8325. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8326. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8327. date += s
  8328. label= datetime.datetime.now().strftime('No.13 Direction 5 @%Y.%m.%d.%H.%M.%S')
  8329. rgb_img0 = Image.open('/var/www/html/cust/13/c/b5.tif')
  8330. ir_img0 = Image.open('/var/www/html/cust/13/c/a5.tif')
  8331. rgb_img0.save(nt)
  8332. ir_img0.save(irt)
  8333. rgb_img0.save(nj,quality=95)
  8334. ir_img0.save(irj,quality=95)
  8335. r,_,_ = rgb_img0.split()
  8336. r = np.asarray(r, dtype=float)
  8337. ir,_,_ = ir_img0.split()
  8338. ir = np.asarray(ir, dtype=float)
  8339. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8340. np.seterr(divide='ignore', invalid='ignore')
  8341. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8342. # Display the results
  8343. fig, ax = plt.subplots()
  8344. plt.plot(ndvi)
  8345. plt.axis('off')
  8346. plt.figure(figsize=(19, 10))
  8347. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8348. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8349. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8350. plt.margins(0, 0)
  8351. #plt.show()
  8352. plt.savefig(ndvis)
  8353. plt.savefig(ndvia)
  8354. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8355. plt.close('all')
  8356. f = open('/var/www/html/cust/c13_5.txt','a')
  8357. f.write(date)
  8358. f.close()
  8359. dress = '/var/www/html/cust/13/c/'
  8360. for root, dirs, files in os.walk(dress):
  8361. print('files: {}'.format(len(files)))
  8362. if len(files)>=1:
  8363. files.sort()
  8364. for f in files:
  8365. with open(os.path.join(root, f), "rb") as imageFile:
  8366. str = base64.b64encode(imageFile.read())
  8367. url = 'http://60.250.156.234/cust/t13.php'
  8368. values = {'data1':str, 'name':f}
  8369. data1 = urllib.parse.urlencode(values)
  8370. data1 = data1.encode('utf-8')
  8371. req = urllib.request.Request(url, data1)
  8372. req.add_header('User-Agent','Magic Browser')
  8373. resp = urllib.request.urlopen(req)
  8374. respdata1 = resp.read()
  8375. print(os.path.join(root, f))
  8376. #print(respdata1)
  8377. os.remove(os.path.join(root, f))
  8378. print("ok")
  8379. except:
  8380. print('error')
  8381. def img13_6():
  8382. try:
  8383. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8384. charset='utf8')
  8385. a = db.cursor()
  8386. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  8387. result = a.fetchall()
  8388. if result ==():
  8389. s =""
  8390. else:
  8391. s = "_" + result[0][3]
  8392. db.close()
  8393. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8394. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8395. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8396. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8397. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8398. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8399. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8400. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8401. date += s
  8402. label= datetime.datetime.now().strftime('No.13 Direction 6 @%Y.%m.%d.%H.%M.%S')
  8403. rgb_img0 = Image.open('/var/www/html/cust/13/c/b6.tif')
  8404. ir_img0 = Image.open('/var/www/html/cust/13/c/a6.tif')
  8405. rgb_img0.save(nt)
  8406. ir_img0.save(irt)
  8407. rgb_img0.save(nj,quality=95)
  8408. ir_img0.save(irj,quality=95)
  8409. r,_,_ = rgb_img0.split()
  8410. r = np.asarray(r, dtype=float)
  8411. ir,_,_ = ir_img0.split()
  8412. ir = np.asarray(ir, dtype=float)
  8413. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8414. np.seterr(divide='ignore', invalid='ignore')
  8415. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8416. # Display the results
  8417. fig, ax = plt.subplots()
  8418. plt.plot(ndvi)
  8419. plt.axis('off')
  8420. plt.figure(figsize=(19, 10))
  8421. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8422. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8423. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8424. plt.margins(0, 0)
  8425. #plt.show()
  8426. plt.savefig(ndvis)
  8427. plt.savefig(ndvia)
  8428. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8429. plt.close('all')
  8430. f = open('/var/www/html/cust/c13_6.txt','a')
  8431. f.write(date)
  8432. f.close()
  8433. dress = '/var/www/html/cust/13/c/'
  8434. for root, dirs, files in os.walk(dress):
  8435. print('files: {}'.format(len(files)))
  8436. if len(files)>=1:
  8437. files.sort()
  8438. for f in files:
  8439. with open(os.path.join(root, f), "rb") as imageFile:
  8440. str = base64.b64encode(imageFile.read())
  8441. url = 'http://60.250.156.234/cust/t13.php'
  8442. values = {'data1':str, 'name':f}
  8443. data1 = urllib.parse.urlencode(values)
  8444. data1 = data1.encode('utf-8')
  8445. req = urllib.request.Request(url, data1)
  8446. req.add_header('User-Agent','Magic Browser')
  8447. resp = urllib.request.urlopen(req)
  8448. respdata1 = resp.read()
  8449. print(os.path.join(root, f))
  8450. #print(respdata1)
  8451. os.remove(os.path.join(root, f))
  8452. print("ok")
  8453. except:
  8454. print('error')
  8455. def img13_7():
  8456. try:
  8457. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8458. charset='utf8')
  8459. a = db.cursor()
  8460. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  8461. result = a.fetchall()
  8462. if result ==():
  8463. s =""
  8464. else:
  8465. s = "_" + result[0][3]
  8466. db.close()
  8467. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8468. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8469. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8470. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8471. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8472. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8473. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8474. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8475. date += s
  8476. label= datetime.datetime.now().strftime('No.13 Direction 7 @%Y.%m.%d.%H.%M.%S')
  8477. rgb_img0 = Image.open('/var/www/html/cust/13/c/b7.tif')
  8478. ir_img0 = Image.open('/var/www/html/cust/13/c/a7.tif')
  8479. rgb_img0.save(nt)
  8480. ir_img0.save(irt)
  8481. rgb_img0.save(nj,quality=95)
  8482. ir_img0.save(irj,quality=95)
  8483. r,_,_ = rgb_img0.split()
  8484. r = np.asarray(r, dtype=float)
  8485. ir,_,_ = ir_img0.split()
  8486. ir = np.asarray(ir, dtype=float)
  8487. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8488. np.seterr(divide='ignore', invalid='ignore')
  8489. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8490. # Display the results
  8491. fig, ax = plt.subplots()
  8492. plt.plot(ndvi)
  8493. plt.axis('off')
  8494. plt.figure(figsize=(19, 10))
  8495. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8496. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8497. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8498. plt.margins(0, 0)
  8499. #plt.show()
  8500. plt.savefig(ndvis)
  8501. plt.savefig(ndvia)
  8502. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8503. plt.close('all')
  8504. f = open('/var/www/html/cust/c13_7.txt','a')
  8505. f.write(date)
  8506. f.close()
  8507. dress = '/var/www/html/cust/13/c/'
  8508. for root, dirs, files in os.walk(dress):
  8509. print('files: {}'.format(len(files)))
  8510. if len(files)>=1:
  8511. files.sort()
  8512. for f in files:
  8513. with open(os.path.join(root, f), "rb") as imageFile:
  8514. str = base64.b64encode(imageFile.read())
  8515. url = 'http://60.250.156.234/cust/t13.php'
  8516. values = {'data1':str, 'name':f}
  8517. data1 = urllib.parse.urlencode(values)
  8518. data1 = data1.encode('utf-8')
  8519. req = urllib.request.Request(url, data1)
  8520. req.add_header('User-Agent','Magic Browser')
  8521. resp = urllib.request.urlopen(req)
  8522. respdata1 = resp.read()
  8523. print(os.path.join(root, f))
  8524. #print(respdata1)
  8525. os.remove(os.path.join(root, f))
  8526. print("ok")
  8527. except:
  8528. print('error')
  8529. def img13_8():
  8530. try:
  8531. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8532. charset='utf8')
  8533. a = db.cursor()
  8534. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  8535. result = a.fetchall()
  8536. if result ==():
  8537. s =""
  8538. else:
  8539. s = "_" + result[0][3]
  8540. db.close()
  8541. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8542. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8543. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8544. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8545. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8546. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8547. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8548. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8549. date += s
  8550. label= datetime.datetime.now().strftime('No.13 Direction 8 @%Y.%m.%d.%H.%M.%S')
  8551. rgb_img0 = Image.open('/var/www/html/cust/13/c/b8.tif')
  8552. ir_img0 = Image.open('/var/www/html/cust/13/c/a8.tif')
  8553. rgb_img0.save(nt)
  8554. ir_img0.save(irt)
  8555. rgb_img0.save(nj,quality=95)
  8556. ir_img0.save(irj,quality=95)
  8557. r,_,_ = rgb_img0.split()
  8558. r = np.asarray(r, dtype=float)
  8559. ir,_,_ = ir_img0.split()
  8560. ir = np.asarray(ir, dtype=float)
  8561. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8562. np.seterr(divide='ignore', invalid='ignore')
  8563. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8564. # Display the results
  8565. fig, ax = plt.subplots()
  8566. plt.plot(ndvi)
  8567. plt.axis('off')
  8568. plt.figure(figsize=(19, 10))
  8569. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8570. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8571. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8572. plt.margins(0, 0)
  8573. #plt.show()
  8574. plt.savefig(ndvis)
  8575. plt.savefig(ndvia)
  8576. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8577. plt.close('all')
  8578. f = open('/var/www/html/cust/c13_8.txt','a')
  8579. f.write(date)
  8580. f.close()
  8581. dress = '/var/www/html/cust/13/c/'
  8582. for root, dirs, files in os.walk(dress):
  8583. print('files: {}'.format(len(files)))
  8584. if len(files)>=1:
  8585. files.sort()
  8586. for f in files:
  8587. with open(os.path.join(root, f), "rb") as imageFile:
  8588. str = base64.b64encode(imageFile.read())
  8589. url = 'http://60.250.156.234/cust/t13.php'
  8590. values = {'data1':str, 'name':f}
  8591. data1 = urllib.parse.urlencode(values)
  8592. data1 = data1.encode('utf-8')
  8593. req = urllib.request.Request(url, data1)
  8594. req.add_header('User-Agent','Magic Browser')
  8595. resp = urllib.request.urlopen(req)
  8596. respdata1 = resp.read()
  8597. print(os.path.join(root, f))
  8598. #print(respdata1)
  8599. os.remove(os.path.join(root, f))
  8600. print("ok")
  8601. except:
  8602. print('error')
  8603. def img13_9():
  8604. try:
  8605. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8606. charset='utf8')
  8607. a = db.cursor()
  8608. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002013' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  8609. result = a.fetchall()
  8610. if result ==():
  8611. s =""
  8612. else:
  8613. s = "_" + result[0][3]
  8614. db.close()
  8615. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8616. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8617. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/13/ndvia/c.png') #ndvi is c.png
  8618. irt = datetime.datetime.now().strftime('/var/www/html/cust/13/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8619. nt = datetime.datetime.now().strftime('/var/www/html/cust/13/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8620. irj = datetime.datetime.now().strftime('/var/www/html/cust/13/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8621. nj = datetime.datetime.now().strftime('/var/www/html/cust/13/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8622. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8623. date += s
  8624. label= datetime.datetime.now().strftime('No.13 Direction 0 @%Y.%m.%d.%H.%M.%S')
  8625. rgb_img0 = Image.open('/var/www/html/cust/13/c/b.tif')
  8626. ir_img0 = Image.open('/var/www/html/cust/13/c/a.tif')
  8627. rgb_img0.save(nt)
  8628. ir_img0.save(irt)
  8629. rgb_img0.save(nj,quality=95)
  8630. ir_img0.save(irj,quality=95)
  8631. r,_,_ = rgb_img0.split()
  8632. r = np.asarray(r, dtype=float)
  8633. ir,_,_ = ir_img0.split()
  8634. ir = np.asarray(ir, dtype=float)
  8635. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8636. np.seterr(divide='ignore', invalid='ignore')
  8637. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8638. # Display the results
  8639. fig, ax = plt.subplots()
  8640. plt.plot(ndvi)
  8641. plt.axis('off')
  8642. plt.figure(figsize=(19, 10))
  8643. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8644. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8645. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8646. plt.margins(0, 0)
  8647. #plt.show()
  8648. plt.savefig(ndvis)
  8649. plt.savefig(ndvia)
  8650. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8651. plt.close('all')
  8652. f = open('/var/www/html/cust/c13.txt','a')
  8653. f.write(date)
  8654. f.close()
  8655. dress = '/var/www/html/cust/13/c/'
  8656. for root, dirs, files in os.walk(dress):
  8657. print('files: {}'.format(len(files)))
  8658. if len(files)>=1:
  8659. files.sort()
  8660. for f in files:
  8661. with open(os.path.join(root, f), "rb") as imageFile:
  8662. str = base64.b64encode(imageFile.read())
  8663. url = 'http://60.250.156.234/cust/t13.php'
  8664. values = {'data1':str, 'name':f}
  8665. data1 = urllib.parse.urlencode(values)
  8666. data1 = data1.encode('utf-8')
  8667. req = urllib.request.Request(url, data1)
  8668. req.add_header('User-Agent','Magic Browser')
  8669. resp = urllib.request.urlopen(req)
  8670. respdata1 = resp.read()
  8671. print(os.path.join(root, f))
  8672. #print(respdata1)
  8673. os.remove(os.path.join(root, f))
  8674. print("ok")
  8675. except:
  8676. print('error')
  8677. def img14_1():
  8678. try:
  8679. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8680. charset='utf8')
  8681. a = db.cursor()
  8682. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  8683. result = a.fetchall()
  8684. if result ==():
  8685. s =""
  8686. else:
  8687. s = "_" + result[0][3]
  8688. db.close()
  8689. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8690. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8691. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  8692. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8693. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8694. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8695. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8696. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8697. date += s
  8698. label= datetime.datetime.now().strftime('No.14 Direction 1 @%Y.%m.%d.%H.%M.%S')
  8699. rgb_img0 = Image.open('/var/www/html/cust/14/c/b1.tif')
  8700. ir_img0 = Image.open('/var/www/html/cust/14/c/a1.tif')
  8701. rgb_img0.save(nt)
  8702. ir_img0.save(irt)
  8703. rgb_img0.save(nj,quality=95)
  8704. ir_img0.save(irj,quality=95)
  8705. r,_,_ = rgb_img0.split()
  8706. r = np.asarray(r, dtype=float)
  8707. ir,_,_ = ir_img0.split()
  8708. ir = np.asarray(ir, dtype=float)
  8709. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8710. np.seterr(divide='ignore', invalid='ignore')
  8711. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8712. # Display the results
  8713. fig, ax = plt.subplots()
  8714. plt.plot(ndvi)
  8715. plt.axis('off')
  8716. plt.figure(figsize=(19, 10))
  8717. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8718. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8719. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8720. plt.margins(0, 0)
  8721. #plt.show()
  8722. plt.savefig(ndvis)
  8723. plt.savefig(ndvia)
  8724. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8725. plt.close('all')
  8726. f = open('/var/www/html/cust/c14_1.txt','a')
  8727. f.write(date)
  8728. f.close()
  8729. dress = '/var/www/html/cust/14/c/'
  8730. for root, dirs, files in os.walk(dress):
  8731. print('files: {}'.format(len(files)))
  8732. if len(files)>=1:
  8733. files.sort()
  8734. for f in files:
  8735. with open(os.path.join(root, f), "rb") as imageFile:
  8736. str = base64.b64encode(imageFile.read())
  8737. url = 'http://60.250.156.234/cust/t14.php'
  8738. values = {'data1':str, 'name':f}
  8739. data1 = urllib.parse.urlencode(values)
  8740. data1 = data1.encode('utf-8')
  8741. req = urllib.request.Request(url, data1)
  8742. req.add_header('User-Agent','Magic Browser')
  8743. resp = urllib.request.urlopen(req)
  8744. respdata1 = resp.read()
  8745. print(os.path.join(root, f))
  8746. #print(respdata1)
  8747. os.remove(os.path.join(root, f))
  8748. print("ok")
  8749. except:
  8750. print('error')
  8751. def img14_2():
  8752. try:
  8753. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8754. charset='utf8')
  8755. a = db.cursor()
  8756. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  8757. result = a.fetchall()
  8758. if result ==():
  8759. s =""
  8760. else:
  8761. s = "_" + result[0][3]
  8762. db.close()
  8763. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8764. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8765. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  8766. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8767. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8768. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8769. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8770. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8771. date += s
  8772. label= datetime.datetime.now().strftime('No.14 Direction 2 @%Y.%m.%d.%H.%M.%S')
  8773. rgb_img0 = Image.open('/var/www/html/cust/14/c/b2.tif')
  8774. ir_img0 = Image.open('/var/www/html/cust/14/c/a2.tif')
  8775. rgb_img0.save(nt)
  8776. ir_img0.save(irt)
  8777. rgb_img0.save(nj,quality=95)
  8778. ir_img0.save(irj,quality=95)
  8779. r,_,_ = rgb_img0.split()
  8780. r = np.asarray(r, dtype=float)
  8781. ir,_,_ = ir_img0.split()
  8782. ir = np.asarray(ir, dtype=float)
  8783. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8784. np.seterr(divide='ignore', invalid='ignore')
  8785. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8786. # Display the results
  8787. fig, ax = plt.subplots()
  8788. plt.plot(ndvi)
  8789. plt.axis('off')
  8790. plt.figure(figsize=(19, 10))
  8791. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8792. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8793. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8794. plt.margins(0, 0)
  8795. #plt.show()
  8796. plt.savefig(ndvis)
  8797. plt.savefig(ndvia)
  8798. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8799. plt.close('all')
  8800. f = open('/var/www/html/cust/c14_2.txt','a')
  8801. f.write(date)
  8802. f.close()
  8803. dress = '/var/www/html/cust/14/c/'
  8804. for root, dirs, files in os.walk(dress):
  8805. print('files: {}'.format(len(files)))
  8806. if len(files)>=1:
  8807. files.sort()
  8808. for f in files:
  8809. with open(os.path.join(root, f), "rb") as imageFile:
  8810. str = base64.b64encode(imageFile.read())
  8811. url = 'http://60.250.156.234/cust/t14.php'
  8812. values = {'data1':str, 'name':f}
  8813. data1 = urllib.parse.urlencode(values)
  8814. data1 = data1.encode('utf-8')
  8815. req = urllib.request.Request(url, data1)
  8816. req.add_header('User-Agent','Magic Browser')
  8817. resp = urllib.request.urlopen(req)
  8818. respdata1 = resp.read()
  8819. print(os.path.join(root, f))
  8820. #print(respdata1)
  8821. os.remove(os.path.join(root, f))
  8822. print("ok")
  8823. except:
  8824. print('error')
  8825. def img14_3():
  8826. try:
  8827. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8828. charset='utf8')
  8829. a = db.cursor()
  8830. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  8831. result = a.fetchall()
  8832. if result ==():
  8833. s =""
  8834. else:
  8835. s = "_" + result[0][3]
  8836. db.close()
  8837. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8838. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8839. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  8840. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8841. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8842. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8843. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8844. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8845. date += s
  8846. label= datetime.datetime.now().strftime('No.14 Direction 3 @%Y.%m.%d.%H.%M.%S')
  8847. rgb_img0 = Image.open('/var/www/html/cust/14/c/b3.tif')
  8848. ir_img0 = Image.open('/var/www/html/cust/14/c/a3.tif')
  8849. rgb_img0.save(nt)
  8850. ir_img0.save(irt)
  8851. rgb_img0.save(nj,quality=95)
  8852. ir_img0.save(irj,quality=95)
  8853. r,_,_ = rgb_img0.split()
  8854. r = np.asarray(r, dtype=float)
  8855. ir,_,_ = ir_img0.split()
  8856. ir = np.asarray(ir, dtype=float)
  8857. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8858. np.seterr(divide='ignore', invalid='ignore')
  8859. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8860. # Display the results
  8861. fig, ax = plt.subplots()
  8862. plt.plot(ndvi)
  8863. plt.axis('off')
  8864. plt.figure(figsize=(19, 10))
  8865. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8866. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8867. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8868. plt.margins(0, 0)
  8869. #plt.show()
  8870. plt.savefig(ndvis)
  8871. plt.savefig(ndvia)
  8872. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8873. plt.close('all')
  8874. f = open('/var/www/html/cust/c14_3.txt','a')
  8875. f.write(date)
  8876. f.close()
  8877. dress = '/var/www/html/cust/14/c/'
  8878. for root, dirs, files in os.walk(dress):
  8879. print('files: {}'.format(len(files)))
  8880. if len(files)>=1:
  8881. files.sort()
  8882. for f in files:
  8883. with open(os.path.join(root, f), "rb") as imageFile:
  8884. str = base64.b64encode(imageFile.read())
  8885. url = 'http://60.250.156.234/cust/t14.php'
  8886. values = {'data1':str, 'name':f}
  8887. data1 = urllib.parse.urlencode(values)
  8888. data1 = data1.encode('utf-8')
  8889. req = urllib.request.Request(url, data1)
  8890. req.add_header('User-Agent','Magic Browser')
  8891. resp = urllib.request.urlopen(req)
  8892. respdata1 = resp.read()
  8893. print(os.path.join(root, f))
  8894. #print(respdata1)
  8895. os.remove(os.path.join(root, f))
  8896. print("ok")
  8897. except:
  8898. print('error')
  8899. def img14_4():
  8900. try:
  8901. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8902. charset='utf8')
  8903. a = db.cursor()
  8904. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  8905. result = a.fetchall()
  8906. if result ==():
  8907. s =""
  8908. else:
  8909. s = "_" + result[0][3]
  8910. db.close()
  8911. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8912. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8913. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  8914. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8915. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8916. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8917. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8918. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8919. date += s
  8920. label= datetime.datetime.now().strftime('No.14 Direction 4 @%Y.%m.%d.%H.%M.%S')
  8921. rgb_img0 = Image.open('/var/www/html/cust/14/c/b4.tif')
  8922. ir_img0 = Image.open('/var/www/html/cust/14/c/a4.tif')
  8923. rgb_img0.save(nt)
  8924. ir_img0.save(irt)
  8925. rgb_img0.save(nj,quality=95)
  8926. ir_img0.save(irj,quality=95)
  8927. r,_,_ = rgb_img0.split()
  8928. r = np.asarray(r, dtype=float)
  8929. ir,_,_ = ir_img0.split()
  8930. ir = np.asarray(ir, dtype=float)
  8931. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  8932. np.seterr(divide='ignore', invalid='ignore')
  8933. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  8934. # Display the results
  8935. fig, ax = plt.subplots()
  8936. plt.plot(ndvi)
  8937. plt.axis('off')
  8938. plt.figure(figsize=(19, 10))
  8939. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  8940. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  8941. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  8942. plt.margins(0, 0)
  8943. #plt.show()
  8944. plt.savefig(ndvis)
  8945. plt.savefig(ndvia)
  8946. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  8947. plt.close('all')
  8948. f = open('/var/www/html/cust/c14_4.txt','a')
  8949. f.write(date)
  8950. f.close()
  8951. dress = '/var/www/html/cust/14/c/'
  8952. for root, dirs, files in os.walk(dress):
  8953. print('files: {}'.format(len(files)))
  8954. if len(files)>=1:
  8955. files.sort()
  8956. for f in files:
  8957. with open(os.path.join(root, f), "rb") as imageFile:
  8958. str = base64.b64encode(imageFile.read())
  8959. url = 'http://60.250.156.234/cust/t14.php'
  8960. values = {'data1':str, 'name':f}
  8961. data1 = urllib.parse.urlencode(values)
  8962. data1 = data1.encode('utf-8')
  8963. req = urllib.request.Request(url, data1)
  8964. req.add_header('User-Agent','Magic Browser')
  8965. resp = urllib.request.urlopen(req)
  8966. respdata1 = resp.read()
  8967. print(os.path.join(root, f))
  8968. #print(respdata1)
  8969. os.remove(os.path.join(root, f))
  8970. print("ok")
  8971. except:
  8972. print('error')
  8973. def img14_5():
  8974. try:
  8975. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  8976. charset='utf8')
  8977. a = db.cursor()
  8978. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  8979. result = a.fetchall()
  8980. if result ==():
  8981. s =""
  8982. else:
  8983. s = "_" + result[0][3]
  8984. db.close()
  8985. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  8986. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  8987. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  8988. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  8989. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  8990. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  8991. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  8992. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  8993. date += s
  8994. label= datetime.datetime.now().strftime('No.14 Direction 5 @%Y.%m.%d.%H.%M.%S')
  8995. rgb_img0 = Image.open('/var/www/html/cust/14/c/b5.tif')
  8996. ir_img0 = Image.open('/var/www/html/cust/14/c/a5.tif')
  8997. rgb_img0.save(nt)
  8998. ir_img0.save(irt)
  8999. rgb_img0.save(nj,quality=95)
  9000. ir_img0.save(irj,quality=95)
  9001. r,_,_ = rgb_img0.split()
  9002. r = np.asarray(r, dtype=float)
  9003. ir,_,_ = ir_img0.split()
  9004. ir = np.asarray(ir, dtype=float)
  9005. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9006. np.seterr(divide='ignore', invalid='ignore')
  9007. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9008. # Display the results
  9009. fig, ax = plt.subplots()
  9010. plt.plot(ndvi)
  9011. plt.axis('off')
  9012. plt.figure(figsize=(19, 10))
  9013. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9014. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9015. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9016. plt.margins(0, 0)
  9017. #plt.show()
  9018. plt.savefig(ndvis)
  9019. plt.savefig(ndvia)
  9020. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9021. plt.close('all')
  9022. f = open('/var/www/html/cust/c14_5.txt','a')
  9023. f.write(date)
  9024. f.close()
  9025. dress = '/var/www/html/cust/14/c/'
  9026. for root, dirs, files in os.walk(dress):
  9027. print('files: {}'.format(len(files)))
  9028. if len(files)>=1:
  9029. files.sort()
  9030. for f in files:
  9031. with open(os.path.join(root, f), "rb") as imageFile:
  9032. str = base64.b64encode(imageFile.read())
  9033. url = 'http://60.250.156.234/cust/t14.php'
  9034. values = {'data1':str, 'name':f}
  9035. data1 = urllib.parse.urlencode(values)
  9036. data1 = data1.encode('utf-8')
  9037. req = urllib.request.Request(url, data1)
  9038. req.add_header('User-Agent','Magic Browser')
  9039. resp = urllib.request.urlopen(req)
  9040. respdata1 = resp.read()
  9041. print(os.path.join(root, f))
  9042. #print(respdata1)
  9043. os.remove(os.path.join(root, f))
  9044. print("ok")
  9045. except:
  9046. print('error')
  9047. def img14_6():
  9048. try:
  9049. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9050. charset='utf8')
  9051. a = db.cursor()
  9052. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  9053. result = a.fetchall()
  9054. if result ==():
  9055. s =""
  9056. else:
  9057. s = "_" + result[0][3]
  9058. db.close()
  9059. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9060. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9061. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  9062. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9063. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9064. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9065. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9066. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9067. date += s
  9068. label= datetime.datetime.now().strftime('No.14 Direction 6 @%Y.%m.%d.%H.%M.%S')
  9069. rgb_img0 = Image.open('/var/www/html/cust/14/c/b6.tif')
  9070. ir_img0 = Image.open('/var/www/html/cust/14/c/a6.tif')
  9071. rgb_img0.save(nt)
  9072. ir_img0.save(irt)
  9073. rgb_img0.save(nj,quality=95)
  9074. ir_img0.save(irj,quality=95)
  9075. r,_,_ = rgb_img0.split()
  9076. r = np.asarray(r, dtype=float)
  9077. ir,_,_ = ir_img0.split()
  9078. ir = np.asarray(ir, dtype=float)
  9079. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9080. np.seterr(divide='ignore', invalid='ignore')
  9081. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9082. # Display the results
  9083. fig, ax = plt.subplots()
  9084. plt.plot(ndvi)
  9085. plt.axis('off')
  9086. plt.figure(figsize=(19, 10))
  9087. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9088. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9089. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9090. plt.margins(0, 0)
  9091. #plt.show()
  9092. plt.savefig(ndvis)
  9093. plt.savefig(ndvia)
  9094. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9095. plt.close('all')
  9096. f = open('/var/www/html/cust/c14_6.txt','a')
  9097. f.write(date)
  9098. f.close()
  9099. dress = '/var/www/html/cust/14/c/'
  9100. for root, dirs, files in os.walk(dress):
  9101. print('files: {}'.format(len(files)))
  9102. if len(files)>=1:
  9103. files.sort()
  9104. for f in files:
  9105. with open(os.path.join(root, f), "rb") as imageFile:
  9106. str = base64.b64encode(imageFile.read())
  9107. url = 'http://60.250.156.234/cust/t14.php'
  9108. values = {'data1':str, 'name':f}
  9109. data1 = urllib.parse.urlencode(values)
  9110. data1 = data1.encode('utf-8')
  9111. req = urllib.request.Request(url, data1)
  9112. req.add_header('User-Agent','Magic Browser')
  9113. resp = urllib.request.urlopen(req)
  9114. respdata1 = resp.read()
  9115. print(os.path.join(root, f))
  9116. #print(respdata1)
  9117. os.remove(os.path.join(root, f))
  9118. print("ok")
  9119. except:
  9120. print('error')
  9121. def img14_7():
  9122. try:
  9123. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9124. charset='utf8')
  9125. a = db.cursor()
  9126. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  9127. result = a.fetchall()
  9128. if result ==():
  9129. s =""
  9130. else:
  9131. s = "_" + result[0][3]
  9132. db.close()
  9133. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9134. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9135. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  9136. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9137. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9138. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9139. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9140. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9141. date += s
  9142. label= datetime.datetime.now().strftime('No.14 Direction 7 @%Y.%m.%d.%H.%M.%S')
  9143. rgb_img0 = Image.open('/var/www/html/cust/14/c/b7.tif')
  9144. ir_img0 = Image.open('/var/www/html/cust/14/c/a7.tif')
  9145. rgb_img0.save(nt)
  9146. ir_img0.save(irt)
  9147. rgb_img0.save(nj,quality=95)
  9148. ir_img0.save(irj,quality=95)
  9149. r,_,_ = rgb_img0.split()
  9150. r = np.asarray(r, dtype=float)
  9151. ir,_,_ = ir_img0.split()
  9152. ir = np.asarray(ir, dtype=float)
  9153. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9154. np.seterr(divide='ignore', invalid='ignore')
  9155. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9156. # Display the results
  9157. fig, ax = plt.subplots()
  9158. plt.plot(ndvi)
  9159. plt.axis('off')
  9160. plt.figure(figsize=(19, 10))
  9161. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9162. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9163. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9164. plt.margins(0, 0)
  9165. #plt.show()
  9166. plt.savefig(ndvis)
  9167. plt.savefig(ndvia)
  9168. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9169. plt.close('all')
  9170. f = open('/var/www/html/cust/c14_7.txt','a')
  9171. f.write(date)
  9172. f.close()
  9173. dress = '/var/www/html/cust/14/c/'
  9174. for root, dirs, files in os.walk(dress):
  9175. print('files: {}'.format(len(files)))
  9176. if len(files)>=1:
  9177. files.sort()
  9178. for f in files:
  9179. with open(os.path.join(root, f), "rb") as imageFile:
  9180. str = base64.b64encode(imageFile.read())
  9181. url = 'http://60.250.156.234/cust/t14.php'
  9182. values = {'data1':str, 'name':f}
  9183. data1 = urllib.parse.urlencode(values)
  9184. data1 = data1.encode('utf-8')
  9185. req = urllib.request.Request(url, data1)
  9186. req.add_header('User-Agent','Magic Browser')
  9187. resp = urllib.request.urlopen(req)
  9188. respdata1 = resp.read()
  9189. print(os.path.join(root, f))
  9190. #print(respdata1)
  9191. os.remove(os.path.join(root, f))
  9192. print("ok")
  9193. except:
  9194. print('error')
  9195. def img14_8():
  9196. try:
  9197. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9198. charset='utf8')
  9199. a = db.cursor()
  9200. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  9201. result = a.fetchall()
  9202. if result ==():
  9203. s =""
  9204. else:
  9205. s = "_" + result[0][3]
  9206. db.close()
  9207. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9208. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9209. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  9210. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9211. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9212. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9213. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9214. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9215. date += s
  9216. label= datetime.datetime.now().strftime('No.14 Direction 8 @%Y.%m.%d.%H.%M.%S')
  9217. rgb_img0 = Image.open('/var/www/html/cust/14/c/b8.tif')
  9218. ir_img0 = Image.open('/var/www/html/cust/14/c/a8.tif')
  9219. rgb_img0.save(nt)
  9220. ir_img0.save(irt)
  9221. rgb_img0.save(nj,quality=95)
  9222. ir_img0.save(irj,quality=95)
  9223. r,_,_ = rgb_img0.split()
  9224. r = np.asarray(r, dtype=float)
  9225. ir,_,_ = ir_img0.split()
  9226. ir = np.asarray(ir, dtype=float)
  9227. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9228. np.seterr(divide='ignore', invalid='ignore')
  9229. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9230. # Display the results
  9231. fig, ax = plt.subplots()
  9232. plt.plot(ndvi)
  9233. plt.axis('off')
  9234. plt.figure(figsize=(19, 10))
  9235. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9236. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9237. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9238. plt.margins(0, 0)
  9239. #plt.show()
  9240. plt.savefig(ndvis)
  9241. plt.savefig(ndvia)
  9242. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9243. plt.close('all')
  9244. f = open('/var/www/html/cust/c14_8.txt','a')
  9245. f.write(date)
  9246. f.close()
  9247. dress = '/var/www/html/cust/14/c/'
  9248. for root, dirs, files in os.walk(dress):
  9249. print('files: {}'.format(len(files)))
  9250. if len(files)>=1:
  9251. files.sort()
  9252. for f in files:
  9253. with open(os.path.join(root, f), "rb") as imageFile:
  9254. str = base64.b64encode(imageFile.read())
  9255. url = 'http://60.250.156.234/cust/t14.php'
  9256. values = {'data1':str, 'name':f}
  9257. data1 = urllib.parse.urlencode(values)
  9258. data1 = data1.encode('utf-8')
  9259. req = urllib.request.Request(url, data1)
  9260. req.add_header('User-Agent','Magic Browser')
  9261. resp = urllib.request.urlopen(req)
  9262. respdata1 = resp.read()
  9263. print(os.path.join(root, f))
  9264. #print(respdata1)
  9265. os.remove(os.path.join(root, f))
  9266. print("ok")
  9267. except:
  9268. print('error')
  9269. def img14_9():
  9270. try:
  9271. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9272. charset='utf8')
  9273. a = db.cursor()
  9274. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002014' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  9275. result = a.fetchall()
  9276. if result ==():
  9277. s =""
  9278. else:
  9279. s = "_" + result[0][3]
  9280. db.close()
  9281. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9282. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9283. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/14/ndvia/c.png') #ndvi is c.png
  9284. irt = datetime.datetime.now().strftime('/var/www/html/cust/14/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9285. nt = datetime.datetime.now().strftime('/var/www/html/cust/14/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9286. irj = datetime.datetime.now().strftime('/var/www/html/cust/14/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9287. nj = datetime.datetime.now().strftime('/var/www/html/cust/14/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9288. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9289. date += s
  9290. label= datetime.datetime.now().strftime('No.14 Direction 0 @%Y.%m.%d.%H.%M.%S')
  9291. rgb_img0 = Image.open('/var/www/html/cust/14/c/b.tif')
  9292. ir_img0 = Image.open('/var/www/html/cust/14/c/a.tif')
  9293. rgb_img0.save(nt)
  9294. ir_img0.save(irt)
  9295. rgb_img0.save(nj,quality=95)
  9296. ir_img0.save(irj,quality=95)
  9297. r,_,_ = rgb_img0.split()
  9298. r = np.asarray(r, dtype=float)
  9299. ir,_,_ = ir_img0.split()
  9300. ir = np.asarray(ir, dtype=float)
  9301. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9302. np.seterr(divide='ignore', invalid='ignore')
  9303. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9304. # Display the results
  9305. fig, ax = plt.subplots()
  9306. plt.plot(ndvi)
  9307. plt.axis('off')
  9308. plt.figure(figsize=(19, 10))
  9309. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9310. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9311. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9312. plt.margins(0, 0)
  9313. #plt.show()
  9314. plt.savefig(ndvis)
  9315. plt.savefig(ndvia)
  9316. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9317. plt.close('all')
  9318. f = open('/var/www/html/cust/c14.txt','a')
  9319. f.write(date)
  9320. f.close()
  9321. dress = '/var/www/html/cust/14/c/'
  9322. for root, dirs, files in os.walk(dress):
  9323. print('files: {}'.format(len(files)))
  9324. if len(files)>=1:
  9325. files.sort()
  9326. for f in files:
  9327. with open(os.path.join(root, f), "rb") as imageFile:
  9328. str = base64.b64encode(imageFile.read())
  9329. url = 'http://60.250.156.234/cust/t14.php'
  9330. values = {'data1':str, 'name':f}
  9331. data1 = urllib.parse.urlencode(values)
  9332. data1 = data1.encode('utf-8')
  9333. req = urllib.request.Request(url, data1)
  9334. req.add_header('User-Agent','Magic Browser')
  9335. resp = urllib.request.urlopen(req)
  9336. respdata1 = resp.read()
  9337. print(os.path.join(root, f))
  9338. #print(respdata1)
  9339. os.remove(os.path.join(root, f))
  9340. print("ok")
  9341. except:
  9342. print('error')
  9343. def img15_1():
  9344. try:
  9345. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9346. charset='utf8')
  9347. a = db.cursor()
  9348. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  9349. result = a.fetchall()
  9350. if result ==():
  9351. s =""
  9352. else:
  9353. s = "_" + result[0][3]
  9354. db.close()
  9355. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9356. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9357. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9358. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9359. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9360. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9361. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9362. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9363. date += s
  9364. label= datetime.datetime.now().strftime('No.15 Direction 1 @%Y.%m.%d.%H.%M.%S')
  9365. rgb_img0 = Image.open('/var/www/html/cust/15/c/b1.tif')
  9366. ir_img0 = Image.open('/var/www/html/cust/15/c/a1.tif')
  9367. rgb_img0.save(nt)
  9368. ir_img0.save(irt)
  9369. rgb_img0.save(nj,quality=95)
  9370. ir_img0.save(irj,quality=95)
  9371. r,_,_ = rgb_img0.split()
  9372. r = np.asarray(r, dtype=float)
  9373. ir,_,_ = ir_img0.split()
  9374. ir = np.asarray(ir, dtype=float)
  9375. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9376. np.seterr(divide='ignore', invalid='ignore')
  9377. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9378. # Display the results
  9379. fig, ax = plt.subplots()
  9380. plt.plot(ndvi)
  9381. plt.axis('off')
  9382. plt.figure(figsize=(19, 10))
  9383. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9384. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9385. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9386. plt.margins(0, 0)
  9387. #plt.show()
  9388. plt.savefig(ndvis)
  9389. plt.savefig(ndvia)
  9390. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9391. plt.close('all')
  9392. f = open('/var/www/html/cust/c15_1.txt','a')
  9393. f.write(date)
  9394. f.close()
  9395. dress = '/var/www/html/cust/15/c/'
  9396. for root, dirs, files in os.walk(dress):
  9397. print('files: {}'.format(len(files)))
  9398. if len(files)>=1:
  9399. files.sort()
  9400. for f in files:
  9401. with open(os.path.join(root, f), "rb") as imageFile:
  9402. str = base64.b64encode(imageFile.read())
  9403. url = 'http://60.250.156.234/cust/t15.php'
  9404. values = {'data1':str, 'name':f}
  9405. data1 = urllib.parse.urlencode(values)
  9406. data1 = data1.encode('utf-8')
  9407. req = urllib.request.Request(url, data1)
  9408. req.add_header('User-Agent','Magic Browser')
  9409. resp = urllib.request.urlopen(req)
  9410. respdata1 = resp.read()
  9411. print(os.path.join(root, f))
  9412. #print(respdata1)
  9413. os.remove(os.path.join(root, f))
  9414. print("ok")
  9415. except:
  9416. print('error')
  9417. def img15_2():
  9418. try:
  9419. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9420. charset='utf8')
  9421. a = db.cursor()
  9422. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  9423. result = a.fetchall()
  9424. if result ==():
  9425. s =""
  9426. else:
  9427. s = "_" + result[0][3]
  9428. db.close()
  9429. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9430. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9431. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9432. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9433. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9434. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9435. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9436. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9437. date += s
  9438. label= datetime.datetime.now().strftime('No.15 Direction 2 @%Y.%m.%d.%H.%M.%S')
  9439. rgb_img0 = Image.open('/var/www/html/cust/15/c/b2.tif')
  9440. ir_img0 = Image.open('/var/www/html/cust/15/c/a2.tif')
  9441. rgb_img0.save(nt)
  9442. ir_img0.save(irt)
  9443. rgb_img0.save(nj,quality=95)
  9444. ir_img0.save(irj,quality=95)
  9445. r,_,_ = rgb_img0.split()
  9446. r = np.asarray(r, dtype=float)
  9447. ir,_,_ = ir_img0.split()
  9448. ir = np.asarray(ir, dtype=float)
  9449. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9450. np.seterr(divide='ignore', invalid='ignore')
  9451. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9452. # Display the results
  9453. fig, ax = plt.subplots()
  9454. plt.plot(ndvi)
  9455. plt.axis('off')
  9456. plt.figure(figsize=(19, 10))
  9457. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9458. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9459. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9460. plt.margins(0, 0)
  9461. #plt.show()
  9462. plt.savefig(ndvis)
  9463. plt.savefig(ndvia)
  9464. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9465. plt.close('all')
  9466. f = open('/var/www/html/cust/c15_2.txt','a')
  9467. f.write(date)
  9468. f.close()
  9469. dress = '/var/www/html/cust/15/c/'
  9470. for root, dirs, files in os.walk(dress):
  9471. print('files: {}'.format(len(files)))
  9472. if len(files)>=1:
  9473. files.sort()
  9474. for f in files:
  9475. with open(os.path.join(root, f), "rb") as imageFile:
  9476. str = base64.b64encode(imageFile.read())
  9477. url = 'http://60.250.156.234/cust/t15.php'
  9478. values = {'data1':str, 'name':f}
  9479. data1 = urllib.parse.urlencode(values)
  9480. data1 = data1.encode('utf-8')
  9481. req = urllib.request.Request(url, data1)
  9482. req.add_header('User-Agent','Magic Browser')
  9483. resp = urllib.request.urlopen(req)
  9484. respdata1 = resp.read()
  9485. print(os.path.join(root, f))
  9486. #print(respdata1)
  9487. os.remove(os.path.join(root, f))
  9488. print("ok")
  9489. except:
  9490. print('error')
  9491. def img15_3():
  9492. try:
  9493. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9494. charset='utf8')
  9495. a = db.cursor()
  9496. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  9497. result = a.fetchall()
  9498. if result ==():
  9499. s =""
  9500. else:
  9501. s = "_" + result[0][3]
  9502. db.close()
  9503. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9504. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9505. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9506. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9507. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9508. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9509. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9510. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9511. date += s
  9512. label= datetime.datetime.now().strftime('No.15 Direction 3 @%Y.%m.%d.%H.%M.%S')
  9513. rgb_img0 = Image.open('/var/www/html/cust/15/c/b3.tif')
  9514. ir_img0 = Image.open('/var/www/html/cust/15/c/a3.tif')
  9515. rgb_img0.save(nt)
  9516. ir_img0.save(irt)
  9517. rgb_img0.save(nj,quality=95)
  9518. ir_img0.save(irj,quality=95)
  9519. r,_,_ = rgb_img0.split()
  9520. r = np.asarray(r, dtype=float)
  9521. ir,_,_ = ir_img0.split()
  9522. ir = np.asarray(ir, dtype=float)
  9523. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9524. np.seterr(divide='ignore', invalid='ignore')
  9525. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9526. # Display the results
  9527. fig, ax = plt.subplots()
  9528. plt.plot(ndvi)
  9529. plt.axis('off')
  9530. plt.figure(figsize=(19, 10))
  9531. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9532. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9533. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9534. plt.margins(0, 0)
  9535. #plt.show()
  9536. plt.savefig(ndvis)
  9537. plt.savefig(ndvia)
  9538. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9539. plt.close('all')
  9540. f = open('/var/www/html/cust/c15_3.txt','a')
  9541. f.write(date)
  9542. f.close()
  9543. dress = '/var/www/html/cust/15/c/'
  9544. for root, dirs, files in os.walk(dress):
  9545. print('files: {}'.format(len(files)))
  9546. if len(files)>=1:
  9547. files.sort()
  9548. for f in files:
  9549. with open(os.path.join(root, f), "rb") as imageFile:
  9550. str = base64.b64encode(imageFile.read())
  9551. url = 'http://60.250.156.234/cust/t15.php'
  9552. values = {'data1':str, 'name':f}
  9553. data1 = urllib.parse.urlencode(values)
  9554. data1 = data1.encode('utf-8')
  9555. req = urllib.request.Request(url, data1)
  9556. req.add_header('User-Agent','Magic Browser')
  9557. resp = urllib.request.urlopen(req)
  9558. respdata1 = resp.read()
  9559. print(os.path.join(root, f))
  9560. #print(respdata1)
  9561. os.remove(os.path.join(root, f))
  9562. print("ok")
  9563. except:
  9564. print('error')
  9565. def img15_4():
  9566. try:
  9567. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9568. charset='utf8')
  9569. a = db.cursor()
  9570. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  9571. result = a.fetchall()
  9572. if result ==():
  9573. s =""
  9574. else:
  9575. s = "_" + result[0][3]
  9576. db.close()
  9577. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9578. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9579. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9580. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9581. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9582. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9583. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9584. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9585. date += s
  9586. label= datetime.datetime.now().strftime('No.15 Direction 4 @%Y.%m.%d.%H.%M.%S')
  9587. rgb_img0 = Image.open('/var/www/html/cust/15/c/b4.tif')
  9588. ir_img0 = Image.open('/var/www/html/cust/15/c/a4.tif')
  9589. rgb_img0.save(nt)
  9590. ir_img0.save(irt)
  9591. rgb_img0.save(nj,quality=95)
  9592. ir_img0.save(irj,quality=95)
  9593. r,_,_ = rgb_img0.split()
  9594. r = np.asarray(r, dtype=float)
  9595. ir,_,_ = ir_img0.split()
  9596. ir = np.asarray(ir, dtype=float)
  9597. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9598. np.seterr(divide='ignore', invalid='ignore')
  9599. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9600. # Display the results
  9601. fig, ax = plt.subplots()
  9602. plt.plot(ndvi)
  9603. plt.axis('off')
  9604. plt.figure(figsize=(19, 10))
  9605. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9606. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9607. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9608. plt.margins(0, 0)
  9609. #plt.show()
  9610. plt.savefig(ndvis)
  9611. plt.savefig(ndvia)
  9612. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9613. plt.close('all')
  9614. f = open('/var/www/html/cust/c15_4.txt','a')
  9615. f.write(date)
  9616. f.close()
  9617. dress = '/var/www/html/cust/15/c/'
  9618. for root, dirs, files in os.walk(dress):
  9619. print('files: {}'.format(len(files)))
  9620. if len(files)>=1:
  9621. files.sort()
  9622. for f in files:
  9623. with open(os.path.join(root, f), "rb") as imageFile:
  9624. str = base64.b64encode(imageFile.read())
  9625. url = 'http://60.250.156.234/cust/t15.php'
  9626. values = {'data1':str, 'name':f}
  9627. data1 = urllib.parse.urlencode(values)
  9628. data1 = data1.encode('utf-8')
  9629. req = urllib.request.Request(url, data1)
  9630. req.add_header('User-Agent','Magic Browser')
  9631. resp = urllib.request.urlopen(req)
  9632. respdata1 = resp.read()
  9633. print(os.path.join(root, f))
  9634. #print(respdata1)
  9635. os.remove(os.path.join(root, f))
  9636. print("ok")
  9637. except:
  9638. print('error')
  9639. def img15_5():
  9640. try:
  9641. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9642. charset='utf8')
  9643. a = db.cursor()
  9644. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  9645. result = a.fetchall()
  9646. if result ==():
  9647. s =""
  9648. else:
  9649. s = "_" + result[0][3]
  9650. db.close()
  9651. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9652. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9653. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9654. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9655. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9656. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9657. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9658. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9659. date += s
  9660. label= datetime.datetime.now().strftime('No.15 Direction 5 @%Y.%m.%d.%H.%M.%S')
  9661. rgb_img0 = Image.open('/var/www/html/cust/15/c/b5.tif')
  9662. ir_img0 = Image.open('/var/www/html/cust/15/c/a5.tif')
  9663. rgb_img0.save(nt)
  9664. ir_img0.save(irt)
  9665. rgb_img0.save(nj,quality=95)
  9666. ir_img0.save(irj,quality=95)
  9667. r,_,_ = rgb_img0.split()
  9668. r = np.asarray(r, dtype=float)
  9669. ir,_,_ = ir_img0.split()
  9670. ir = np.asarray(ir, dtype=float)
  9671. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9672. np.seterr(divide='ignore', invalid='ignore')
  9673. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9674. # Display the results
  9675. fig, ax = plt.subplots()
  9676. plt.plot(ndvi)
  9677. plt.axis('off')
  9678. plt.figure(figsize=(19, 10))
  9679. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9680. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9681. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9682. plt.margins(0, 0)
  9683. #plt.show()
  9684. plt.savefig(ndvis)
  9685. plt.savefig(ndvia)
  9686. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9687. plt.close('all')
  9688. f = open('/var/www/html/cust/c15_5.txt','a')
  9689. f.write(date)
  9690. f.close()
  9691. dress = '/var/www/html/cust/15/c/'
  9692. for root, dirs, files in os.walk(dress):
  9693. print('files: {}'.format(len(files)))
  9694. if len(files)>=1:
  9695. files.sort()
  9696. for f in files:
  9697. with open(os.path.join(root, f), "rb") as imageFile:
  9698. str = base64.b64encode(imageFile.read())
  9699. url = 'http://60.250.156.234/cust/t15.php'
  9700. values = {'data1':str, 'name':f}
  9701. data1 = urllib.parse.urlencode(values)
  9702. data1 = data1.encode('utf-8')
  9703. req = urllib.request.Request(url, data1)
  9704. req.add_header('User-Agent','Magic Browser')
  9705. resp = urllib.request.urlopen(req)
  9706. respdata1 = resp.read()
  9707. print(os.path.join(root, f))
  9708. #print(respdata1)
  9709. os.remove(os.path.join(root, f))
  9710. print("ok")
  9711. except:
  9712. print('error')
  9713. def img15_6():
  9714. try:
  9715. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9716. charset='utf8')
  9717. a = db.cursor()
  9718. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  9719. result = a.fetchall()
  9720. if result ==():
  9721. s =""
  9722. else:
  9723. s = "_" + result[0][3]
  9724. db.close()
  9725. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9726. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9727. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9728. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9729. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9730. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9731. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9732. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9733. date += s
  9734. label= datetime.datetime.now().strftime('No.15 Direction 6 @%Y.%m.%d.%H.%M.%S')
  9735. rgb_img0 = Image.open('/var/www/html/cust/15/c/b6.tif')
  9736. ir_img0 = Image.open('/var/www/html/cust/15/c/a6.tif')
  9737. rgb_img0.save(nt)
  9738. ir_img0.save(irt)
  9739. rgb_img0.save(nj,quality=95)
  9740. ir_img0.save(irj,quality=95)
  9741. r,_,_ = rgb_img0.split()
  9742. r = np.asarray(r, dtype=float)
  9743. ir,_,_ = ir_img0.split()
  9744. ir = np.asarray(ir, dtype=float)
  9745. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9746. np.seterr(divide='ignore', invalid='ignore')
  9747. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9748. # Display the results
  9749. fig, ax = plt.subplots()
  9750. plt.plot(ndvi)
  9751. plt.axis('off')
  9752. plt.figure(figsize=(19, 10))
  9753. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9754. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9755. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9756. plt.margins(0, 0)
  9757. #plt.show()
  9758. plt.savefig(ndvis)
  9759. plt.savefig(ndvia)
  9760. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9761. plt.close('all')
  9762. f = open('/var/www/html/cust/c15_6.txt','a')
  9763. f.write(date)
  9764. f.close()
  9765. dress = '/var/www/html/cust/15/c/'
  9766. for root, dirs, files in os.walk(dress):
  9767. print('files: {}'.format(len(files)))
  9768. if len(files)>=1:
  9769. files.sort()
  9770. for f in files:
  9771. with open(os.path.join(root, f), "rb") as imageFile:
  9772. str = base64.b64encode(imageFile.read())
  9773. url = 'http://60.250.156.234/cust/t15.php'
  9774. values = {'data1':str, 'name':f}
  9775. data1 = urllib.parse.urlencode(values)
  9776. data1 = data1.encode('utf-8')
  9777. req = urllib.request.Request(url, data1)
  9778. req.add_header('User-Agent','Magic Browser')
  9779. resp = urllib.request.urlopen(req)
  9780. respdata1 = resp.read()
  9781. print(os.path.join(root, f))
  9782. #print(respdata1)
  9783. os.remove(os.path.join(root, f))
  9784. print("ok")
  9785. except:
  9786. print('error')
  9787. def img15_7():
  9788. try:
  9789. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9790. charset='utf8')
  9791. a = db.cursor()
  9792. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  9793. result = a.fetchall()
  9794. if result ==():
  9795. s =""
  9796. else:
  9797. s = "_" + result[0][3]
  9798. db.close()
  9799. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9800. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9801. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9802. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9803. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9804. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9805. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9806. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9807. date += s
  9808. label= datetime.datetime.now().strftime('No.15 Direction 7 @%Y.%m.%d.%H.%M.%S')
  9809. rgb_img0 = Image.open('/var/www/html/cust/15/c/b7.tif')
  9810. ir_img0 = Image.open('/var/www/html/cust/15/c/a7.tif')
  9811. rgb_img0.save(nt)
  9812. ir_img0.save(irt)
  9813. rgb_img0.save(nj,quality=95)
  9814. ir_img0.save(irj,quality=95)
  9815. r,_,_ = rgb_img0.split()
  9816. r = np.asarray(r, dtype=float)
  9817. ir,_,_ = ir_img0.split()
  9818. ir = np.asarray(ir, dtype=float)
  9819. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9820. np.seterr(divide='ignore', invalid='ignore')
  9821. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9822. # Display the results
  9823. fig, ax = plt.subplots()
  9824. plt.plot(ndvi)
  9825. plt.axis('off')
  9826. plt.figure(figsize=(19, 10))
  9827. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9828. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9829. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9830. plt.margins(0, 0)
  9831. #plt.show()
  9832. plt.savefig(ndvis)
  9833. plt.savefig(ndvia)
  9834. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9835. plt.close('all')
  9836. f = open('/var/www/html/cust/c15_7.txt','a')
  9837. f.write(date)
  9838. f.close()
  9839. dress = '/var/www/html/cust/15/c/'
  9840. for root, dirs, files in os.walk(dress):
  9841. print('files: {}'.format(len(files)))
  9842. if len(files)>=1:
  9843. files.sort()
  9844. for f in files:
  9845. with open(os.path.join(root, f), "rb") as imageFile:
  9846. str = base64.b64encode(imageFile.read())
  9847. url = 'http://60.250.156.234/cust/t15.php'
  9848. values = {'data1':str, 'name':f}
  9849. data1 = urllib.parse.urlencode(values)
  9850. data1 = data1.encode('utf-8')
  9851. req = urllib.request.Request(url, data1)
  9852. req.add_header('User-Agent','Magic Browser')
  9853. resp = urllib.request.urlopen(req)
  9854. respdata1 = resp.read()
  9855. print(os.path.join(root, f))
  9856. #print(respdata1)
  9857. os.remove(os.path.join(root, f))
  9858. print("ok")
  9859. except:
  9860. print('error')
  9861. def img15_8():
  9862. try:
  9863. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9864. charset='utf8')
  9865. a = db.cursor()
  9866. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  9867. result = a.fetchall()
  9868. if result ==():
  9869. s =""
  9870. else:
  9871. s = "_" + result[0][3]
  9872. db.close()
  9873. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9874. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9875. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9876. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9877. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9878. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9879. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9880. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9881. date += s
  9882. label= datetime.datetime.now().strftime('No.15 Direction 8 @%Y.%m.%d.%H.%M.%S')
  9883. rgb_img0 = Image.open('/var/www/html/cust/15/c/b8.tif')
  9884. ir_img0 = Image.open('/var/www/html/cust/15/c/a8.tif')
  9885. rgb_img0.save(nt)
  9886. ir_img0.save(irt)
  9887. rgb_img0.save(nj,quality=95)
  9888. ir_img0.save(irj,quality=95)
  9889. r,_,_ = rgb_img0.split()
  9890. r = np.asarray(r, dtype=float)
  9891. ir,_,_ = ir_img0.split()
  9892. ir = np.asarray(ir, dtype=float)
  9893. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9894. np.seterr(divide='ignore', invalid='ignore')
  9895. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9896. # Display the results
  9897. fig, ax = plt.subplots()
  9898. plt.plot(ndvi)
  9899. plt.axis('off')
  9900. plt.figure(figsize=(19, 10))
  9901. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9902. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9903. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9904. plt.margins(0, 0)
  9905. #plt.show()
  9906. plt.savefig(ndvis)
  9907. plt.savefig(ndvia)
  9908. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9909. plt.close('all')
  9910. f = open('/var/www/html/cust/c15_8.txt','a')
  9911. f.write(date)
  9912. f.close()
  9913. dress = '/var/www/html/cust/15/c/'
  9914. for root, dirs, files in os.walk(dress):
  9915. print('files: {}'.format(len(files)))
  9916. if len(files)>=1:
  9917. files.sort()
  9918. for f in files:
  9919. with open(os.path.join(root, f), "rb") as imageFile:
  9920. str = base64.b64encode(imageFile.read())
  9921. url = 'http://60.250.156.234/cust/t15.php'
  9922. values = {'data1':str, 'name':f}
  9923. data1 = urllib.parse.urlencode(values)
  9924. data1 = data1.encode('utf-8')
  9925. req = urllib.request.Request(url, data1)
  9926. req.add_header('User-Agent','Magic Browser')
  9927. resp = urllib.request.urlopen(req)
  9928. respdata1 = resp.read()
  9929. print(os.path.join(root, f))
  9930. #print(respdata1)
  9931. os.remove(os.path.join(root, f))
  9932. print("ok")
  9933. except:
  9934. print('error')
  9935. def img15_9():
  9936. try:
  9937. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  9938. charset='utf8')
  9939. a = db.cursor()
  9940. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002015' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  9941. result = a.fetchall()
  9942. if result ==():
  9943. s =""
  9944. else:
  9945. s = "_" + result[0][3]
  9946. db.close()
  9947. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  9948. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  9949. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/15/ndvia/c.png') #ndvi is c.png
  9950. irt = datetime.datetime.now().strftime('/var/www/html/cust/15/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  9951. nt = datetime.datetime.now().strftime('/var/www/html/cust/15/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  9952. irj = datetime.datetime.now().strftime('/var/www/html/cust/15/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  9953. nj = datetime.datetime.now().strftime('/var/www/html/cust/15/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  9954. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  9955. date += s
  9956. label= datetime.datetime.now().strftime('No.15 Direction 0 @%Y.%m.%d.%H.%M.%S')
  9957. rgb_img0 = Image.open('/var/www/html/cust/15/c/b.tif')
  9958. ir_img0 = Image.open('/var/www/html/cust/15/c/a.tif')
  9959. rgb_img0.save(nt)
  9960. ir_img0.save(irt)
  9961. rgb_img0.save(nj,quality=95)
  9962. ir_img0.save(irj,quality=95)
  9963. r,_,_ = rgb_img0.split()
  9964. r = np.asarray(r, dtype=float)
  9965. ir,_,_ = ir_img0.split()
  9966. ir = np.asarray(ir, dtype=float)
  9967. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  9968. np.seterr(divide='ignore', invalid='ignore')
  9969. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  9970. # Display the results
  9971. fig, ax = plt.subplots()
  9972. plt.plot(ndvi)
  9973. plt.axis('off')
  9974. plt.figure(figsize=(19, 10))
  9975. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  9976. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  9977. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  9978. plt.margins(0, 0)
  9979. #plt.show()
  9980. plt.savefig(ndvis)
  9981. plt.savefig(ndvia)
  9982. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  9983. plt.close('all')
  9984. f = open('/var/www/html/cust/c15.txt','a')
  9985. f.write(date)
  9986. f.close()
  9987. dress = '/var/www/html/cust/15/c/'
  9988. for root, dirs, files in os.walk(dress):
  9989. print('files: {}'.format(len(files)))
  9990. if len(files)>=1:
  9991. files.sort()
  9992. for f in files:
  9993. with open(os.path.join(root, f), "rb") as imageFile:
  9994. str = base64.b64encode(imageFile.read())
  9995. url = 'http://60.250.156.234/cust/t15.php'
  9996. values = {'data1':str, 'name':f}
  9997. data1 = urllib.parse.urlencode(values)
  9998. data1 = data1.encode('utf-8')
  9999. req = urllib.request.Request(url, data1)
  10000. req.add_header('User-Agent','Magic Browser')
  10001. resp = urllib.request.urlopen(req)
  10002. respdata1 = resp.read()
  10003. print(os.path.join(root, f))
  10004. #print(respdata1)
  10005. os.remove(os.path.join(root, f))
  10006. print("ok")
  10007. except:
  10008. print('error')
  10009. def img16_1():
  10010. try:
  10011. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10012. charset='utf8')
  10013. a = db.cursor()
  10014. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  10015. result = a.fetchall()
  10016. if result ==():
  10017. s =""
  10018. else:
  10019. s = "_" + result[0][3]
  10020. db.close()
  10021. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10022. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10023. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10024. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10025. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10026. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10027. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10028. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10029. date += s
  10030. label= datetime.datetime.now().strftime('No.16 Direction 1 @%Y.%m.%d.%H.%M.%S')
  10031. rgb_img0 = Image.open('/var/www/html/cust/16/c/b1.tif')
  10032. ir_img0 = Image.open('/var/www/html/cust/16/c/a1.tif')
  10033. rgb_img0.save(nt)
  10034. ir_img0.save(irt)
  10035. rgb_img0.save(nj,quality=95)
  10036. ir_img0.save(irj,quality=95)
  10037. r,_,_ = rgb_img0.split()
  10038. r = np.asarray(r, dtype=float)
  10039. ir,_,_ = ir_img0.split()
  10040. ir = np.asarray(ir, dtype=float)
  10041. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10042. np.seterr(divide='ignore', invalid='ignore')
  10043. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10044. # Display the results
  10045. fig, ax = plt.subplots()
  10046. plt.plot(ndvi)
  10047. plt.axis('off')
  10048. plt.figure(figsize=(19, 10))
  10049. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10050. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10051. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10052. plt.margins(0, 0)
  10053. #plt.show()
  10054. plt.savefig(ndvis)
  10055. plt.savefig(ndvia)
  10056. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10057. plt.close('all')
  10058. f = open('/var/www/html/cust/c16_1.txt','a')
  10059. f.write(date)
  10060. f.close()
  10061. dress = '/var/www/html/cust/16/c/'
  10062. for root, dirs, files in os.walk(dress):
  10063. print('files: {}'.format(len(files)))
  10064. if len(files)>=1:
  10065. files.sort()
  10066. for f in files:
  10067. with open(os.path.join(root, f), "rb") as imageFile:
  10068. str = base64.b64encode(imageFile.read())
  10069. url = 'http://60.250.156.234/cust/t16.php'
  10070. values = {'data1':str, 'name':f}
  10071. data1 = urllib.parse.urlencode(values)
  10072. data1 = data1.encode('utf-8')
  10073. req = urllib.request.Request(url, data1)
  10074. req.add_header('User-Agent','Magic Browser')
  10075. resp = urllib.request.urlopen(req)
  10076. respdata1 = resp.read()
  10077. print(os.path.join(root, f))
  10078. #print(respdata1)
  10079. os.remove(os.path.join(root, f))
  10080. print("ok")
  10081. except:
  10082. print('error')
  10083. def img16_2():
  10084. try:
  10085. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10086. charset='utf8')
  10087. a = db.cursor()
  10088. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  10089. result = a.fetchall()
  10090. if result ==():
  10091. s =""
  10092. else:
  10093. s = "_" + result[0][3]
  10094. db.close()
  10095. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10096. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10097. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10098. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10099. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10100. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10101. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10102. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10103. date += s
  10104. label= datetime.datetime.now().strftime('No.16 Direction 2 @%Y.%m.%d.%H.%M.%S')
  10105. rgb_img0 = Image.open('/var/www/html/cust/16/c/b2.tif')
  10106. ir_img0 = Image.open('/var/www/html/cust/16/c/a2.tif')
  10107. rgb_img0.save(nt)
  10108. ir_img0.save(irt)
  10109. rgb_img0.save(nj,quality=95)
  10110. ir_img0.save(irj,quality=95)
  10111. r,_,_ = rgb_img0.split()
  10112. r = np.asarray(r, dtype=float)
  10113. ir,_,_ = ir_img0.split()
  10114. ir = np.asarray(ir, dtype=float)
  10115. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10116. np.seterr(divide='ignore', invalid='ignore')
  10117. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10118. # Display the results
  10119. fig, ax = plt.subplots()
  10120. plt.plot(ndvi)
  10121. plt.axis('off')
  10122. plt.figure(figsize=(19, 10))
  10123. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10124. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10125. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10126. plt.margins(0, 0)
  10127. #plt.show()
  10128. plt.savefig(ndvis)
  10129. plt.savefig(ndvia)
  10130. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10131. plt.close('all')
  10132. f = open('/var/www/html/cust/c16_2.txt','a')
  10133. f.write(date)
  10134. f.close()
  10135. dress = '/var/www/html/cust/16/c/'
  10136. for root, dirs, files in os.walk(dress):
  10137. print('files: {}'.format(len(files)))
  10138. if len(files)>=1:
  10139. files.sort()
  10140. for f in files:
  10141. with open(os.path.join(root, f), "rb") as imageFile:
  10142. str = base64.b64encode(imageFile.read())
  10143. url = 'http://60.250.156.234/cust/t16.php'
  10144. values = {'data1':str, 'name':f}
  10145. data1 = urllib.parse.urlencode(values)
  10146. data1 = data1.encode('utf-8')
  10147. req = urllib.request.Request(url, data1)
  10148. req.add_header('User-Agent','Magic Browser')
  10149. resp = urllib.request.urlopen(req)
  10150. respdata1 = resp.read()
  10151. print(os.path.join(root, f))
  10152. #print(respdata1)
  10153. os.remove(os.path.join(root, f))
  10154. print("ok")
  10155. except:
  10156. print('error')
  10157. def img16_3():
  10158. try:
  10159. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10160. charset='utf8')
  10161. a = db.cursor()
  10162. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  10163. result = a.fetchall()
  10164. if result ==():
  10165. s =""
  10166. else:
  10167. s = "_" + result[0][3]
  10168. db.close()
  10169. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10170. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10171. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10172. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10173. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10174. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10175. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10176. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10177. date += s
  10178. label= datetime.datetime.now().strftime('No.16 Direction 3 @%Y.%m.%d.%H.%M.%S')
  10179. rgb_img0 = Image.open('/var/www/html/cust/16/c/b3.tif')
  10180. ir_img0 = Image.open('/var/www/html/cust/16/c/a3.tif')
  10181. rgb_img0.save(nt)
  10182. ir_img0.save(irt)
  10183. rgb_img0.save(nj,quality=95)
  10184. ir_img0.save(irj,quality=95)
  10185. r,_,_ = rgb_img0.split()
  10186. r = np.asarray(r, dtype=float)
  10187. ir,_,_ = ir_img0.split()
  10188. ir = np.asarray(ir, dtype=float)
  10189. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10190. np.seterr(divide='ignore', invalid='ignore')
  10191. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10192. # Display the results
  10193. fig, ax = plt.subplots()
  10194. plt.plot(ndvi)
  10195. plt.axis('off')
  10196. plt.figure(figsize=(19, 10))
  10197. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10198. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10199. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10200. plt.margins(0, 0)
  10201. #plt.show()
  10202. plt.savefig(ndvis)
  10203. plt.savefig(ndvia)
  10204. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10205. plt.close('all')
  10206. f = open('/var/www/html/cust/c16_3.txt','a')
  10207. f.write(date)
  10208. f.close()
  10209. dress = '/var/www/html/cust/16/c/'
  10210. for root, dirs, files in os.walk(dress):
  10211. print('files: {}'.format(len(files)))
  10212. if len(files)>=1:
  10213. files.sort()
  10214. for f in files:
  10215. with open(os.path.join(root, f), "rb") as imageFile:
  10216. str = base64.b64encode(imageFile.read())
  10217. url = 'http://60.250.156.234/cust/t16.php'
  10218. values = {'data1':str, 'name':f}
  10219. data1 = urllib.parse.urlencode(values)
  10220. data1 = data1.encode('utf-8')
  10221. req = urllib.request.Request(url, data1)
  10222. req.add_header('User-Agent','Magic Browser')
  10223. resp = urllib.request.urlopen(req)
  10224. respdata1 = resp.read()
  10225. print(os.path.join(root, f))
  10226. #print(respdata1)
  10227. os.remove(os.path.join(root, f))
  10228. print("ok")
  10229. except:
  10230. print('error')
  10231. def img16_4():
  10232. try:
  10233. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10234. charset='utf8')
  10235. a = db.cursor()
  10236. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  10237. result = a.fetchall()
  10238. if result ==():
  10239. s =""
  10240. else:
  10241. s = "_" + result[0][3]
  10242. db.close()
  10243. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10244. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10245. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10246. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10247. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10248. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10249. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10250. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10251. date += s
  10252. label= datetime.datetime.now().strftime('No.16 Direction 4 @%Y.%m.%d.%H.%M.%S')
  10253. rgb_img0 = Image.open('/var/www/html/cust/16/c/b4.tif')
  10254. ir_img0 = Image.open('/var/www/html/cust/16/c/a4.tif')
  10255. rgb_img0.save(nt)
  10256. ir_img0.save(irt)
  10257. rgb_img0.save(nj,quality=95)
  10258. ir_img0.save(irj,quality=95)
  10259. r,_,_ = rgb_img0.split()
  10260. r = np.asarray(r, dtype=float)
  10261. ir,_,_ = ir_img0.split()
  10262. ir = np.asarray(ir, dtype=float)
  10263. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10264. np.seterr(divide='ignore', invalid='ignore')
  10265. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10266. # Display the results
  10267. fig, ax = plt.subplots()
  10268. plt.plot(ndvi)
  10269. plt.axis('off')
  10270. plt.figure(figsize=(19, 10))
  10271. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10272. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10273. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10274. plt.margins(0, 0)
  10275. #plt.show()
  10276. plt.savefig(ndvis)
  10277. plt.savefig(ndvia)
  10278. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10279. plt.close('all')
  10280. f = open('/var/www/html/cust/c16_4.txt','a')
  10281. f.write(date)
  10282. f.close()
  10283. dress = '/var/www/html/cust/16/c/'
  10284. for root, dirs, files in os.walk(dress):
  10285. print('files: {}'.format(len(files)))
  10286. if len(files)>=1:
  10287. files.sort()
  10288. for f in files:
  10289. with open(os.path.join(root, f), "rb") as imageFile:
  10290. str = base64.b64encode(imageFile.read())
  10291. url = 'http://60.250.156.234/cust/t16.php'
  10292. values = {'data1':str, 'name':f}
  10293. data1 = urllib.parse.urlencode(values)
  10294. data1 = data1.encode('utf-8')
  10295. req = urllib.request.Request(url, data1)
  10296. req.add_header('User-Agent','Magic Browser')
  10297. resp = urllib.request.urlopen(req)
  10298. respdata1 = resp.read()
  10299. print(os.path.join(root, f))
  10300. #print(respdata1)
  10301. os.remove(os.path.join(root, f))
  10302. print("ok")
  10303. except:
  10304. print('error')
  10305. def img16_5():
  10306. try:
  10307. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10308. charset='utf8')
  10309. a = db.cursor()
  10310. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  10311. result = a.fetchall()
  10312. if result ==():
  10313. s =""
  10314. else:
  10315. s = "_" + result[0][3]
  10316. db.close()
  10317. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10318. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10319. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10320. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10321. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10322. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10323. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10324. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10325. date += s
  10326. label= datetime.datetime.now().strftime('No.16 Direction 5 @%Y.%m.%d.%H.%M.%S')
  10327. rgb_img0 = Image.open('/var/www/html/cust/16/c/b5.tif')
  10328. ir_img0 = Image.open('/var/www/html/cust/16/c/a5.tif')
  10329. rgb_img0.save(nt)
  10330. ir_img0.save(irt)
  10331. rgb_img0.save(nj,quality=95)
  10332. ir_img0.save(irj,quality=95)
  10333. r,_,_ = rgb_img0.split()
  10334. r = np.asarray(r, dtype=float)
  10335. ir,_,_ = ir_img0.split()
  10336. ir = np.asarray(ir, dtype=float)
  10337. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10338. np.seterr(divide='ignore', invalid='ignore')
  10339. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10340. # Display the results
  10341. fig, ax = plt.subplots()
  10342. plt.plot(ndvi)
  10343. plt.axis('off')
  10344. plt.figure(figsize=(19, 10))
  10345. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10346. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10347. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10348. plt.margins(0, 0)
  10349. #plt.show()
  10350. plt.savefig(ndvis)
  10351. plt.savefig(ndvia)
  10352. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10353. plt.close('all')
  10354. f = open('/var/www/html/cust/c16_5.txt','a')
  10355. f.write(date)
  10356. f.close()
  10357. dress = '/var/www/html/cust/16/c/'
  10358. for root, dirs, files in os.walk(dress):
  10359. print('files: {}'.format(len(files)))
  10360. if len(files)>=1:
  10361. files.sort()
  10362. for f in files:
  10363. with open(os.path.join(root, f), "rb") as imageFile:
  10364. str = base64.b64encode(imageFile.read())
  10365. url = 'http://60.250.156.234/cust/t16.php'
  10366. values = {'data1':str, 'name':f}
  10367. data1 = urllib.parse.urlencode(values)
  10368. data1 = data1.encode('utf-8')
  10369. req = urllib.request.Request(url, data1)
  10370. req.add_header('User-Agent','Magic Browser')
  10371. resp = urllib.request.urlopen(req)
  10372. respdata1 = resp.read()
  10373. print(os.path.join(root, f))
  10374. #print(respdata1)
  10375. os.remove(os.path.join(root, f))
  10376. print("ok")
  10377. except:
  10378. print('error')
  10379. def img16_6():
  10380. try:
  10381. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10382. charset='utf8')
  10383. a = db.cursor()
  10384. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  10385. result = a.fetchall()
  10386. if result ==():
  10387. s =""
  10388. else:
  10389. s = "_" + result[0][3]
  10390. db.close()
  10391. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10392. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10393. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10394. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10395. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10396. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10397. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10398. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10399. date += s
  10400. label= datetime.datetime.now().strftime('No.16 Direction 6 @%Y.%m.%d.%H.%M.%S')
  10401. rgb_img0 = Image.open('/var/www/html/cust/16/c/b6.tif')
  10402. ir_img0 = Image.open('/var/www/html/cust/16/c/a6.tif')
  10403. rgb_img0.save(nt)
  10404. ir_img0.save(irt)
  10405. rgb_img0.save(nj,quality=95)
  10406. ir_img0.save(irj,quality=95)
  10407. r,_,_ = rgb_img0.split()
  10408. r = np.asarray(r, dtype=float)
  10409. ir,_,_ = ir_img0.split()
  10410. ir = np.asarray(ir, dtype=float)
  10411. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10412. np.seterr(divide='ignore', invalid='ignore')
  10413. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10414. # Display the results
  10415. fig, ax = plt.subplots()
  10416. plt.plot(ndvi)
  10417. plt.axis('off')
  10418. plt.figure(figsize=(19, 10))
  10419. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10420. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10421. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10422. plt.margins(0, 0)
  10423. #plt.show()
  10424. plt.savefig(ndvis)
  10425. plt.savefig(ndvia)
  10426. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10427. plt.close('all')
  10428. f = open('/var/www/html/cust/c16_6.txt','a')
  10429. f.write(date)
  10430. f.close()
  10431. dress = '/var/www/html/cust/16/c/'
  10432. for root, dirs, files in os.walk(dress):
  10433. print('files: {}'.format(len(files)))
  10434. if len(files)>=1:
  10435. files.sort()
  10436. for f in files:
  10437. with open(os.path.join(root, f), "rb") as imageFile:
  10438. str = base64.b64encode(imageFile.read())
  10439. url = 'http://60.250.156.234/cust/t16.php'
  10440. values = {'data1':str, 'name':f}
  10441. data1 = urllib.parse.urlencode(values)
  10442. data1 = data1.encode('utf-8')
  10443. req = urllib.request.Request(url, data1)
  10444. req.add_header('User-Agent','Magic Browser')
  10445. resp = urllib.request.urlopen(req)
  10446. respdata1 = resp.read()
  10447. print(os.path.join(root, f))
  10448. #print(respdata1)
  10449. os.remove(os.path.join(root, f))
  10450. print("ok")
  10451. except:
  10452. print('error')
  10453. def img16_7():
  10454. try:
  10455. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10456. charset='utf8')
  10457. a = db.cursor()
  10458. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  10459. result = a.fetchall()
  10460. if result ==():
  10461. s =""
  10462. else:
  10463. s = "_" + result[0][3]
  10464. db.close()
  10465. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10466. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10467. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10468. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10469. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10470. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10471. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10472. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10473. date += s
  10474. label= datetime.datetime.now().strftime('No.16 Direction 7 @%Y.%m.%d.%H.%M.%S')
  10475. rgb_img0 = Image.open('/var/www/html/cust/16/c/b7.tif')
  10476. ir_img0 = Image.open('/var/www/html/cust/16/c/a7.tif')
  10477. rgb_img0.save(nt)
  10478. ir_img0.save(irt)
  10479. rgb_img0.save(nj,quality=95)
  10480. ir_img0.save(irj,quality=95)
  10481. r,_,_ = rgb_img0.split()
  10482. r = np.asarray(r, dtype=float)
  10483. ir,_,_ = ir_img0.split()
  10484. ir = np.asarray(ir, dtype=float)
  10485. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10486. np.seterr(divide='ignore', invalid='ignore')
  10487. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10488. # Display the results
  10489. fig, ax = plt.subplots()
  10490. plt.plot(ndvi)
  10491. plt.axis('off')
  10492. plt.figure(figsize=(19, 10))
  10493. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10494. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10495. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10496. plt.margins(0, 0)
  10497. #plt.show()
  10498. plt.savefig(ndvis)
  10499. plt.savefig(ndvia)
  10500. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10501. plt.close('all')
  10502. f = open('/var/www/html/cust/c16_7.txt','a')
  10503. f.write(date)
  10504. f.close()
  10505. dress = '/var/www/html/cust/16/c/'
  10506. for root, dirs, files in os.walk(dress):
  10507. print('files: {}'.format(len(files)))
  10508. if len(files)>=1:
  10509. files.sort()
  10510. for f in files:
  10511. with open(os.path.join(root, f), "rb") as imageFile:
  10512. str = base64.b64encode(imageFile.read())
  10513. url = 'http://60.250.156.234/cust/t16.php'
  10514. values = {'data1':str, 'name':f}
  10515. data1 = urllib.parse.urlencode(values)
  10516. data1 = data1.encode('utf-8')
  10517. req = urllib.request.Request(url, data1)
  10518. req.add_header('User-Agent','Magic Browser')
  10519. resp = urllib.request.urlopen(req)
  10520. respdata1 = resp.read()
  10521. print(os.path.join(root, f))
  10522. #print(respdata1)
  10523. os.remove(os.path.join(root, f))
  10524. print("ok")
  10525. except:
  10526. print('error')
  10527. def img16_8():
  10528. try:
  10529. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10530. charset='utf8')
  10531. a = db.cursor()
  10532. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  10533. result = a.fetchall()
  10534. if result ==():
  10535. s =""
  10536. else:
  10537. s = "_" + result[0][3]
  10538. db.close()
  10539. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10540. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10541. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10542. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10543. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10544. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10545. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10546. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10547. date += s
  10548. label= datetime.datetime.now().strftime('No.16 Direction 8 @%Y.%m.%d.%H.%M.%S')
  10549. rgb_img0 = Image.open('/var/www/html/cust/16/c/b8.tif')
  10550. ir_img0 = Image.open('/var/www/html/cust/16/c/a8.tif')
  10551. rgb_img0.save(nt)
  10552. ir_img0.save(irt)
  10553. rgb_img0.save(nj,quality=95)
  10554. ir_img0.save(irj,quality=95)
  10555. r,_,_ = rgb_img0.split()
  10556. r = np.asarray(r, dtype=float)
  10557. ir,_,_ = ir_img0.split()
  10558. ir = np.asarray(ir, dtype=float)
  10559. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10560. np.seterr(divide='ignore', invalid='ignore')
  10561. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10562. # Display the results
  10563. fig, ax = plt.subplots()
  10564. plt.plot(ndvi)
  10565. plt.axis('off')
  10566. plt.figure(figsize=(19, 10))
  10567. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10568. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10569. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10570. plt.margins(0, 0)
  10571. #plt.show()
  10572. plt.savefig(ndvis)
  10573. plt.savefig(ndvia)
  10574. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10575. plt.close('all')
  10576. f = open('/var/www/html/cust/c16_8.txt','a')
  10577. f.write(date)
  10578. f.close()
  10579. dress = '/var/www/html/cust/16/c/'
  10580. for root, dirs, files in os.walk(dress):
  10581. print('files: {}'.format(len(files)))
  10582. if len(files)>=1:
  10583. files.sort()
  10584. for f in files:
  10585. with open(os.path.join(root, f), "rb") as imageFile:
  10586. str = base64.b64encode(imageFile.read())
  10587. url = 'http://60.250.156.234/cust/t16.php'
  10588. values = {'data1':str, 'name':f}
  10589. data1 = urllib.parse.urlencode(values)
  10590. data1 = data1.encode('utf-8')
  10591. req = urllib.request.Request(url, data1)
  10592. req.add_header('User-Agent','Magic Browser')
  10593. resp = urllib.request.urlopen(req)
  10594. respdata1 = resp.read()
  10595. print(os.path.join(root, f))
  10596. #print(respdata1)
  10597. os.remove(os.path.join(root, f))
  10598. print("ok")
  10599. except:
  10600. print('error')
  10601. def img16_9():
  10602. try:
  10603. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10604. charset='utf8')
  10605. a = db.cursor()
  10606. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002016' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  10607. result = a.fetchall()
  10608. if result ==():
  10609. s =""
  10610. else:
  10611. s = "_" + result[0][3]
  10612. db.close()
  10613. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10614. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10615. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/16/ndvia/c.png') #ndvi is c.png
  10616. irt = datetime.datetime.now().strftime('/var/www/html/cust/16/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10617. nt = datetime.datetime.now().strftime('/var/www/html/cust/16/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10618. irj = datetime.datetime.now().strftime('/var/www/html/cust/16/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10619. nj = datetime.datetime.now().strftime('/var/www/html/cust/16/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10620. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10621. date += s
  10622. label= datetime.datetime.now().strftime('No.16 Direction 0 @%Y.%m.%d.%H.%M.%S')
  10623. rgb_img0 = Image.open('/var/www/html/cust/16/c/b.tif')
  10624. ir_img0 = Image.open('/var/www/html/cust/16/c/a.tif')
  10625. rgb_img0.save(nt)
  10626. ir_img0.save(irt)
  10627. rgb_img0.save(nj,quality=95)
  10628. ir_img0.save(irj,quality=95)
  10629. r,_,_ = rgb_img0.split()
  10630. r = np.asarray(r, dtype=float)
  10631. ir,_,_ = ir_img0.split()
  10632. ir = np.asarray(ir, dtype=float)
  10633. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10634. np.seterr(divide='ignore', invalid='ignore')
  10635. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10636. # Display the results
  10637. fig, ax = plt.subplots()
  10638. plt.plot(ndvi)
  10639. plt.axis('off')
  10640. plt.figure(figsize=(19, 10))
  10641. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10642. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10643. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10644. plt.margins(0, 0)
  10645. #plt.show()
  10646. plt.savefig(ndvis)
  10647. plt.savefig(ndvia)
  10648. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10649. plt.close('all')
  10650. f = open('/var/www/html/cust/c16.txt','a')
  10651. f.write(date)
  10652. f.close()
  10653. dress = '/var/www/html/cust/16/c/'
  10654. for root, dirs, files in os.walk(dress):
  10655. print('files: {}'.format(len(files)))
  10656. if len(files)>=1:
  10657. files.sort()
  10658. for f in files:
  10659. with open(os.path.join(root, f), "rb") as imageFile:
  10660. str = base64.b64encode(imageFile.read())
  10661. url = 'http://60.250.156.234/cust/t16.php'
  10662. values = {'data1':str, 'name':f}
  10663. data1 = urllib.parse.urlencode(values)
  10664. data1 = data1.encode('utf-8')
  10665. req = urllib.request.Request(url, data1)
  10666. req.add_header('User-Agent','Magic Browser')
  10667. resp = urllib.request.urlopen(req)
  10668. respdata1 = resp.read()
  10669. print(os.path.join(root, f))
  10670. #print(respdata1)
  10671. os.remove(os.path.join(root, f))
  10672. print("ok")
  10673. except:
  10674. print('error')
  10675. def img17_1():
  10676. try:
  10677. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10678. charset='utf8')
  10679. a = db.cursor()
  10680. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  10681. result = a.fetchall()
  10682. if result ==():
  10683. s =""
  10684. else:
  10685. s = "_" + result[0][3]
  10686. db.close()
  10687. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10688. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10689. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  10690. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10691. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10692. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10693. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10694. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10695. date += s
  10696. label= datetime.datetime.now().strftime('No.17 Direction 1 @%Y.%m.%d.%H.%M.%S')
  10697. rgb_img0 = Image.open('/var/www/html/cust/17/c/b1.tif')
  10698. ir_img0 = Image.open('/var/www/html/cust/17/c/a1.tif')
  10699. rgb_img0.save(nt)
  10700. ir_img0.save(irt)
  10701. rgb_img0.save(nj,quality=95)
  10702. ir_img0.save(irj,quality=95)
  10703. r,_,_ = rgb_img0.split()
  10704. r = np.asarray(r, dtype=float)
  10705. ir,_,_ = ir_img0.split()
  10706. ir = np.asarray(ir, dtype=float)
  10707. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10708. np.seterr(divide='ignore', invalid='ignore')
  10709. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10710. # Display the results
  10711. fig, ax = plt.subplots()
  10712. plt.plot(ndvi)
  10713. plt.axis('off')
  10714. plt.figure(figsize=(19, 10))
  10715. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10716. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10717. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10718. plt.margins(0, 0)
  10719. #plt.show()
  10720. plt.savefig(ndvis)
  10721. plt.savefig(ndvia)
  10722. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10723. plt.close('all')
  10724. f = open('/var/www/html/cust/c17_1.txt','a')
  10725. f.write(date)
  10726. f.close()
  10727. dress = '/var/www/html/cust/17/c/'
  10728. for root, dirs, files in os.walk(dress):
  10729. print('files: {}'.format(len(files)))
  10730. if len(files)>=1:
  10731. files.sort()
  10732. for f in files:
  10733. with open(os.path.join(root, f), "rb") as imageFile:
  10734. str = base64.b64encode(imageFile.read())
  10735. url = 'http://60.250.156.234/cust/t17.php'
  10736. values = {'data1':str, 'name':f}
  10737. data1 = urllib.parse.urlencode(values)
  10738. data1 = data1.encode('utf-8')
  10739. req = urllib.request.Request(url, data1)
  10740. req.add_header('User-Agent','Magic Browser')
  10741. resp = urllib.request.urlopen(req)
  10742. respdata1 = resp.read()
  10743. print(os.path.join(root, f))
  10744. #print(respdata1)
  10745. os.remove(os.path.join(root, f))
  10746. print("ok")
  10747. except:
  10748. print('error')
  10749. def img17_2():
  10750. try:
  10751. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10752. charset='utf8')
  10753. a = db.cursor()
  10754. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  10755. result = a.fetchall()
  10756. if result ==():
  10757. s =""
  10758. else:
  10759. s = "_" + result[0][3]
  10760. db.close()
  10761. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10762. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10763. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  10764. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10765. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10766. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10767. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10768. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10769. date += s
  10770. label= datetime.datetime.now().strftime('No.17 Direction 2 @%Y.%m.%d.%H.%M.%S')
  10771. rgb_img0 = Image.open('/var/www/html/cust/17/c/b2.tif')
  10772. ir_img0 = Image.open('/var/www/html/cust/17/c/a2.tif')
  10773. rgb_img0.save(nt)
  10774. ir_img0.save(irt)
  10775. rgb_img0.save(nj,quality=95)
  10776. ir_img0.save(irj,quality=95)
  10777. r,_,_ = rgb_img0.split()
  10778. r = np.asarray(r, dtype=float)
  10779. ir,_,_ = ir_img0.split()
  10780. ir = np.asarray(ir, dtype=float)
  10781. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10782. np.seterr(divide='ignore', invalid='ignore')
  10783. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10784. # Display the results
  10785. fig, ax = plt.subplots()
  10786. plt.plot(ndvi)
  10787. plt.axis('off')
  10788. plt.figure(figsize=(19, 10))
  10789. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10790. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10791. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10792. plt.margins(0, 0)
  10793. #plt.show()
  10794. plt.savefig(ndvis)
  10795. plt.savefig(ndvia)
  10796. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10797. plt.close('all')
  10798. f = open('/var/www/html/cust/c17_2.txt','a')
  10799. f.write(date)
  10800. f.close()
  10801. dress = '/var/www/html/cust/17/c/'
  10802. for root, dirs, files in os.walk(dress):
  10803. print('files: {}'.format(len(files)))
  10804. if len(files)>=1:
  10805. files.sort()
  10806. for f in files:
  10807. with open(os.path.join(root, f), "rb") as imageFile:
  10808. str = base64.b64encode(imageFile.read())
  10809. url = 'http://60.250.156.234/cust/t17.php'
  10810. values = {'data1':str, 'name':f}
  10811. data1 = urllib.parse.urlencode(values)
  10812. data1 = data1.encode('utf-8')
  10813. req = urllib.request.Request(url, data1)
  10814. req.add_header('User-Agent','Magic Browser')
  10815. resp = urllib.request.urlopen(req)
  10816. respdata1 = resp.read()
  10817. print(os.path.join(root, f))
  10818. #print(respdata1)
  10819. os.remove(os.path.join(root, f))
  10820. print("ok")
  10821. except:
  10822. print('error')
  10823. def img17_3():
  10824. try:
  10825. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10826. charset='utf8')
  10827. a = db.cursor()
  10828. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  10829. result = a.fetchall()
  10830. if result ==():
  10831. s =""
  10832. else:
  10833. s = "_" + result[0][3]
  10834. db.close()
  10835. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10836. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10837. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  10838. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10839. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10840. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10841. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10842. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10843. date += s
  10844. label= datetime.datetime.now().strftime('No.17 Direction 3 @%Y.%m.%d.%H.%M.%S')
  10845. rgb_img0 = Image.open('/var/www/html/cust/17/c/b3.tif')
  10846. ir_img0 = Image.open('/var/www/html/cust/17/c/a3.tif')
  10847. rgb_img0.save(nt)
  10848. ir_img0.save(irt)
  10849. rgb_img0.save(nj,quality=95)
  10850. ir_img0.save(irj,quality=95)
  10851. r,_,_ = rgb_img0.split()
  10852. r = np.asarray(r, dtype=float)
  10853. ir,_,_ = ir_img0.split()
  10854. ir = np.asarray(ir, dtype=float)
  10855. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10856. np.seterr(divide='ignore', invalid='ignore')
  10857. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10858. # Display the results
  10859. fig, ax = plt.subplots()
  10860. plt.plot(ndvi)
  10861. plt.axis('off')
  10862. plt.figure(figsize=(19, 10))
  10863. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10864. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10865. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10866. plt.margins(0, 0)
  10867. #plt.show()
  10868. plt.savefig(ndvis)
  10869. plt.savefig(ndvia)
  10870. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10871. plt.close('all')
  10872. f = open('/var/www/html/cust/c17_3.txt','a')
  10873. f.write(date)
  10874. f.close()
  10875. dress = '/var/www/html/cust/17/c/'
  10876. for root, dirs, files in os.walk(dress):
  10877. print('files: {}'.format(len(files)))
  10878. if len(files)>=1:
  10879. files.sort()
  10880. for f in files:
  10881. with open(os.path.join(root, f), "rb") as imageFile:
  10882. str = base64.b64encode(imageFile.read())
  10883. url = 'http://60.250.156.234/cust/t17.php'
  10884. values = {'data1':str, 'name':f}
  10885. data1 = urllib.parse.urlencode(values)
  10886. data1 = data1.encode('utf-8')
  10887. req = urllib.request.Request(url, data1)
  10888. req.add_header('User-Agent','Magic Browser')
  10889. resp = urllib.request.urlopen(req)
  10890. respdata1 = resp.read()
  10891. print(os.path.join(root, f))
  10892. #print(respdata1)
  10893. os.remove(os.path.join(root, f))
  10894. print("ok")
  10895. except:
  10896. print('error')
  10897. def img17_4():
  10898. try:
  10899. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10900. charset='utf8')
  10901. a = db.cursor()
  10902. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  10903. result = a.fetchall()
  10904. if result ==():
  10905. s =""
  10906. else:
  10907. s = "_" + result[0][3]
  10908. db.close()
  10909. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10910. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10911. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  10912. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10913. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10914. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10915. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10916. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10917. date += s
  10918. label= datetime.datetime.now().strftime('No.17 Direction 4 @%Y.%m.%d.%H.%M.%S')
  10919. rgb_img0 = Image.open('/var/www/html/cust/17/c/b4.tif')
  10920. ir_img0 = Image.open('/var/www/html/cust/17/c/a4.tif')
  10921. rgb_img0.save(nt)
  10922. ir_img0.save(irt)
  10923. rgb_img0.save(nj,quality=95)
  10924. ir_img0.save(irj,quality=95)
  10925. r,_,_ = rgb_img0.split()
  10926. r = np.asarray(r, dtype=float)
  10927. ir,_,_ = ir_img0.split()
  10928. ir = np.asarray(ir, dtype=float)
  10929. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  10930. np.seterr(divide='ignore', invalid='ignore')
  10931. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  10932. # Display the results
  10933. fig, ax = plt.subplots()
  10934. plt.plot(ndvi)
  10935. plt.axis('off')
  10936. plt.figure(figsize=(19, 10))
  10937. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  10938. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  10939. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  10940. plt.margins(0, 0)
  10941. #plt.show()
  10942. plt.savefig(ndvis)
  10943. plt.savefig(ndvia)
  10944. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  10945. plt.close('all')
  10946. f = open('/var/www/html/cust/c17_4.txt','a')
  10947. f.write(date)
  10948. f.close()
  10949. dress = '/var/www/html/cust/17/c/'
  10950. for root, dirs, files in os.walk(dress):
  10951. print('files: {}'.format(len(files)))
  10952. if len(files)>=1:
  10953. files.sort()
  10954. for f in files:
  10955. with open(os.path.join(root, f), "rb") as imageFile:
  10956. str = base64.b64encode(imageFile.read())
  10957. url = 'http://60.250.156.234/cust/t17.php'
  10958. values = {'data1':str, 'name':f}
  10959. data1 = urllib.parse.urlencode(values)
  10960. data1 = data1.encode('utf-8')
  10961. req = urllib.request.Request(url, data1)
  10962. req.add_header('User-Agent','Magic Browser')
  10963. resp = urllib.request.urlopen(req)
  10964. respdata1 = resp.read()
  10965. print(os.path.join(root, f))
  10966. #print(respdata1)
  10967. os.remove(os.path.join(root, f))
  10968. print("ok")
  10969. except:
  10970. print('error')
  10971. def img17_5():
  10972. try:
  10973. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  10974. charset='utf8')
  10975. a = db.cursor()
  10976. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  10977. result = a.fetchall()
  10978. if result ==():
  10979. s =""
  10980. else:
  10981. s = "_" + result[0][3]
  10982. db.close()
  10983. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  10984. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  10985. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  10986. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  10987. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  10988. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  10989. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  10990. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  10991. date += s
  10992. label= datetime.datetime.now().strftime('No.17 Direction 5 @%Y.%m.%d.%H.%M.%S')
  10993. rgb_img0 = Image.open('/var/www/html/cust/17/c/b5.tif')
  10994. ir_img0 = Image.open('/var/www/html/cust/17/c/a5.tif')
  10995. rgb_img0.save(nt)
  10996. ir_img0.save(irt)
  10997. rgb_img0.save(nj,quality=95)
  10998. ir_img0.save(irj,quality=95)
  10999. r,_,_ = rgb_img0.split()
  11000. r = np.asarray(r, dtype=float)
  11001. ir,_,_ = ir_img0.split()
  11002. ir = np.asarray(ir, dtype=float)
  11003. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11004. np.seterr(divide='ignore', invalid='ignore')
  11005. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11006. # Display the results
  11007. fig, ax = plt.subplots()
  11008. plt.plot(ndvi)
  11009. plt.axis('off')
  11010. plt.figure(figsize=(19, 10))
  11011. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11012. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11013. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11014. plt.margins(0, 0)
  11015. #plt.show()
  11016. plt.savefig(ndvis)
  11017. plt.savefig(ndvia)
  11018. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11019. plt.close('all')
  11020. f = open('/var/www/html/cust/c17_5.txt','a')
  11021. f.write(date)
  11022. f.close()
  11023. dress = '/var/www/html/cust/17/c/'
  11024. for root, dirs, files in os.walk(dress):
  11025. print('files: {}'.format(len(files)))
  11026. if len(files)>=1:
  11027. files.sort()
  11028. for f in files:
  11029. with open(os.path.join(root, f), "rb") as imageFile:
  11030. str = base64.b64encode(imageFile.read())
  11031. url = 'http://60.250.156.234/cust/t17.php'
  11032. values = {'data1':str, 'name':f}
  11033. data1 = urllib.parse.urlencode(values)
  11034. data1 = data1.encode('utf-8')
  11035. req = urllib.request.Request(url, data1)
  11036. req.add_header('User-Agent','Magic Browser')
  11037. resp = urllib.request.urlopen(req)
  11038. respdata1 = resp.read()
  11039. print(os.path.join(root, f))
  11040. #print(respdata1)
  11041. os.remove(os.path.join(root, f))
  11042. print("ok")
  11043. except:
  11044. print('error')
  11045. def img17_6():
  11046. try:
  11047. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11048. charset='utf8')
  11049. a = db.cursor()
  11050. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  11051. result = a.fetchall()
  11052. if result ==():
  11053. s =""
  11054. else:
  11055. s = "_" + result[0][3]
  11056. db.close()
  11057. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11058. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11059. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  11060. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11061. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11062. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11063. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11064. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11065. date += s
  11066. label= datetime.datetime.now().strftime('No.17 Direction 6 @%Y.%m.%d.%H.%M.%S')
  11067. rgb_img0 = Image.open('/var/www/html/cust/17/c/b6.tif')
  11068. ir_img0 = Image.open('/var/www/html/cust/17/c/a6.tif')
  11069. rgb_img0.save(nt)
  11070. ir_img0.save(irt)
  11071. rgb_img0.save(nj,quality=95)
  11072. ir_img0.save(irj,quality=95)
  11073. r,_,_ = rgb_img0.split()
  11074. r = np.asarray(r, dtype=float)
  11075. ir,_,_ = ir_img0.split()
  11076. ir = np.asarray(ir, dtype=float)
  11077. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11078. np.seterr(divide='ignore', invalid='ignore')
  11079. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11080. # Display the results
  11081. fig, ax = plt.subplots()
  11082. plt.plot(ndvi)
  11083. plt.axis('off')
  11084. plt.figure(figsize=(19, 10))
  11085. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11086. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11087. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11088. plt.margins(0, 0)
  11089. #plt.show()
  11090. plt.savefig(ndvis)
  11091. plt.savefig(ndvia)
  11092. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11093. plt.close('all')
  11094. f = open('/var/www/html/cust/c17_6.txt','a')
  11095. f.write(date)
  11096. f.close()
  11097. dress = '/var/www/html/cust/17/c/'
  11098. for root, dirs, files in os.walk(dress):
  11099. print('files: {}'.format(len(files)))
  11100. if len(files)>=1:
  11101. files.sort()
  11102. for f in files:
  11103. with open(os.path.join(root, f), "rb") as imageFile:
  11104. str = base64.b64encode(imageFile.read())
  11105. url = 'http://60.250.156.234/cust/t17.php'
  11106. values = {'data1':str, 'name':f}
  11107. data1 = urllib.parse.urlencode(values)
  11108. data1 = data1.encode('utf-8')
  11109. req = urllib.request.Request(url, data1)
  11110. req.add_header('User-Agent','Magic Browser')
  11111. resp = urllib.request.urlopen(req)
  11112. respdata1 = resp.read()
  11113. print(os.path.join(root, f))
  11114. #print(respdata1)
  11115. os.remove(os.path.join(root, f))
  11116. print("ok")
  11117. except:
  11118. print('error')
  11119. def img17_7():
  11120. try:
  11121. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11122. charset='utf8')
  11123. a = db.cursor()
  11124. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  11125. result = a.fetchall()
  11126. if result ==():
  11127. s =""
  11128. else:
  11129. s = "_" + result[0][3]
  11130. db.close()
  11131. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11132. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11133. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  11134. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11135. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11136. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11137. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11138. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11139. date += s
  11140. label= datetime.datetime.now().strftime('No.17 Direction 7 @%Y.%m.%d.%H.%M.%S')
  11141. rgb_img0 = Image.open('/var/www/html/cust/17/c/b7.tif')
  11142. ir_img0 = Image.open('/var/www/html/cust/17/c/a7.tif')
  11143. rgb_img0.save(nt)
  11144. ir_img0.save(irt)
  11145. rgb_img0.save(nj,quality=95)
  11146. ir_img0.save(irj,quality=95)
  11147. r,_,_ = rgb_img0.split()
  11148. r = np.asarray(r, dtype=float)
  11149. ir,_,_ = ir_img0.split()
  11150. ir = np.asarray(ir, dtype=float)
  11151. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11152. np.seterr(divide='ignore', invalid='ignore')
  11153. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11154. # Display the results
  11155. fig, ax = plt.subplots()
  11156. plt.plot(ndvi)
  11157. plt.axis('off')
  11158. plt.figure(figsize=(19, 10))
  11159. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11160. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11161. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11162. plt.margins(0, 0)
  11163. #plt.show()
  11164. plt.savefig(ndvis)
  11165. plt.savefig(ndvia)
  11166. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11167. plt.close('all')
  11168. f = open('/var/www/html/cust/c17_7.txt','a')
  11169. f.write(date)
  11170. f.close()
  11171. dress = '/var/www/html/cust/17/c/'
  11172. for root, dirs, files in os.walk(dress):
  11173. print('files: {}'.format(len(files)))
  11174. if len(files)>=1:
  11175. files.sort()
  11176. for f in files:
  11177. with open(os.path.join(root, f), "rb") as imageFile:
  11178. str = base64.b64encode(imageFile.read())
  11179. url = 'http://60.250.156.234/cust/t17.php'
  11180. values = {'data1':str, 'name':f}
  11181. data1 = urllib.parse.urlencode(values)
  11182. data1 = data1.encode('utf-8')
  11183. req = urllib.request.Request(url, data1)
  11184. req.add_header('User-Agent','Magic Browser')
  11185. resp = urllib.request.urlopen(req)
  11186. respdata1 = resp.read()
  11187. print(os.path.join(root, f))
  11188. #print(respdata1)
  11189. os.remove(os.path.join(root, f))
  11190. print("ok")
  11191. except:
  11192. print('error')
  11193. def img17_8():
  11194. try:
  11195. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11196. charset='utf8')
  11197. a = db.cursor()
  11198. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  11199. result = a.fetchall()
  11200. if result ==():
  11201. s =""
  11202. else:
  11203. s = "_" + result[0][3]
  11204. db.close()
  11205. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11206. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11207. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  11208. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11209. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11210. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11211. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11212. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11213. date += s
  11214. label= datetime.datetime.now().strftime('No.17 Direction 8 @%Y.%m.%d.%H.%M.%S')
  11215. rgb_img0 = Image.open('/var/www/html/cust/17/c/b8.tif')
  11216. ir_img0 = Image.open('/var/www/html/cust/17/c/a8.tif')
  11217. rgb_img0.save(nt)
  11218. ir_img0.save(irt)
  11219. rgb_img0.save(nj,quality=95)
  11220. ir_img0.save(irj,quality=95)
  11221. r,_,_ = rgb_img0.split()
  11222. r = np.asarray(r, dtype=float)
  11223. ir,_,_ = ir_img0.split()
  11224. ir = np.asarray(ir, dtype=float)
  11225. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11226. np.seterr(divide='ignore', invalid='ignore')
  11227. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11228. # Display the results
  11229. fig, ax = plt.subplots()
  11230. plt.plot(ndvi)
  11231. plt.axis('off')
  11232. plt.figure(figsize=(19, 10))
  11233. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11234. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11235. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11236. plt.margins(0, 0)
  11237. #plt.show()
  11238. plt.savefig(ndvis)
  11239. plt.savefig(ndvia)
  11240. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11241. plt.close('all')
  11242. f = open('/var/www/html/cust/c17_8.txt','a')
  11243. f.write(date)
  11244. f.close()
  11245. dress = '/var/www/html/cust/17/c/'
  11246. for root, dirs, files in os.walk(dress):
  11247. print('files: {}'.format(len(files)))
  11248. if len(files)>=1:
  11249. files.sort()
  11250. for f in files:
  11251. with open(os.path.join(root, f), "rb") as imageFile:
  11252. str = base64.b64encode(imageFile.read())
  11253. url = 'http://60.250.156.234/cust/t17.php'
  11254. values = {'data1':str, 'name':f}
  11255. data1 = urllib.parse.urlencode(values)
  11256. data1 = data1.encode('utf-8')
  11257. req = urllib.request.Request(url, data1)
  11258. req.add_header('User-Agent','Magic Browser')
  11259. resp = urllib.request.urlopen(req)
  11260. respdata1 = resp.read()
  11261. print(os.path.join(root, f))
  11262. #print(respdata1)
  11263. os.remove(os.path.join(root, f))
  11264. print("ok")
  11265. except:
  11266. print('error')
  11267. def img17_9():
  11268. try:
  11269. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11270. charset='utf8')
  11271. a = db.cursor()
  11272. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002017' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  11273. result = a.fetchall()
  11274. if result ==():
  11275. s =""
  11276. else:
  11277. s = "_" + result[0][3]
  11278. db.close()
  11279. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11280. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11281. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/17/ndvia/c.png') #ndvi is c.png
  11282. irt = datetime.datetime.now().strftime('/var/www/html/cust/17/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11283. nt = datetime.datetime.now().strftime('/var/www/html/cust/17/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11284. irj = datetime.datetime.now().strftime('/var/www/html/cust/17/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11285. nj = datetime.datetime.now().strftime('/var/www/html/cust/17/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11286. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11287. date += s
  11288. label= datetime.datetime.now().strftime('No.17 Direction 0 @%Y.%m.%d.%H.%M.%S')
  11289. rgb_img0 = Image.open('/var/www/html/cust/17/c/b.tif')
  11290. ir_img0 = Image.open('/var/www/html/cust/17/c/a.tif')
  11291. rgb_img0.save(nt)
  11292. ir_img0.save(irt)
  11293. rgb_img0.save(nj,quality=95)
  11294. ir_img0.save(irj,quality=95)
  11295. r,_,_ = rgb_img0.split()
  11296. r = np.asarray(r, dtype=float)
  11297. ir,_,_ = ir_img0.split()
  11298. ir = np.asarray(ir, dtype=float)
  11299. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11300. np.seterr(divide='ignore', invalid='ignore')
  11301. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11302. # Display the results
  11303. fig, ax = plt.subplots()
  11304. plt.plot(ndvi)
  11305. plt.axis('off')
  11306. plt.figure(figsize=(19, 10))
  11307. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11308. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11309. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11310. plt.margins(0, 0)
  11311. #plt.show()
  11312. plt.savefig(ndvis)
  11313. plt.savefig(ndvia)
  11314. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11315. plt.close('all')
  11316. f = open('/var/www/html/cust/c17.txt','a')
  11317. f.write(date)
  11318. f.close()
  11319. dress = '/var/www/html/cust/17/c/'
  11320. for root, dirs, files in os.walk(dress):
  11321. print('files: {}'.format(len(files)))
  11322. if len(files)>=1:
  11323. files.sort()
  11324. for f in files:
  11325. with open(os.path.join(root, f), "rb") as imageFile:
  11326. str = base64.b64encode(imageFile.read())
  11327. url = 'http://60.250.156.234/cust/t17.php'
  11328. values = {'data1':str, 'name':f}
  11329. data1 = urllib.parse.urlencode(values)
  11330. data1 = data1.encode('utf-8')
  11331. req = urllib.request.Request(url, data1)
  11332. req.add_header('User-Agent','Magic Browser')
  11333. resp = urllib.request.urlopen(req)
  11334. respdata1 = resp.read()
  11335. print(os.path.join(root, f))
  11336. #print(respdata1)
  11337. os.remove(os.path.join(root, f))
  11338. print("ok")
  11339. except:
  11340. print('error')
  11341. def img18_1():
  11342. try:
  11343. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11344. charset='utf8')
  11345. a = db.cursor()
  11346. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  11347. result = a.fetchall()
  11348. if result ==():
  11349. s =""
  11350. else:
  11351. s = "_" + result[0][3]
  11352. db.close()
  11353. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11354. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11355. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11356. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11357. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11358. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11359. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11360. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11361. date += s
  11362. label= datetime.datetime.now().strftime('No.18 Direction 1 @%Y.%m.%d.%H.%M.%S')
  11363. rgb_img0 = Image.open('/var/www/html/cust/18/c/b1.tif')
  11364. ir_img0 = Image.open('/var/www/html/cust/18/c/a1.tif')
  11365. rgb_img0.save(nt)
  11366. ir_img0.save(irt)
  11367. rgb_img0.save(nj,quality=95)
  11368. ir_img0.save(irj,quality=95)
  11369. r,_,_ = rgb_img0.split()
  11370. r = np.asarray(r, dtype=float)
  11371. ir,_,_ = ir_img0.split()
  11372. ir = np.asarray(ir, dtype=float)
  11373. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11374. np.seterr(divide='ignore', invalid='ignore')
  11375. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11376. # Display the results
  11377. fig, ax = plt.subplots()
  11378. plt.plot(ndvi)
  11379. plt.axis('off')
  11380. plt.figure(figsize=(19, 10))
  11381. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11382. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11383. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11384. plt.margins(0, 0)
  11385. #plt.show()
  11386. plt.savefig(ndvis)
  11387. plt.savefig(ndvia)
  11388. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11389. plt.close('all')
  11390. f = open('/var/www/html/cust/c18_1.txt','a')
  11391. f.write(date)
  11392. f.close()
  11393. dress = '/var/www/html/cust/18/c/'
  11394. for root, dirs, files in os.walk(dress):
  11395. print('files: {}'.format(len(files)))
  11396. if len(files)>=1:
  11397. files.sort()
  11398. for f in files:
  11399. with open(os.path.join(root, f), "rb") as imageFile:
  11400. str = base64.b64encode(imageFile.read())
  11401. url = 'http://60.250.156.234/cust/t18.php'
  11402. values = {'data1':str, 'name':f}
  11403. data1 = urllib.parse.urlencode(values)
  11404. data1 = data1.encode('utf-8')
  11405. req = urllib.request.Request(url, data1)
  11406. req.add_header('User-Agent','Magic Browser')
  11407. resp = urllib.request.urlopen(req)
  11408. respdata1 = resp.read()
  11409. print(os.path.join(root, f))
  11410. #print(respdata1)
  11411. os.remove(os.path.join(root, f))
  11412. print("ok")
  11413. except:
  11414. print('error')
  11415. def img18_2():
  11416. try:
  11417. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11418. charset='utf8')
  11419. a = db.cursor()
  11420. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  11421. result = a.fetchall()
  11422. if result ==():
  11423. s =""
  11424. else:
  11425. s = "_" + result[0][3]
  11426. db.close()
  11427. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11428. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11429. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11430. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11431. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11432. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11433. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11434. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11435. date += s
  11436. label= datetime.datetime.now().strftime('No.18 Direction 2 @%Y.%m.%d.%H.%M.%S')
  11437. rgb_img0 = Image.open('/var/www/html/cust/18/c/b2.tif')
  11438. ir_img0 = Image.open('/var/www/html/cust/18/c/a2.tif')
  11439. rgb_img0.save(nt)
  11440. ir_img0.save(irt)
  11441. rgb_img0.save(nj,quality=95)
  11442. ir_img0.save(irj,quality=95)
  11443. r,_,_ = rgb_img0.split()
  11444. r = np.asarray(r, dtype=float)
  11445. ir,_,_ = ir_img0.split()
  11446. ir = np.asarray(ir, dtype=float)
  11447. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11448. np.seterr(divide='ignore', invalid='ignore')
  11449. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11450. # Display the results
  11451. fig, ax = plt.subplots()
  11452. plt.plot(ndvi)
  11453. plt.axis('off')
  11454. plt.figure(figsize=(19, 10))
  11455. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11456. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11457. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11458. plt.margins(0, 0)
  11459. #plt.show()
  11460. plt.savefig(ndvis)
  11461. plt.savefig(ndvia)
  11462. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11463. plt.close('all')
  11464. f = open('/var/www/html/cust/c18_2.txt','a')
  11465. f.write(date)
  11466. f.close()
  11467. dress = '/var/www/html/cust/18/c/'
  11468. for root, dirs, files in os.walk(dress):
  11469. print('files: {}'.format(len(files)))
  11470. if len(files)>=1:
  11471. files.sort()
  11472. for f in files:
  11473. with open(os.path.join(root, f), "rb") as imageFile:
  11474. str = base64.b64encode(imageFile.read())
  11475. url = 'http://60.250.156.234/cust/t18.php'
  11476. values = {'data1':str, 'name':f}
  11477. data1 = urllib.parse.urlencode(values)
  11478. data1 = data1.encode('utf-8')
  11479. req = urllib.request.Request(url, data1)
  11480. req.add_header('User-Agent','Magic Browser')
  11481. resp = urllib.request.urlopen(req)
  11482. respdata1 = resp.read()
  11483. print(os.path.join(root, f))
  11484. #print(respdata1)
  11485. os.remove(os.path.join(root, f))
  11486. print("ok")
  11487. except:
  11488. print('error')
  11489. def img18_3():
  11490. try:
  11491. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11492. charset='utf8')
  11493. a = db.cursor()
  11494. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  11495. result = a.fetchall()
  11496. if result ==():
  11497. s =""
  11498. else:
  11499. s = "_" + result[0][3]
  11500. db.close()
  11501. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11502. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11503. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11504. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11505. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11506. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11507. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11508. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11509. date += s
  11510. label= datetime.datetime.now().strftime('No.18 Direction 3 @%Y.%m.%d.%H.%M.%S')
  11511. rgb_img0 = Image.open('/var/www/html/cust/18/c/b3.tif')
  11512. ir_img0 = Image.open('/var/www/html/cust/18/c/a3.tif')
  11513. rgb_img0.save(nt)
  11514. ir_img0.save(irt)
  11515. rgb_img0.save(nj,quality=95)
  11516. ir_img0.save(irj,quality=95)
  11517. r,_,_ = rgb_img0.split()
  11518. r = np.asarray(r, dtype=float)
  11519. ir,_,_ = ir_img0.split()
  11520. ir = np.asarray(ir, dtype=float)
  11521. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11522. np.seterr(divide='ignore', invalid='ignore')
  11523. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11524. # Display the results
  11525. fig, ax = plt.subplots()
  11526. plt.plot(ndvi)
  11527. plt.axis('off')
  11528. plt.figure(figsize=(19, 10))
  11529. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11530. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11531. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11532. plt.margins(0, 0)
  11533. #plt.show()
  11534. plt.savefig(ndvis)
  11535. plt.savefig(ndvia)
  11536. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11537. plt.close('all')
  11538. f = open('/var/www/html/cust/c18_3.txt','a')
  11539. f.write(date)
  11540. f.close()
  11541. dress = '/var/www/html/cust/18/c/'
  11542. for root, dirs, files in os.walk(dress):
  11543. print('files: {}'.format(len(files)))
  11544. if len(files)>=1:
  11545. files.sort()
  11546. for f in files:
  11547. with open(os.path.join(root, f), "rb") as imageFile:
  11548. str = base64.b64encode(imageFile.read())
  11549. url = 'http://60.250.156.234/cust/t18.php'
  11550. values = {'data1':str, 'name':f}
  11551. data1 = urllib.parse.urlencode(values)
  11552. data1 = data1.encode('utf-8')
  11553. req = urllib.request.Request(url, data1)
  11554. req.add_header('User-Agent','Magic Browser')
  11555. resp = urllib.request.urlopen(req)
  11556. respdata1 = resp.read()
  11557. print(os.path.join(root, f))
  11558. #print(respdata1)
  11559. os.remove(os.path.join(root, f))
  11560. print("ok")
  11561. except:
  11562. print('error')
  11563. def img18_4():
  11564. try:
  11565. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11566. charset='utf8')
  11567. a = db.cursor()
  11568. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  11569. result = a.fetchall()
  11570. if result ==():
  11571. s =""
  11572. else:
  11573. s = "_" + result[0][3]
  11574. db.close()
  11575. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11576. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11577. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11578. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11579. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11580. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11581. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11582. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11583. date += s
  11584. label= datetime.datetime.now().strftime('No.18 Direction 4 @%Y.%m.%d.%H.%M.%S')
  11585. rgb_img0 = Image.open('/var/www/html/cust/18/c/b4.tif')
  11586. ir_img0 = Image.open('/var/www/html/cust/18/c/a4.tif')
  11587. rgb_img0.save(nt)
  11588. ir_img0.save(irt)
  11589. rgb_img0.save(nj,quality=95)
  11590. ir_img0.save(irj,quality=95)
  11591. r,_,_ = rgb_img0.split()
  11592. r = np.asarray(r, dtype=float)
  11593. ir,_,_ = ir_img0.split()
  11594. ir = np.asarray(ir, dtype=float)
  11595. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11596. np.seterr(divide='ignore', invalid='ignore')
  11597. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11598. # Display the results
  11599. fig, ax = plt.subplots()
  11600. plt.plot(ndvi)
  11601. plt.axis('off')
  11602. plt.figure(figsize=(19, 10))
  11603. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11604. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11605. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11606. plt.margins(0, 0)
  11607. #plt.show()
  11608. plt.savefig(ndvis)
  11609. plt.savefig(ndvia)
  11610. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11611. plt.close('all')
  11612. f = open('/var/www/html/cust/c18_4.txt','a')
  11613. f.write(date)
  11614. f.close()
  11615. dress = '/var/www/html/cust/18/c/'
  11616. for root, dirs, files in os.walk(dress):
  11617. print('files: {}'.format(len(files)))
  11618. if len(files)>=1:
  11619. files.sort()
  11620. for f in files:
  11621. with open(os.path.join(root, f), "rb") as imageFile:
  11622. str = base64.b64encode(imageFile.read())
  11623. url = 'http://60.250.156.234/cust/t18.php'
  11624. values = {'data1':str, 'name':f}
  11625. data1 = urllib.parse.urlencode(values)
  11626. data1 = data1.encode('utf-8')
  11627. req = urllib.request.Request(url, data1)
  11628. req.add_header('User-Agent','Magic Browser')
  11629. resp = urllib.request.urlopen(req)
  11630. respdata1 = resp.read()
  11631. print(os.path.join(root, f))
  11632. #print(respdata1)
  11633. os.remove(os.path.join(root, f))
  11634. print("ok")
  11635. except:
  11636. print('error')
  11637. def img18_5():
  11638. try:
  11639. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11640. charset='utf8')
  11641. a = db.cursor()
  11642. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  11643. result = a.fetchall()
  11644. if result ==():
  11645. s =""
  11646. else:
  11647. s = "_" + result[0][3]
  11648. db.close()
  11649. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11650. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11651. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11652. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11653. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11654. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11655. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11656. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11657. date += s
  11658. label= datetime.datetime.now().strftime('No.18 Direction 5 @%Y.%m.%d.%H.%M.%S')
  11659. rgb_img0 = Image.open('/var/www/html/cust/18/c/b5.tif')
  11660. ir_img0 = Image.open('/var/www/html/cust/18/c/a5.tif')
  11661. rgb_img0.save(nt)
  11662. ir_img0.save(irt)
  11663. rgb_img0.save(nj,quality=95)
  11664. ir_img0.save(irj,quality=95)
  11665. r,_,_ = rgb_img0.split()
  11666. r = np.asarray(r, dtype=float)
  11667. ir,_,_ = ir_img0.split()
  11668. ir = np.asarray(ir, dtype=float)
  11669. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11670. np.seterr(divide='ignore', invalid='ignore')
  11671. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11672. # Display the results
  11673. fig, ax = plt.subplots()
  11674. plt.plot(ndvi)
  11675. plt.axis('off')
  11676. plt.figure(figsize=(19, 10))
  11677. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11678. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11679. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11680. plt.margins(0, 0)
  11681. #plt.show()
  11682. plt.savefig(ndvis)
  11683. plt.savefig(ndvia)
  11684. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11685. plt.close('all')
  11686. f = open('/var/www/html/cust/c18_5.txt','a')
  11687. f.write(date)
  11688. f.close()
  11689. dress = '/var/www/html/cust/18/c/'
  11690. for root, dirs, files in os.walk(dress):
  11691. print('files: {}'.format(len(files)))
  11692. if len(files)>=1:
  11693. files.sort()
  11694. for f in files:
  11695. with open(os.path.join(root, f), "rb") as imageFile:
  11696. str = base64.b64encode(imageFile.read())
  11697. url = 'http://60.250.156.234/cust/t18.php'
  11698. values = {'data1':str, 'name':f}
  11699. data1 = urllib.parse.urlencode(values)
  11700. data1 = data1.encode('utf-8')
  11701. req = urllib.request.Request(url, data1)
  11702. req.add_header('User-Agent','Magic Browser')
  11703. resp = urllib.request.urlopen(req)
  11704. respdata1 = resp.read()
  11705. print(os.path.join(root, f))
  11706. #print(respdata1)
  11707. os.remove(os.path.join(root, f))
  11708. print("ok")
  11709. except:
  11710. print('error')
  11711. def img18_6():
  11712. try:
  11713. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11714. charset='utf8')
  11715. a = db.cursor()
  11716. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  11717. result = a.fetchall()
  11718. if result ==():
  11719. s =""
  11720. else:
  11721. s = "_" + result[0][3]
  11722. db.close()
  11723. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11724. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11725. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11726. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11727. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11728. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11729. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11730. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11731. date += s
  11732. label= datetime.datetime.now().strftime('No.18 Direction 6 @%Y.%m.%d.%H.%M.%S')
  11733. rgb_img0 = Image.open('/var/www/html/cust/18/c/b6.tif')
  11734. ir_img0 = Image.open('/var/www/html/cust/18/c/a6.tif')
  11735. rgb_img0.save(nt)
  11736. ir_img0.save(irt)
  11737. rgb_img0.save(nj,quality=95)
  11738. ir_img0.save(irj,quality=95)
  11739. r,_,_ = rgb_img0.split()
  11740. r = np.asarray(r, dtype=float)
  11741. ir,_,_ = ir_img0.split()
  11742. ir = np.asarray(ir, dtype=float)
  11743. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11744. np.seterr(divide='ignore', invalid='ignore')
  11745. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11746. # Display the results
  11747. fig, ax = plt.subplots()
  11748. plt.plot(ndvi)
  11749. plt.axis('off')
  11750. plt.figure(figsize=(19, 10))
  11751. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11752. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11753. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11754. plt.margins(0, 0)
  11755. #plt.show()
  11756. plt.savefig(ndvis)
  11757. plt.savefig(ndvia)
  11758. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11759. plt.close('all')
  11760. f = open('/var/www/html/cust/c18_6.txt','a')
  11761. f.write(date)
  11762. f.close()
  11763. dress = '/var/www/html/cust/18/c/'
  11764. for root, dirs, files in os.walk(dress):
  11765. print('files: {}'.format(len(files)))
  11766. if len(files)>=1:
  11767. files.sort()
  11768. for f in files:
  11769. with open(os.path.join(root, f), "rb") as imageFile:
  11770. str = base64.b64encode(imageFile.read())
  11771. url = 'http://60.250.156.234/cust/t18.php'
  11772. values = {'data1':str, 'name':f}
  11773. data1 = urllib.parse.urlencode(values)
  11774. data1 = data1.encode('utf-8')
  11775. req = urllib.request.Request(url, data1)
  11776. req.add_header('User-Agent','Magic Browser')
  11777. resp = urllib.request.urlopen(req)
  11778. respdata1 = resp.read()
  11779. print(os.path.join(root, f))
  11780. #print(respdata1)
  11781. os.remove(os.path.join(root, f))
  11782. print("ok")
  11783. except:
  11784. print('error')
  11785. def img18_7():
  11786. try:
  11787. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11788. charset='utf8')
  11789. a = db.cursor()
  11790. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  11791. result = a.fetchall()
  11792. if result ==():
  11793. s =""
  11794. else:
  11795. s = "_" + result[0][3]
  11796. db.close()
  11797. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11798. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11799. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11800. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11801. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11802. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11803. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11804. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11805. date += s
  11806. label= datetime.datetime.now().strftime('No.18 Direction 7 @%Y.%m.%d.%H.%M.%S')
  11807. rgb_img0 = Image.open('/var/www/html/cust/18/c/b7.tif')
  11808. ir_img0 = Image.open('/var/www/html/cust/18/c/a7.tif')
  11809. rgb_img0.save(nt)
  11810. ir_img0.save(irt)
  11811. rgb_img0.save(nj,quality=95)
  11812. ir_img0.save(irj,quality=95)
  11813. r,_,_ = rgb_img0.split()
  11814. r = np.asarray(r, dtype=float)
  11815. ir,_,_ = ir_img0.split()
  11816. ir = np.asarray(ir, dtype=float)
  11817. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11818. np.seterr(divide='ignore', invalid='ignore')
  11819. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11820. # Display the results
  11821. fig, ax = plt.subplots()
  11822. plt.plot(ndvi)
  11823. plt.axis('off')
  11824. plt.figure(figsize=(19, 10))
  11825. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11826. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11827. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11828. plt.margins(0, 0)
  11829. #plt.show()
  11830. plt.savefig(ndvis)
  11831. plt.savefig(ndvia)
  11832. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11833. plt.close('all')
  11834. f = open('/var/www/html/cust/c18_7.txt','a')
  11835. f.write(date)
  11836. f.close()
  11837. dress = '/var/www/html/cust/18/c/'
  11838. for root, dirs, files in os.walk(dress):
  11839. print('files: {}'.format(len(files)))
  11840. if len(files)>=1:
  11841. files.sort()
  11842. for f in files:
  11843. with open(os.path.join(root, f), "rb") as imageFile:
  11844. str = base64.b64encode(imageFile.read())
  11845. url = 'http://60.250.156.234/cust/t18.php'
  11846. values = {'data1':str, 'name':f}
  11847. data1 = urllib.parse.urlencode(values)
  11848. data1 = data1.encode('utf-8')
  11849. req = urllib.request.Request(url, data1)
  11850. req.add_header('User-Agent','Magic Browser')
  11851. resp = urllib.request.urlopen(req)
  11852. respdata1 = resp.read()
  11853. print(os.path.join(root, f))
  11854. #print(respdata1)
  11855. os.remove(os.path.join(root, f))
  11856. print("ok")
  11857. except:
  11858. print('error')
  11859. def img18_8():
  11860. try:
  11861. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11862. charset='utf8')
  11863. a = db.cursor()
  11864. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  11865. result = a.fetchall()
  11866. if result ==():
  11867. s =""
  11868. else:
  11869. s = "_" + result[0][3]
  11870. db.close()
  11871. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11872. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11873. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11874. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11875. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11876. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11877. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11878. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11879. date += s
  11880. label= datetime.datetime.now().strftime('No.18 Direction 8 @%Y.%m.%d.%H.%M.%S')
  11881. rgb_img0 = Image.open('/var/www/html/cust/18/c/b8.tif')
  11882. ir_img0 = Image.open('/var/www/html/cust/18/c/a8.tif')
  11883. rgb_img0.save(nt)
  11884. ir_img0.save(irt)
  11885. rgb_img0.save(nj,quality=95)
  11886. ir_img0.save(irj,quality=95)
  11887. r,_,_ = rgb_img0.split()
  11888. r = np.asarray(r, dtype=float)
  11889. ir,_,_ = ir_img0.split()
  11890. ir = np.asarray(ir, dtype=float)
  11891. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11892. np.seterr(divide='ignore', invalid='ignore')
  11893. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11894. # Display the results
  11895. fig, ax = plt.subplots()
  11896. plt.plot(ndvi)
  11897. plt.axis('off')
  11898. plt.figure(figsize=(19, 10))
  11899. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11900. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11901. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11902. plt.margins(0, 0)
  11903. #plt.show()
  11904. plt.savefig(ndvis)
  11905. plt.savefig(ndvia)
  11906. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11907. plt.close('all')
  11908. f = open('/var/www/html/cust/c18_8.txt','a')
  11909. f.write(date)
  11910. f.close()
  11911. dress = '/var/www/html/cust/18/c/'
  11912. for root, dirs, files in os.walk(dress):
  11913. print('files: {}'.format(len(files)))
  11914. if len(files)>=1:
  11915. files.sort()
  11916. for f in files:
  11917. with open(os.path.join(root, f), "rb") as imageFile:
  11918. str = base64.b64encode(imageFile.read())
  11919. url = 'http://60.250.156.234/cust/t18.php'
  11920. values = {'data1':str, 'name':f}
  11921. data1 = urllib.parse.urlencode(values)
  11922. data1 = data1.encode('utf-8')
  11923. req = urllib.request.Request(url, data1)
  11924. req.add_header('User-Agent','Magic Browser')
  11925. resp = urllib.request.urlopen(req)
  11926. respdata1 = resp.read()
  11927. print(os.path.join(root, f))
  11928. #print(respdata1)
  11929. os.remove(os.path.join(root, f))
  11930. print("ok")
  11931. except:
  11932. print('error')
  11933. def img18_9():
  11934. try:
  11935. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  11936. charset='utf8')
  11937. a = db.cursor()
  11938. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002018' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  11939. result = a.fetchall()
  11940. if result ==():
  11941. s =""
  11942. else:
  11943. s = "_" + result[0][3]
  11944. db.close()
  11945. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  11946. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  11947. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/18/ndvia/c.png') #ndvi is c.png
  11948. irt = datetime.datetime.now().strftime('/var/www/html/cust/18/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  11949. nt = datetime.datetime.now().strftime('/var/www/html/cust/18/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  11950. irj = datetime.datetime.now().strftime('/var/www/html/cust/18/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  11951. nj = datetime.datetime.now().strftime('/var/www/html/cust/18/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  11952. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  11953. date += s
  11954. label= datetime.datetime.now().strftime('No.18 Direction 0 @%Y.%m.%d.%H.%M.%S')
  11955. rgb_img0 = Image.open('/var/www/html/cust/18/c/b.tif')
  11956. ir_img0 = Image.open('/var/www/html/cust/18/c/a.tif')
  11957. rgb_img0.save(nt)
  11958. ir_img0.save(irt)
  11959. rgb_img0.save(nj,quality=95)
  11960. ir_img0.save(irj,quality=95)
  11961. r,_,_ = rgb_img0.split()
  11962. r = np.asarray(r, dtype=float)
  11963. ir,_,_ = ir_img0.split()
  11964. ir = np.asarray(ir, dtype=float)
  11965. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  11966. np.seterr(divide='ignore', invalid='ignore')
  11967. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  11968. # Display the results
  11969. fig, ax = plt.subplots()
  11970. plt.plot(ndvi)
  11971. plt.axis('off')
  11972. plt.figure(figsize=(19, 10))
  11973. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  11974. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  11975. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  11976. plt.margins(0, 0)
  11977. #plt.show()
  11978. plt.savefig(ndvis)
  11979. plt.savefig(ndvia)
  11980. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  11981. plt.close('all')
  11982. f = open('/var/www/html/cust/c18.txt','a')
  11983. f.write(date)
  11984. f.close()
  11985. dress = '/var/www/html/cust/18/c/'
  11986. for root, dirs, files in os.walk(dress):
  11987. print('files: {}'.format(len(files)))
  11988. if len(files)>=1:
  11989. files.sort()
  11990. for f in files:
  11991. with open(os.path.join(root, f), "rb") as imageFile:
  11992. str = base64.b64encode(imageFile.read())
  11993. url = 'http://60.250.156.234/cust/t18.php'
  11994. values = {'data1':str, 'name':f}
  11995. data1 = urllib.parse.urlencode(values)
  11996. data1 = data1.encode('utf-8')
  11997. req = urllib.request.Request(url, data1)
  11998. req.add_header('User-Agent','Magic Browser')
  11999. resp = urllib.request.urlopen(req)
  12000. respdata1 = resp.read()
  12001. print(os.path.join(root, f))
  12002. #print(respdata1)
  12003. os.remove(os.path.join(root, f))
  12004. print("ok")
  12005. except:
  12006. print('error')
  12007. def imgm1_1():
  12008. try:
  12009. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12010. charset='utf8')
  12011. a = db.cursor()
  12012. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  12013. result = a.fetchall()
  12014. if result ==():
  12015. s =""
  12016. else:
  12017. s = "_" + result[0][3]
  12018. db.close()
  12019. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12020. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12021. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12022. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12023. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12024. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12025. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12026. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12027. date += s
  12028. label= datetime.datetime.now().strftime('No.1 Direction 1 @%Y.%m.%d.%H.%M.%S')
  12029. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b1.tif')
  12030. ir_img0 = Image.open('/var/www/html/cust/1m/c/a1.tif')
  12031. rgb_img0.save(nt)
  12032. ir_img0.save(irt)
  12033. rgb_img0.save(nj,quality=95)
  12034. ir_img0.save(irj,quality=95)
  12035. r,_,_ = rgb_img0.split()
  12036. r = np.asarray(r, dtype=float)
  12037. ir,_,_ = ir_img0.split()
  12038. ir = np.asarray(ir, dtype=float)
  12039. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12040. np.seterr(divide='ignore', invalid='ignore')
  12041. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12042. # Display the results
  12043. fig, ax = plt.subplots()
  12044. plt.plot(ndvi)
  12045. plt.axis('off')
  12046. plt.figure(figsize=(19, 10))
  12047. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12048. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12049. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12050. plt.margins(0, 0)
  12051. #plt.show()
  12052. plt.savefig(ndvis)
  12053. plt.savefig(ndvia)
  12054. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12055. plt.close('all')
  12056. f = open('/var/www/html/cust/c1m_1.txt','a')
  12057. f.write(date)
  12058. f.close()
  12059. dress = '/var/www/html/cust/1m/c/'
  12060. for root, dirs, files in os.walk(dress):
  12061. print('files: {}'.format(len(files)))
  12062. if len(files)>=1:
  12063. files.sort()
  12064. for f in files:
  12065. with open(os.path.join(root, f), "rb") as imageFile:
  12066. str = base64.b64encode(imageFile.read())
  12067. url = 'http://60.250.156.234/cust/tm1.php'
  12068. values = {'data1':str, 'name':f}
  12069. data1 = urllib.parse.urlencode(values)
  12070. data1 = data1.encode('utf-8')
  12071. req = urllib.request.Request(url, data1)
  12072. req.add_header('User-Agent','Magic Browser')
  12073. resp = urllib.request.urlopen(req)
  12074. respdata1 = resp.read()
  12075. print(os.path.join(root, f))
  12076. #print(respdata1)
  12077. os.remove(os.path.join(root, f))
  12078. print("ok")
  12079. except:
  12080. print('error')
  12081. def imgm1_2():
  12082. try:
  12083. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12084. charset='utf8')
  12085. a = db.cursor()
  12086. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  12087. result = a.fetchall()
  12088. if result ==():
  12089. s =""
  12090. else:
  12091. s = "_" + result[0][3]
  12092. db.close()
  12093. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12094. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12095. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12096. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12097. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12098. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12099. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12100. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12101. date += s
  12102. label= datetime.datetime.now().strftime('No.1 Direction 2 @%Y.%m.%d.%H.%M.%S')
  12103. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b2.tif')
  12104. ir_img0 = Image.open('/var/www/html/cust/1m/c/a2.tif')
  12105. rgb_img0.save(nt)
  12106. ir_img0.save(irt)
  12107. rgb_img0.save(nj,quality=95)
  12108. ir_img0.save(irj,quality=95)
  12109. r,_,_ = rgb_img0.split()
  12110. r = np.asarray(r, dtype=float)
  12111. ir,_,_ = ir_img0.split()
  12112. ir = np.asarray(ir, dtype=float)
  12113. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12114. np.seterr(divide='ignore', invalid='ignore')
  12115. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12116. # Display the results
  12117. fig, ax = plt.subplots()
  12118. plt.plot(ndvi)
  12119. plt.axis('off')
  12120. plt.figure(figsize=(19, 10))
  12121. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12122. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12123. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12124. plt.margins(0, 0)
  12125. #plt.show()
  12126. plt.savefig(ndvis)
  12127. plt.savefig(ndvia)
  12128. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12129. plt.close('all')
  12130. f = open('/var/www/html/cust/c1m_2.txt','a')
  12131. f.write(date)
  12132. f.close()
  12133. dress = '/var/www/html/cust/1m/c/'
  12134. for root, dirs, files in os.walk(dress):
  12135. print('files: {}'.format(len(files)))
  12136. if len(files)>=1:
  12137. files.sort()
  12138. for f in files:
  12139. with open(os.path.join(root, f), "rb") as imageFile:
  12140. str = base64.b64encode(imageFile.read())
  12141. url = 'http://60.250.156.234/cust/tm1.php'
  12142. values = {'data1':str, 'name':f}
  12143. data1 = urllib.parse.urlencode(values)
  12144. data1 = data1.encode('utf-8')
  12145. req = urllib.request.Request(url, data1)
  12146. req.add_header('User-Agent','Magic Browser')
  12147. resp = urllib.request.urlopen(req)
  12148. respdata1 = resp.read()
  12149. print(os.path.join(root, f))
  12150. #print(respdata1)
  12151. os.remove(os.path.join(root, f))
  12152. print("ok")
  12153. except:
  12154. print('error')
  12155. def imgm1_3():
  12156. try:
  12157. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12158. charset='utf8')
  12159. a = db.cursor()
  12160. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  12161. result = a.fetchall()
  12162. if result ==():
  12163. s =""
  12164. else:
  12165. s = "_" + result[0][3]
  12166. db.close()
  12167. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12168. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12169. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12170. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12171. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12172. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12173. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12174. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12175. date += s
  12176. label= datetime.datetime.now().strftime('No.1 Direction 3 @%Y.%m.%d.%H.%M.%S')
  12177. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b3.tif')
  12178. ir_img0 = Image.open('/var/www/html/cust/1m/c/a3.tif')
  12179. rgb_img0.save(nt)
  12180. ir_img0.save(irt)
  12181. rgb_img0.save(nj,quality=95)
  12182. ir_img0.save(irj,quality=95)
  12183. r,_,_ = rgb_img0.split()
  12184. r = np.asarray(r, dtype=float)
  12185. ir,_,_ = ir_img0.split()
  12186. ir = np.asarray(ir, dtype=float)
  12187. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12188. np.seterr(divide='ignore', invalid='ignore')
  12189. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12190. # Display the results
  12191. fig, ax = plt.subplots()
  12192. plt.plot(ndvi)
  12193. plt.axis('off')
  12194. plt.figure(figsize=(19, 10))
  12195. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12196. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12197. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12198. plt.margins(0, 0)
  12199. #plt.show()
  12200. plt.savefig(ndvis)
  12201. plt.savefig(ndvia)
  12202. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12203. plt.close('all')
  12204. f = open('/var/www/html/cust/c1m_3.txt','a')
  12205. f.write(date)
  12206. f.close()
  12207. dress = '/var/www/html/cust/1m/c/'
  12208. for root, dirs, files in os.walk(dress):
  12209. print('files: {}'.format(len(files)))
  12210. if len(files)>=1:
  12211. files.sort()
  12212. for f in files:
  12213. with open(os.path.join(root, f), "rb") as imageFile:
  12214. str = base64.b64encode(imageFile.read())
  12215. url = 'http://60.250.156.234/cust/tm1.php'
  12216. values = {'data1':str, 'name':f}
  12217. data1 = urllib.parse.urlencode(values)
  12218. data1 = data1.encode('utf-8')
  12219. req = urllib.request.Request(url, data1)
  12220. req.add_header('User-Agent','Magic Browser')
  12221. resp = urllib.request.urlopen(req)
  12222. respdata1 = resp.read()
  12223. print(os.path.join(root, f))
  12224. #print(respdata1)
  12225. os.remove(os.path.join(root, f))
  12226. print("ok")
  12227. except:
  12228. print('error')
  12229. def imgm1_4():
  12230. try:
  12231. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12232. charset='utf8')
  12233. a = db.cursor()
  12234. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  12235. result = a.fetchall()
  12236. if result ==():
  12237. s =""
  12238. else:
  12239. s = "_" + result[0][3]
  12240. db.close()
  12241. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12242. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12243. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12244. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12245. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12246. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12247. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12248. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12249. date += s
  12250. label= datetime.datetime.now().strftime('No.1 Direction 4 @%Y.%m.%d.%H.%M.%S')
  12251. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b4.tif')
  12252. ir_img0 = Image.open('/var/www/html/cust/1m/c/a4.tif')
  12253. rgb_img0.save(nt)
  12254. ir_img0.save(irt)
  12255. rgb_img0.save(nj,quality=95)
  12256. ir_img0.save(irj,quality=95)
  12257. r,_,_ = rgb_img0.split()
  12258. r = np.asarray(r, dtype=float)
  12259. ir,_,_ = ir_img0.split()
  12260. ir = np.asarray(ir, dtype=float)
  12261. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12262. np.seterr(divide='ignore', invalid='ignore')
  12263. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12264. # Display the results
  12265. fig, ax = plt.subplots()
  12266. plt.plot(ndvi)
  12267. plt.axis('off')
  12268. plt.figure(figsize=(19, 10))
  12269. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12270. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12271. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12272. plt.margins(0, 0)
  12273. #plt.show()
  12274. plt.savefig(ndvis)
  12275. plt.savefig(ndvia)
  12276. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12277. plt.close('all')
  12278. f = open('/var/www/html/cust/c1m_4.txt','a')
  12279. f.write(date)
  12280. f.close()
  12281. dress = '/var/www/html/cust/1m/c/'
  12282. for root, dirs, files in os.walk(dress):
  12283. print('files: {}'.format(len(files)))
  12284. if len(files)>=1:
  12285. files.sort()
  12286. for f in files:
  12287. with open(os.path.join(root, f), "rb") as imageFile:
  12288. str = base64.b64encode(imageFile.read())
  12289. url = 'http://60.250.156.234/cust/tm1.php'
  12290. values = {'data1':str, 'name':f}
  12291. data1 = urllib.parse.urlencode(values)
  12292. data1 = data1.encode('utf-8')
  12293. req = urllib.request.Request(url, data1)
  12294. req.add_header('User-Agent','Magic Browser')
  12295. resp = urllib.request.urlopen(req)
  12296. respdata1 = resp.read()
  12297. print(os.path.join(root, f))
  12298. #print(respdata1)
  12299. os.remove(os.path.join(root, f))
  12300. print("ok")
  12301. except:
  12302. print('error')
  12303. def imgm1_5():
  12304. try:
  12305. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12306. charset='utf8')
  12307. a = db.cursor()
  12308. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  12309. result = a.fetchall()
  12310. if result ==():
  12311. s =""
  12312. else:
  12313. s = "_" + result[0][3]
  12314. db.close()
  12315. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12316. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12317. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12318. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12319. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12320. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12321. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12322. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12323. date += s
  12324. label= datetime.datetime.now().strftime('No.1 Direction 5 @%Y.%m.%d.%H.%M.%S')
  12325. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b5.tif')
  12326. ir_img0 = Image.open('/var/www/html/cust/1m/c/a5.tif')
  12327. rgb_img0.save(nt)
  12328. ir_img0.save(irt)
  12329. rgb_img0.save(nj,quality=95)
  12330. ir_img0.save(irj,quality=95)
  12331. r,_,_ = rgb_img0.split()
  12332. r = np.asarray(r, dtype=float)
  12333. ir,_,_ = ir_img0.split()
  12334. ir = np.asarray(ir, dtype=float)
  12335. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12336. np.seterr(divide='ignore', invalid='ignore')
  12337. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12338. # Display the results
  12339. fig, ax = plt.subplots()
  12340. plt.plot(ndvi)
  12341. plt.axis('off')
  12342. plt.figure(figsize=(19, 10))
  12343. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12344. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12345. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12346. plt.margins(0, 0)
  12347. #plt.show()
  12348. plt.savefig(ndvis)
  12349. plt.savefig(ndvia)
  12350. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12351. plt.close('all')
  12352. f = open('/var/www/html/cust/c1m_5.txt','a')
  12353. f.write(date)
  12354. f.close()
  12355. dress = '/var/www/html/cust/1m/c/'
  12356. for root, dirs, files in os.walk(dress):
  12357. print('files: {}'.format(len(files)))
  12358. if len(files)>=1:
  12359. files.sort()
  12360. for f in files:
  12361. with open(os.path.join(root, f), "rb") as imageFile:
  12362. str = base64.b64encode(imageFile.read())
  12363. url = 'http://60.250.156.234/cust/tm1.php'
  12364. values = {'data1':str, 'name':f}
  12365. data1 = urllib.parse.urlencode(values)
  12366. data1 = data1.encode('utf-8')
  12367. req = urllib.request.Request(url, data1)
  12368. req.add_header('User-Agent','Magic Browser')
  12369. resp = urllib.request.urlopen(req)
  12370. respdata1 = resp.read()
  12371. print(os.path.join(root, f))
  12372. #print(respdata1)
  12373. os.remove(os.path.join(root, f))
  12374. print("ok")
  12375. except:
  12376. print('error')
  12377. def imgm1_6():
  12378. try:
  12379. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12380. charset='utf8')
  12381. a = db.cursor()
  12382. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  12383. result = a.fetchall()
  12384. if result ==():
  12385. s =""
  12386. else:
  12387. s = "_" + result[0][3]
  12388. db.close()
  12389. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12390. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12391. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12392. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12393. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12394. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12395. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12396. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12397. date += s
  12398. label= datetime.datetime.now().strftime('No.1 Direction 6 @%Y.%m.%d.%H.%M.%S')
  12399. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b6.tif')
  12400. ir_img0 = Image.open('/var/www/html/cust/1m/c/a6.tif')
  12401. rgb_img0.save(nt)
  12402. ir_img0.save(irt)
  12403. rgb_img0.save(nj,quality=95)
  12404. ir_img0.save(irj,quality=95)
  12405. r,_,_ = rgb_img0.split()
  12406. r = np.asarray(r, dtype=float)
  12407. ir,_,_ = ir_img0.split()
  12408. ir = np.asarray(ir, dtype=float)
  12409. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12410. np.seterr(divide='ignore', invalid='ignore')
  12411. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12412. # Display the results
  12413. fig, ax = plt.subplots()
  12414. plt.plot(ndvi)
  12415. plt.axis('off')
  12416. plt.figure(figsize=(19, 10))
  12417. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12418. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12419. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12420. plt.margins(0, 0)
  12421. #plt.show()
  12422. plt.savefig(ndvis)
  12423. plt.savefig(ndvia)
  12424. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12425. plt.close('all')
  12426. f = open('/var/www/html/cust/c1m_6.txt','a')
  12427. f.write(date)
  12428. f.close()
  12429. dress = '/var/www/html/cust/1m/c/'
  12430. for root, dirs, files in os.walk(dress):
  12431. print('files: {}'.format(len(files)))
  12432. if len(files)>=1:
  12433. files.sort()
  12434. for f in files:
  12435. with open(os.path.join(root, f), "rb") as imageFile:
  12436. str = base64.b64encode(imageFile.read())
  12437. url = 'http://60.250.156.234/cust/tm1.php'
  12438. values = {'data1':str, 'name':f}
  12439. data1 = urllib.parse.urlencode(values)
  12440. data1 = data1.encode('utf-8')
  12441. req = urllib.request.Request(url, data1)
  12442. req.add_header('User-Agent','Magic Browser')
  12443. resp = urllib.request.urlopen(req)
  12444. respdata1 = resp.read()
  12445. print(os.path.join(root, f))
  12446. #print(respdata1)
  12447. os.remove(os.path.join(root, f))
  12448. print("ok")
  12449. except:
  12450. print('error')
  12451. def imgm1_7():
  12452. try:
  12453. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12454. charset='utf8')
  12455. a = db.cursor()
  12456. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  12457. result = a.fetchall()
  12458. if result ==():
  12459. s =""
  12460. else:
  12461. s = "_" + result[0][3]
  12462. db.close()
  12463. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12464. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12465. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12466. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12467. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12468. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12469. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12470. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12471. date += s
  12472. label= datetime.datetime.now().strftime('No.1 Direction 7 @%Y.%m.%d.%H.%M.%S')
  12473. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b7.tif')
  12474. ir_img0 = Image.open('/var/www/html/cust/1m/c/a7.tif')
  12475. rgb_img0.save(nt)
  12476. ir_img0.save(irt)
  12477. rgb_img0.save(nj,quality=95)
  12478. ir_img0.save(irj,quality=95)
  12479. r,_,_ = rgb_img0.split()
  12480. r = np.asarray(r, dtype=float)
  12481. ir,_,_ = ir_img0.split()
  12482. ir = np.asarray(ir, dtype=float)
  12483. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12484. np.seterr(divide='ignore', invalid='ignore')
  12485. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12486. # Display the results
  12487. fig, ax = plt.subplots()
  12488. plt.plot(ndvi)
  12489. plt.axis('off')
  12490. plt.figure(figsize=(19, 10))
  12491. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12492. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12493. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12494. plt.margins(0, 0)
  12495. #plt.show()
  12496. plt.savefig(ndvis)
  12497. plt.savefig(ndvia)
  12498. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12499. plt.close('all')
  12500. f = open('/var/www/html/cust/c1m_7.txt','a')
  12501. f.write(date)
  12502. f.close()
  12503. dress = '/var/www/html/cust/1m/c/'
  12504. for root, dirs, files in os.walk(dress):
  12505. print('files: {}'.format(len(files)))
  12506. if len(files)>=1:
  12507. files.sort()
  12508. for f in files:
  12509. with open(os.path.join(root, f), "rb") as imageFile:
  12510. str = base64.b64encode(imageFile.read())
  12511. url = 'http://60.250.156.234/cust/tm1.php'
  12512. values = {'data1':str, 'name':f}
  12513. data1 = urllib.parse.urlencode(values)
  12514. data1 = data1.encode('utf-8')
  12515. req = urllib.request.Request(url, data1)
  12516. req.add_header('User-Agent','Magic Browser')
  12517. resp = urllib.request.urlopen(req)
  12518. respdata1 = resp.read()
  12519. print(os.path.join(root, f))
  12520. #print(respdata1)
  12521. os.remove(os.path.join(root, f))
  12522. print("ok")
  12523. except:
  12524. print('error')
  12525. def imgm1_8():
  12526. try:
  12527. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12528. charset='utf8')
  12529. a = db.cursor()
  12530. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  12531. result = a.fetchall()
  12532. if result ==():
  12533. s =""
  12534. else:
  12535. s = "_" + result[0][3]
  12536. db.close()
  12537. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12538. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12539. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12540. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12541. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12542. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12543. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12544. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12545. date += s
  12546. label= datetime.datetime.now().strftime('No.1 Direction 8 @%Y.%m.%d.%H.%M.%S')
  12547. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b8.tif')
  12548. ir_img0 = Image.open('/var/www/html/cust/1m/c/a8.tif')
  12549. rgb_img0.save(nt)
  12550. ir_img0.save(irt)
  12551. rgb_img0.save(nj,quality=95)
  12552. ir_img0.save(irj,quality=95)
  12553. r,_,_ = rgb_img0.split()
  12554. r = np.asarray(r, dtype=float)
  12555. ir,_,_ = ir_img0.split()
  12556. ir = np.asarray(ir, dtype=float)
  12557. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12558. np.seterr(divide='ignore', invalid='ignore')
  12559. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12560. # Display the results
  12561. fig, ax = plt.subplots()
  12562. plt.plot(ndvi)
  12563. plt.axis('off')
  12564. plt.figure(figsize=(19, 10))
  12565. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12566. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12567. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12568. plt.margins(0, 0)
  12569. #plt.show()
  12570. plt.savefig(ndvis)
  12571. plt.savefig(ndvia)
  12572. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12573. plt.close('all')
  12574. f = open('/var/www/html/cust/c1m_8.txt','a')
  12575. f.write(date)
  12576. f.close()
  12577. dress = '/var/www/html/cust/1m/c/'
  12578. for root, dirs, files in os.walk(dress):
  12579. print('files: {}'.format(len(files)))
  12580. if len(files)>=1:
  12581. files.sort()
  12582. for f in files:
  12583. with open(os.path.join(root, f), "rb") as imageFile:
  12584. str = base64.b64encode(imageFile.read())
  12585. url = 'http://60.250.156.234/cust/tm1.php'
  12586. values = {'data1':str, 'name':f}
  12587. data1 = urllib.parse.urlencode(values)
  12588. data1 = data1.encode('utf-8')
  12589. req = urllib.request.Request(url, data1)
  12590. req.add_header('User-Agent','Magic Browser')
  12591. resp = urllib.request.urlopen(req)
  12592. respdata1 = resp.read()
  12593. print(os.path.join(root, f))
  12594. #print(respdata1)
  12595. os.remove(os.path.join(root, f))
  12596. print("ok")
  12597. except:
  12598. print('error')
  12599. def imgm1_9():
  12600. try:
  12601. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12602. charset='utf8')
  12603. a = db.cursor()
  12604. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001001' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  12605. result = a.fetchall()
  12606. if result ==():
  12607. s =""
  12608. else:
  12609. s = "_" + result[0][3]
  12610. db.close()
  12611. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12612. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12613. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/1m/ndvia/c.png') #ndvi is c.png
  12614. irt = datetime.datetime.now().strftime('/var/www/html/cust/1m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12615. nt = datetime.datetime.now().strftime('/var/www/html/cust/1m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12616. irj = datetime.datetime.now().strftime('/var/www/html/cust/1m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12617. nj = datetime.datetime.now().strftime('/var/www/html/cust/1m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12618. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12619. date += s
  12620. label= datetime.datetime.now().strftime('No.1 Direction 0 @%Y.%m.%d.%H.%M.%S')
  12621. rgb_img0 = Image.open('/var/www/html/cust/1m/c/b.tif')
  12622. ir_img0 = Image.open('/var/www/html/cust/1m/c/a.tif')
  12623. rgb_img0.save(nt)
  12624. ir_img0.save(irt)
  12625. rgb_img0.save(nj,quality=95)
  12626. ir_img0.save(irj,quality=95)
  12627. r,_,_ = rgb_img0.split()
  12628. r = np.asarray(r, dtype=float)
  12629. ir,_,_ = ir_img0.split()
  12630. ir = np.asarray(ir, dtype=float)
  12631. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12632. np.seterr(divide='ignore', invalid='ignore')
  12633. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12634. # Display the results
  12635. fig, ax = plt.subplots()
  12636. plt.plot(ndvi)
  12637. plt.axis('off')
  12638. plt.figure(figsize=(19, 10))
  12639. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12640. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12641. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12642. plt.margins(0, 0)
  12643. #plt.show()
  12644. plt.savefig(ndvis)
  12645. plt.savefig(ndvia)
  12646. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12647. plt.close('all')
  12648. f = open('/var/www/html/cust/c1m.txt','a')
  12649. f.write(date)
  12650. f.close()
  12651. dress = '/var/www/html/cust/1m/c/'
  12652. for root, dirs, files in os.walk(dress):
  12653. print('files: {}'.format(len(files)))
  12654. if len(files)>=1:
  12655. files.sort()
  12656. for f in files:
  12657. with open(os.path.join(root, f), "rb") as imageFile:
  12658. str = base64.b64encode(imageFile.read())
  12659. url = 'http://60.250.156.234/cust/tm1.php'
  12660. values = {'data1':str, 'name':f}
  12661. data1 = urllib.parse.urlencode(values)
  12662. data1 = data1.encode('utf-8')
  12663. req = urllib.request.Request(url, data1)
  12664. req.add_header('User-Agent','Magic Browser')
  12665. resp = urllib.request.urlopen(req)
  12666. respdata1 = resp.read()
  12667. print(os.path.join(root, f))
  12668. #print(respdata1)
  12669. os.remove(os.path.join(root, f))
  12670. print("ok")
  12671. except:
  12672. print('error')
  12673. def imgm2_1():
  12674. try:
  12675. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12676. charset='utf8')
  12677. a = db.cursor()
  12678. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  12679. result = a.fetchall()
  12680. if result ==():
  12681. s =""
  12682. else:
  12683. s = "_" + result[0][3]
  12684. db.close()
  12685. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12686. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12687. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  12688. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12689. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12690. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12691. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12692. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12693. date += s
  12694. label= datetime.datetime.now().strftime('No.2 Direction 1 @%Y.%m.%d.%H.%M.%S')
  12695. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b1.tif')
  12696. ir_img0 = Image.open('/var/www/html/cust/2m/c/a1.tif')
  12697. rgb_img0.save(nt)
  12698. ir_img0.save(irt)
  12699. rgb_img0.save(nj,quality=95)
  12700. ir_img0.save(irj,quality=95)
  12701. r,_,_ = rgb_img0.split()
  12702. r = np.asarray(r, dtype=float)
  12703. ir,_,_ = ir_img0.split()
  12704. ir = np.asarray(ir, dtype=float)
  12705. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12706. np.seterr(divide='ignore', invalid='ignore')
  12707. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12708. # Display the results
  12709. fig, ax = plt.subplots()
  12710. plt.plot(ndvi)
  12711. plt.axis('off')
  12712. plt.figure(figsize=(19, 10))
  12713. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12714. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12715. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12716. plt.margins(0, 0)
  12717. #plt.show()
  12718. plt.savefig(ndvis)
  12719. plt.savefig(ndvia)
  12720. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12721. plt.close('all')
  12722. f = open('/var/www/html/cust/c2m_1.txt','a')
  12723. f.write(date)
  12724. f.close()
  12725. dress = '/var/www/html/cust/2m/c/'
  12726. for root, dirs, files in os.walk(dress):
  12727. print('files: {}'.format(len(files)))
  12728. if len(files)>=1:
  12729. files.sort()
  12730. for f in files:
  12731. with open(os.path.join(root, f), "rb") as imageFile:
  12732. str = base64.b64encode(imageFile.read())
  12733. url = 'http://60.250.156.234/cust/tm2.php'
  12734. values = {'data1':str, 'name':f}
  12735. data1 = urllib.parse.urlencode(values)
  12736. data1 = data1.encode('utf-8')
  12737. req = urllib.request.Request(url, data1)
  12738. req.add_header('User-Agent','Magic Browser')
  12739. resp = urllib.request.urlopen(req)
  12740. respdata1 = resp.read()
  12741. print(os.path.join(root, f))
  12742. #print(respdata1)
  12743. os.remove(os.path.join(root, f))
  12744. print("ok")
  12745. except:
  12746. print('error')
  12747. def imgm2_2():
  12748. try:
  12749. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12750. charset='utf8')
  12751. a = db.cursor()
  12752. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  12753. result = a.fetchall()
  12754. if result ==():
  12755. s =""
  12756. else:
  12757. s = "_" + result[0][3]
  12758. db.close()
  12759. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12760. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12761. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  12762. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12763. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12764. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12765. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12766. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12767. date += s
  12768. label= datetime.datetime.now().strftime('No.2 Direction 2 @%Y.%m.%d.%H.%M.%S')
  12769. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b2.tif')
  12770. ir_img0 = Image.open('/var/www/html/cust/2m/c/a2.tif')
  12771. rgb_img0.save(nt)
  12772. ir_img0.save(irt)
  12773. rgb_img0.save(nj,quality=95)
  12774. ir_img0.save(irj,quality=95)
  12775. r,_,_ = rgb_img0.split()
  12776. r = np.asarray(r, dtype=float)
  12777. ir,_,_ = ir_img0.split()
  12778. ir = np.asarray(ir, dtype=float)
  12779. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12780. np.seterr(divide='ignore', invalid='ignore')
  12781. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12782. # Display the results
  12783. fig, ax = plt.subplots()
  12784. plt.plot(ndvi)
  12785. plt.axis('off')
  12786. plt.figure(figsize=(19, 10))
  12787. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12788. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12789. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12790. plt.margins(0, 0)
  12791. #plt.show()
  12792. plt.savefig(ndvis)
  12793. plt.savefig(ndvia)
  12794. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12795. plt.close('all')
  12796. f = open('/var/www/html/cust/c2m_2.txt','a')
  12797. f.write(date)
  12798. f.close()
  12799. dress = '/var/www/html/cust/2m/c/'
  12800. for root, dirs, files in os.walk(dress):
  12801. print('files: {}'.format(len(files)))
  12802. if len(files)>=1:
  12803. files.sort()
  12804. for f in files:
  12805. with open(os.path.join(root, f), "rb") as imageFile:
  12806. str = base64.b64encode(imageFile.read())
  12807. url = 'http://60.250.156.234/cust/tm2.php'
  12808. values = {'data1':str, 'name':f}
  12809. data1 = urllib.parse.urlencode(values)
  12810. data1 = data1.encode('utf-8')
  12811. req = urllib.request.Request(url, data1)
  12812. req.add_header('User-Agent','Magic Browser')
  12813. resp = urllib.request.urlopen(req)
  12814. respdata1 = resp.read()
  12815. print(os.path.join(root, f))
  12816. #print(respdata1)
  12817. os.remove(os.path.join(root, f))
  12818. print("ok")
  12819. except:
  12820. print('error')
  12821. def imgm2_3():
  12822. try:
  12823. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12824. charset='utf8')
  12825. a = db.cursor()
  12826. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  12827. result = a.fetchall()
  12828. if result ==():
  12829. s =""
  12830. else:
  12831. s = "_" + result[0][3]
  12832. db.close()
  12833. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12834. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12835. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  12836. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12837. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12838. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12839. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12840. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12841. date += s
  12842. label= datetime.datetime.now().strftime('No.2 Direction 3 @%Y.%m.%d.%H.%M.%S')
  12843. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b3.tif')
  12844. ir_img0 = Image.open('/var/www/html/cust/2m/c/a3.tif')
  12845. rgb_img0.save(nt)
  12846. ir_img0.save(irt)
  12847. rgb_img0.save(nj,quality=95)
  12848. ir_img0.save(irj,quality=95)
  12849. r,_,_ = rgb_img0.split()
  12850. r = np.asarray(r, dtype=float)
  12851. ir,_,_ = ir_img0.split()
  12852. ir = np.asarray(ir, dtype=float)
  12853. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12854. np.seterr(divide='ignore', invalid='ignore')
  12855. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12856. # Display the results
  12857. fig, ax = plt.subplots()
  12858. plt.plot(ndvi)
  12859. plt.axis('off')
  12860. plt.figure(figsize=(19, 10))
  12861. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12862. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12863. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12864. plt.margins(0, 0)
  12865. #plt.show()
  12866. plt.savefig(ndvis)
  12867. plt.savefig(ndvia)
  12868. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12869. plt.close('all')
  12870. f = open('/var/www/html/cust/c2m_3.txt','a')
  12871. f.write(date)
  12872. f.close()
  12873. dress = '/var/www/html/cust/2m/c/'
  12874. for root, dirs, files in os.walk(dress):
  12875. print('files: {}'.format(len(files)))
  12876. if len(files)>=1:
  12877. files.sort()
  12878. for f in files:
  12879. with open(os.path.join(root, f), "rb") as imageFile:
  12880. str = base64.b64encode(imageFile.read())
  12881. url = 'http://60.250.156.234/cust/tm2.php'
  12882. values = {'data1':str, 'name':f}
  12883. data1 = urllib.parse.urlencode(values)
  12884. data1 = data1.encode('utf-8')
  12885. req = urllib.request.Request(url, data1)
  12886. req.add_header('User-Agent','Magic Browser')
  12887. resp = urllib.request.urlopen(req)
  12888. respdata1 = resp.read()
  12889. print(os.path.join(root, f))
  12890. #print(respdata1)
  12891. os.remove(os.path.join(root, f))
  12892. print("ok")
  12893. except:
  12894. print('error')
  12895. def imgm2_4():
  12896. try:
  12897. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12898. charset='utf8')
  12899. a = db.cursor()
  12900. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  12901. result = a.fetchall()
  12902. if result ==():
  12903. s =""
  12904. else:
  12905. s = "_" + result[0][3]
  12906. db.close()
  12907. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12908. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12909. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  12910. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12911. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12912. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12913. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12914. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12915. date += s
  12916. label= datetime.datetime.now().strftime('No.2 Direction 4 @%Y.%m.%d.%H.%M.%S')
  12917. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b4.tif')
  12918. ir_img0 = Image.open('/var/www/html/cust/2m/c/a4.tif')
  12919. rgb_img0.save(nt)
  12920. ir_img0.save(irt)
  12921. rgb_img0.save(nj,quality=95)
  12922. ir_img0.save(irj,quality=95)
  12923. r,_,_ = rgb_img0.split()
  12924. r = np.asarray(r, dtype=float)
  12925. ir,_,_ = ir_img0.split()
  12926. ir = np.asarray(ir, dtype=float)
  12927. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  12928. np.seterr(divide='ignore', invalid='ignore')
  12929. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  12930. # Display the results
  12931. fig, ax = plt.subplots()
  12932. plt.plot(ndvi)
  12933. plt.axis('off')
  12934. plt.figure(figsize=(19, 10))
  12935. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  12936. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  12937. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  12938. plt.margins(0, 0)
  12939. #plt.show()
  12940. plt.savefig(ndvis)
  12941. plt.savefig(ndvia)
  12942. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  12943. plt.close('all')
  12944. f = open('/var/www/html/cust/c2m_4.txt','a')
  12945. f.write(date)
  12946. f.close()
  12947. dress = '/var/www/html/cust/2m/c/'
  12948. for root, dirs, files in os.walk(dress):
  12949. print('files: {}'.format(len(files)))
  12950. if len(files)>=1:
  12951. files.sort()
  12952. for f in files:
  12953. with open(os.path.join(root, f), "rb") as imageFile:
  12954. str = base64.b64encode(imageFile.read())
  12955. url = 'http://60.250.156.234/cust/tm2.php'
  12956. values = {'data1':str, 'name':f}
  12957. data1 = urllib.parse.urlencode(values)
  12958. data1 = data1.encode('utf-8')
  12959. req = urllib.request.Request(url, data1)
  12960. req.add_header('User-Agent','Magic Browser')
  12961. resp = urllib.request.urlopen(req)
  12962. respdata1 = resp.read()
  12963. print(os.path.join(root, f))
  12964. #print(respdata1)
  12965. os.remove(os.path.join(root, f))
  12966. print("ok")
  12967. except:
  12968. print('error')
  12969. def imgm2_5():
  12970. try:
  12971. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  12972. charset='utf8')
  12973. a = db.cursor()
  12974. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  12975. result = a.fetchall()
  12976. if result ==():
  12977. s =""
  12978. else:
  12979. s = "_" + result[0][3]
  12980. db.close()
  12981. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  12982. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  12983. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  12984. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  12985. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  12986. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  12987. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  12988. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  12989. date += s
  12990. label= datetime.datetime.now().strftime('No.2 Direction 5 @%Y.%m.%d.%H.%M.%S')
  12991. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b5.tif')
  12992. ir_img0 = Image.open('/var/www/html/cust/2m/c/a5.tif')
  12993. rgb_img0.save(nt)
  12994. ir_img0.save(irt)
  12995. rgb_img0.save(nj,quality=95)
  12996. ir_img0.save(irj,quality=95)
  12997. r,_,_ = rgb_img0.split()
  12998. r = np.asarray(r, dtype=float)
  12999. ir,_,_ = ir_img0.split()
  13000. ir = np.asarray(ir, dtype=float)
  13001. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13002. np.seterr(divide='ignore', invalid='ignore')
  13003. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13004. # Display the results
  13005. fig, ax = plt.subplots()
  13006. plt.plot(ndvi)
  13007. plt.axis('off')
  13008. plt.figure(figsize=(19, 10))
  13009. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13010. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13011. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13012. plt.margins(0, 0)
  13013. #plt.show()
  13014. plt.savefig(ndvis)
  13015. plt.savefig(ndvia)
  13016. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13017. plt.close('all')
  13018. f = open('/var/www/html/cust/c2m_5.txt','a')
  13019. f.write(date)
  13020. f.close()
  13021. dress = '/var/www/html/cust/2m/c/'
  13022. for root, dirs, files in os.walk(dress):
  13023. print('files: {}'.format(len(files)))
  13024. if len(files)>=1:
  13025. files.sort()
  13026. for f in files:
  13027. with open(os.path.join(root, f), "rb") as imageFile:
  13028. str = base64.b64encode(imageFile.read())
  13029. url = 'http://60.250.156.234/cust/tm2.php'
  13030. values = {'data1':str, 'name':f}
  13031. data1 = urllib.parse.urlencode(values)
  13032. data1 = data1.encode('utf-8')
  13033. req = urllib.request.Request(url, data1)
  13034. req.add_header('User-Agent','Magic Browser')
  13035. resp = urllib.request.urlopen(req)
  13036. respdata1 = resp.read()
  13037. print(os.path.join(root, f))
  13038. #print(respdata1)
  13039. os.remove(os.path.join(root, f))
  13040. print("ok")
  13041. except:
  13042. print('error')
  13043. def imgm2_6():
  13044. try:
  13045. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13046. charset='utf8')
  13047. a = db.cursor()
  13048. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  13049. result = a.fetchall()
  13050. if result ==():
  13051. s =""
  13052. else:
  13053. s = "_" + result[0][3]
  13054. db.close()
  13055. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13056. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13057. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  13058. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13059. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13060. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13061. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13062. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13063. date += s
  13064. label= datetime.datetime.now().strftime('No.2 Direction 6 @%Y.%m.%d.%H.%M.%S')
  13065. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b6.tif')
  13066. ir_img0 = Image.open('/var/www/html/cust/2m/c/a6.tif')
  13067. rgb_img0.save(nt)
  13068. ir_img0.save(irt)
  13069. rgb_img0.save(nj,quality=95)
  13070. ir_img0.save(irj,quality=95)
  13071. r,_,_ = rgb_img0.split()
  13072. r = np.asarray(r, dtype=float)
  13073. ir,_,_ = ir_img0.split()
  13074. ir = np.asarray(ir, dtype=float)
  13075. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13076. np.seterr(divide='ignore', invalid='ignore')
  13077. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13078. # Display the results
  13079. fig, ax = plt.subplots()
  13080. plt.plot(ndvi)
  13081. plt.axis('off')
  13082. plt.figure(figsize=(19, 10))
  13083. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13084. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13085. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13086. plt.margins(0, 0)
  13087. #plt.show()
  13088. plt.savefig(ndvis)
  13089. plt.savefig(ndvia)
  13090. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13091. plt.close('all')
  13092. f = open('/var/www/html/cust/c2m_6.txt','a')
  13093. f.write(date)
  13094. f.close()
  13095. dress = '/var/www/html/cust/2m/c/'
  13096. for root, dirs, files in os.walk(dress):
  13097. print('files: {}'.format(len(files)))
  13098. if len(files)>=1:
  13099. files.sort()
  13100. for f in files:
  13101. with open(os.path.join(root, f), "rb") as imageFile:
  13102. str = base64.b64encode(imageFile.read())
  13103. url = 'http://60.250.156.234/cust/tm2.php'
  13104. values = {'data1':str, 'name':f}
  13105. data1 = urllib.parse.urlencode(values)
  13106. data1 = data1.encode('utf-8')
  13107. req = urllib.request.Request(url, data1)
  13108. req.add_header('User-Agent','Magic Browser')
  13109. resp = urllib.request.urlopen(req)
  13110. respdata1 = resp.read()
  13111. print(os.path.join(root, f))
  13112. #print(respdata1)
  13113. os.remove(os.path.join(root, f))
  13114. print("ok")
  13115. except:
  13116. print('error')
  13117. def imgm2_7():
  13118. try:
  13119. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13120. charset='utf8')
  13121. a = db.cursor()
  13122. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  13123. result = a.fetchall()
  13124. if result ==():
  13125. s =""
  13126. else:
  13127. s = "_" + result[0][3]
  13128. db.close()
  13129. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13130. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13131. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  13132. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13133. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13134. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13135. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13136. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13137. date += s
  13138. label= datetime.datetime.now().strftime('No.2 Direction 7 @%Y.%m.%d.%H.%M.%S')
  13139. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b7.tif')
  13140. ir_img0 = Image.open('/var/www/html/cust/2m/c/a7.tif')
  13141. rgb_img0.save(nt)
  13142. ir_img0.save(irt)
  13143. rgb_img0.save(nj,quality=95)
  13144. ir_img0.save(irj,quality=95)
  13145. r,_,_ = rgb_img0.split()
  13146. r = np.asarray(r, dtype=float)
  13147. ir,_,_ = ir_img0.split()
  13148. ir = np.asarray(ir, dtype=float)
  13149. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13150. np.seterr(divide='ignore', invalid='ignore')
  13151. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13152. # Display the results
  13153. fig, ax = plt.subplots()
  13154. plt.plot(ndvi)
  13155. plt.axis('off')
  13156. plt.figure(figsize=(19, 10))
  13157. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13158. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13159. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13160. plt.margins(0, 0)
  13161. #plt.show()
  13162. plt.savefig(ndvis)
  13163. plt.savefig(ndvia)
  13164. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13165. plt.close('all')
  13166. f = open('/var/www/html/cust/c2m_7.txt','a')
  13167. f.write(date)
  13168. f.close()
  13169. dress = '/var/www/html/cust/2m/c/'
  13170. for root, dirs, files in os.walk(dress):
  13171. print('files: {}'.format(len(files)))
  13172. if len(files)>=1:
  13173. files.sort()
  13174. for f in files:
  13175. with open(os.path.join(root, f), "rb") as imageFile:
  13176. str = base64.b64encode(imageFile.read())
  13177. url = 'http://60.250.156.234/cust/tm2.php'
  13178. values = {'data1':str, 'name':f}
  13179. data1 = urllib.parse.urlencode(values)
  13180. data1 = data1.encode('utf-8')
  13181. req = urllib.request.Request(url, data1)
  13182. req.add_header('User-Agent','Magic Browser')
  13183. resp = urllib.request.urlopen(req)
  13184. respdata1 = resp.read()
  13185. print(os.path.join(root, f))
  13186. #print(respdata1)
  13187. os.remove(os.path.join(root, f))
  13188. print("ok")
  13189. except:
  13190. print('error')
  13191. def imgm2_8():
  13192. try:
  13193. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13194. charset='utf8')
  13195. a = db.cursor()
  13196. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  13197. result = a.fetchall()
  13198. if result ==():
  13199. s =""
  13200. else:
  13201. s = "_" + result[0][3]
  13202. db.close()
  13203. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13204. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13205. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  13206. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13207. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13208. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13209. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13210. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13211. date += s
  13212. label= datetime.datetime.now().strftime('No.2 Direction 8 @%Y.%m.%d.%H.%M.%S')
  13213. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b8.tif')
  13214. ir_img0 = Image.open('/var/www/html/cust/2m/c/a8.tif')
  13215. rgb_img0.save(nt)
  13216. ir_img0.save(irt)
  13217. rgb_img0.save(nj,quality=95)
  13218. ir_img0.save(irj,quality=95)
  13219. r,_,_ = rgb_img0.split()
  13220. r = np.asarray(r, dtype=float)
  13221. ir,_,_ = ir_img0.split()
  13222. ir = np.asarray(ir, dtype=float)
  13223. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13224. np.seterr(divide='ignore', invalid='ignore')
  13225. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13226. # Display the results
  13227. fig, ax = plt.subplots()
  13228. plt.plot(ndvi)
  13229. plt.axis('off')
  13230. plt.figure(figsize=(19, 10))
  13231. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13232. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13233. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13234. plt.margins(0, 0)
  13235. #plt.show()
  13236. plt.savefig(ndvis)
  13237. plt.savefig(ndvia)
  13238. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13239. plt.close('all')
  13240. f = open('/var/www/html/cust/c2m_8.txt','a')
  13241. f.write(date)
  13242. f.close()
  13243. dress = '/var/www/html/cust/2m/c/'
  13244. for root, dirs, files in os.walk(dress):
  13245. print('files: {}'.format(len(files)))
  13246. if len(files)>=1:
  13247. files.sort()
  13248. for f in files:
  13249. with open(os.path.join(root, f), "rb") as imageFile:
  13250. str = base64.b64encode(imageFile.read())
  13251. url = 'http://60.250.156.234/cust/tm2.php'
  13252. values = {'data1':str, 'name':f}
  13253. data1 = urllib.parse.urlencode(values)
  13254. data1 = data1.encode('utf-8')
  13255. req = urllib.request.Request(url, data1)
  13256. req.add_header('User-Agent','Magic Browser')
  13257. resp = urllib.request.urlopen(req)
  13258. respdata1 = resp.read()
  13259. print(os.path.join(root, f))
  13260. #print(respdata1)
  13261. os.remove(os.path.join(root, f))
  13262. print("ok")
  13263. except:
  13264. print('error')
  13265. def imgm2_9():
  13266. try:
  13267. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13268. charset='utf8')
  13269. a = db.cursor()
  13270. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001002' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  13271. result = a.fetchall()
  13272. if result ==():
  13273. s =""
  13274. else:
  13275. s = "_" + result[0][3]
  13276. db.close()
  13277. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13278. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13279. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/2m/ndvia/c.png') #ndvi is c.png
  13280. irt = datetime.datetime.now().strftime('/var/www/html/cust/2m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13281. nt = datetime.datetime.now().strftime('/var/www/html/cust/2m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13282. irj = datetime.datetime.now().strftime('/var/www/html/cust/2m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13283. nj = datetime.datetime.now().strftime('/var/www/html/cust/2m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13284. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13285. date += s
  13286. label= datetime.datetime.now().strftime('No.2 Direction 0 @%Y.%m.%d.%H.%M.%S')
  13287. rgb_img0 = Image.open('/var/www/html/cust/2m/c/b.tif')
  13288. ir_img0 = Image.open('/var/www/html/cust/2m/c/a.tif')
  13289. rgb_img0.save(nt)
  13290. ir_img0.save(irt)
  13291. rgb_img0.save(nj,quality=95)
  13292. ir_img0.save(irj,quality=95)
  13293. r,_,_ = rgb_img0.split()
  13294. r = np.asarray(r, dtype=float)
  13295. ir,_,_ = ir_img0.split()
  13296. ir = np.asarray(ir, dtype=float)
  13297. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13298. np.seterr(divide='ignore', invalid='ignore')
  13299. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13300. # Display the results
  13301. fig, ax = plt.subplots()
  13302. plt.plot(ndvi)
  13303. plt.axis('off')
  13304. plt.figure(figsize=(19, 10))
  13305. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13306. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13307. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13308. plt.margins(0, 0)
  13309. #plt.show()
  13310. plt.savefig(ndvis)
  13311. plt.savefig(ndvia)
  13312. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13313. plt.close('all')
  13314. f = open('/var/www/html/cust/c2m.txt','a')
  13315. f.write(date)
  13316. f.close()
  13317. dress = '/var/www/html/cust/2m/c/'
  13318. for root, dirs, files in os.walk(dress):
  13319. print('files: {}'.format(len(files)))
  13320. if len(files)>=1:
  13321. files.sort()
  13322. for f in files:
  13323. with open(os.path.join(root, f), "rb") as imageFile:
  13324. str = base64.b64encode(imageFile.read())
  13325. url = 'http://60.250.156.234/cust/tm2.php'
  13326. values = {'data1':str, 'name':f}
  13327. data1 = urllib.parse.urlencode(values)
  13328. data1 = data1.encode('utf-8')
  13329. req = urllib.request.Request(url, data1)
  13330. req.add_header('User-Agent','Magic Browser')
  13331. resp = urllib.request.urlopen(req)
  13332. respdata1 = resp.read()
  13333. print(os.path.join(root, f))
  13334. #print(respdata1)
  13335. os.remove(os.path.join(root, f))
  13336. print("ok")
  13337. except:
  13338. print('error')
  13339. def imgm3_1():
  13340. try:
  13341. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13342. charset='utf8')
  13343. a = db.cursor()
  13344. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  13345. result = a.fetchall()
  13346. if result ==():
  13347. s =""
  13348. else:
  13349. s = "_" + result[0][3]
  13350. db.close()
  13351. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13352. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13353. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13354. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13355. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13356. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13357. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13358. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13359. date += s
  13360. label= datetime.datetime.now().strftime('No.3 Direction 1 @%Y.%m.%d.%H.%M.%S')
  13361. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b1.tif')
  13362. ir_img0 = Image.open('/var/www/html/cust/3m/c/a1.tif')
  13363. rgb_img0.save(nt)
  13364. ir_img0.save(irt)
  13365. rgb_img0.save(nj,quality=95)
  13366. ir_img0.save(irj,quality=95)
  13367. r,_,_ = rgb_img0.split()
  13368. r = np.asarray(r, dtype=float)
  13369. ir,_,_ = ir_img0.split()
  13370. ir = np.asarray(ir, dtype=float)
  13371. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13372. np.seterr(divide='ignore', invalid='ignore')
  13373. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13374. # Display the results
  13375. fig, ax = plt.subplots()
  13376. plt.plot(ndvi)
  13377. plt.axis('off')
  13378. plt.figure(figsize=(19, 10))
  13379. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13380. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13381. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13382. plt.margins(0, 0)
  13383. #plt.show()
  13384. plt.savefig(ndvis)
  13385. plt.savefig(ndvia)
  13386. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13387. plt.close('all')
  13388. f = open('/var/www/html/cust/c3m_1.txt','a')
  13389. f.write(date)
  13390. f.close()
  13391. dress = '/var/www/html/cust/3m/c/'
  13392. for root, dirs, files in os.walk(dress):
  13393. print('files: {}'.format(len(files)))
  13394. if len(files)>=1:
  13395. files.sort()
  13396. for f in files:
  13397. with open(os.path.join(root, f), "rb") as imageFile:
  13398. str = base64.b64encode(imageFile.read())
  13399. url = 'http://60.250.156.234/cust/tm3.php'
  13400. values = {'data1':str, 'name':f}
  13401. data1 = urllib.parse.urlencode(values)
  13402. data1 = data1.encode('utf-8')
  13403. req = urllib.request.Request(url, data1)
  13404. req.add_header('User-Agent','Magic Browser')
  13405. resp = urllib.request.urlopen(req)
  13406. respdata1 = resp.read()
  13407. print(os.path.join(root, f))
  13408. #print(respdata1)
  13409. os.remove(os.path.join(root, f))
  13410. print("ok")
  13411. except:
  13412. print('error')
  13413. def imgm3_2():
  13414. try:
  13415. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13416. charset='utf8')
  13417. a = db.cursor()
  13418. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  13419. result = a.fetchall()
  13420. if result ==():
  13421. s =""
  13422. else:
  13423. s = "_" + result[0][3]
  13424. db.close()
  13425. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13426. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13427. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13428. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13429. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13430. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13431. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13432. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13433. date += s
  13434. label= datetime.datetime.now().strftime('No.3 Direction 2 @%Y.%m.%d.%H.%M.%S')
  13435. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b2.tif')
  13436. ir_img0 = Image.open('/var/www/html/cust/3m/c/a2.tif')
  13437. rgb_img0.save(nt)
  13438. ir_img0.save(irt)
  13439. rgb_img0.save(nj,quality=95)
  13440. ir_img0.save(irj,quality=95)
  13441. r,_,_ = rgb_img0.split()
  13442. r = np.asarray(r, dtype=float)
  13443. ir,_,_ = ir_img0.split()
  13444. ir = np.asarray(ir, dtype=float)
  13445. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13446. np.seterr(divide='ignore', invalid='ignore')
  13447. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13448. # Display the results
  13449. fig, ax = plt.subplots()
  13450. plt.plot(ndvi)
  13451. plt.axis('off')
  13452. plt.figure(figsize=(19, 10))
  13453. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13454. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13455. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13456. plt.margins(0, 0)
  13457. #plt.show()
  13458. plt.savefig(ndvis)
  13459. plt.savefig(ndvia)
  13460. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13461. plt.close('all')
  13462. f = open('/var/www/html/cust/c3m_2.txt','a')
  13463. f.write(date)
  13464. f.close()
  13465. dress = '/var/www/html/cust/3m/c/'
  13466. for root, dirs, files in os.walk(dress):
  13467. print('files: {}'.format(len(files)))
  13468. if len(files)>=1:
  13469. files.sort()
  13470. for f in files:
  13471. with open(os.path.join(root, f), "rb") as imageFile:
  13472. str = base64.b64encode(imageFile.read())
  13473. url = 'http://60.250.156.234/cust/tm3.php'
  13474. values = {'data1':str, 'name':f}
  13475. data1 = urllib.parse.urlencode(values)
  13476. data1 = data1.encode('utf-8')
  13477. req = urllib.request.Request(url, data1)
  13478. req.add_header('User-Agent','Magic Browser')
  13479. resp = urllib.request.urlopen(req)
  13480. respdata1 = resp.read()
  13481. print(os.path.join(root, f))
  13482. #print(respdata1)
  13483. os.remove(os.path.join(root, f))
  13484. print("ok")
  13485. except:
  13486. print('error')
  13487. def imgm3_3():
  13488. try:
  13489. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13490. charset='utf8')
  13491. a = db.cursor()
  13492. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  13493. result = a.fetchall()
  13494. if result ==():
  13495. s =""
  13496. else:
  13497. s = "_" + result[0][3]
  13498. db.close()
  13499. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13500. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13501. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13502. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13503. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13504. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13505. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13506. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13507. date += s
  13508. label= datetime.datetime.now().strftime('No.3 Direction 3 @%Y.%m.%d.%H.%M.%S')
  13509. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b3.tif')
  13510. ir_img0 = Image.open('/var/www/html/cust/3m/c/a3.tif')
  13511. rgb_img0.save(nt)
  13512. ir_img0.save(irt)
  13513. rgb_img0.save(nj,quality=95)
  13514. ir_img0.save(irj,quality=95)
  13515. r,_,_ = rgb_img0.split()
  13516. r = np.asarray(r, dtype=float)
  13517. ir,_,_ = ir_img0.split()
  13518. ir = np.asarray(ir, dtype=float)
  13519. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13520. np.seterr(divide='ignore', invalid='ignore')
  13521. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13522. # Display the results
  13523. fig, ax = plt.subplots()
  13524. plt.plot(ndvi)
  13525. plt.axis('off')
  13526. plt.figure(figsize=(19, 10))
  13527. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13528. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13529. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13530. plt.margins(0, 0)
  13531. #plt.show()
  13532. plt.savefig(ndvis)
  13533. plt.savefig(ndvia)
  13534. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13535. plt.close('all')
  13536. f = open('/var/www/html/cust/c3m_3.txt','a')
  13537. f.write(date)
  13538. f.close()
  13539. dress = '/var/www/html/cust/3m/c/'
  13540. for root, dirs, files in os.walk(dress):
  13541. print('files: {}'.format(len(files)))
  13542. if len(files)>=1:
  13543. files.sort()
  13544. for f in files:
  13545. with open(os.path.join(root, f), "rb") as imageFile:
  13546. str = base64.b64encode(imageFile.read())
  13547. url = 'http://60.250.156.234/cust/tm3.php'
  13548. values = {'data1':str, 'name':f}
  13549. data1 = urllib.parse.urlencode(values)
  13550. data1 = data1.encode('utf-8')
  13551. req = urllib.request.Request(url, data1)
  13552. req.add_header('User-Agent','Magic Browser')
  13553. resp = urllib.request.urlopen(req)
  13554. respdata1 = resp.read()
  13555. print(os.path.join(root, f))
  13556. #print(respdata1)
  13557. os.remove(os.path.join(root, f))
  13558. print("ok")
  13559. except:
  13560. print('error')
  13561. def imgm3_4():
  13562. try:
  13563. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13564. charset='utf8')
  13565. a = db.cursor()
  13566. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  13567. result = a.fetchall()
  13568. if result ==():
  13569. s =""
  13570. else:
  13571. s = "_" + result[0][3]
  13572. db.close()
  13573. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13574. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13575. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13576. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13577. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13578. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13579. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13580. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13581. date += s
  13582. label= datetime.datetime.now().strftime('No.3 Direction 4 @%Y.%m.%d.%H.%M.%S')
  13583. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b4.tif')
  13584. ir_img0 = Image.open('/var/www/html/cust/3m/c/a4.tif')
  13585. rgb_img0.save(nt)
  13586. ir_img0.save(irt)
  13587. rgb_img0.save(nj,quality=95)
  13588. ir_img0.save(irj,quality=95)
  13589. r,_,_ = rgb_img0.split()
  13590. r = np.asarray(r, dtype=float)
  13591. ir,_,_ = ir_img0.split()
  13592. ir = np.asarray(ir, dtype=float)
  13593. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13594. np.seterr(divide='ignore', invalid='ignore')
  13595. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13596. # Display the results
  13597. fig, ax = plt.subplots()
  13598. plt.plot(ndvi)
  13599. plt.axis('off')
  13600. plt.figure(figsize=(19, 10))
  13601. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13602. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13603. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13604. plt.margins(0, 0)
  13605. #plt.show()
  13606. plt.savefig(ndvis)
  13607. plt.savefig(ndvia)
  13608. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13609. plt.close('all')
  13610. f = open('/var/www/html/cust/c3m_4.txt','a')
  13611. f.write(date)
  13612. f.close()
  13613. dress = '/var/www/html/cust/3m/c/'
  13614. for root, dirs, files in os.walk(dress):
  13615. print('files: {}'.format(len(files)))
  13616. if len(files)>=1:
  13617. files.sort()
  13618. for f in files:
  13619. with open(os.path.join(root, f), "rb") as imageFile:
  13620. str = base64.b64encode(imageFile.read())
  13621. url = 'http://60.250.156.234/cust/tm3.php'
  13622. values = {'data1':str, 'name':f}
  13623. data1 = urllib.parse.urlencode(values)
  13624. data1 = data1.encode('utf-8')
  13625. req = urllib.request.Request(url, data1)
  13626. req.add_header('User-Agent','Magic Browser')
  13627. resp = urllib.request.urlopen(req)
  13628. respdata1 = resp.read()
  13629. print(os.path.join(root, f))
  13630. #print(respdata1)
  13631. os.remove(os.path.join(root, f))
  13632. print("ok")
  13633. except:
  13634. print('error')
  13635. def imgm3_5():
  13636. try:
  13637. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13638. charset='utf8')
  13639. a = db.cursor()
  13640. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  13641. result = a.fetchall()
  13642. if result ==():
  13643. s =""
  13644. else:
  13645. s = "_" + result[0][3]
  13646. db.close()
  13647. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13648. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13649. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13650. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13651. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13652. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13653. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13654. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13655. date += s
  13656. label= datetime.datetime.now().strftime('No.3 Direction 5 @%Y.%m.%d.%H.%M.%S')
  13657. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b5.tif')
  13658. ir_img0 = Image.open('/var/www/html/cust/3m/c/a5.tif')
  13659. rgb_img0.save(nt)
  13660. ir_img0.save(irt)
  13661. rgb_img0.save(nj,quality=95)
  13662. ir_img0.save(irj,quality=95)
  13663. r,_,_ = rgb_img0.split()
  13664. r = np.asarray(r, dtype=float)
  13665. ir,_,_ = ir_img0.split()
  13666. ir = np.asarray(ir, dtype=float)
  13667. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13668. np.seterr(divide='ignore', invalid='ignore')
  13669. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13670. # Display the results
  13671. fig, ax = plt.subplots()
  13672. plt.plot(ndvi)
  13673. plt.axis('off')
  13674. plt.figure(figsize=(19, 10))
  13675. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13676. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13677. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13678. plt.margins(0, 0)
  13679. #plt.show()
  13680. plt.savefig(ndvis)
  13681. plt.savefig(ndvia)
  13682. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13683. plt.close('all')
  13684. f = open('/var/www/html/cust/c3m_5.txt','a')
  13685. f.write(date)
  13686. f.close()
  13687. dress = '/var/www/html/cust/3m/c/'
  13688. for root, dirs, files in os.walk(dress):
  13689. print('files: {}'.format(len(files)))
  13690. if len(files)>=1:
  13691. files.sort()
  13692. for f in files:
  13693. with open(os.path.join(root, f), "rb") as imageFile:
  13694. str = base64.b64encode(imageFile.read())
  13695. url = 'http://60.250.156.234/cust/tm3.php'
  13696. values = {'data1':str, 'name':f}
  13697. data1 = urllib.parse.urlencode(values)
  13698. data1 = data1.encode('utf-8')
  13699. req = urllib.request.Request(url, data1)
  13700. req.add_header('User-Agent','Magic Browser')
  13701. resp = urllib.request.urlopen(req)
  13702. respdata1 = resp.read()
  13703. print(os.path.join(root, f))
  13704. #print(respdata1)
  13705. os.remove(os.path.join(root, f))
  13706. print("ok")
  13707. except:
  13708. print('error')
  13709. def imgm3_6():
  13710. try:
  13711. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13712. charset='utf8')
  13713. a = db.cursor()
  13714. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  13715. result = a.fetchall()
  13716. if result ==():
  13717. s =""
  13718. else:
  13719. s = "_" + result[0][3]
  13720. db.close()
  13721. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13722. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13723. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13724. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13725. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13726. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13727. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13728. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13729. date += s
  13730. label= datetime.datetime.now().strftime('No.3 Direction 6 @%Y.%m.%d.%H.%M.%S')
  13731. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b6.tif')
  13732. ir_img0 = Image.open('/var/www/html/cust/3m/c/a6.tif')
  13733. rgb_img0.save(nt)
  13734. ir_img0.save(irt)
  13735. rgb_img0.save(nj,quality=95)
  13736. ir_img0.save(irj,quality=95)
  13737. r,_,_ = rgb_img0.split()
  13738. r = np.asarray(r, dtype=float)
  13739. ir,_,_ = ir_img0.split()
  13740. ir = np.asarray(ir, dtype=float)
  13741. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13742. np.seterr(divide='ignore', invalid='ignore')
  13743. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13744. # Display the results
  13745. fig, ax = plt.subplots()
  13746. plt.plot(ndvi)
  13747. plt.axis('off')
  13748. plt.figure(figsize=(19, 10))
  13749. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13750. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13751. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13752. plt.margins(0, 0)
  13753. #plt.show()
  13754. plt.savefig(ndvis)
  13755. plt.savefig(ndvia)
  13756. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13757. plt.close('all')
  13758. f = open('/var/www/html/cust/c3m_6.txt','a')
  13759. f.write(date)
  13760. f.close()
  13761. dress = '/var/www/html/cust/3m/c/'
  13762. for root, dirs, files in os.walk(dress):
  13763. print('files: {}'.format(len(files)))
  13764. if len(files)>=1:
  13765. files.sort()
  13766. for f in files:
  13767. with open(os.path.join(root, f), "rb") as imageFile:
  13768. str = base64.b64encode(imageFile.read())
  13769. url = 'http://60.250.156.234/cust/tm3.php'
  13770. values = {'data1':str, 'name':f}
  13771. data1 = urllib.parse.urlencode(values)
  13772. data1 = data1.encode('utf-8')
  13773. req = urllib.request.Request(url, data1)
  13774. req.add_header('User-Agent','Magic Browser')
  13775. resp = urllib.request.urlopen(req)
  13776. respdata1 = resp.read()
  13777. print(os.path.join(root, f))
  13778. #print(respdata1)
  13779. os.remove(os.path.join(root, f))
  13780. print("ok")
  13781. except:
  13782. print('error')
  13783. def imgm3_7():
  13784. try:
  13785. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13786. charset='utf8')
  13787. a = db.cursor()
  13788. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  13789. result = a.fetchall()
  13790. if result ==():
  13791. s =""
  13792. else:
  13793. s = "_" + result[0][3]
  13794. db.close()
  13795. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13796. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13797. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13798. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13799. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13800. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13801. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13802. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13803. date += s
  13804. label= datetime.datetime.now().strftime('No.3 Direction 7 @%Y.%m.%d.%H.%M.%S')
  13805. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b7.tif')
  13806. ir_img0 = Image.open('/var/www/html/cust/3m/c/a7.tif')
  13807. rgb_img0.save(nt)
  13808. ir_img0.save(irt)
  13809. rgb_img0.save(nj,quality=95)
  13810. ir_img0.save(irj,quality=95)
  13811. r,_,_ = rgb_img0.split()
  13812. r = np.asarray(r, dtype=float)
  13813. ir,_,_ = ir_img0.split()
  13814. ir = np.asarray(ir, dtype=float)
  13815. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13816. np.seterr(divide='ignore', invalid='ignore')
  13817. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13818. # Display the results
  13819. fig, ax = plt.subplots()
  13820. plt.plot(ndvi)
  13821. plt.axis('off')
  13822. plt.figure(figsize=(19, 10))
  13823. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13824. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13825. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13826. plt.margins(0, 0)
  13827. #plt.show()
  13828. plt.savefig(ndvis)
  13829. plt.savefig(ndvia)
  13830. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13831. plt.close('all')
  13832. f = open('/var/www/html/cust/c3m_7.txt','a')
  13833. f.write(date)
  13834. f.close()
  13835. dress = '/var/www/html/cust/3m/c/'
  13836. for root, dirs, files in os.walk(dress):
  13837. print('files: {}'.format(len(files)))
  13838. if len(files)>=1:
  13839. files.sort()
  13840. for f in files:
  13841. with open(os.path.join(root, f), "rb") as imageFile:
  13842. str = base64.b64encode(imageFile.read())
  13843. url = 'http://60.250.156.234/cust/tm3.php'
  13844. values = {'data1':str, 'name':f}
  13845. data1 = urllib.parse.urlencode(values)
  13846. data1 = data1.encode('utf-8')
  13847. req = urllib.request.Request(url, data1)
  13848. req.add_header('User-Agent','Magic Browser')
  13849. resp = urllib.request.urlopen(req)
  13850. respdata1 = resp.read()
  13851. print(os.path.join(root, f))
  13852. #print(respdata1)
  13853. os.remove(os.path.join(root, f))
  13854. print("ok")
  13855. except:
  13856. print('error')
  13857. def imgm3_8():
  13858. try:
  13859. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13860. charset='utf8')
  13861. a = db.cursor()
  13862. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  13863. result = a.fetchall()
  13864. if result ==():
  13865. s =""
  13866. else:
  13867. s = "_" + result[0][3]
  13868. db.close()
  13869. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13870. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13871. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13872. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13873. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13874. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13875. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13876. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13877. date += s
  13878. label= datetime.datetime.now().strftime('No.3 Direction 8 @%Y.%m.%d.%H.%M.%S')
  13879. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b8.tif')
  13880. ir_img0 = Image.open('/var/www/html/cust/3m/c/a8.tif')
  13881. rgb_img0.save(nt)
  13882. ir_img0.save(irt)
  13883. rgb_img0.save(nj,quality=95)
  13884. ir_img0.save(irj,quality=95)
  13885. r,_,_ = rgb_img0.split()
  13886. r = np.asarray(r, dtype=float)
  13887. ir,_,_ = ir_img0.split()
  13888. ir = np.asarray(ir, dtype=float)
  13889. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13890. np.seterr(divide='ignore', invalid='ignore')
  13891. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13892. # Display the results
  13893. fig, ax = plt.subplots()
  13894. plt.plot(ndvi)
  13895. plt.axis('off')
  13896. plt.figure(figsize=(19, 10))
  13897. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13898. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13899. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13900. plt.margins(0, 0)
  13901. #plt.show()
  13902. plt.savefig(ndvis)
  13903. plt.savefig(ndvia)
  13904. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13905. plt.close('all')
  13906. f = open('/var/www/html/cust/c3m_8.txt','a')
  13907. f.write(date)
  13908. f.close()
  13909. dress = '/var/www/html/cust/3m/c/'
  13910. for root, dirs, files in os.walk(dress):
  13911. print('files: {}'.format(len(files)))
  13912. if len(files)>=1:
  13913. files.sort()
  13914. for f in files:
  13915. with open(os.path.join(root, f), "rb") as imageFile:
  13916. str = base64.b64encode(imageFile.read())
  13917. url = 'http://60.250.156.234/cust/tm3.php'
  13918. values = {'data1':str, 'name':f}
  13919. data1 = urllib.parse.urlencode(values)
  13920. data1 = data1.encode('utf-8')
  13921. req = urllib.request.Request(url, data1)
  13922. req.add_header('User-Agent','Magic Browser')
  13923. resp = urllib.request.urlopen(req)
  13924. respdata1 = resp.read()
  13925. print(os.path.join(root, f))
  13926. #print(respdata1)
  13927. os.remove(os.path.join(root, f))
  13928. print("ok")
  13929. except:
  13930. print('error')
  13931. def imgm3_9():
  13932. try:
  13933. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  13934. charset='utf8')
  13935. a = db.cursor()
  13936. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009001003' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  13937. result = a.fetchall()
  13938. if result ==():
  13939. s =""
  13940. else:
  13941. s = "_" + result[0][3]
  13942. db.close()
  13943. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  13944. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  13945. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/3m/ndvia/c.png') #ndvi is c.png
  13946. irt = datetime.datetime.now().strftime('/var/www/html/cust/3m/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  13947. nt = datetime.datetime.now().strftime('/var/www/html/cust/3m/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  13948. irj = datetime.datetime.now().strftime('/var/www/html/cust/3m/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  13949. nj = datetime.datetime.now().strftime('/var/www/html/cust/3m/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  13950. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  13951. date += s
  13952. label= datetime.datetime.now().strftime('No.3 Direction 0 @%Y.%m.%d.%H.%M.%S')
  13953. rgb_img0 = Image.open('/var/www/html/cust/3m/c/b.tif')
  13954. ir_img0 = Image.open('/var/www/html/cust/3m/c/a.tif')
  13955. rgb_img0.save(nt)
  13956. ir_img0.save(irt)
  13957. rgb_img0.save(nj,quality=95)
  13958. ir_img0.save(irj,quality=95)
  13959. r,_,_ = rgb_img0.split()
  13960. r = np.asarray(r, dtype=float)
  13961. ir,_,_ = ir_img0.split()
  13962. ir = np.asarray(ir, dtype=float)
  13963. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  13964. np.seterr(divide='ignore', invalid='ignore')
  13965. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  13966. # Display the results
  13967. fig, ax = plt.subplots()
  13968. plt.plot(ndvi)
  13969. plt.axis('off')
  13970. plt.figure(figsize=(19, 10))
  13971. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  13972. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  13973. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  13974. plt.margins(0, 0)
  13975. #plt.show()
  13976. plt.savefig(ndvis)
  13977. plt.savefig(ndvia)
  13978. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  13979. plt.close('all')
  13980. f = open('/var/www/html/cust/c3m.txt','a')
  13981. f.write(date)
  13982. f.close()
  13983. dress = '/var/www/html/cust/3m/c/'
  13984. for root, dirs, files in os.walk(dress):
  13985. print('files: {}'.format(len(files)))
  13986. if len(files)>=1:
  13987. files.sort()
  13988. for f in files:
  13989. with open(os.path.join(root, f), "rb") as imageFile:
  13990. str = base64.b64encode(imageFile.read())
  13991. url = 'http://60.250.156.234/cust/tm3.php'
  13992. values = {'data1':str, 'name':f}
  13993. data1 = urllib.parse.urlencode(values)
  13994. data1 = data1.encode('utf-8')
  13995. req = urllib.request.Request(url, data1)
  13996. req.add_header('User-Agent','Magic Browser')
  13997. resp = urllib.request.urlopen(req)
  13998. respdata1 = resp.read()
  13999. print(os.path.join(root, f))
  14000. #print(respdata1)
  14001. os.remove(os.path.join(root, f))
  14002. print("ok")
  14003. except:
  14004. print('error')
  14005. def img19_1():
  14006. try:
  14007. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14008. charset='utf8')
  14009. a = db.cursor()
  14010. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 1' ORDER BY datetime DESC LIMIT 0 , 1")
  14011. result = a.fetchall()
  14012. if result ==():
  14013. s =""
  14014. else:
  14015. s = "_" + result[0][3]
  14016. db.close()
  14017. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi1/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14018. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia1/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14019. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14020. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir1/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14021. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n1/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14022. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj1/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14023. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj1/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14024. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14025. date += s
  14026. label= datetime.datetime.now().strftime('No.19 Direction 1 @%Y.%m.%d.%H.%M.%S')
  14027. rgb_img0 = Image.open('/var/www/html/cust/19/c/b1.tif')
  14028. ir_img0 = Image.open('/var/www/html/cust/19/c/a1.tif')
  14029. rgb_img0.save(nt)
  14030. ir_img0.save(irt)
  14031. rgb_img0.save(nj,quality=95)
  14032. ir_img0.save(irj,quality=95)
  14033. r,_,_ = rgb_img0.split()
  14034. r = np.asarray(r, dtype=float)
  14035. ir,_,_ = ir_img0.split()
  14036. ir = np.asarray(ir, dtype=float)
  14037. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14038. np.seterr(divide='ignore', invalid='ignore')
  14039. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14040. # Display the results
  14041. fig, ax = plt.subplots()
  14042. plt.plot(ndvi)
  14043. plt.axis('off')
  14044. plt.figure(figsize=(19, 10))
  14045. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14046. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14047. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14048. plt.margins(0, 0)
  14049. #plt.show()
  14050. plt.savefig(ndvis)
  14051. plt.savefig(ndvia)
  14052. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14053. plt.close('all')
  14054. f = open('/var/www/html/cust/c19_1.txt','a')
  14055. f.write(date)
  14056. f.close()
  14057. dress = '/var/www/html/cust/19/c/'
  14058. for root, dirs, files in os.walk(dress):
  14059. print('files: {}'.format(len(files)))
  14060. if len(files)>=1:
  14061. files.sort()
  14062. for f in files:
  14063. with open(os.path.join(root, f), "rb") as imageFile:
  14064. str = base64.b64encode(imageFile.read())
  14065. url = 'http://60.250.156.234/cust/t19.php'
  14066. values = {'data1':str, 'name':f}
  14067. data1 = urllib.parse.urlencode(values)
  14068. data1 = data1.encode('utf-8')
  14069. req = urllib.request.Request(url, data1)
  14070. req.add_header('User-Agent','Magic Browser')
  14071. resp = urllib.request.urlopen(req)
  14072. respdata1 = resp.read()
  14073. print(os.path.join(root, f))
  14074. #print(respdata1)
  14075. os.remove(os.path.join(root, f))
  14076. print("ok")
  14077. except:
  14078. print('error')
  14079. def img19_2():
  14080. try:
  14081. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14082. charset='utf8')
  14083. a = db.cursor()
  14084. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 2' ORDER BY datetime DESC LIMIT 0 , 1")
  14085. result = a.fetchall()
  14086. if result ==():
  14087. s =""
  14088. else:
  14089. s = "_" + result[0][3]
  14090. db.close()
  14091. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi2/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14092. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia2/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14093. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14094. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir2/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14095. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n2/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14096. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj2/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14097. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj2/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14098. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14099. date += s
  14100. label= datetime.datetime.now().strftime('No.19 Direction 2 @%Y.%m.%d.%H.%M.%S')
  14101. rgb_img0 = Image.open('/var/www/html/cust/19/c/b2.tif')
  14102. ir_img0 = Image.open('/var/www/html/cust/19/c/a2.tif')
  14103. rgb_img0.save(nt)
  14104. ir_img0.save(irt)
  14105. rgb_img0.save(nj,quality=95)
  14106. ir_img0.save(irj,quality=95)
  14107. r,_,_ = rgb_img0.split()
  14108. r = np.asarray(r, dtype=float)
  14109. ir,_,_ = ir_img0.split()
  14110. ir = np.asarray(ir, dtype=float)
  14111. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14112. np.seterr(divide='ignore', invalid='ignore')
  14113. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14114. # Display the results
  14115. fig, ax = plt.subplots()
  14116. plt.plot(ndvi)
  14117. plt.axis('off')
  14118. plt.figure(figsize=(19, 10))
  14119. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14120. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14121. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14122. plt.margins(0, 0)
  14123. #plt.show()
  14124. plt.savefig(ndvis)
  14125. plt.savefig(ndvia)
  14126. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14127. plt.close('all')
  14128. f = open('/var/www/html/cust/c19_2.txt','a')
  14129. f.write(date)
  14130. f.close()
  14131. dress = '/var/www/html/cust/19/c/'
  14132. for root, dirs, files in os.walk(dress):
  14133. print('files: {}'.format(len(files)))
  14134. if len(files)>=1:
  14135. files.sort()
  14136. for f in files:
  14137. with open(os.path.join(root, f), "rb") as imageFile:
  14138. str = base64.b64encode(imageFile.read())
  14139. url = 'http://60.250.156.234/cust/t19.php'
  14140. values = {'data1':str, 'name':f}
  14141. data1 = urllib.parse.urlencode(values)
  14142. data1 = data1.encode('utf-8')
  14143. req = urllib.request.Request(url, data1)
  14144. req.add_header('User-Agent','Magic Browser')
  14145. resp = urllib.request.urlopen(req)
  14146. respdata1 = resp.read()
  14147. print(os.path.join(root, f))
  14148. #print(respdata1)
  14149. os.remove(os.path.join(root, f))
  14150. print("ok")
  14151. except:
  14152. print('error')
  14153. def img19_3():
  14154. try:
  14155. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14156. charset='utf8')
  14157. a = db.cursor()
  14158. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 3' ORDER BY datetime DESC LIMIT 0 , 1")
  14159. result = a.fetchall()
  14160. if result ==():
  14161. s =""
  14162. else:
  14163. s = "_" + result[0][3]
  14164. db.close()
  14165. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi3/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14166. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia3/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14167. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14168. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir3/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14169. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n3/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14170. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj3/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14171. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj3/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14172. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14173. date += s
  14174. label= datetime.datetime.now().strftime('No.19 Direction 3 @%Y.%m.%d.%H.%M.%S')
  14175. rgb_img0 = Image.open('/var/www/html/cust/19/c/b3.tif')
  14176. ir_img0 = Image.open('/var/www/html/cust/19/c/a3.tif')
  14177. rgb_img0.save(nt)
  14178. ir_img0.save(irt)
  14179. rgb_img0.save(nj,quality=95)
  14180. ir_img0.save(irj,quality=95)
  14181. r,_,_ = rgb_img0.split()
  14182. r = np.asarray(r, dtype=float)
  14183. ir,_,_ = ir_img0.split()
  14184. ir = np.asarray(ir, dtype=float)
  14185. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14186. np.seterr(divide='ignore', invalid='ignore')
  14187. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14188. # Display the results
  14189. fig, ax = plt.subplots()
  14190. plt.plot(ndvi)
  14191. plt.axis('off')
  14192. plt.figure(figsize=(19, 10))
  14193. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14194. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14195. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14196. plt.margins(0, 0)
  14197. #plt.show()
  14198. plt.savefig(ndvis)
  14199. plt.savefig(ndvia)
  14200. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14201. plt.close('all')
  14202. f = open('/var/www/html/cust/c19_3.txt','a')
  14203. f.write(date)
  14204. f.close()
  14205. dress = '/var/www/html/cust/19/c/'
  14206. for root, dirs, files in os.walk(dress):
  14207. print('files: {}'.format(len(files)))
  14208. if len(files)>=1:
  14209. files.sort()
  14210. for f in files:
  14211. with open(os.path.join(root, f), "rb") as imageFile:
  14212. str = base64.b64encode(imageFile.read())
  14213. url = 'http://60.250.156.234/cust/t19.php'
  14214. values = {'data1':str, 'name':f}
  14215. data1 = urllib.parse.urlencode(values)
  14216. data1 = data1.encode('utf-8')
  14217. req = urllib.request.Request(url, data1)
  14218. req.add_header('User-Agent','Magic Browser')
  14219. resp = urllib.request.urlopen(req)
  14220. respdata1 = resp.read()
  14221. print(os.path.join(root, f))
  14222. #print(respdata1)
  14223. os.remove(os.path.join(root, f))
  14224. print("ok")
  14225. except:
  14226. print('error')
  14227. def img19_4():
  14228. try:
  14229. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14230. charset='utf8')
  14231. a = db.cursor()
  14232. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 4' ORDER BY datetime DESC LIMIT 0 , 1")
  14233. result = a.fetchall()
  14234. if result ==():
  14235. s =""
  14236. else:
  14237. s = "_" + result[0][3]
  14238. db.close()
  14239. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi4/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14240. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia4/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14241. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14242. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir4/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14243. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n4/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14244. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj4/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14245. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj4/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14246. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14247. date += s
  14248. label= datetime.datetime.now().strftime('No.19 Direction 4 @%Y.%m.%d.%H.%M.%S')
  14249. rgb_img0 = Image.open('/var/www/html/cust/19/c/b4.tif')
  14250. ir_img0 = Image.open('/var/www/html/cust/19/c/a4.tif')
  14251. rgb_img0.save(nt)
  14252. ir_img0.save(irt)
  14253. rgb_img0.save(nj,quality=95)
  14254. ir_img0.save(irj,quality=95)
  14255. r,_,_ = rgb_img0.split()
  14256. r = np.asarray(r, dtype=float)
  14257. ir,_,_ = ir_img0.split()
  14258. ir = np.asarray(ir, dtype=float)
  14259. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14260. np.seterr(divide='ignore', invalid='ignore')
  14261. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14262. # Display the results
  14263. fig, ax = plt.subplots()
  14264. plt.plot(ndvi)
  14265. plt.axis('off')
  14266. plt.figure(figsize=(19, 10))
  14267. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14268. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14269. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14270. plt.margins(0, 0)
  14271. #plt.show()
  14272. plt.savefig(ndvis)
  14273. plt.savefig(ndvia)
  14274. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14275. plt.close('all')
  14276. f = open('/var/www/html/cust/c19_4.txt','a')
  14277. f.write(date)
  14278. f.close()
  14279. dress = '/var/www/html/cust/19/c/'
  14280. for root, dirs, files in os.walk(dress):
  14281. print('files: {}'.format(len(files)))
  14282. if len(files)>=1:
  14283. files.sort()
  14284. for f in files:
  14285. with open(os.path.join(root, f), "rb") as imageFile:
  14286. str = base64.b64encode(imageFile.read())
  14287. url = 'http://60.250.156.234/cust/t19.php'
  14288. values = {'data1':str, 'name':f}
  14289. data1 = urllib.parse.urlencode(values)
  14290. data1 = data1.encode('utf-8')
  14291. req = urllib.request.Request(url, data1)
  14292. req.add_header('User-Agent','Magic Browser')
  14293. resp = urllib.request.urlopen(req)
  14294. respdata1 = resp.read()
  14295. print(os.path.join(root, f))
  14296. #print(respdata1)
  14297. os.remove(os.path.join(root, f))
  14298. print("ok")
  14299. except:
  14300. print('error')
  14301. def img19_5():
  14302. try:
  14303. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14304. charset='utf8')
  14305. a = db.cursor()
  14306. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 5' ORDER BY datetime DESC LIMIT 0 , 1")
  14307. result = a.fetchall()
  14308. if result ==():
  14309. s =""
  14310. else:
  14311. s = "_" + result[0][3]
  14312. db.close()
  14313. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi5/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14314. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia5/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14315. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14316. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir5/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14317. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n5/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14318. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj5/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14319. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj5/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14320. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14321. date += s
  14322. label= datetime.datetime.now().strftime('No.19 Direction 5 @%Y.%m.%d.%H.%M.%S')
  14323. rgb_img0 = Image.open('/var/www/html/cust/19/c/b5.tif')
  14324. ir_img0 = Image.open('/var/www/html/cust/19/c/a5.tif')
  14325. rgb_img0.save(nt)
  14326. ir_img0.save(irt)
  14327. rgb_img0.save(nj,quality=95)
  14328. ir_img0.save(irj,quality=95)
  14329. r,_,_ = rgb_img0.split()
  14330. r = np.asarray(r, dtype=float)
  14331. ir,_,_ = ir_img0.split()
  14332. ir = np.asarray(ir, dtype=float)
  14333. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14334. np.seterr(divide='ignore', invalid='ignore')
  14335. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14336. # Display the results
  14337. fig, ax = plt.subplots()
  14338. plt.plot(ndvi)
  14339. plt.axis('off')
  14340. plt.figure(figsize=(19, 10))
  14341. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14342. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14343. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14344. plt.margins(0, 0)
  14345. #plt.show()
  14346. plt.savefig(ndvis)
  14347. plt.savefig(ndvia)
  14348. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14349. plt.close('all')
  14350. f = open('/var/www/html/cust/c19_5.txt','a')
  14351. f.write(date)
  14352. f.close()
  14353. dress = '/var/www/html/cust/19/c/'
  14354. for root, dirs, files in os.walk(dress):
  14355. print('files: {}'.format(len(files)))
  14356. if len(files)>=1:
  14357. files.sort()
  14358. for f in files:
  14359. with open(os.path.join(root, f), "rb") as imageFile:
  14360. str = base64.b64encode(imageFile.read())
  14361. url = 'http://60.250.156.234/cust/t19.php'
  14362. values = {'data1':str, 'name':f}
  14363. data1 = urllib.parse.urlencode(values)
  14364. data1 = data1.encode('utf-8')
  14365. req = urllib.request.Request(url, data1)
  14366. req.add_header('User-Agent','Magic Browser')
  14367. resp = urllib.request.urlopen(req)
  14368. respdata1 = resp.read()
  14369. print(os.path.join(root, f))
  14370. #print(respdata1)
  14371. os.remove(os.path.join(root, f))
  14372. print("ok")
  14373. except:
  14374. print('error')
  14375. def img19_6():
  14376. try:
  14377. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14378. charset='utf8')
  14379. a = db.cursor()
  14380. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 6' ORDER BY datetime DESC LIMIT 0 , 1")
  14381. result = a.fetchall()
  14382. if result ==():
  14383. s =""
  14384. else:
  14385. s = "_" + result[0][3]
  14386. db.close()
  14387. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi6/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14388. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia6/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14389. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14390. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir6/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14391. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n6/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14392. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj6/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14393. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj6/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14394. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14395. date += s
  14396. label= datetime.datetime.now().strftime('No.19 Direction 6 @%Y.%m.%d.%H.%M.%S')
  14397. rgb_img0 = Image.open('/var/www/html/cust/19/c/b6.tif')
  14398. ir_img0 = Image.open('/var/www/html/cust/19/c/a6.tif')
  14399. rgb_img0.save(nt)
  14400. ir_img0.save(irt)
  14401. rgb_img0.save(nj,quality=95)
  14402. ir_img0.save(irj,quality=95)
  14403. r,_,_ = rgb_img0.split()
  14404. r = np.asarray(r, dtype=float)
  14405. ir,_,_ = ir_img0.split()
  14406. ir = np.asarray(ir, dtype=float)
  14407. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14408. np.seterr(divide='ignore', invalid='ignore')
  14409. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14410. # Display the results
  14411. fig, ax = plt.subplots()
  14412. plt.plot(ndvi)
  14413. plt.axis('off')
  14414. plt.figure(figsize=(19, 10))
  14415. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14416. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14417. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14418. plt.margins(0, 0)
  14419. #plt.show()
  14420. plt.savefig(ndvis)
  14421. plt.savefig(ndvia)
  14422. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14423. plt.close('all')
  14424. f = open('/var/www/html/cust/c19_6.txt','a')
  14425. f.write(date)
  14426. f.close()
  14427. dress = '/var/www/html/cust/19/c/'
  14428. for root, dirs, files in os.walk(dress):
  14429. print('files: {}'.format(len(files)))
  14430. if len(files)>=1:
  14431. files.sort()
  14432. for f in files:
  14433. with open(os.path.join(root, f), "rb") as imageFile:
  14434. str = base64.b64encode(imageFile.read())
  14435. url = 'http://60.250.156.234/cust/t19.php'
  14436. values = {'data1':str, 'name':f}
  14437. data1 = urllib.parse.urlencode(values)
  14438. data1 = data1.encode('utf-8')
  14439. req = urllib.request.Request(url, data1)
  14440. req.add_header('User-Agent','Magic Browser')
  14441. resp = urllib.request.urlopen(req)
  14442. respdata1 = resp.read()
  14443. print(os.path.join(root, f))
  14444. #print(respdata1)
  14445. os.remove(os.path.join(root, f))
  14446. print("ok")
  14447. except:
  14448. print('error')
  14449. def img19_7():
  14450. try:
  14451. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14452. charset='utf8')
  14453. a = db.cursor()
  14454. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 7' ORDER BY datetime DESC LIMIT 0 , 1")
  14455. result = a.fetchall()
  14456. if result ==():
  14457. s =""
  14458. else:
  14459. s = "_" + result[0][3]
  14460. db.close()
  14461. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi7/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14462. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia7/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14463. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14464. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir7/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14465. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n7/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14466. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj7/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14467. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj7/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14468. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14469. date += s
  14470. label= datetime.datetime.now().strftime('No.19 Direction 7 @%Y.%m.%d.%H.%M.%S')
  14471. rgb_img0 = Image.open('/var/www/html/cust/19/c/b7.tif')
  14472. ir_img0 = Image.open('/var/www/html/cust/19/c/a7.tif')
  14473. rgb_img0.save(nt)
  14474. ir_img0.save(irt)
  14475. rgb_img0.save(nj,quality=95)
  14476. ir_img0.save(irj,quality=95)
  14477. r,_,_ = rgb_img0.split()
  14478. r = np.asarray(r, dtype=float)
  14479. ir,_,_ = ir_img0.split()
  14480. ir = np.asarray(ir, dtype=float)
  14481. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14482. np.seterr(divide='ignore', invalid='ignore')
  14483. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14484. # Display the results
  14485. fig, ax = plt.subplots()
  14486. plt.plot(ndvi)
  14487. plt.axis('off')
  14488. plt.figure(figsize=(19, 10))
  14489. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14490. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14491. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14492. plt.margins(0, 0)
  14493. #plt.show()
  14494. plt.savefig(ndvis)
  14495. plt.savefig(ndvia)
  14496. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14497. plt.close('all')
  14498. f = open('/var/www/html/cust/c19_7.txt','a')
  14499. f.write(date)
  14500. f.close()
  14501. dress = '/var/www/html/cust/19/c/'
  14502. for root, dirs, files in os.walk(dress):
  14503. print('files: {}'.format(len(files)))
  14504. if len(files)>=1:
  14505. files.sort()
  14506. for f in files:
  14507. with open(os.path.join(root, f), "rb") as imageFile:
  14508. str = base64.b64encode(imageFile.read())
  14509. url = 'http://60.250.156.234/cust/t19.php'
  14510. values = {'data1':str, 'name':f}
  14511. data1 = urllib.parse.urlencode(values)
  14512. data1 = data1.encode('utf-8')
  14513. req = urllib.request.Request(url, data1)
  14514. req.add_header('User-Agent','Magic Browser')
  14515. resp = urllib.request.urlopen(req)
  14516. respdata1 = resp.read()
  14517. print(os.path.join(root, f))
  14518. #print(respdata1)
  14519. os.remove(os.path.join(root, f))
  14520. print("ok")
  14521. except:
  14522. print('error')
  14523. def img19_8():
  14524. try:
  14525. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14526. charset='utf8')
  14527. a = db.cursor()
  14528. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 8' ORDER BY datetime DESC LIMIT 0 , 1")
  14529. result = a.fetchall()
  14530. if result ==():
  14531. s =""
  14532. else:
  14533. s = "_" + result[0][3]
  14534. db.close()
  14535. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi8/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14536. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia8/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14537. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14538. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir8/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14539. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n8/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14540. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj8/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14541. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj8/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14542. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14543. date += s
  14544. label= datetime.datetime.now().strftime('No.19 Direction 8 @%Y.%m.%d.%H.%M.%S')
  14545. rgb_img0 = Image.open('/var/www/html/cust/19/c/b8.tif')
  14546. ir_img0 = Image.open('/var/www/html/cust/19/c/a8.tif')
  14547. rgb_img0.save(nt)
  14548. ir_img0.save(irt)
  14549. rgb_img0.save(nj,quality=95)
  14550. ir_img0.save(irj,quality=95)
  14551. r,_,_ = rgb_img0.split()
  14552. r = np.asarray(r, dtype=float)
  14553. ir,_,_ = ir_img0.split()
  14554. ir = np.asarray(ir, dtype=float)
  14555. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14556. np.seterr(divide='ignore', invalid='ignore')
  14557. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14558. # Display the results
  14559. fig, ax = plt.subplots()
  14560. plt.plot(ndvi)
  14561. plt.axis('off')
  14562. plt.figure(figsize=(19, 10))
  14563. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14564. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14565. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14566. plt.margins(0, 0)
  14567. #plt.show()
  14568. plt.savefig(ndvis)
  14569. plt.savefig(ndvia)
  14570. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14571. plt.close('all')
  14572. f = open('/var/www/html/cust/c19_8.txt','a')
  14573. f.write(date)
  14574. f.close()
  14575. dress = '/var/www/html/cust/19/c/'
  14576. for root, dirs, files in os.walk(dress):
  14577. print('files: {}'.format(len(files)))
  14578. if len(files)>=1:
  14579. files.sort()
  14580. for f in files:
  14581. with open(os.path.join(root, f), "rb") as imageFile:
  14582. str = base64.b64encode(imageFile.read())
  14583. url = 'http://60.250.156.234/cust/t19.php'
  14584. values = {'data1':str, 'name':f}
  14585. data1 = urllib.parse.urlencode(values)
  14586. data1 = data1.encode('utf-8')
  14587. req = urllib.request.Request(url, data1)
  14588. req.add_header('User-Agent','Magic Browser')
  14589. resp = urllib.request.urlopen(req)
  14590. respdata1 = resp.read()
  14591. print(os.path.join(root, f))
  14592. #print(respdata1)
  14593. os.remove(os.path.join(root, f))
  14594. print("ok")
  14595. except:
  14596. print('error')
  14597. def img19_9():
  14598. try:
  14599. db = pymysql.connect(host='52.69.200.169', port=3306, user='edamame', password='skyeye', database='Edamame',
  14600. charset='utf8')
  14601. a = db.cursor()
  14602. a.execute("SELECT * FROM jvt_o_time where nr ='GTW009002019' and mode = ' 9' ORDER BY datetime DESC LIMIT 0 , 1")
  14603. result = a.fetchall()
  14604. if result ==():
  14605. s =""
  14606. else:
  14607. s = "_" + result[0][3]
  14608. db.close()
  14609. ndvis = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvi/%Y-%m-%d_%H.%M.tif') #ndvi is time.tif
  14610. ndvia = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/%Y-%m-%d_%H.%M.png') #ndvi is time.png
  14611. ndviajpg = datetime.datetime.now().strftime('/var/www/html/cust/19/ndvia/c.png') #ndvi is c.png
  14612. irt = datetime.datetime.now().strftime('/var/www/html/cust/19/ir/%Y-%m-%d_%H.%M.tif') # irtif is time.tif
  14613. nt = datetime.datetime.now().strftime('/var/www/html/cust/19/n/%Y-%m-%d_%H.%M.tif') # ntif is time.tif
  14614. irj = datetime.datetime.now().strftime('/var/www/html/cust/19/irj/%Y-%m-%d_%H.%M.jpg') # irjpg is time.jpg
  14615. nj = datetime.datetime.now().strftime('/var/www/html/cust/19/nj/%Y-%m-%d_%H.%M.jpg') # njpg is time.jpg
  14616. date = datetime.datetime.now().strftime('\n%Y-%m-%d_%H.%Mn')
  14617. date += s
  14618. label= datetime.datetime.now().strftime('No.19 Direction 0 @%Y.%m.%d.%H.%M.%S')
  14619. rgb_img0 = Image.open('/var/www/html/cust/19/c/b.tif')
  14620. ir_img0 = Image.open('/var/www/html/cust/19/c/a.tif')
  14621. rgb_img0.save(nt)
  14622. ir_img0.save(irt)
  14623. rgb_img0.save(nj,quality=95)
  14624. ir_img0.save(irj,quality=95)
  14625. r,_,_ = rgb_img0.split()
  14626. r = np.asarray(r, dtype=float)
  14627. ir,_,_ = ir_img0.split()
  14628. ir = np.asarray(ir, dtype=float)
  14629. ndvi = np.zeros(r.size) # The NDVI image will be the same size as the input image
  14630. np.seterr(divide='ignore', invalid='ignore')
  14631. ndvi = np.true_divide(np.subtract(ir, r), np.add(ir, r))
  14632. # Display the results
  14633. fig, ax = plt.subplots()
  14634. plt.plot(ndvi)
  14635. plt.axis('off')
  14636. plt.figure(figsize=(19, 10))
  14637. plt.imshow(ndvi, cmap=plt.cm.get_cmap('Spectral'), vmin=-1, vmax=1)
  14638. plt.gca().xaxis.set_major_locator(plt.NullLocator())
  14639. plt.gca().yaxis.set_major_locator(plt.NullLocator())
  14640. plt.margins(0, 0)
  14641. #plt.show()
  14642. plt.savefig(ndvis)
  14643. plt.savefig(ndvia)
  14644. plt.savefig(ndviajpg,bbox_inches='tight',pad_inches=0,format='png')
  14645. plt.close('all')
  14646. f = open('/var/www/html/cust/c19.txt','a')
  14647. f.write(date)
  14648. f.close()
  14649. dress = '/var/www/html/cust/19/c/'
  14650. for root, dirs, files in os.walk(dress):
  14651. print('files: {}'.format(len(files)))
  14652. if len(files)>=1:
  14653. files.sort()
  14654. for f in files:
  14655. with open(os.path.join(root, f), "rb") as imageFile:
  14656. str = base64.b64encode(imageFile.read())
  14657. url = 'http://60.250.156.234/cust/t19.php'
  14658. values = {'data1':str, 'name':f}
  14659. data1 = urllib.parse.urlencode(values)
  14660. data1 = data1.encode('utf-8')
  14661. req = urllib.request.Request(url, data1)
  14662. req.add_header('User-Agent','Magic Browser')
  14663. resp = urllib.request.urlopen(req)
  14664. respdata1 = resp.read()
  14665. print(os.path.join(root, f))
  14666. #print(respdata1)
  14667. os.remove(os.path.join(root, f))
  14668. print("ok")
  14669. except:
  14670. print('error')
  14671. while True:
  14672. img1_1()
  14673. img1_2()
  14674. img1_3()
  14675. img1_4()
  14676. img1_5()
  14677. img1_6()
  14678. img1_7()
  14679. img1_8()
  14680. img1_9()
  14681. img2_1()
  14682. img2_2()
  14683. img2_3()
  14684. img2_4()
  14685. img2_5()
  14686. img2_6()
  14687. img2_7()
  14688. img2_8()
  14689. img2_9()
  14690. img3_1()
  14691. img3_2()
  14692. img3_3()
  14693. img3_4()
  14694. img3_5()
  14695. img3_6()
  14696. img3_7()
  14697. img3_8()
  14698. img3_9()
  14699. img4_1()
  14700. img4_2()
  14701. img4_3()
  14702. img4_4()
  14703. img4_5()
  14704. img4_6()
  14705. img4_7()
  14706. img4_8()
  14707. img4_9()
  14708. img5_1()
  14709. img5_2()
  14710. img5_3()
  14711. img5_4()
  14712. img5_5()
  14713. img5_6()
  14714. img5_7()
  14715. img5_8()
  14716. img5_9()
  14717. img6_1()
  14718. img6_2()
  14719. img6_3()
  14720. img6_4()
  14721. img6_5()
  14722. img6_6()
  14723. img6_7()
  14724. img6_8()
  14725. img6_9()
  14726. img7_1()
  14727. img7_2()
  14728. img7_3()
  14729. img7_4()
  14730. img7_5()
  14731. img7_6()
  14732. img7_7()
  14733. img7_8()
  14734. img7_9()
  14735. img8_1()
  14736. img8_2()
  14737. img8_3()
  14738. img8_4()
  14739. img8_5()
  14740. img8_6()
  14741. img8_7()
  14742. img8_8()
  14743. img8_9()
  14744. img9_1()
  14745. img9_2()
  14746. img9_3()
  14747. img9_4()
  14748. img9_5()
  14749. img9_6()
  14750. img9_7()
  14751. img9_8()
  14752. img9_9()
  14753. img10_1()
  14754. img10_2()
  14755. img10_3()
  14756. img10_4()
  14757. img10_5()
  14758. img10_6()
  14759. img10_7()
  14760. img10_8()
  14761. img10_9()
  14762. img11_1()
  14763. img11_2()
  14764. img11_3()
  14765. img11_4()
  14766. img11_5()
  14767. img11_6()
  14768. img11_7()
  14769. img11_8()
  14770. img11_9()
  14771. img12_1()
  14772. img12_2()
  14773. img12_3()
  14774. img12_4()
  14775. img12_5()
  14776. img12_6()
  14777. img12_7()
  14778. img12_8()
  14779. img12_9()
  14780. img13_1()
  14781. img13_2()
  14782. img13_3()
  14783. img13_4()
  14784. img13_5()
  14785. img13_6()
  14786. img13_7()
  14787. img13_8()
  14788. img13_9()
  14789. img14_1()
  14790. img14_2()
  14791. img14_3()
  14792. img14_4()
  14793. img14_5()
  14794. img14_6()
  14795. img14_7()
  14796. img14_8()
  14797. img14_9()
  14798. img15_1()
  14799. img15_2()
  14800. img15_3()
  14801. img15_4()
  14802. img15_5()
  14803. img15_6()
  14804. img15_7()
  14805. img15_8()
  14806. img15_9()
  14807. img16_1()
  14808. img16_2()
  14809. img16_3()
  14810. img16_4()
  14811. img16_5()
  14812. img16_6()
  14813. img16_7()
  14814. img16_8()
  14815. img16_9()
  14816. img17_1()
  14817. img17_2()
  14818. img17_3()
  14819. img17_4()
  14820. img17_5()
  14821. img17_6()
  14822. img17_7()
  14823. img17_8()
  14824. img17_9()
  14825. img18_1()
  14826. img18_2()
  14827. img18_3()
  14828. img18_4()
  14829. img18_5()
  14830. img18_6()
  14831. img18_7()
  14832. img18_8()
  14833. img18_9()
  14834. imgm1_1()
  14835. imgm1_2()
  14836. imgm1_3()
  14837. imgm1_4()
  14838. imgm1_5()
  14839. imgm1_6()
  14840. imgm1_7()
  14841. imgm1_8()
  14842. imgm1_9()
  14843. imgm2_1()
  14844. imgm2_2()
  14845. imgm2_3()
  14846. imgm2_4()
  14847. imgm2_5()
  14848. imgm2_6()
  14849. imgm2_7()
  14850. imgm2_8()
  14851. imgm2_9()
  14852. imgm3_1()
  14853. imgm3_2()
  14854. imgm3_3()
  14855. imgm3_4()
  14856. imgm3_5()
  14857. imgm3_6()
  14858. imgm3_7()
  14859. imgm3_8()
  14860. imgm3_9()
  14861. img19_1()
  14862. img19_2()
  14863. img19_3()
  14864. img19_4()
  14865. img19_5()
  14866. img19_6()
  14867. img19_7()
  14868. img19_8()
  14869. img19_9()