Skip to main content
Solved

Using BulkAttributeRenamer to convert list values to attributes, result is badly ordered

  • October 18, 2018
  • 7 replies
  • 59 views

nicholas
Contributor
Forum|alt.badge.img+14

Hello all,

I am processing a dataset of rainfall values. For each feature, I have 365 values in a list. I am using BulkAttributeRenamer to convert the list values to 365 attribute columns. The result is badly ordered. I was expecting the new columns to be ordered numerically, but they are scrambled up. It will take me a very long time to correct the order by hand.

Best answer by takashi

Got it, it's just annoying indeed.

It could be a workaround if you have exposed the list elements under the RasterCellCoercer and set All Attributes to the Rename parameter in the BulkAttributeRenamer with the Regular Expression Replace action.

See my solution in this Q&A;: How to change List to attribute (with ListIndexer transformer loop or another way)?

Example:

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

7 replies

takashi
Celebrity
  • 7843 replies
  • October 18, 2018
Could you please explain the situation more specifically?

 

  • How did you configure the transformer parameters?
  • Where/How do the attributes appear scrambled up?
and so on.

 

[Addition] What version of FME are you using?

david_r
Celebrity
  • 8394 replies
  • October 18, 2018

It's fairly easy to do this in Python, where the order is guaranteed. For example something like:

def FeatureProcessor(feature):
    list_values = feature.getAttribute('_list{}.item')
    for n, value in enumerate(list_values):
        feature.setAttribute('item_%0.3d' % n, value)

This will convert

_list{0}.item = a

 

_list{1}.item = b

 

_list{2}.item = c

To

item_001 = a

 

item_002 = b

 

item_003 = c

etc.


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • October 18, 2018
Could you please explain the situation more specifically?

 

  • How did you configure the transformer parameters?
  • Where/How do the attributes appear scrambled up?
and so on.

 

[Addition] What version of FME are you using?
The original dataset is a NetCDF file of rainfall in Australia.There are 365 bands, representing the rainfall on each day of the year. Spatially, the data is a 5km grid over Australia.

 

I use RasterCellCoercer to convert each grid pixel into a square polygon, each feature has a list, _band{}.value

 

I use BulkAttributeRenamer to convert the list values into attribute values. This is where the problem occurs.

 

Attributes to Rename, I choose Selected Attributes

 

I tick _band{}.value

 

I am then prompted to select the list elements, and I enter 0-364

 

I press OK to close the dialogue

 

The output is then scrambled like this;

 

_band{}.value

 

_band{79}.value

 

_band{53}.value

 

_band{331}.value

 

_band{88}.value

 

_band{297}.value

 

...and so on

 

 

What I actually want is;

 

_band{0}.value

 

_band{1}.value

 

_band{2}.value

 

...and so on

 

 


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • October 18, 2018
Could you please explain the situation more specifically?

 

  • How did you configure the transformer parameters?
  • Where/How do the attributes appear scrambled up?
and so on.

 

[Addition] What version of FME are you using?
Also, I am running

 

FME Desktop Oracle Edition 2018.1.0.0 (20180516 - Build 18479 - WIN64)

 

 


takashi
Celebrity
  • 7843 replies
  • Best Answer
  • October 19, 2018

Got it, it's just annoying indeed.

It could be a workaround if you have exposed the list elements under the RasterCellCoercer and set All Attributes to the Rename parameter in the BulkAttributeRenamer with the Regular Expression Replace action.

See my solution in this Q&A;: How to change List to attribute (with ListIndexer transformer loop or another way)?

Example:


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • October 22, 2018

Got it, it's just annoying indeed.

It could be a workaround if you have exposed the list elements under the RasterCellCoercer and set All Attributes to the Rename parameter in the BulkAttributeRenamer with the Regular Expression Replace action.

See my solution in this Q&A;: How to change List to attribute (with ListIndexer transformer loop or another way)?

Example:

This worked :-)

 

In RasterCellCoercer, I did a right-click on the attributes under Output to choose "Expose Attributes". This gave me all the bands in numerical order.

 

Then in BulkAttributeRenamer I followed your advice to rename the attributes nicely.

 

But I think the critical step was "Expose Attributes" in RasterCellCoercer.

 

Thank you takashi

 

 


nicholas
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • 116 replies
  • October 23, 2018

Got it, it's just annoying indeed.

It could be a workaround if you have exposed the list elements under the RasterCellCoercer and set All Attributes to the Rename parameter in the BulkAttributeRenamer with the Regular Expression Replace action.

See my solution in this Q&A;: How to change List to attribute (with ListIndexer transformer loop or another way)?

Example:

Specifically, in RasterCellCoercer I right-clicked on "_band{}.value" and chose "Expose Elements"