Ellipsoidal vortices in rotating stratified fluids: beyond the quasi-geostrophic approximation