writing binned data