POST
|
Stinking preconditions, get me everytime.... Thanks so much for your help Curtis
... View more
04-17-2012
12:31 PM
|
0
|
0
|
89
|
POST
|
You were right, meant Calculate values 🙂 The reference for the string slicing is a good nugget to have. I Can never keep straight of when to use the colon. I'm attaching a screenshot of the part of the model where I'm trying to implement the Calculate Value. I specified a .tif image and parse the the path to get the file name (%Value%) to carry off for further processing. In the Calculate Base Fiel Name I put the following code in the Expression line only (expression.png): r"%Value%"[:-8] [ATTACH=CONFIG]13606[/ATTACH] The output value for basename is in the screenshot (model_snippet.png). I'm expecting the value to be "dinsdale_b1" Should the line of code be encapsulated with f() ? [ATTACH=CONFIG]13605[/ATTACH]
... View more
04-17-2012
12:11 PM
|
0
|
0
|
728
|
POST
|
Thanks for the replies guys. Adding the precondition in that spot did the trick Shitij. Curtis, I'm using the Parse path tool extensively and it's pretty slick. The problem I'm running in to is that I'm generating individual clipped raster files for a list shapefiles (bnd1_raster, bnd2_raster, etc.). Due to some downstream processing, my rasters end up with names like bnd1_raster_tpi, bnd2_raster_tpi, etc. I need to clip these again by the perspective shapefile feature. Was thinking that using calculate field on %Value% (%Value% = bnd1_raster_tpi) and stripping the "_raster_tpi" and adding ".shp" would be the easiest way to specify the right shapefile to clip by in each iteration. I know this would be MUCH easier if I would just script it in Python, but now the Calculate Field tool is gettign the best of me and I can't have that happen... 🙂 Wade
... View more
04-17-2012
10:23 AM
|
0
|
0
|
1523
|
POST
|
Thanks for the references! Will start digging into them. In the interest of making it a bit more universal for future use, would the following remove the last 4 characters from a string stored in %Value% ? Using Calculate Field Expression: f(r"%Value%") Code Block: def f(Value):
import os
return Value[-4] Data type set as String
... View more
04-17-2012
09:24 AM
|
0
|
0
|
728
|
POST
|
In ModelBuilder 10.x you can access this value from the feature layer output for the iterator using the Get Field Value tool. The output of that tool will be the value (say, %Name%) you can use in the output file name. Another approach I've used is include the OID and name field in the iterator - then you can parse the value out of the iterator label element using the Calculate Value tool. For example on an iteration the iterator label element may be "1_Foo", you can then use Calculate Value to get the value using this expression: r"%Value%".split("_")[1] the above expression returns "Foo" if Value is "1_Foo". Curtis: Can you point me to some documentation, or examples of the expression syntax similar to that above. I'm wanting to do something similar but strip off the last 4 characters of %Value%. So if %Value% = raster.tif, I want to use %Value% plus an expression to get raster.shp Thanks! Wade
... View more
04-17-2012
08:26 AM
|
0
|
0
|
728
|
POST
|
That's what I started out using, but since the rasters I am processing are geoTIFF's, the Name variable gives me the file name plus the .tif extension. When using %Name% for raster.tif in my results (%Name%_result.tif) I end up with raster.tif_result.tif. I need to drop the .tif extension because the multiple .tif's in the resulting filenames are causing me headaches downstream. Thanks for the suggestion though, Wade
... View more
04-16-2012
03:06 PM
|
0
|
0
|
1523
|
POST
|
Got a weird problem that I can't track down. I'm using an iterator in ModelBuilder to step through a list of rasters in a workspace and and apply a set of filters. I'm getting the file mae of the raster (%Value%) and using it to name the results from the last slice result "3 Class Smoothed Output" (%Value%cl). The problem is the filenames are 1 off. It appears to be naming my results by the file name ahead of the one the results are based on. I'm sure I need to but in a precondition somewhere, but I've looked at it until I'm cross-eyed and can't find the right spot. Pic of the model is attached in case it is plainly obvious to someone other than me 🙂 Thanks ahead, Wade[ATTACH=CONFIG]13563[/ATTACH]
... View more
04-16-2012
01:32 PM
|
0
|
6
|
4530
|
POST
|
That works perfectly. Now if I could only do this based on unique to each raster, quantile classification....
... View more
04-16-2012
05:58 AM
|
0
|
0
|
751
|
POST
|
I'm trying to batch reclassify a set of rasters in ModelBuilder by assigning an interger from 1-8. So if raster value is 1-1.5 =1.5-2.5=3, ...... 7.5-8=8 I know I can put these values in a table, but it would be nice to embed it in the model for portability. Thanks!
... View more
04-12-2012
09:47 AM
|
0
|
2
|
1799
|
POST
|
Here is an example that may help:
fc = "fishnet"
rows = arcpy.UpdateCursor(fc)
for row in rows:
geom = row.shape
row.LowerX = geom.extent.XMin
row.UpperX = geom.extent.XMax
row.LowerY = geom.extent.YMin
row.UpperY = geom.extent.YMax
rows.updateRow(row)
del row, rows Thanks a bunch! Worked like a charm!
... View more
03-15-2012
10:08 AM
|
0
|
0
|
404
|
POST
|
Hi Wade, one way you could go is with field calculator: 1. create fields for centroidX/centroidY of the grids, calculate geometry for them. 2. create fields for UpperY, LowerY, LeftX, RightX in field calculator you can then calculate each field: UpperY = centroidY + (gridheight*0.5) LowerY = centroidY - (gridheight*0.5) LeftX = centroidX - (gridwidth*0.5) RightX = centroidX + (gridwidth*0.5) Thought about doing something similar to this after the first reply, but a little worried as to what the results would be if I want them in decimal degrees. Going to try the python code above first after my computer finishes up its processing task. Thanks!
... View more
03-15-2012
08:47 AM
|
0
|
0
|
404
|
POST
|
Looking for a little from the guru's out there on a task I'm trying to accomplish. I have a vector file I created using the fishnet tool that consists of hundreds of rectagular "grids". I'd like to loop through the records and find the uuper and lower Y, and left and right X values for each grid and write them to the appropriate new columns in the dataset (UpperY, LowerY, LeftX, RightX) Any ideas on how to go about doing this? Thanks again,
... View more
03-15-2012
07:49 AM
|
0
|
7
|
1038
|
POST
|
I'm using ModelBuilder to create a new field ([cat]) that will contain category values based on range criteria of another field ([yield]). I would like to use the Python parser. HEre is what I have so far in the Pre-Logic Script Code:
def Reclass(yield) :
if (yield <=140) :
return "Low"
elif (yield > 140 and yield <= 180) :
return "Average"
elif (yield > 180) :
In the expression block I have cat = Reclass(!cat!) I get a red "X" in the calculate Field dialog stating there is a parse error on line 1. Any ideas as to what I'm doing wrong? Thanks,
... View more
02-29-2012
12:25 PM
|
0
|
5
|
1414
|
POST
|
I insert many rasters into my Arc projects daily and by default the color rmap is always black to white. I have to manually change to a more 'elevation-friendly' color ramp consisting of earthy colors. In the style manager window I am unable to perform any changes to the ESRI.style list of styles. The only option I can can choose is to right click on a style and click copy. If I could just manually change the black to white color ramp to the elevation color ramp I would be good but it's not letting me. Any ideas? If not in the Style window, where else can I change this? Thanks, James Ever get an answer to this?
... View more
09-21-2011
12:44 PM
|
0
|
0
|
565
|
POST
|
It's designed to limit the color ramps shown depending on category. Category is an attribute you can edit so you can change it for color ramps you want to show up. To edit the category of a color ramp do this: 1. Open the Styyle Manager (Customize menu > Style Manager) 2. In the Style Manager find the Color ramp folder in your style in the left hand pane and click on it to open it 3. In the right hand pane find the color ramp you want to show. Make sure you have the style view set to show details. 4. In the Category column click on the category text next to your color ramp to put the text into edit mode. 5. Change the text to Default Ramps OK out of the dialogs and you should see your ramp in the layer symbology dialog dropdown now Is there a way to make this the default color ramp used instead of the black/white color ramp?
... View more
09-06-2011
09:26 AM
|
0
|
0
|
172
|
Title | Kudos | Posted |
---|---|---|
1 | 07-26-2011 07:57 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|