|
POST
|
The zone raster (your watersheds) must be an integer raster, and it must have an attribute table. If it wasn't automatically built, you can build one with the Build Raster Attribute Table. I don't know if it makes any difference, but you may want to symbolize those watersheds with unique value or discrete.
... View more
04-05-2013
08:18 PM
|
0
|
0
|
2054
|
|
POST
|
Anyone have an idea why my fieldList variable wont' allow it to run? I think you have a syntax problem -- extra brackets. Here's a suggested fix. Note you don't need line continuations in the middle of a list (Python knows to keep reading to the end.) fieldList = ['tblFlowMeters.MeterName', 'tblDataCollectionPeriods.StartDate', 'tblDataCollectionPeriods.EndDate', 'tblMeteringData.MeteringDataId', 'tblMeteringData.MeteringDateTime', 'tblMeteringData.DepthInches', 'tblMeteringData.VelocityFTperSec', 'tblMeteringData.FlowMGD', 'tblMeteringData.RainInches','tblMeteringData.DebrisInches']
... View more
04-05-2013
08:03 PM
|
0
|
0
|
907
|
|
POST
|
You're on the right track; I think the trick here is the Calculate Value tool. Say your shapefile name is "f:\test\sites1979.shp" - you are iterating on a bunch of shapefiles just fine, and the name is coming out as an iterator as the model element Feature class You have a raster you want to run your tool on called "f:\images\image1979.tif" Connect Feature Class to the Parse Path tool to get the base name "sites1979.shp" - call this element Shape name. (Your Name output from the iterator could also be used) Add the model-only tool Calculate Value, and give it this expression: r"f:\images\image{0}.tif".format("%Shape name%"[5:9]) This string expression will evaluate to "f:\images\image1979.tif" when the tool runs. Set the output data type of the CV tool to be "raster dataset" - then you can connect it to the Extract Values to Points tool. You can use the built-in variable %n% in output pathnames so the outputs will be unique filenames. (%n% is the iteration 0,1,2,3...) The other thing to look for is using preconditions to connect outputs and tools so they will run in the correct order. Hope this helps you get started.
... View more
04-04-2013
09:20 PM
|
0
|
0
|
3101
|
|
POST
|
I still have to figure out how to exclude dissimilar species. There are enough different species that I want to avoid having to break them out into separate feature classes. There's really no reason to do that, as if you supply a layer as input to a tool, in most cases only the selected features are used. You may be able to get what you need just by selecting each species one at a time and running the Point Distance tool. You could do this in Model Builder with an iterator, running Point Distance for each unique species.
... View more
04-04-2013
09:08 PM
|
0
|
0
|
5369
|
|
POST
|
I've tried to construct a cost surface based on slope, but I haven't been able to figure out how to do it so it takes into account the direction of travel. I need it to do so because there are different costs to going up and to going down a particular slope degree.Is there any way to calculate slope relative to a starting point other than the path distance tool? The path distance tool does do this complex analysis I'd maybe go back and check the inputs you are giving the tool in terms of units and such. I would also give very high-slope areas an additionally high general (nondirectional) cost as travel is difficult on a steep slope no matter what direction you are going. Units are a huge thing to worry about here because your x y and z units need to be the same (or differences accounted for) and your costs need to be scaled in a way that doesn't overcome the topographic costs pathdistance is modeling.
... View more
04-04-2013
09:04 PM
|
0
|
0
|
1080
|
|
POST
|
For instance limit the prediction to within -4 to 1, rather than allowing the calculator to predict values of up to -16, etc. SetNull and Con can do a lot of handy things like this with cell values. Reclassify is also useful, but Con and SetNull are more flexible and work well with float and integer rasters. For example, if this is your regression equation, go ahead and calculate all the values to a grid called "results": (5.0 * factor1) + 0.45 To set all cells outside the range, to NoData you could then do this with a second Raster Calculator run: SetNull("results" < -4 or "results" > 1, "results") You can get fancier, for example, to "saturate" at those values and make all the areas below -4 stay at -4, you could do this: Con("results" < -4, -4, Con("results" > 1, 1, "results") Hope this helps!
... View more
04-04-2013
08:54 PM
|
0
|
0
|
1462
|
|
POST
|
There must be something wrong with GetCount in ArcGIS 10.0. I haven't had any problems with GetCount myself. Are you sure you're using it properly - it now returns a result object instead of a string: Arc 9.3:
number = int(gp.GetCount_management("mylayer"))
Arc 10.x:
Result = arcpy.GetCount_management("my layer")
number = int(Result.getOutput(0))
... View more
04-03-2013
08:25 PM
|
0
|
0
|
2215
|
|
POST
|
I don't have an answer, but some guidance based on experience: The place to focus your attention is the cost raster. If you can solve that problem and get cost values that make sense, you will be 95% of the way there.
... View more
04-03-2013
08:21 PM
|
0
|
0
|
1080
|
|
POST
|
Leah, The best way to use and visualize the output direction and velocity information is to create tracks using the ParticleTrack tool. Have you tried that yet?
... View more
04-03-2013
08:13 PM
|
0
|
0
|
723
|
|
POST
|
"%Ammonia%" I think this is correct. Not exactly. The value of your string variable (let's call it Compound) should be set to Ammonia (no quotes). Then you can refer to it elsewhere in the model as %Compound%, this will be replaced by the string Ammonia at runtime. So a CV expression "%Compound%" == "Ammonia" (quotes included) becomes "Ammonia" == "Ammonia" when CV is executed. Our example, just worries about true and false. However, you can also use model variables in pathnames and other tool input expressions. You can see how CV is very handy to create strings that are ready to stick into a tool input parameter or a path. CV's output can be set to a multitude of data types; this make it possible to connect its output to a tool that expects that particular data type. The way you set up preconditions is to grab the magic wand tool, click on a data element/variable you want set or created before a tool runs, then drag to the tool, let go, and pick "Precondition" from the list. Preconditions can also be set by right-clicking on a tool and going to the Precondition tab and adding an element there.
... View more
04-02-2013
01:31 PM
|
0
|
0
|
7268
|
|
POST
|
ERROR 000539: Error running expression: CalcDiff(r"C:\Export_Output.dbf", "PIPELENGTH", "DISTANCE") <type 'exceptions.TypeError'>: 'geoprocessing cursor object' object is not iterable Failed to execute (CalculateValue). Sorry about that -- I forgot to use 9.3 syntax for cursors. Need to go look at the 9.3 help... import arcgisscripting gp = arcgisscripting.create(9.3) def CalcDiff(tbl,valField,diffField): procFields = valField + ";" + diffField sortField = valField Rows = gp.UpdateCursor(tbl, "", "", procFields, sortField) lastVal = 0 Row = Rows.next() while Row: val = float(Row.getValue(valField)) # calc the difference between the last value and this one diff = val - lastVal Row.setValue(diffField,diff) Rows.updateRow(Row) lastVal = val Row = Rows.next() del Row, Rows return tbl
... View more
04-02-2013
08:50 AM
|
0
|
0
|
5181
|
|
POST
|
It appears the export to excel tool needs validation that Calculate Value can't provide. For the validation to work, connect the Merge output to Add Field and add the RADIUS field. Connect the output of Add Field to your export tool. This way the export tool will be aware of your new field. But you still want to populate that RADIUS field with values, so: Connect the output of Add Field to the Calculate Value tool as a precondition, and the CV's output to the export tool as a precondition. I'm not sure this will all work, but it's worth a try.
... View more
04-01-2013
04:26 PM
|
0
|
0
|
1932
|
|
POST
|
I have a dbf table with four fields: OID,TYPE,FREQUENCY,COUNT. I only want to keep TYPE. This should do what you want (except you can't delete the object ID field):
test_dbf = "C:\\TempData\\testdata.dbf"
# one of more fields to keep in a list
keepers = ["TYPE"]
# list all field delete candidates
fields = [f.name for f in arcpy.Describe(test_dbf).Fields \
if f.type not in ["Geometry, "Raster", "BLOB", "OID"]]
# remove TYPE field from delete list
fields = [f for f in fields if f.upper() not in keepers]
arcpy.DeleteFields_management(test_dbf, fields)
... View more
04-01-2013
04:11 PM
|
0
|
0
|
1508
|
|
POST
|
. I need to know if ArcGIS 10.1 will like these newer flavors of 2.7 before I mess everything up. Thanks. Esri product team folks have told me that although they recommend sticking with the version shipped with ArcGIS, any 2.7.x version should work if you need to update Python to be compatible with some third-party package. With 10.0, any 2.6.x should be okay.
... View more
04-01-2013
03:56 PM
|
0
|
0
|
677
|
| 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
|