lookup

lookup(indexer, values)

Build an output fieldset using the values in indexer as indices for a look-up in values.

Parameters
  • index – indexer fieldset

  • values (Fieldset or 1D-ndarray) – values to choose from

Return type

Fieldset

lookup() takes the grid values in indexer and uses them as index in values in the following way:

  • let us suppose a grid value in the i-th indexer field is N (for float values the integer part is taken)

  • what happens depends on the type of values:

    • if values is a Fieldset the value at the same gridpoint in the (N-1)-th field in values is written into the i-th output field at the given gridpoint (here field indexing starts at 0)

    • if values is an ndarray the value at the (N-1)-th position in the values array is written into the i-th output field at the given gridpoint

The output will have has as many fields as there are in indexer.

Any missing values in indexer will cause the function to fail with a “value out of range” error message.