|
POST
|
followed by error 000732 input rows for my "target shapfile" does not exist or is not supported failed to execute (getcount) It's very important that you use this syntax to pass dataset model elements to Calculate Value so the pathname will get through to Python correctly: r + " + % + elementname + % + " for example: r"%Output shapefile%" It's also very important that you spell the element name correctly, otherwise the variable isn't recognized and passed on to the code block; and the function then will see something like "%Target Shapfile%". This is so easy to do that my usual method to do this is to a) right click the model element, b) pick Rename, c) copy, cancel, d) open the Calculate Value tool and paste the name between the %%'s in the expression field.
... View more
03-14-2013
01:21 PM
|
0
|
0
|
4800
|
|
POST
|
Yes, this will get you! The trick here is to do the GetCount inside the calculate value. A little Python goes a long way in ModelBuilder! "Output feature class" is the model element for your shapefile that you want to delete if it is empty. You should have Output feature class be precondition for this Calculate Value tool so it will run at the right time. expression: DeleteIfZeroCount(r"%Output feature class%") code block:
def DeleteIfZeroCount(inFC):
import arcpy
if int(arcpy.GetCount_management(inFC).getOutput(0)) == 0:
arcpy.Delete_management(inFC)
return True
else:
return False
... View more
03-14-2013
08:46 AM
|
0
|
0
|
4800
|
|
POST
|
Okay, I get some idea of what you´re heading for and the syntax. I tried it but it failed Okay -- try this: 1. Add "dtm20" to ArcMap as a raster layer 2. Start Raster Calculator. 3. Compose this expression. "dtm20" == FocalStatistics("dtm20",NbrCircle(5),"MAXIMUM") This should give you a 1-0 grid where 1 (True) cells are where the cell is at the local maximum for the 5x5 circular neighborhood. This will include flat areas. You can play with it further once you get that far. Example of how to specify neighborhood are in the help for Focal Statistics.
... View more
03-13-2013
02:43 PM
|
0
|
0
|
2613
|
|
POST
|
I would like to aggregate the files using their files names, which are in the form "TOMS_YEARmMONTHDAY_v8.HDF" (i.e. "TOMS_1976m0105_v8.HDF" for January 5, 1976). If you aren't quite ready to dive both feet into Python, another option is using ModelBuilder to search for a month of rasters using an iterator, for example, to get one month of data, search for "TOMS_1976m01*". You can use model variables in the wild card, for example: "TOMS_%year%m%month%*", and nest models one in another for looping. The outside model would iterate by year, inside that would iterate by month and generate the list of daily raster, and inside that would be your CellStatistics function. This is a lot of work... python or ModelBuilder. You may want to check out a really cool site that has massive climate data set up on a server that can do the work for you -- if they have the climate data you need. USGS GeoData Portal http://cida.usgs.gov/climate/gdp/ The USGS Geo Data Portal (GDP) project provides scientists and environmental resource managers access to downscaled climate projections and other data resources that are otherwise difficult to access and manipulate. This user interface demonstrates an example implementation of the GDP project web-service software and standards-based data integration strategy. A user of the GDP interface can supply their area of interest as a pre-existing GIS shapefile with one to many unique polygons or by drawing a single polygon using an interactive web-map. A user can select from available GDP project web-service processing algorithms, which include raw data subsetting and area-weighted statistics summarization. Processing algorithm options such as dataset component of interest, time period of interest and output file formatting must be specified. As the GDP project progresses, other processing algorithms and output formatting options will become available. Datasets available from the initial public release of the portal include historic weather and downscaled climate projections.
... View more
03-13-2013
10:21 AM
|
0
|
0
|
2578
|
|
POST
|
UPDATE: it gets better, you can do this in one raster calculator expression that is easy to tweak if you change your mind about how to handle your classes. This all goes on one line -- I have separated it to make it easier to read: Con("landcover","landcover", Nibble("landcover",SetNull("landcover","landcover","VALUE NOT IN (1,2)")), "VALUE IN (3,4,5)") 1. Keep 3,4,5 cells as-is 2. Expand 1,2 cells everywhere else (All values not mentioned will be overwritten by values 1 or 2)
... View more
03-13-2013
10:01 AM
|
0
|
0
|
1643
|
|
POST
|
I want it to continue Nibbling farther than it does, I guess, especially when a cell is surrounded half by nodata and half by some other value. I get to the point where only one or two cells are nibbled at a time, which is very tedious (diminishing returns).... I was hoping there is a method to provoke the Nibble function to nibble more pixels at a time Does the input raster (first argument to Nibble) have any NoData in it? If you want all the NoData filled in, the first input should be all data cells. The NoData in the second raster defines where Nibble will go. (In my example, I was assuming that all of the landcover raster had all data cells, at least everywhere you wanted to fill in.) I have not been using Raster Calculator, just doing a reclassify in between Nibble operations? Is this ill-advised for any reason. I haven't used the Raster Calculator ever before, actually, but it doesn't look too bad. Perhaps it might be more efficient? Raster Calculator is a lot more efficient if you are nesting functions. I think for your problem Con is easier to work with than Reclassify, but that's just a personal preference. I was trying to be concise earlier, but it seems my original post was a little misleading. I have classes that can be roughly though about as 3 overall types, but there are more than just those listed in my original post. What I really have are 14 vegetation types I want to nibble into 6 other vegetation types, while avoiding 6 distinct "other" types. Water is just one example of those 6 "other" types. My example should still work for you. The Con function can be used with a list of values using its "where_expr" to form more complicated queries. So, for example to "keep" classes 3,4,8,11,12, and 13, replace the last step with: Con("landcover", "landcover", "nibras", "VALUE IN (3,4,8,11,12,13)") In the above example, "landcover" cells for the listed classes will be "True" so they will be burned into the output, i.e. they will be the same value as the same cell in "landcover". All other cells (where_expr evaluated to "False") will pick up the value of your nibble output ("nibras"). As you can see this less work than filling out the Reclassify tool dialog, especially if you need to change things and re-run it.
... View more
03-13-2013
09:24 AM
|
0
|
0
|
1643
|
|
POST
|
Since the inputs are different cell sizes, etc., I suggest trying the Extract Multi-Value to Points tool instead of Sample. This tool basically does the same thing. I don't know why these three tools (Extract Values to Point, Extract MultiValues to Point, and Sample) have so many problems, but often I have found one to work when one of the others failed.
... View more
03-12-2013
07:44 PM
|
0
|
0
|
1570
|
|
POST
|
I am working with a raster map vegetation types. I have about 20 types with unique raster code values that can be sorted into three classes: 1 - vegetation types I want to expand using the nibble function (e.g. forest) 2 - vegetation types I consider static that I do not want to either nibble or be nibbled (e.g. water, developed areas) 3 - vegetation types that I want to eliminate through the nibble function (early seral stages, such as grass and chaparral) Nibble is tricky. Nibble doesn't use a search radius - it requires adjacency to grow raster zones. It can't "jump" across a non-NoData area in your mask. Assume: Forest = 1 (expand) Forest2 = 2 (expand) Water = 3 (keep) Developed = 4 (keep) (Other - to be nibbled - deleted) I'm assuming you're using the Raster Calculator tool here. 1. Set all cells to NoData except 1 and 2 cells SetNull("landcover" != 1 and "landcover" != 2, "landcover") -> "maskras" 2. (nibble 1,2 cells into all nodata areas) Nibble("landcover","maskras") -> "nibras" 3. "burn" class 3 and 4 cells back into raster results at their original locations Con("landcover" == 3 or "landcover" == 4, "landcover", "nibras")
... View more
03-12-2013
07:17 PM
|
0
|
0
|
1643
|
|
POST
|
I have forty years of data in the form of one raster per day. I am hoping to aggregate these rasters so that I get one raster per month. What do you mean by "aggregate"?
... View more
03-12-2013
06:38 PM
|
0
|
0
|
2578
|
|
POST
|
On a different topic, do you know how to change the thread icon from a red 'Q' to a green 'A'? This happens then you check a post as your answer by setting the big checkmark. Or better how to delete a thread entirely? Only the uber-moderators can do this. This thread is likely here forever.
... View more
03-12-2013
06:27 PM
|
0
|
0
|
1438
|
|
POST
|
Still not sure what was going wrong Append_arc (Coverage toolbox) and Append_management (Data management toolbox) are different tools. Append_management is the one that accepts shapefile input.
... View more
03-12-2013
06:22 PM
|
0
|
0
|
855
|
|
POST
|
The indentations seem fine in my script, it's only when I paste the code in the message box here that all indentations were removed Please read: [thread]48475[/thread] Here's my attempt at a solution for you -- just to show your original syntax could work too. (I believe if the table is indexed by this field, the form may be slightly faster -- indexes are data-format dependent though so I'm not sure.)
queries = []
qry = '"LOT_PLAN" = \'{0}\''
for rec in f:
queries.append(qry.format(rec))
f.close()
sQuery = " OR ".join(queries)
print sQuery
... View more
03-12-2013
04:51 PM
|
0
|
0
|
3818
|
|
POST
|
Sorry, I slipped back into 9x map algebra. Here's a raster calculator syntax ("inraster" == FocalStatistics("inraster","#","MAXIMUM")) and
("inraster" > FocalStatistics("inraster","#","MINIMUM")) Using a larger-than-default neighborhood may help you find broader "domes" that have some flat areas on the top. These areas could then be collapsed to single-cells or points using the Zonal Geometry tool with the CENTROID option. This will select areas where the center cell is the equal to or greater than the maximum of the neighborhood, as long as the whole neighborhood is not the same value (flat).
... View more
03-11-2013
03:26 PM
|
0
|
0
|
2613
|
|
POST
|
I need to use SetNull function several times to extracting the required values from the raster dataset. I am using the following line of code, and the tool is running without any error; but it is not providing the desired output. arcpy.gp.RasterCalculator_sa("SetNull(ZMAXRas == -99,ZMAXRas)",outWorkspace + inputASCII [:-4] + "_W") I recommend using the 10.x Python map algebra instead. This enables more efficiency in processing and also is easier to read/debug. (Raster Calculator is really more for interactive use or ModelBuilder.) Try this and see if it works better:
from arcpy.sa import *
arcpy.env.workspace = outWorkspace
ZMAXRas = Raster(ZMAXRas) # convert a path to a raster object
outRas = SetNull(ZMAXRas == -99,ZMAXRas)
outRas.save(inputASCII[:-4] + "_W")
... View more
03-11-2013
08:14 AM
|
0
|
0
|
1299
|
|
POST
|
Eric, I was currently solving this problem why it doesnt work for like 2 hours. Thanks alot for helping me! Elizabeth posted some very good tips above on getting the syntax right in the 10x Raster Calculator tool. If her suggestions don't help, feel free to post more details!
... View more
03-09-2013
09:36 PM
|
0
|
0
|
2882
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-11-2021 01:26 PM | |
| 5 | 12-10-2021 04:58 PM | |
| 1 | 02-27-2017 09:30 AM | |
| 2 | 12-04-2023 01:05 PM | |
| 1 | 04-12-2016 10:17 AM |
| Online Status |
Offline
|
| Date Last Visited |
06-19-2024
12:10 AM
|