Linking Statistics Type with Calculate Field after a Table Join (Model Builder)

المشرف العام

Administrator
طاقم الإدارة
I am attempting to build a model using model builder in which there is a zone statistics tool being run iteratively for a set of rasters. The input is a blank template table that contains the number of rows and names of the zone feature layer which is constant throughout the iteration. The iteration then loops through a number of different rasters, computing zone stats based on this zone layer for each one. My goal is to save the computed statistic for each iteration in one table, appending columns as the iteration progresses, and then export it to excel. However, I would also like to be able to have the user define the type of statistic being computed as a model parameter. Currently I have succeeded in doing everything except being able to change the statistics type. This is because my process is one of using the template table as a place for which the stats computed in each iteration are stored, saving each previous one as the iteration goes forward. I achieved this by adding a field called Raster_%n% to the template table for each iteration, then performing the zone stats for the given iteration, joining the zone stats output table and the template table, and then setting the Raster_%n% field of the template table equal to joined field with calculate field, and then removing the join, leaving just the template table with its Raster_%n% column containing the statistics of the iteration just performed. However, I would like the user to be able to define the statistics type being computed as a model parameter, but in doing so I am not sure how to successfully link this so that the correct calculation is being made in the "Calculate Field" expression, which is currently set as "[zonestatinterim.MEAN]", with zonestatinterim being the name of the table produced by the Zone Stats tool, which has a Column of name MEAN. This works fine as long as you always choose MEAN to be the statistics type, but if it were to be MEDIAN, I would need the calculate field expression to automatically update to say [zonestatinterim.MEDIAN]. Not sure how to do this. Any ideas? The model schematic and current calculate field settings are shown below:

Thanks!

Nick



أكثر...
 
أعلى