I cannot figure out how to insert all the dbf files for the code block in calculate value tool. After iterating through all files I use the expression below to get the two coefficient values in each dbf file and store them as two seperate coefficient value variable. I will then insert these values one dbf file at a time in raster calculator and multiple by a raster to generate interpolation maps.
Expression: values[0]
Code block:for dbf_file in '%Iterate through tables and collect all dbf files%':
with arcpy.da.SearchCursor(dbf_file,["Coef"]) as cursor:
values = sorted({row[0] for row in cursor})
I have also tried it with python but I get an error.
Can anyone help me out figuring out a way to attain my goal.
Thank you.
Solved! Go to Solution.
The answer to this question was just use copy tool and rename the files using the name variable from the iterate tables itself. I have further simplified the model.
I have solved the issue of itering through dbf files, getting the two coefficient values in each file and inserting the two values in raster calculator.The following is the procedure:
1- Creating a sub model for iterating through tables,
2- creating a sub model to get both the coefficient values and add the sub model to the iterate dbf files model as shown in previous image,
3- Create two sub models for iterating through both list of coefficient values,
4- Lastly, create a final model with the raster calculator using the last two sub model where we itertae through the list of both coefficient values.
The challange I face now is how to iterate through the names of dbf files and use the names to save the interpolation rasters. The first model provides the names of rasters in the variable name but how I can insert these names in the last model with raster calculator. Is there a way?
You have the iteration backwards, the sub model should do the calculations (including raster calculator) and write the output, the driver (outside) model should do the iteration. See the examples in the help.
thank you helped a lot.
The answer to this question was just use copy tool and rename the files using the name variable from the iterate tables itself. I have further simplified the model.