You should  use `.ravel()` here instead of `.flatten()` to try and avoid making a copy. If the coordinate is large this could be an important saving.