Added bin_3d routine for binning data in 3D input space