Declaration: TMetaData.WorldToIndex(dim: TDims; coord: double; grp: integer; var resid: double): integer;
Converts the world coordinate coord along the dimension specified by the parameter dim to the corresponding cell index. For layers (dim = dimL) the grp parameter has to contain the spectral group number, for all other dimensions it is ignored. The variable parameter resid returns the fractional part of the calculated index and may be used to round it (the calculated index is always truncated).

Hint: In order to directly access the metadata of the currently loaded dataset you can use the pre-declared global variable MData.