Jump to content

kidd

Members
  • Posts

    37
  • Joined

  • Last visited

  • Days Won

    1

kidd last won the day on April 2 2013

kidd had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

kidd's Achievements

Newbie

Newbie (1/14)

  • Week One Done Rare
  • One Month Later Rare
  • One Year In Rare

Recent Badges

15

Reputation

  1. Multumesc! Am vazut dupa editul. Am facut deci un GUI general cu butonul de working directory si scriptul propriu zis: import Tkinter, tkFileDialog, Tkconstants from Tkinter import * root = Tk() root.title('My NDVI GUI') root.geometry('500x100') # Size 500, 200 dirtext='Step 1: Select your working directory!' #Asking directory button def openDirectory(): dirname = tkFileDialog.askdirectory(parent=root, initialdir='/home/', title=dirtext) dirbut["text"] = str(dirname) if dirname else dirtext #Options for button button_opt = {'fill': Tkconstants.BOTH, 'padx': 5, 'pady': 5} #Define asking directory button dirbut= Button(root, text = dirtext, bg = 'yellow', fg = 'black', command= openDirectory) dirbut.pack(**button_opt) #Run NDVI def callback(): execfile("example5.py") b=Button(root, text="Step 2: Click for NDVI", command=callback, bg="green") b.pack() root.mainloop() Acum ar fi perfect daca as putea face ca working dir din script sa nu fie definit si sa-mi citeasca directorul ales cu tkfiledialog.askdirectory din GUI.
  2. Salutare, Incerc sa implementeaz un dialog box pentru selectarea unui working directory pentru un script de Python. As vrea sa fac in asa fel incat scriptul sa nu aiba niciun working directory prestabilit ci sa trebuiasca definit atunci cand e rulat scriptul printr-un un mic dialog box. Asta e scriptul: # import modules import os, numpy, sys, time from osgeo import gdal, ogr from osgeo.gdalconst import * startTime = time.time() # set the working directory os.chdir(r'F:\NDVI_Py\data') # register all of the GDAL drivers gdal.AllRegister() # open the image inDs = gdal.Open('L82015.img', GA_ReadOnly) if inDs is None: print 'Could not open L82015.img' sys.exit(1) # get image size rows = inDs.RasterYSize cols = inDs.RasterXSize bands = inDs.RasterCount # get the bands and block sizes inBand4 = inDs.GetRasterBand(4) inBand5 = inDs.GetRasterBand(5) blockSizes = inBand4.GetBlockSize() xBlockSize = blockSizes[0] yBlockSize = blockSizes[1] # create the output image driver = gdal.GetDriverByName('HFA') outDs = driver.Create('ndvi_L82015.img', cols, rows, 1, GDT_Float32) if outDs is None: print 'Could not create ndvi_L82015.img.img' sys.exit(1) outBand = outDs.GetRasterBand(1) # loop through the rows for i in range(0, rows, yBlockSize): if i + yBlockSize < rows: numRows = yBlockSize else: numRows = rows - i # loop through the columns for j in range(0, cols, xBlockSize): if j + xBlockSize < cols: numCols = xBlockSize else: numCols = cols - j # read the data in data4 = inBand4.ReadAsArray(j, i, numCols, numRows).astype(numpy.float) data5 = inBand5.ReadAsArray(j, i, numCols, numRows).astype(numpy.float) # do the calculations mask = numpy.greater(data4 + data5, 0) ndvi = numpy.choose(mask, (-99, (data5 - data4) / (data5 + data4 + 0.00000000001))) # write the data outBand.WriteArray(ndvi, j, i) # flush data to disk, set the NoData value and calculate stats outBand.FlushCache() outBand.SetNoDataValue(-99) stats = outBand.GetStatistics(0, 1) # georeference the image and set the projection outDs.SetGeoTransform(inDs.GetGeoTransform()) outDs.SetProjection(inDs.GetProjection()) # build pyramids gdal.SetConfigOption('HFA_USE_RRD', 'YES') outDs.BuildOverviews(overviewlist=[2,4,8,16,32,64,128]) inDs = None outDs = None print 'NDVI Calculated and Outputted to File F:\NDVI_Py\data\L82015.img' print 'script took', time.time() - startTime, 'seconds to run' Stiu ca se foloseste tkFileDialog.askdirectory pt asta dar nu stiu cum ar trebui scris in loc de: # set the working directory os.chdir(r'F:\NDVI_Py\data') Apreciez orice sfat. Multumesc!
  3. Deci am citit si eu un articol, din.. 1999. How NSA access was built into Windows | Telepolis si am inteles ca acest .dll permite anumite accese din afara. Din nefericire l-am gasit si la mine in pc. Unii spun ca nu il au, dar e ciudat pt ca articolul spune ca e in toate distributile de windows.. Sunt curios daca stiti si voi ceva in legatura cu asta si daca sunt modalitati de 'disable functions' ca sa zic asa ale fisierului. As vrea sa-l sterg dar am citit ca se ocupa si de alte servicii cum ar fi: Advanced Services Provide access to functionality additional to the kernel. Included are things like the Windows registry, shutdown/restart the system (or abort), start/stop/create a Windows service, manage user accounts. These functions reside in advapi32.dll on 32-bit Windows. Nah, zic si eu; dati-va si voi cu parerea daca doriti.
  4. @W8: The company has stated that they can only “kill” programs downloaded from its new Microsoft App Store. This is what the company has to say about it in official terms: -“In cases where your security is at risk, or where we’re required to do so for legal reasons, you may not be able to run apps or access content that you previously acquired or purchased a license for. Sa fie doar alea?
  5. Nu sunt un user care sa fi ajutat aceasta comunitate, neavand cunostiinte in materie. Am consinderat ca atata timp cat nu am nimic bun de spus in legatura cu "the main topic of this forum" mai bine nu o fac. Va rog sa-mi scuzati eventualele greseli gramaticale. Se pare ca in ultimul timp s-au inmultit cei care "AU GURA WITHOUT BRAIN". Poate o sa dau in off-topic dar o sa incerc sa-mi explic (poate si unora dintre voi) cu ajutorul acestui post, "de ce aceasta stare de lucruri?" Asta-i parerea mea. Sa-mi spuneti voi daca am dreptate sau nu. Acest sistem f. democratic sa fie cauza? Adica ma uit la fratemiu care e din '78, si la generatiile apropiate lui, si la generatiile dupa '90, din care fac parte si eu. Nu cred ca nu mai trebuie sa spun nimic. Alta educatie => alte valori, alta mentalitate. In continuare, nu imi dau seama cu exactitate cui apartine vina. Sa fie bataia de joc de care au dat dovada guvernele romaniei in legatura cu sistemul educational (platile profesorilor, nivelu de implicare, etc)? Sa fie vina profesorilor care nu au stiut sa trezeasca "dragostea" in elevi/studenti fata de valorile sociale & morale? Sa fie vina parintiilor si lipsa de grija/timp/ aratata "plozilor", care au ramas cu orele in fata pc-urilor si tv-urilor? Ar mai fi multe de adaugat. In orice caz, pare sa fie un cerc vicios. Solutii? Eu personal nu prea vad. Incet, incet, oamenii cu cap care au obisnuit sa lupte se retrag (diverse motive, precum: familii, plictiseala s.a.m.d) in locul acestora ramanand acesti kinderi care, dupa ce ca "sunt prosti, mai si semnalizeaza". Dumnezeu sa ne ajute!
  6. personal, acest mesaj de ramas bun mi se pare de nota 11! numai bine!
  7. Vand ForceFactor! 200 Ron cutia de 120 de pastile (only 2 bottles). Ajung cam o luna si ceva with medium intake(cate 3 pastile de 2 ori pe zi) Livrare Personala Bucuresti/Ploiesti sau fancourier in restu tarii. INFO: Force Factor represents a long overdue progression in the fundamental paradigm of nutraceutical development. The L-Arginine enhancement in Force Factor, along with Force Factor's proprietary blend of naturally occurring ingredients, increases the body's power, strength, and endurance levels by stimulating the natural production of Nitric Oxide, a critical player in the recovery and renewal process. Nitric Oxide forms an essential basis for muscle growth and performance in the body, mediating vital nutrient delivery, blood flow, and metabolic adaptation. The unique nutrient delivery system guarantees efficient release of Nitric Oxide sustained throughout a workout. Force Factor's distinctly effective formulation harnesses the raw power of the body's internal muscle enhancing machinery, making for an unbeatable body development experience. More Info: Force Factor | Products | Force Factor ® | Official Site
  8. kidd

    Vand PSP!

    Vand PSP negru, foarte putin folosit, adus din America, nebrick-uit. 2000 Slim&Lite System Software : 6.37 Card M2 2 GB (cu adaptor Pro Duo) +Joc Prince of Persia Revelations Pret:400 Ron Doritorii contact me via private messages.
×
×
  • Create New...