bool = PlanetIsVisible(nDate, nSunSourceIndex, nPlanetID, bMorning, nRefTime, nRefOffset, nMinDuration)
This macro function predicts whether nPlanetID can be seen during a specified morning or evening interval on nDate, at Sun data source nSunSourceIndex. Here, “visible” means that the planet passes the built-in visibility model under its assumed atmospheric and observer conditions, for the sampled span described below. It is more than an above-horizon test, but it is not a guarantee of detection in actual weather or through local obstructions.
•The allowed values for nPlanetID range from n_MERCURY to n_PLUTO.
•bMorning=true searches a morning interval ending at sunrise on nDate; bMorning=false searches an evening interval starting at sunset on that date. All times use the selected Sun source's local-time settings.
•nRefTime and nRefOffset set the other end of the interval: its start in the morning, or its end in the evening. Where used, nRefOffset is in HHNN format (hours and minutes), not millionths of a day:
onRefTime = 0: Morning starts at midnight at the beginning of the date; evening ends at the following midnight. The offset is ignored.
onRefTime = 1: Morning starts halfway between the previous sunset and today's sunrise; evening ends halfway between today's sunset and the next sunrise. The offset is ignored.
onRefTime = 2: The offset specifies an absolute local clock time on the stated date: the morning start or evening end. For example, 0530 means 05:30. Choose a time that gives a valid interval before sunrise or after sunset, respectively.
onRefTime = 3: Morning starts the offset duration before sunrise; evening ends the offset duration after sunset. For example, 0300 searches the three hours before sunrise or after sunset.
onRefTime = 4: Morning starts the offset duration before civil dawn (Sun 6° below the horizon); evening ends the offset duration after civil dusk. The morning interval still ends at sunrise, and the evening interval still starts at sunset.
onRefTime = 5: Morning starts the offset duration before nautical dawn (Sun 12° below the horizon); evening ends the offset duration after nautical dusk. The morning interval still ends at sunrise, and the evening interval still starts at sunset.
onRefTime = 6: Morning starts the offset duration before astronomical dawn (Sun 18° below the horizon); evening ends the offset duration after astronomical dusk. The morning interval still ends at sunrise, and the evening interval still starts at sunset.
•nMinDuration is the required span in minutes between the first and last samples that pass the visibility test. The interval is sampled at one-minute steps. A result of true means that this span is at least nMinDuration; it does not guarantee uninterrupted visibility between those samples.
A useful starting choice is nRefTime=3, nRefOffset=0300 and nMinDuration=30: search the three hours before sunrise or after sunset, requiring at least 30 minutes between the first and last visible samples.
The calculation assumes that the sunrise, sunset and any dawn or dusk needed to construct the chosen interval exist. It does not provide a general polar-day or polar-night fallback when these events are absent.
See also: planetary data exportation and planetary macro functions.
Topic 188995, last updated on 12-Oct-2026