fmeobjects.FMEPalette

Inheritance diagram of fmeobjects.FMEPalette

FMEPalette.addKeysAndValues(keys, values)

Adds keys and values to the palette.

FMEPalette.containsKeys(keys)

Returns whether the specified keys are contained in the palette.

FMEPalette.containsValues(values)

Returns whether the specified values are contained in the palette.

FMEPalette.equals(palette)

Evaluates whether two palettes are identical.

FMEPalette.getKeyIndices(keys)

Returns the indices of the specified keys in the palette.

FMEPalette.getKeyTile()

Returns the keys of the palette.

FMEPalette.getMaxComponentValues()

Returns a tile containing the maximum values of each component in the palette.

FMEPalette.getMaxKey()

Returns the maximum key of the palette.

FMEPalette.getMaxValue()

Returns the maximum value of the palette.

FMEPalette.getMinComponentValues()

Returns a tile containing the minimum values of each component in the palette.

FMEPalette.getMinKey()

Returns the minimum key of the palette.

FMEPalette.getMinValue()

Returns the minimum value of the palette.

FMEPalette.getName()

Returns the name of the palette.

FMEPalette.getNextAvailableKeys(numKeys)

Returns the next available keys from the palette.

FMEPalette.getNumEntries()

Returns the number of entries in the palette.

FMEPalette.getValueTile()

Returns the values of the palette.

FMEPalette.getValuesFromKeys(keys)

Returns resolved values from the keys parameter.

FMEPalette.hasBeenModified()

Returns whether the palette has been modified from its baseline state.

FMEPalette.isSelected()

Returns whether the palette is selected for operations.

FMEPalette.removeKeysAndValues(keys)

Removes specified keys and corresponding values from the palette.

FMEPalette.setModified(modified)

Sets whether palette has been modified from baseline state.

FMEPalette.setSelected(selected)

Selects/deselects palette for operations.

FMEPalette.setValuesFromKeys(keys, values)

Sets value associated with the key of the palette.

class FMEPalette

FME Palette Class

Create an instance of a FMEPalette object.

init(name, key, value)

Creates a palette with the given properties.

The keys tile and values tile must have the same number of entries.

Parameters:
  • name (str) – Name of the palette.

  • keys (FMETile) – Keys to set. Duplicate keys are not allowed and keys must be in ascending order.

  • values (FMETile) – Values to set.

Return type:

FMEPalette

Returns:

An instance of a Palette object.

init(palette)

Create a copy of the passed in palette object.

Parameters:

palette (FMEPalette) – The palette object to create a copy of.

Return type:

FMEPalette

Returns:

An instance of a FMEPalette object.

__init__(*args, **kwargs)
addKeysAndValues(keys, values)

Adds keys and values to the palette. This method can add and/or set multiple values at once.

The input keys tile must be the same interpretation as the palette keys. The input values tile must be the same interpretation as the palette values.

The size of keys must be the same as the size of the values.

Parameters:
  • keys (FMETile) – Key tile to add. Must be the same interpretation as the palette keys.

  • values (FMETile) – Value tile to add. Must be the same interpretation as the palette values.

Return type:

None

Raises:

FMEException

An exception is raised:

  • if an error occurred.

  • if the number of new keys exceed the maximum number of keys this palette can handle.

containsKeys(keys)

Returns whether the specified keys are contained in the palette. The input tile may contain multiple keys.

Parameters:

keys (FMETile) – Key tile to look for.

Return type:

bool

Returns:

True if the specified keys are contained in the palette. False if not.

containsValues(values)

Returns whether the specified values are contained in the palette. The input tile may contain multiple values.

Parameters:

values (FMETile) – Value tile to look for.

Return type:

bool

Returns:

True if the specified values are contained in the palette. False if not.

equals(palette)

Evaluates whether two palettes are identical.

Parameters:

palette (FMEPalette) – The palette object to compare to.

Return type:

bool

Returns:

True if the two palette are the same.

getKeyIndices(keys)

Returns the indices of the specified keys in the palette.

