Using Near-Infrared Spectroscopy in Agricultural Systems