Added mechanism to compute array index given real units.
minor formatting edits