Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Counting Features in a Feature Class with the Field Calculator using Python

$
0
0
Hi experts,

first things first: I'm a Python-noob, so keep the answers as simple as possible ;-)

My problem is:
I have a Shapefile that represents Drill-Core-Data. The column "UK_GES" represents the Z-value for a geological layer.
I have to interpolate missing values between existing values. Until now, I'm working on the DBF-file in Excel (as shown in the attached png). To get the interpolation done, I use a function that includes the Excel-standard-function "COUNT" (in german: "ANZAHL")... As you may know, importing Excel-Data back into ArcGIS sometimes leads to errors especially when you're working with confusingly huge Excel-files (in most cases these errors are caused by the operator, not by the system...). So I'd like to implement the function (that is shown in the attached png) directly in ArcGIS to avoid conversion-steps and the mentioned operator-made errors.
For that, I would like to use the Field Calculator.

What I need:
I need a Python-script for an linear interpolation that can be scripted and used with the Field Calculator. It should work only for selected rows/Featuers. It should express the following:

[ A + ( C - A ) ] / [ COUNT ( A to B ) ]

(explanation: A,B,C are rows/Features in a selected column; A= Z-value of the 1st Feature in a Feature Class; B= Z-value of the 2nd Feature in a Feature Class; C= Z-value of the 3rd Feature in a Feature Class)

The attached png should show wich values have to be interpolated (the selected ones).

I think this shouldn't be that challanging for Python-Pro's ;-) For me it is, alas...
Thanks in advance!!!
Attached Thumbnails
Click image for larger version

Name:	excel_function.png‎
Views:	N/A
Size:	186.7 KB
ID:	20912   Click image for larger version

Name:	attributetable.png‎
Views:	N/A
Size:	55.9 KB
ID:	20913  

Viewing all articles
Browse latest Browse all 2485

Latest Images

Trending Articles



Latest Images