eradiate.xarray.interp.dataarray_to_rgb(da, channels, normalize=True, gamma_correction=True)[source]#

Compose an RGB image from radiance data.

  • da (DataArray) – The data array from which radiance data will be taken. It has to be such that data, when selected on a spectral axis, is 2-dimensional.

  • channels (sequence of tuples) – Three (coordinate label, coordinate value) pairs used to select the data used to compose the image. Channels are ordered as follows: (R, G, B). For instance, to select wavelengths (dimension "w") at 440 (blue), 550 (green) and 660 (red) nm, use channels=[("w", 660), ("w", 550), ("w", 440)].

  • normalize (bool, optional) – If True, the data will be normalized by its maximum value.

  • gamma_correction (bool, optional) – If True, apply a gamma operator to the data.


ndarray – An RGB image which can be displayed using matplotlib.pyplot.imshow().


The image processing pipeline implemented by this function is rudimentary. It only applies, if instructed, a gamma operator. For more advanced tone mapping operations, use this function with normalize=False and gamma_correction=False, then apply your own post-processing to the resulting (N, M, 3)-shaped array.