I think the person also have to perfect in precepts.
The Blessed One also amplified thus: “If a monk should frame a
wish as follows :- “Let me with a divinely clear vision, surpassing
that of men, behold beings as they pass from one existence and
spring up in another existence, let me discern the base and the
noble, the handsome and the ugly, those in a higher state of
existence and those in the lower state of existence undergoing the
result of their deeds, so that I can know as follows:- ‘Alas! these
beings, having been wicked of body, wicked of voice, wicked of
mind, slanderers of noble people, wrong in their views, acquirers
of false merit under wrong views, have arrived after the
dissolution of the body, after death, at a place of punishment, a
place of suffering, perdition, hell; or again, these other beings,
having been righteous of body, righteous of voice, righteous of
mind, not slanderers of noble people, right in their views,
acquirers of merit under right views, have arrived, after the
dissolution of the body, after death, at a place of happiness, a
heavenly world.” Thus let me with a divinely clear vision,
surpassing that of men, discern beings as they pass from one
existence and spring up in another existence; let me discern the
base and the noble, the handsome and the ugly, those in a higher
state of existence and those in a lower state of existence
undergoing the result of their deeds,” then he must be perfect in
the precepts etc. This refers to the power of knowing the Truth of
Karma.