RNRL(5) File Formats Manual RNRL(5)

rnrlradiance distribution format

rnrl is a binary file format for storing a radiance distribution, i.e. a set of radiances (in W/m^2/sr/m) sorted by ascending wavelength (in nm).

A rnrl file is actualy a Star-Buffer file (see sbuf(5)). It starts with a header of 4 integers The first integer is a power of two (usually 4096) that defines the size of the memory page in bytes (pagesize) on which the list of radiances by wavelength is aligned. By aligning data to pagesize, and depending on system requirements, memory mapping can be used to automatically load/unload pages on demand (see mmap(2)). The second integer is the size of the array, i.e. the number of wavelengths for which a radiance is defined. The 2 remaining integers store the memory size (16 bytes) and memory alignment (16 bytes) of each entry, i.e. the wavelength (in nm) and its associated radiance (in W/m^2/sr/m).

Padding bytes follow the file header to align the radiance distribution to pagesize.

The distribution is finally followed by padding bytes to align the overall file size with the size of a page.

Data are encoded with respect to the little endian bytes ordering, i.e. least significant bytes are stored first.

The file format is as follows:

rnsl ::= pagesize⟩ ⟨size16 16
padding
distribution
padding
pagesize ::= uint64_t
distribution ::= wavelength⟩ ⟨radiance
...
wavelength ::= double # In nm
radiance ::= double # In W/m^2/sr/m
padding ::= [int8_t ...]

mmap(2), sbuf(5)

October 9, 2023 UNIX