POST
|
Hi Helena and comunity I'm having the same problem!! to clip, to extract, or whatever. The only extrange thing is that I worked with those images before and it didn't happen. I'd like to know if you could solve the problem and how. Please, I really need it soon. Thanks in advance. Hey, I am at the moment working with TRMM precipitation data. I've downloaded files as NetCDF format and made them to raster in ArcMap. I only need a specific area from the raster so I have clipped it using a shapefile of the area of interest. But when I do this my clipped raster does not have the same pixel values as the original raster anymore. Why is this? What am I doing wrong? I would very much aprreciate some help on this! Thank you, Helena
... View more
02-18-2013
05:33 AM
|
0
|
0
|
486
|
POST
|
Hello everybody I was trying to start a code to analyze some measure points in different scales and exponents, when I found an extrange error and I don't understand why it happen. Ther error says:. ERROR 999999: Error executing function. Failed to execute (AddField). And it only happen when I put AddField function into a FOR statement and not out of it. I'd realy like to know why it is, any help will welcome! import arcpy from arcpy import env from arcpy.sa import * import math from math import sqrt import numpy from numpy import * import shapefile try: # Check out any necessary licenses arcpy.CheckOutExtension("spatial") env.workspace = "D:/Users/" inFeatures=["WS.shp","malla.shp"] outPoints="WSTT.shp" Malla="malla.shp" Calcs="calcs.shp" arcpy.Intersect_analysis(inFeatures, outPoints, "", "", "point") arcpy.Copy_management(Malla, Calcs, "") arcpy.JoinField_management(Calcs, "FID", outPoints, "FID_malla_", "Pp") arcpy.Delete_management(outPoints) sf = shapefile.Reader(Calcs) fields=sf.fields records = sf.records() ppp=[] lg=len(records)-1 for i in range(0,lg): pp=records[2] ppp.append(pp) ppp=numpy.array(ppp) Nt=sum(ppp) print Nt for L in range(0,4): sc=int(2**L) scn="sc"+str(sc) Ppsc="Ppsc"+str(sc) Pi="Pi_"+str(sc) ########### Ni(L) ################# arcpy.AddField_management(Calcs, Ppsc, "FLOAT", "10", "6", "", "", "NON_NULLABLE", "NON_REQUIRED", "") arcpy.CalculateField_management(Calcs, Ppsc, '!Pp!', "PYTHON","") arcpy.AddField_management(Calcs, scn, "text", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "") arcpy.CalculateField_management(Calcs, scn, 'str(int(math.ceil(float(!x!)/sc)))+","+str(int(math.ceil(float(!y!)/sc)))', "PYTHON","") outDissolve="Pp_sc"+str(sc)+".shp" dissolveField = [scn] statistics=Ppsc+" SUM" arcpy.Dissolve_management(Calcs, outDissolve, dissolveField, statistics,"MULTI_PART", "DISSOLVE_LINES") print L except Exception, e: print arcpy.GetMessages() Thanks in advance Mariella
... View more
06-11-2012
02:44 PM
|
0
|
1
|
1468
|
POST
|
Hello everybody I hope somebody can help me. I wrote a code in python, it run well in my friend's computer and just for one raster (without "for") in mine. When I run the code, It only do the process for the first raster and then the following message appears "pythonw.exe has encountered a problem and needs to close." Thanks in advance.
... View more
08-16-2011
01:26 PM
|
0
|
4
|
635
|
POST
|
Thanks Curtis, but I used "dir" many times in the same way and it works well. However, I changed some things and also I found the main error was that I have to do Float -> Raster and then Raster -> Integer. Another error was that "ArcToolBox help" indicate "Int" (for scripts) but Python doesn't reconize, instead of that Python accept "arcpy.gp.Int_sa" for Integers. Now, It works excellent manually with ArcToolbox and in python with only one file, however when I put "for" I have an error ("pythonw.exe has encountered a problem and needs to close. We are sorry for the inconvenience"). Rarely, I tested the same code in other computer .... and voila!!! it's ok!!! Anybody knows what's wrong? Here it's my code: # Import arcpy module import arcpy import sys import string import os from arcpy import env from arcpy.sa import * # Check out any necessary licenses arcpy.CheckOutExtension("spatial") path="D:/Documents and Settings/mcarbajal/My Documents/" ruta=path+"gridss/" try: for n in range(1,13): inFloat=ruta+"grid"+str(n)+".flt" outRaster=ruta+"grid"+str(n)+"_rt" outInt=ruta+"grid"+str(n)+"_int" # Process: Float to Raster arcpy.FloatToRaster_conversion(inFloat,outRaster) arcpy.gp.Int_sa(outRaster,outInt) print n except: #print error message if an error occurs print arcpy.GetMessages()
... View more
06-21-2011
12:22 PM
|
0
|
0
|
282
|
POST
|
I've just started to work with python in ArcGIS 10. I'm trying to make a simple program to transform a raster in float format to Integer, I only replaced my variables in the example help and it doesn't work. Here I put my code if anyone can help me. import arcpy import sys import string import os from arcpy import env from arcpy.sa import * env.workspace = "D:/floats" desc="_14p" # Define the files and number of files to process for root,files,dir in os.walk("D:/floats"): #print dir num=len(dir) print "number of files: ", num try: for n in range(0,num): inRaster = dir ext='.flt' outInt = inRaster[:-len(ext)]+str(desc) arcpy.CheckOutExtension("Spatial") outInt=Int(inRaster) outInt.save(outint) print n except: #print error message if an error occurs print arcpy.GetMessages()
... View more
06-20-2011
10:27 AM
|
0
|
2
|
447
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|