SolarCalculator 3.2.1
dotnet add package SolarCalculator --version 3.2.1
NuGet\Install-Package SolarCalculator -Version 3.2.1
<PackageReference Include="SolarCalculator" Version="3.2.1" />
paket add SolarCalculator --version 3.2.1
#r "nuget: SolarCalculator, 3.2.1"
// Install SolarCalculator as a Cake Addin
#addin nuget:?package=SolarCalculator&version=3.2.1
// Install SolarCalculator as a Cake Tool
#tool nuget:?package=SolarCalculator&version=3.2.1
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
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 |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows |
.NET Core | netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard1.3 netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1 |
.NET Framework | net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen30 tizen40 tizen60 |
Universal Windows Platform | uap uap10.0 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
-
.NETCoreApp 3.1
- Angle (>= 3.2.1)
-
.NETFramework 4.0
- Angle (>= 3.2.1)
-
.NETFramework 4.5
- Angle (>= 3.2.1)
-
.NETFramework 4.6.1
- Angle (>= 3.2.1)
-
.NETStandard 1.3
- Angle (>= 3.2.1)
- NETStandard.Library (>= 1.6.1)
-
.NETStandard 2.0
- Angle (>= 3.2.1)
-
.NETStandard 2.1
- Angle (>= 3.2.1)
-
net5.0
- Angle (>= 3.2.1)
-
net6.0
- Angle (>= 3.2.1)
-
net7.0
- Angle (>= 3.2.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SolarCalculator:
Package | Downloads |
---|---|
ColorTurbine.Framework
LED animation/information display framework |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on SolarCalculator:
Repository | Stars |
---|---|
genielabs/HomeGenie
HomeGenie, the programmable automation system for smart devices and applications.
|
Version | Downloads | Last updated |
---|---|---|
3.2.1 | 8,509 | 12/2/2022 |
3.2.0 | 189 | 12/2/2022 |
3.1.0 | 53,361 | 1/15/2022 |
3.0.6 | 102,628 | 8/4/2020 |
3.0.5 | 29,814 | 4/17/2020 |
3.0.4 | 402 | 4/16/2020 |
3.0.3 | 415 | 4/14/2020 |
3.0.2 | 401 | 4/14/2020 |
3.0.1 | 2,144 | 1/25/2020 |
2.0.4 | 49,943 | 10/17/2018 |
2.0.3 | 2,277 | 7/10/2018 |
2.0.2 | 5,719 | 10/2/2017 |
2.0.1 | 847 | 10/1/2017 |
2.0.0 | 963 | 9/29/2017 |
1.0.8 | 51,657 | 7/27/2014 |
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.6 Added calculations for Astronomical, Nautical and Civil Dawn and Dusk times (rbdavison).
v3.0.5 Reverted changes until further research can be done.
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.4 Bug Fix - Removed internal date setting by string that was not compatible in all locales - t1m0thyj
v2.0.3 Added azimuth calculation - GeorgeHahn
v2.0.2 Corrected date portion of SolarNoon date and time. It was showing the correct time but the wrong day.
v2.0.1 Change default value for SolarNoon to the ForDate property.
v2.0.0 Converted to .NET Standard/Moved to GitHub.
v1.0.8 Added multiple .NET versions.
v1.0.7 Removed Angle class and referenced it from NuGet library.
v1.0.6 Updated NuGet package only.
v1.0.5 Added a class/data type called Angle to handle computations and conversions. This class inherently behaves as a type double so that pre-existing code is not broken.
v1.0.4 Change the type of ForDate to DateTimeOffset due to improper handling of Time Zone. This does not affected code already written against this method.
v1.0.3 Corrected a time issue causing the wrong sunrise and sunset times to be returned. All test cases passed.
v1.0.2 Added XML comments file.
v1.0.1 Updated license and project URL's in package.