An index represents the position of a key in the overall list of keys. For example, if a palette contains the following keys: 0 2 5 8, then the corresponding indices are: 0 1 2 3.

Parameters:

keys (FMETile) – The keys tiles to look for. The keys tiles must be the same interpretation as the palette keys.

Return type:

FMETile

Returns:

Indices of the specified keys in the palette.

Raises:

FMEException

An exception is raised:

  • if an error occurred.

  • if the palette does not contain one of the specified keys.

getKeyTile()

Returns the keys of the palette.

Return type:

FMETile

Returns:

Keys of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMaxComponentValues()

Returns a tile containing the maximum values of each component in the palette.

This tile might not be part of the palette itself and might not have a corresponding key tile.

Return type:

FMETile

Returns:

A tile containing the maximum value of each component in this palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMaxKey()

Returns the maximum key of the palette.

Return type:

FMETile

Returns:

The maximum key of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMaxValue()

Returns the maximum value of the palette.

Return type:

FMETile

Returns:

The maximum value of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMinComponentValues()

Returns a tile containing the minimum values of each component in the palette.

This tile might not be part of the palette itself and might not have a corresponding key tile.

Return type:

FMETile

Returns:

A tile containing the minimum value of each component in this palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMinKey()

Returns the minimum key of the palette.

Return type:

FMETile

Returns:

The minimum key of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getMinValue()

Returns the minimum value of the palette.

Return type:

FMETile

Returns:

The minimum value of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getName()

Returns the name of the palette.

Return type:

str

Returns:

Name of the palette.

getNextAvailableKeys(numKeys)

Returns the next available keys from the palette.

This method can get multiple available keys at once.

This routine can be used before the addKeysAndValues routine to make sure that there are enough new keys.

Parameters:

numKeys (int) – Number of keys to look up.

Return type:

FMETile

Returns:

The next available keys from the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getNumEntries()

Returns the number of entries in the palette.

Return type:

int

Returns:

The number of entries in the palette.

getValueTile()

Returns the values of the palette.

Return type:

FMETile

Returns:

Values of the palette.

Raises:

FMEException – An exception is raised if an error occurred.

getValuesFromKeys(keys)

Returns resolved values from the keys parameter.

This method allow multiple key-to-value lookups.

The input keys tile must be the same interpretation as the palette keys.

Parameters:

keys (FMETile) – Input key tile. It must be the same interpretation as the palette keys.

Return type:

FMETile

Returns:

Values associated with keys. If specified key is not found in the palette, the value will be set to 0.

Raises:

FMEException – An exception is raised if an error occurred.

hasBeenModified()

Returns whether the palette has been modified from its baseline state.

Return type:

bool

Returns:

True if it has been modified, False if it has not.

isSelected()

Returns whether the palette is selected for operations.

Return type:

bool

Returns:

True if it is selected, False if it is not.

removeKeysAndValues(keys)

Removes specified keys and corresponding values from the palette. This method can remove multiple keys and values at once.

The input keys tile must be the same interpretation as the palette keys.

Note that palette cannot be empty, meaning that there must be at least one entry in the palette. Therefore, attempting to remove everything from the palette will give an error and raise an exception.

Parameters:

keys (FMETile) – Key to remove.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

setModified(modified)

Sets whether palette has been modified from baseline state.

Note that hasBeenModified is initially set to False. Then, any calls that alter the palette will cause the modified state to become True (this does not need to be explicitly set; it will occur automatically).

Parameters:

modified (bool) – True when properties is altered.

Return type:

None

setSelected(selected)

Selects/deselects palette for operations.

Parameters:

selected (bool) – True to select, False to deselect.

Return type:

None

setValuesFromKeys(keys, values)

Sets value associated with the key of the palette. This method can set multiple values at once.

The input keys tile must be the same interpretation as the palette keys. The input values tile must be the same interpretation as the palette values.

The size of the keys must be the same as the size of the values.

Parameters:
Return type:

None

Raises:

FMEException

An exception is raised:

  • if an error occurred.

  • if some of the keys do not exist.