Angle 3.4.0
dotnet add package Angle --version 3.4.0
NuGet\Install-Package Angle -Version 3.4.0
<PackageReference Include="Angle" Version="3.4.0" />
paket add Angle --version 3.4.0
#r "nuget: Angle, 3.4.0"
// Install Angle as a Cake Addin #addin nuget:?package=Angle&version=3.4.0 // Install Angle as a Cake Tool #tool nuget:?package=Angle&version=3.4.0
Solar-Calculator
Calculates the sunrise and sunset for a given date and location (using GEO coordinates). This library uses the method outlined NOAA Solar Calculations Day spreadsheet found at http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html.
Installing
Add this to your project in Visual Studio using NuGet Package Manager UI and ID SolarCalculator or using the Package Manager Console.
PM> Install-Package SolarCalculator
Notes
Starting in version 3.3.0 there are two new properties for checking if a date is a Polar Day (IsPolarDay
) or Polar Night (IsPolarNight
). If the combination of date and location result in a Polar Day or Polar Night, the values for Sunrise and Sunset are as follows:
Polar Day: Sunrise = DateTime.MinValue
, Sunset = DateTime.MaxValue
Polar Night: Sunrise = DateTime.MaxValue
, Sunset = DateTime.MinValue
Sample Code
The sample code below shows how to initialize and call the Solar Calculator to get the sunrise and sunset for the given location.
Sunrise in Chicago
using System;
using Innovative.SolarCalculator;
//
// Geo coordinates of Oak Street Beach in Chicago, IL
//
// NOTE: the .Date is not necessary but is included to demonstrate that time input
// does not affect the output. Time will be returned in the current time zone so it
// will need to be adjusted to the time zone where the coordinates are from (there
// are services that can be used to get time zone from a latitude and longitude position).
//
TimeZoneInfo cst = TimeZoneInfo.FindSystemTimeZoneById("Central Standard Time");
SolarTimes solarTimes = new SolarTimes(DateTime.Now.Date, 41.9032, -87.6224);
DateTime sunrise = TimeZoneInfo.ConvertTimeFromUtc(solarTimes.Sunrise.ToUniversalTime(), cst);
//
// Display the sunrise
//
Console.WriteLine($"View the sunrise across Lake Michigan from Oak Street Beach in Chicago at {sunrise.ToLongTimeString()} on {sunrise.ToLongDateString()}.");
Sunset in Michigan
//
// Geo coordinates of Benton Harbor/Benton Heights in Michigan
//
TimeZoneInfo est = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
SolarTimes solarTimes = new SolarTimes(DateTime.Now, 42.1543, -86.4459);
DateTime sunset = TimeZoneInfo.ConvertTimeFromUtc(solarTimes.Sunset.ToUniversalTime(), est);
//
// Display the sunset
//
Console.WriteLine($"View the sunset across Lake Michigan from Benton Harbor in Michigan at {sunset.ToLongTimeString()} on {sunset.ToLongDateString()}.");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. 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 is compatible. 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 is compatible. 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. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 is compatible. 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 | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Angle:
Package | Downloads |
---|---|
SolarCalculator
Calculates the sunrise and sunset for a given date and location (using Geographic Coordinates). This library uses the method outlined NOAA Solar Calculations Day spreadsheet found at http://www.esrl.noaa.gov/gmd/grad/solcalc/calcdetails.html. Calculations are based on the book "Astronomical Algorithms" by Jean Meeus. |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Angle:
Repository | Stars |
---|---|
genielabs/HomeGenie
HomeGenie, the programmable automation intelligence
|
v3.4.0 Added net 8.0 support.
v3.3.0 Corrections added for Polar Day and Polar Night (Nickztar)
v3.2.1 Added ReadMe to package.
v3.2.0 Added net 7.0 support.
v3.1.0 Added support for net 5.0 and net 6.0.
v3.0.4 Corrected date shifting issue.
v3.0.3 Added missing documentation.
v3.0.2 Added source code and symbol integration to NuGet package.
v3.0.1 Changed license to LGPL Public 3.0.
v3.0.0 Added support for multiple frameworks.
v2.0.0 Converted to .NET Standard/Moved to GitHub.
v1.0.2 Added multiple .NET versions. Completed units test and corrected minor issues.
v1.0.1 Changed namespace to Innovative.Geometry