Issues while batch processing models from Model-Builder

Discussion created by leonardorey on Aug 19, 2011

I have been working for several weeks on a model that can help me to batch process 92 rasters. The original model worked well with the first layer as run in the Model-builder window. The model in general does the following sequenced steps:

1. Create a couple of fields
2. Make two Joins from tables
3. Calculate certain parameters with the spatial data of the feature layer and the Joined tables using python 9.3 "code-block" boolean expressions, that dependi on certain conditions of the analysed polygons. An example of the "Calculate Field" expression follows

CalcJpLast( !JpRest! , !Jp7_12! , !Jp8_12!, !Axrest! , !SpecID! )

Code block:

def CalcJpLast(Jp, Qw7,Qw8,Ax,Species):
if Species==1:
return Jp

4. Transforms the .shp to Raster
5. Transforms the raster to Ascii files

In order to avoid all the problems with the Join tables and the field names I have used some tricks learnt from the Forum:

1. Uncheck the "Maintain fully qualified names" in Environments/Fields
2. Make a feature layer after the Join and manually specify the names for the fields
3. Use a merge after the "Make a feature layer" and again manually specify the names for the fields

As I mentioned before the first layer as run from the Model-Builder window works fine, however, when I used the model as a tool (by creating parameters for my input layers), and try to batch process 5 or 3  layers, all I get is zeros instead of the calculations I need! I think the problem is that the Batch routine does not respect the Field names and all my boolean expressions produce errors (the code block need the exact names for it to work), however I do not know for sure.

Is there a way to maintain the field names through the Batch process? Is there a way to use code-blocks that do not fail with changing names from the Joined tables?

I would really appreciate some help in this, I have tried everything I found on-line and ran out of options and cannot process so many layers one by one.