Hello!
I would like to calculate the difference of z value between two neighboor points in the following way:
- test if the extreme_ is LOKMIN
- if it is LOKMIN , then take the two neighbor value (the points are sorted), take the higher (so the bigger number) and exract them each other.
Here is my attempt:
import fme
import fmeobjects
from functools import reduce
from math import sin, pi
def left_slope(feature_a, feature_b, feature_c):
a_x = float(feature_a.getAttribute('z_uj'))
a_sz = feature_a.getAttribute('_szelsoertek')
b_x = float(feature_b.getAttribute('z_uj'))
b_sz= feature_b.getAttribute('_szelsoertek')
c_x = float(feature_c.getAttribute('z_uj'))
if b_sz == "LOKMIN":
k = c_x - a_x
#_nyomvalyu = b_x - a_x
feature_b.setAttribute('_nyomvalyu', k)
return feature_a
return feature_c
class FeatureProcessor(object):
def __init__(self):
self.features = r]
def input(self,feature):
self.features.append(feature)
def close(self):
reduce(left_slope, self.features)
for feature in self.features:
self.pyoutput(feature)
But it gives an error, can you help me?
Python Exception <TypeError>: left_slope() takes exactly 3 arguments (2 given)
Traceback (most recent call last):
File "<string>", line 24, in close
TypeError: left_slope() takes exactly 3 arguments (2 given)
PythonCaller_5(PythonFactory): PythonFactory failed to close properly
PythonCaller_5(PythonFactory): A fatal error has occurred. Check the logfile above for details