Skip to main content

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.

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.

 

pAddition] What version of FME are you using?

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.


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.

 

pAddition] 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

 

 


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.

 

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

 

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

 

 


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:


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

 

 


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"

 

 


Reply