fix handling of internal NaNs in Cast.add_depth

previously only checked for NaNs at the beginning and would give incorrect
depths when NaNs were in the interior

Now uses linear interpolation over density