Comparison of lunar and terrestrial ion measurements obtained by the WIND and GEOTAIL spacecraft outside and inside the Earth's magnetosphere