Hello!
I have a python script that calculates slope between points. I want to complete it with a while loop, to calculate between only those points where _lineID is equal, so like:
while _lineID == _lineID
z_kulonbseg = b_z - a_z
slope_degree = (z_kulonbseg / a_t) * 100
and so on....
import fme
import fmeobjects
from functools import reduce
from math import sin, pi
def left_slope(feature_a, feature_b):
a_x = float(feature_a.getAttribute('x'))
a_y = float(feature_a.getAttribute('y'))
a_z = float(feature_a.getAttribute('z_uj'))
a_t = float(feature_a.getAttribute('tavolsag_szomszed'))
b_x = float(feature_b.getAttribute('x'))
b_y = float(feature_b.getAttribute('y'))
b_z = float(feature_b.getAttribute('z_uj'))
b_t = float(feature_b.getAttribute('tavolsag_szomszed'))
###### WHILE LOOP
z_kulonbseg = b_z - a_z
slope_degree = (z_kulonbseg / a_t) * 100
if slope_degree > 0:
elojel = "1"
else:
elojel = "0"
feature_a.setAttribute('_slope', slope_degree)
feature_a.setAttribute('_elojel', elojel)
return feature_b
class FeatureProcessor(object):
def __init__(self):
self.features = o]
def input(self,feature):
self.features.append(feature)
def close(self):
reduce(left_slope, self.features)
for feature in self.feature
self.pyoutput(feature)
Can you help me to correct it?