/// <summary>
    /// Calculate selenographic (lunar) coordinates (sub-Solar)
    /// </summary>
    /// <returns>sub-solar longitude, sub-solar colongitude, and sub-solar latitude</returns>
    public (double subSolarLongitude, double subSolarColongitude, double subSolarLatitude) SelenographicCoordinates2(double gwdateDay, int gwdateMonth, int gwdateYear)
    {
        var julianDateDays           = PAMacros.CivilDateToJulianDate(gwdateDay, gwdateMonth, gwdateYear);
        var tCenturies               = (julianDateDays - 2451545) / 36525;
        var longAscNodeDeg           = 125.044522 - 1934.136261 * tCenturies;
        var f1                       = 93.27191 + 483202.0175 * tCenturies;
        var f2                       = f1 - 360 * (f1 / 360).Floor();
        var sunGeocentricLongDeg     = PAMacros.SunLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear);
        var moonEquHorParallaxArcMin = PAMacros.MoonHP(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear) * 60;
        var sunEarthDistAU           = PAMacros.SunDist(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear);
        var geocentricMoonLatRad     = (PAMacros.MoonLat(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear)).ToRadians();
        var geocentricMoonLongDeg    = PAMacros.MoonLong(0, 0, 0, 0, 0, gwdateDay, gwdateMonth, gwdateYear);
        var adjustedMoonLongDeg      = sunGeocentricLongDeg + 180 + (26.4 * (geocentricMoonLatRad).Cosine() * ((sunGeocentricLongDeg - geocentricMoonLongDeg).ToRadians()).Sine() / (moonEquHorParallaxArcMin * sunEarthDistAU));
        var adjustedMoonLatRad       = 0.14666 * geocentricMoonLatRad / (moonEquHorParallaxArcMin * sunEarthDistAU);
        var inclinationRad           = (PAMacros.DegreesMinutesSecondsToDecimalDegrees(1, 32, 32.7)).ToRadians();
        var nodeLongRad              = (longAscNodeDeg - adjustedMoonLongDeg).ToRadians();
        var sinBs                    = -(inclinationRad).Cosine() * (adjustedMoonLatRad).Sine() + (inclinationRad).Sine() * (adjustedMoonLatRad).Cosine() * (nodeLongRad).Sine();
        var subSolarLatDeg           = PAMacros.Degrees((sinBs).ASine());
        var aRad                     = (-(adjustedMoonLatRad).Sine() * (inclinationRad).Sine() - (adjustedMoonLatRad).Cosine() * (inclinationRad).Cosine() * (nodeLongRad).Sine()).AngleTangent2((adjustedMoonLatRad).Cosine() * (nodeLongRad).Cosine());
        var aDeg                     = PAMacros.Degrees(aRad);
        var subSolarLongDeg1         = aDeg - f2;
        var subSolarLongDeg2         = subSolarLongDeg1 - 360 * (subSolarLongDeg1 / 360).Floor();
        var subSolarLongDeg3         = (subSolarLongDeg2 > 180) ? subSolarLongDeg2 - 360 : subSolarLongDeg2;
        var subSolarColongDeg        = 90 - subSolarLongDeg3;

        var subSolarLongitude   = Math.Round(subSolarLongDeg3, 2);
        var subSolarColongitude = Math.Round(subSolarColongDeg, 2);
        var subSolarLatitude    = Math.Round(subSolarLatDeg, 2);

        return(subSolarLongitude, subSolarColongitude, subSolarLatitude);
    }
Example #2
0
    /// <summary>
    /// Calculate Moon's distance, angular diameter, and horizontal parallax.
    /// </summary>
    /// <returns>
    /// <para>earth_moon_dist -- Earth-Moon distance (km)</para>
    /// <para>ang_diameter_deg -- Angular diameter (degrees part)</para>
    /// <para>ang_diameter_min -- Angular diameter (minutes part)</para>
    /// <para>hor_parallax_deg -- Horizontal parallax (degrees part)</para>
    /// <para>hor_parallax_min -- Horizontal parallax (minutes part)</para>
    /// <para>hor_parallax_sec -- Horizontal parallax (seconds part)</para>
    /// </returns>
    public (double earthMoonDist, double angDiameterDeg, double angDiameterMin, double horParallaxDeg, double horParallaxMin, double horParallaxSec) MoonDistAngDiamHorParallax(double lctHour, double lctMin, double lctSec, bool isDaylightSaving, int zoneCorrectionHours, double localDateDay, int localDateMonth, int localDateYear)
    {
        var daylightSaving = (isDaylightSaving) ? 1 : 0;

        var moonDistance           = PAMacros.MoonDist(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);
        var moonAngularDiameter    = PAMacros.MoonSize(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);
        var moonHorizontalParallax = PAMacros.MoonHP(lctHour, lctMin, lctSec, daylightSaving, zoneCorrectionHours, localDateDay, localDateMonth, localDateYear);

        var earthMoonDist  = Math.Round(moonDistance, 0);
        var angDiameterDeg = PAMacros.DecimalDegreesDegrees(moonAngularDiameter + 0.008333);
        var angDiameterMin = PAMacros.DecimalDegreesMinutes(moonAngularDiameter + 0.008333);
        var horParallaxDeg = PAMacros.DecimalDegreesDegrees(moonHorizontalParallax);
        var horParallaxMin = PAMacros.DecimalDegreesMinutes(moonHorizontalParallax);
        var horParallaxSec = PAMacros.DecimalDegreesSeconds(moonHorizontalParallax);

        return(earthMoonDist, angDiameterDeg, angDiameterMin, horParallaxDeg, horParallaxMin, horParallaxSec);
    }