Select to view content in your preferred language

IDW Iteration - Model Builder

6236
3
11-28-2011 08:21 AM
LiamHendricken
New Contributor
I've seen a lot of posts about this, but there do not seem to be many helpful answers.  I have a point feature layer which describes 18 ozone monitoring sites (on rows).  Some of my fields are descriptors for those sites, while the bulk of the fields are random samples in time (rxxxx) which report ozone level by site as such:

site     x       y     r0001    ...     r0254       
1        0       0        2                  4
2        0       1        4.5               5
3        1       0        5.5               8
4        1       1        9                  1
...      ...     ....       ...               ....

What I am trying to do is use model builder to run the IDW tool for all random steps, but can't quite figure out how to feed the z value field in IDW with the field names r0001 through r0254.  I'm not very literate with Python, and am fairly new to Model Builder.  I know that I can set up batch runs for tools, but would rather not if anyone is familiar with another way to do this?  Can I feed the names of the z value fields as a list into IDW? 

I transposed the field names and tried to feed them into an iterator to spit the names out as variables, but could not figure out how to feed them into the z value field variable.

Thanks

Edit: I've done searching for these methods, and here are some examples of similar questions, but the answers are still unclear to me or don't exist:

First: http://gis.stackexchange.com/questions/3670/interpolation-for-timeseries-in-arcgis trying to do something exactly like this, but the exact steps user2445 suggests are not clear (the link between the iteration and the IDW tool specifically).

Second: http://forums.arcgis.com/threads/18870-Create-a-loop-for-IDW-SPatial-Analyst is from these forums, but unanswered.
0 Kudos
3 Replies
LiamHendricken
New Contributor
Just to provide an update:

While I did not find an iterative solution to this problem, I just selected a list for the z field values, and fed in the list this way.  Not what I wanted to do, but it did work.

Again, if anyone has a better way to do this using iterators, it would be extremely helpful.

Thanks.
0 Kudos
aichaous
Deactivated User

plz can you share your code ?

0 Kudos
DarrenWiens2
MVP Alum

I see this post is unanswered from 4 years ago, but here goes, with Python:

>>> import os # import os library
... fc = 'points' # points layer
... r_fields = arcpy.ListFields("points", "r*") # get list of fields beginning with 'r' - it will depend on your data if this is appropriate
... cell_size = 100 # cell size for IDW
... out_folder = r'C:\junk' # folder for output rasters
... for r_field in r_fields: # loop through r_fields
...    outIDW = arcpy.sa.Idw(fc, r_field.name, cell_size) # run IDW considering r_field
...    outIDW.save(os.path.join(out_folder,r_field.name + '.tif')) # save output
0 Kudos