1

I run the OLS (Ordinary Least Squares) tool in my model and output a coefficient table. Now I need to use the slope and intercept values in the coefficient table in a Raster Calculator. I've tried using the different iterators (Row Selection, Field Values) but they only output one value at a time.

Does anyone know how to get "SearchCursor"-like functionality in ModelBuilder?

Here's a picture of the model:

enter image description here

and a picture of "coef_table":

enter image description here

How do I get the two values in the Coef column as separate values that I can use in the Raster Calculator?

3

If you are using ModelBuilder and want to create a list of values then use the Field Values iterator and send the output to a Collect Values tool. Expose the output values as a parameter, then embed this sub-model into the master model.

Creating a list of values

Having created your list of values (in your example you are returning just two values) you can use the Calculate Values tool to extract them into their own variables which you can then use with inline-substitution in your raster calculations.

Extracting to variables

The Calculate values tool uses the following python code, note I am returning an integer value in my example, you may want to use float? Variable v1 is index 0 and v2 is index 1. It are these v1 and v2 that you use in your raster calculation.

The Calculate Value Tool

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.