Quantcast
Channel: Question and Answer » modelbuilder
Viewing all articles
Browse latest Browse all 135

How can i add script with math functions to model builder?

$
0
0

I am very new to model builder + python. (Sorry for my english too)

I am trying to make a model. Don’t know if it matters to upload it. If you want i can.

I want to calculate variance from a points-shapefile with elevation data and want to add this script to my model:

### x = (column: GRID_CODE, from a shapefile from model builder)

average = sum(x) / len(x)
variance = sum((average - value) ** 2 for value in x) / (len(x)-1)

### output to a new shapefile

How could i make this script working? Searched a lot here and at arcgis help but couldn’t find something.
Can’t understand how to “grab” data from shapefile, process them through script and then print the output.


Viewing all articles
Browse latest Browse all 135

Trending Articles