Astronomy 1.0.1

dotnet add package Astronomy --version 1.0.1
                    
NuGet\Install-Package Astronomy -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Astronomy" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Astronomy" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Astronomy" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Astronomy --version 1.0.1
                    
#r "nuget: Astronomy, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Astronomy&version=1.0.1
                    
Install Astronomy as a Cake Addin
#tool nuget:?package=Astronomy&version=1.0.1
                    
Install Astronomy as a Cake Tool

Astronomy Astronomy is a tiny .net standart 2.0 library for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), moon position and lunar phase for the given location and time, created by Azat Salakhutdinov (@developerAzat), Aigul Sibgatullina (@Aigul9), Ilnar Aglyamzyanov (@ilnarag21).

Most calculations are based on the formulas given in the excellent Astronomy Answers articles about position of the sun and the planets.

NuGet You can download the package from NuGet Package Manager

Install-Package Astronomy -Version 1.0.1 dotnet add package Astronomy --version 1.0.1 Usage example //Moscow var res = SunCalculator.GetTimes(DateTime.Now, 55.75700, 37.61500);

Console.WriteLine("Sunrise time in Moscow: " + res.Sunrise.Hour.ToString() + ":" + res.Sunrise.Minute.ToString() + ":" + res.Sunrise.Second.ToString()); Console.WriteLine("Sunset time in Moscow: " + res.Sunset.Hour.ToString() + ":" + res.Sunset.Minute.ToString() + ":" + res.Sunset.Second.ToString());

res = SunCalculator.GetTimes(DateTime.Now, 55.80030, 49.10827);

Console.WriteLine("Sunrise time in Kazan: " + res.Sunrise.Hour.ToString() + ":" + res.Sunrise.Minute.ToString() + ":" + res.Sunrise.Second.ToString()); Console.WriteLine("Sunset time in Kazan: " + res.Sunset.Hour.ToString() + ":" + res.Sunset.Minute.ToString() + ":" + res.Sunset.Second.ToString()); Reference Sunlight times SunCalculator.GetTimes(/DateTime/ date, /double/ latitude, /double/ longitude, /double (default=0)/ height) Returns an object (SunTimes) with the following properties (each is a DateTime object):

Property Description Sunrise sunrise (top edge of the sun appears on the horizon) SunriseEnd sunrise ends (bottom edge of the sun touches the horizon) GoldenHourEnd morning golden hour (soft light, best time for photography) ends SolarNoon solar noon (sun is in the highest position) GoldenHour evening golden hour starts SunsetStart sunset starts (bottom edge of the sun touches the horizon) Sunset sunset (sun disappears below the horizon, evening civil twilight starts) Dusk dusk (evening nautical twilight starts) NauticalDusk nautical dusk (evening astronomical twilight starts) Night night starts (dark enough for astronomical observations) Nadir nadir (darkest moment of the night, sun is in the lowest position) NightEnd night ends (morning astronomical twilight starts) NauticalDawn nautical dawn (morning nautical twilight starts) Dawn dawn (morning nautical twilight ends, morning civil twilight starts) Sun position SunPosition GetSunPosition(DateTime date, double lat, double lng) Returns an object with the following properties:

Altitude: sun altitude above the horizon in radians, e.g. 0 at the horizon and PI/2 at the zenith (straight over your head) Azimuth: sun azimuth in radians (direction along the horizon, measured from south to west), e.g. 0 is south and Math.PI * 3/4 is northwest Moon position MoonPosition GetMoonPosition(DateTime date, double lat, double lng) Returns an object with the following properties:

Altitude: moon altitude above the horizon in radians Azimuth: moon azimuth in radians Distance: distance to moon in kilometers ParallacticAngle: parallactic angle of the moon in radians Moon illumination Tuple<double, double, double> GetMoonIllumination(DateTime date) Returns an object with the following properties:

fraction: illuminated fraction of the moon; varies from 0.0 (new moon) to 1.0 (full moon) phase: moon phase; varies from 0.0 to 1.0, described below angle: midpoint angle in radians of the illuminated limb of the moon reckoned eastward from the north point of the disk; the moon is waxing if the angle is negative, and waning if positive Moon phase value should be interpreted like this:

Phase Name 0 New Moon Waxing Crescent 0.25 First Quarter Waxing Gibbous 0.5 Full Moon Waning Gibbous 0.75 Last Quarter Waning Crescent By subtracting the parallacticAngle from the angle one can get the zenith angle of the moons bright limb (anticlockwise). The zenith angle can be used do draw the moon shape from the observers perspective (e.g. moon lying on its back).

Moon rise and set times MoonTimes GetTimes(DateTime date, double lat, double lng) Returns an object with the following properties:

Rise: moonrise time as Date Set: moonset time as Date AlwaysUp: true if the moon never rises/sets and is always above the horizon during the day AlwaysDown: true if the moon is always below the horizon

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 2,524 5/17/2021
1.0.0 432 4/22/2021