jsauve / aasharp Goto Github PK
View Code? Open in Web Editor NEWAstronomical Algorithms in C#
License: GNU Lesser General Public License v3.0
Astronomical Algorithms in C#
License: GNU Lesser General Public License v3.0
@jsauve
@elendil-software
@NameOfTheDragon
The AASharp.AASCoordinateTransformation.Equatorial2Horizontal method is incorrectly implemented.
It gives definitely wrong result for Polaris azimuth coordinate.
We all know that Polaris has a "special place" on the night sky and its azimuth coordinate regardless of the current geographic location must be always near 359° (or 0° - 1°, but always between these values).
But the current implementation gives cca 179° for Polaris azimuth, which is impossible!
Used following code to test it:
using System;
using System.Globalization;
using AASharp;
namespace ABC {
class Program {
static void Main(string[] args) {
// constants
var latitude = 47.832301400; // enter your latitude in decimal degrees
var longitude = 17.668490900; // enter your longitude in decimal degrees
var ra = 2.53030404466667; // Polaris RA in decimal hours
var de = 89.26410897; // Polaris DE in decimal degrees
// calculated values
var utcNow = DateTime.UtcNow;
var jd1 = new AASDate(utcNow.Year, utcNow.Month, utcNow.Day, utcNow.Hour, utcNow.Minute, utcNow.Second, true).Julian;
var gmst = AASSidereal.MeanGreenwichSiderealTime(jd1);
var lmst = gmst + AASCoordinateTransformation.DegreesToHours(longitude);
var lha = lmst - ra;
var coord = AASCoordinateTransformation.Equatorial2Horizontal(lha, de, latitude);
// display values
Console.WriteLine("{0,-30}{1}", "UTC", utcNow.ToString(@"HH\:mm\:ss", CultureInfo.InvariantCulture) );
Console.WriteLine("{0,-30}{1}", "Greenwich mean sidereal time", TimeSpan.FromHours(gmst).ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture) );
Console.WriteLine("{0,-30}{1}", "Local mean sidereal time", TimeSpan.FromHours(lmst).ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture) );
Console.WriteLine("{0,-30}{1}", "Local hour angle", TimeSpan.FromHours(lha).ToString(@"hh\:mm\:ss", CultureInfo.InvariantCulture) );
Console.WriteLine("{0,-30}{1}", "Azimuth", FormatDMS(coord.X) );
Console.WriteLine("{0,-30}{1}", "Altitude", FormatDMS(coord.Y) );
Console.Write(Environment.NewLine);
}
// Convert decimal degrees to DMS string
private static string FormatDMS(double dd) {
var ts = TimeSpan.FromHours(dd);
return string.Format("{0:D}", ts.Days * 24 + ts.Hours) + "°" +
string.Format("{0:D2}", ts.Minutes) + "'" +
string.Format("{0:D2}", ts.Seconds) + "\"";
}
}
}
Hi,
Not an issue per-se. I just discovered your code, and since I am the author of the Objective-C(++) / Swift and Javascript versions, I thought it would be cool to link to yours.
You may be interested to link back ? :-)
https://github.com/onekiloparsec/SwiftAA
Best
Hi,
I open this issue to discuss the need of the Mono solution version (AASharp.Mono.sln)
With .Net standard I'm not sure it is still necessary to keep this solution file.
Note : the solution AASharp.sln is targeting .Net Standard 2.0, .Net 4.0 and .Net 4.5. We could add .Net Standard 1.6 to support Mono 4.6
Hi @elendil-software @jsauve !
As the title says, that function would be really useful.
There is a ready to use JavaScript application available here.
Demo page is here.
It would be nice to port this to our lovely AASharp.
BR,
Ladislav
@jsauve
I created a new repository for extension to AASharp : https://github.com/elendil-software/AASharp.Extension
And I reported the modifications of AA+ 1.98 and 1.99. I will build the NuGet package soon. I have some problem with my CI server. As soon I solve that I build the package.
Julien
Would you possibly change the used license LGPL-3.0 to MIT_License?
It would make it easier to use in other projects.
Since v2.36 (12 September 2021) of AA+, the Height parameter was removed from the CAARiseTransitSet2::Calculate & CalculateMoon methods. But it is not ported yet to AASharp.
The parameter was removed and replaced by 0 (Zero) in all occurrences.
The link for the announcement : https://naughter.wordpress.com/2021/09/12/aa-v2-36/
Note that CAARiseTransitSet2::CalculateMoon algorithm has changed.
Thanks.
Hi @jsauve
Cannot open the AASharp.sln solution, at least in Visual Studio 2013.
However, as far as I checked the source code, it looks a very good Astro library, with rich function set!
Did u consider to make it available as a nuget package at www.nuget.org ?
Hi @jsauve
I implemented the last AA+ additions on the develop branch. If you want to have a look before I merge it on Master and release the NuGet package.
Regards,
Julien
Hello,
What amazing repository !
I'm searching a way to calculate the 5th solar term for the chinese calendar.
I know there is some calculation to do in order to get the gregorian date, but I have no idea to do this :/.
I think your libraries can do this, but have you any idea ?
If you can help we with your project it will be so cool ;)
Some link :
https://en.wikipedia.org/wiki/Solar_term
https://en.wikipedia.org/wiki/Qingming_Festival
http://www.math.nus.edu.sg/aslaksen/gem-projects/hm/Chinese_Calendar.pdf
Best regards,
Shaenn
AASharp/Src/AASharp/AASUranus.cs
Line 9 in 4f977c6
The validation is not correct, an exception is thrown if month is lower than 1 AND greater than 12. Should be month is lower than 1 OR greater than 12
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.