lookup
- lookup(indexer, values)
Build an output fieldset using the values in
indexer
as indices for a look-up invalues
.- Parameters
index – indexer fieldset
values (
Fieldset
or 1D-ndarray) – values to choose from
- Return type
lookup()
takes the grid values inindexer
and uses them as index invalues
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 aFieldset
the value at the same gridpoint in the (N-1)-th field invalues
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 thevalues
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.