Question

Looping custom transformer with adjacent feature attributes

  • 16 April 2021
  • 2 replies
  • 10 views

Badge

Hi All,

 

I'm having problems looping a custom transformer I've created that makes use of adjacent feature attributes.

The workbench I'm working on is intended to smooth DTM data and then identify trends in gradient along a set line. I've tested the process by manually replicating the transformers I'd like to loop but when I add them to a custom transformer and try to loop them I get an error (please see attached image).ErrorBefore the data enters the loop I expose the adjacent z value and calculate: IF z-z+1 >=0.01 then z-(z-z+1) else z. I then write the result to an attribute 'bicubic_smoothing' so that the data entering the loop doesn't use adjacent attributes. The 'AttributeCreator_15' in the loop uses adjacent features to asses the difference between the first 'bicubic_smoothing' attribute and the second 'bicubic_smoothing' attribute and so on. 'StatisticsCalculator_2' assess the range of the values created by 'AttributeCreator_15'. 'Tester_2' assess if the values calculated by 'StatisticsCalculator_2' meet the required range threshold. If the results don't meet the requirement they go to the tester failed port. 'AttributeCreator_16' applies the calculation IF 'bicubic_smoothing'-'bicubic_smoothing'+1 >=0.01 then 'bicubic_smoothing'-('bicubic_smoothing'-'bicubic_smoothing'+1) else 'bicubic_smoothing'. Attribute manager then writes this result to an attribute to remove the need for adjacent features and then loops back (please see screenshot below of the custom transformer).

CaptureThanks in advance for your help.


2 replies

Badge

I think I've overcome my original problem by adding a dummy attribute called 'feature[+1].bicubic_smoothing'. This allows data to enter the custom transformer. However, when a result fails to meet the tolerance set in the tester it should loop back to the start but the model fails with an error. The error in the log file is: Loop to DTM_resampler_loop3_FeatureHolder_2_Input1618573799 Input Splitter (BranchingFactory): Transformer/Factory DTM_resampler_loop3_StatisticsCalculator_2 is blocking and cannot be used in a loop.

I've updated the transformers since my last post. So please see below for amended version.

Capture2 

I've now enabled blocked looping at that appears to have allowed the loop to run.

 

Badge

I spoke to soon. I'm still struggling to get this to work. I've tried several different iterations but all of them have resulted in the the loop running for a long time without creating any results. With the conditions I've set it should run the loop 13 times before the condition is met. Below is a screenshot of the loop as it currently stands. Data is read in but no results are generated. I'm clearly missing something but I'm out of ideas of what it could be. So suggestions welcome.

Untitled

Reply