Do you need to know what height you are at when you log each sample? If so, that makes the problem rather harder to solve.