/// <summary> /// Calculate new moon and full moon instances. /// </summary> /// <returns> /// <para>nmLocalTimeHour -- new Moon instant - local time (hour)</para> /// <para>nmLocalTimeMin -- new Moon instant - local time (minutes)</para> /// <para>nmLocalDateDay -- new Moon instance - local date (day)</para> /// <para>nmLocalDateMonth -- new Moon instance - local date (month)</para> /// <para>nmLocalDateYear -- new Moon instance - local date (year)</para> /// <para>fmLocalTimeHour -- full Moon instant - local time (hour)</para> /// <para>fmLocalTimeMin -- full Moon instant - local time (minutes)</para> /// <para>fmLocalDateDay -- full Moon instance - local date (day)</para> /// <para>fmLocalDateMonth -- full Moon instance - local date (month)</para> /// <para>fmLocalDateYear -- full Moon instance - local date (year)</para> /// </returns> public (double nmLocalTimeHour, double nmLocalTimeMin, double nmLocalDateDay, int nmLocalDateMonth, int nmLocalDateYear, double fmLocalTimeHour, double fmLocalTimeMin, double fmLocalDateDay, int fmLocalDateMonth, int fmLocalDateYear) TimesOfNewMoonAndFullMoon(bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear) { var daylightSaving = (isDaylightSaving) ? 1 : 0; var jdOfNewMoonDays = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var jdOfFullMoonDays = PAMacros.FullMoon(3, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfNewMoonDay = PAMacros.JulianDateDay(jdOfNewMoonDays); var integerDay1 = gDateOfNewMoonDay.Floor(); var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(jdOfNewMoonDays); var gDateOfNewMoonYear = PAMacros.JulianDateYear(jdOfNewMoonDays); var gDateOfFullMoonDay = PAMacros.JulianDateDay(jdOfFullMoonDays); var integerDay2 = gDateOfFullMoonDay.Floor(); var gDateOfFullMoonMonth = PAMacros.JulianDateMonth(jdOfFullMoonDays); var gDateOfFullMoonYear = PAMacros.JulianDateYear(jdOfFullMoonDays); var utOfNewMoonHours = 24.0 * (gDateOfNewMoonDay - integerDay1); var utOfFullMoonHours = 24.0 * (gDateOfFullMoonDay - integerDay2); var lctOfNewMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfNewMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); var lctOfFullMoonHours = PAMacros.UniversalTimeToLocalCivilTime(utOfFullMoonHours + 0.008333, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); var nmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfNewMoonHours); var nmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfNewMoonHours); var nmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); var nmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); var nmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay1, gDateOfNewMoonMonth, gDateOfNewMoonYear); var fmLocalTimeHour = PAMacros.DecimalHoursHour(lctOfFullMoonHours); var fmLocalTimeMin = PAMacros.DecimalHoursMinute(lctOfFullMoonHours); var fmLocalDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); var fmLocalDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); var fmLocalDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfFullMoonHours, 0, 0, daylightSaving, zoneCorrectionHours, integerDay2, gDateOfFullMoonMonth, gDateOfFullMoonYear); return(nmLocalTimeHour, nmLocalTimeMin, nmLocalDateDay, nmLocalDateMonth, nmLocalDateYear, fmLocalTimeHour, fmLocalTimeMin, fmLocalDateDay, fmLocalDateMonth, fmLocalDateYear); }
/// <summary> /// Calculate the circumstances of a solar eclipse. /// </summary> /// <returns> /// <para>solarEclipseCertainDateDay -- Solar eclipse date (day)</para> /// <para>solarEclipseCertainDateMonth -- Solar eclipse date (month)</para> /// <para>solarEclipseCertainDateYear -- Solar eclipse date (year)</para> /// <para>utFirstContactHour -- First contact of shadow (hour)</para> /// <para>utFirstContactMinutes -- First contact of shadow (minutes)</para> /// <para>utMidEclipseHour -- Mid-eclipse (hour)</para> /// <para>utMidEclipseMinutes -- Mid-eclipse (minutes)</para> /// <para>utLastContactHour -- Last contact of shadow (hour)</para> /// <para>utLastContactMinutes -- Last contact of shadow (minutes)</para> /// <para>eclipseMagnitude -- Eclipse magnitude</para> /// </returns> public (double solarEclipseCertainDateDay, int solarEclipseCertainDateMonth, int solarEclipseCertainDateYear, double utFirstContactHour, double utFirstContactMinutes, double utMidEclipseHour, double utMidEclipseMinutes, double utLastContactHour, double utLastContactMinutes, double eclipseMagnitude) SolarEclipseCircumstances(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours, double geogLongitudeDeg, double geogLatitudeDeg) { var daylightSaving = (isDaylightSaving) ? 1 : 0; var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); var integerDay = (gDateOfNewMoonDay).Floor(); var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var utMaxEclipse = PAMacros.UTMaxSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); var utFirstContact = PAMacros.UTFirstContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); var utLastContact = PAMacros.UTLastContactSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); var magnitude = PAMacros.MagSolarEclipse(localDateDay, localDateMonth, localDateYear, daylightSaving, zoneCorrectionHours, geogLongitudeDeg, geogLatitudeDeg); var solarEclipseCertainDateDay = localCivilDateDay; var solarEclipseCertainDateMonth = localCivilDateMonth; var solarEclipseCertainDateYear = localCivilDateYear; var utFirstContactHour = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utFirstContact + 0.008333); var utFirstContactMinutes = (utFirstContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utFirstContact + 0.008333); var utMidEclipseHour = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utMaxEclipse + 0.008333); var utMidEclipseMinutes = (utMaxEclipse == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utMaxEclipse + 0.008333); var utLastContactHour = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursHour(utLastContact + 0.008333); var utLastContactMinutes = (utLastContact == -99.0) ? -99.0 : PAMacros.DecimalHoursMinute(utLastContact + 0.008333); var eclipseMagnitude = (magnitude == -99.0) ? -99.0 : Math.Round(magnitude, 3); return(solarEclipseCertainDateDay, solarEclipseCertainDateMonth, solarEclipseCertainDateYear, utFirstContactHour, utFirstContactMinutes, utMidEclipseHour, utMidEclipseMinutes, utLastContactHour, utLastContactMinutes, eclipseMagnitude); }
/// <summary> /// Determine if a solar eclipse is likely to occur. /// </summary> /// <returns> /// <para>status -- One of "Solar eclipse certain", "Solar eclipse possible", or "No solar eclipse".</para> /// <para>event_date_day -- Date of eclipse event (day).</para> /// <para>event_date_month -- Date of eclipse event (month).</para> /// <para>event_date_year -- Date of eclipse event (year).</para> /// </returns> public (string status, double eventDateDay, int eventDateMonth, int eventDateYear) SolarEclipseOccurrence(double localDateDay, int localDateMonth, int localDateYear, bool isDaylightSaving, int zoneCorrectionHours) { var daylightSaving = (isDaylightSaving) ? 1 : 0; var julianDateOfNewMoon = PAMacros.NewMoon(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var gDateOfNewMoonDay = PAMacros.JulianDateDay(julianDateOfNewMoon); var integerDay = (gDateOfNewMoonDay).Floor(); var gDateOfNewMoonMonth = PAMacros.JulianDateMonth(julianDateOfNewMoon); var gDateOfNewMoonYear = PAMacros.JulianDateYear(julianDateOfNewMoon); var utOfNewMoonHours = gDateOfNewMoonDay - integerDay; var localCivilDateDay = PAMacros.UniversalTime_LocalCivilDay(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var localCivilDateMonth = PAMacros.UniversalTime_LocalCivilMonth(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var localCivilDateYear = PAMacros.UniversalTime_LocalCivilYear(utOfNewMoonHours, 0.0, 0.0, daylightSaving, zoneCorrectionHours, integerDay, gDateOfNewMoonMonth, gDateOfNewMoonYear); var eclipseOccurrence = PAMacros.SolarEclipseOccurrence(daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear); var status = eclipseOccurrence; var eventDateDay = localCivilDateDay; var eventDateMonth = localCivilDateMonth; var eventDateYear = localCivilDateYear; return(status, eventDateDay, eventDateMonth, eventDateYear); }