Please enable JavaScript to view this site.

 

bool = PlanetIsUp(nDate, nTimeOfDay, nPlanetID, nMoonSourceIndex)

 

This macro function checks if the planet nPlanetID has risen (and not yet set) on the date nDate at nTimeOfDay for the Moon data source of position nMoonSourceIndex.

 

The allowed values for nPlanetID range from n_MERCURY to n_PLUTO, and also include n_MOON (for the Sun, use the function SunIsUp).

The parameter nTimeOfDay should be supplied in one millionth of a day (less than 1/10th of a second), using the function MillionFromHMS to avoid any error.

 

The macro code below checks for the lunar occultation of any of the planets, on the date of the incoming macro token, but then checks if that planet is up or not before adding that planet to the list.

sOccultationsBuffer = ''
for nPlanet = n_MERCURY to n_PLUTO step 1
    sBuffer = ''
    nComboResult = LunarOccultationOnDate(n_TokenDate, 1, nPlanet)
    if nComboResult > -1
        nTime = nComboResult mod 1000000
        // only list it if it is "up" as seen by the Moon source used
        if PlanetIsUp(n_TokenDate, nTime, nPlanet, 1
            sBuffer = 'Lunar occultation of ' + PlanetName(nPlanet)
            sBuffer = sBuffer + ' at ' + FormatTime('hh:nn', nTime, true)
            sOccultationsBuffer = sOccultationsBuffer + chr(13) + sBuffer
        endif
    endif
endfor

Note that the function PlanetIsUp uses the apparent position of the planet, which takes into account atmospheric refraction, and therefore is closest to what a human observer would see.

 

See also: planetary macro functions.

 


Topic 179955, last updated on 18-Apr-2020