Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wwaEpv00 / wwaApco returning incorrect values? #12

Open
GregTheDev opened this issue Mar 23, 2023 · 0 comments
Open

wwaEpv00 / wwaApco returning incorrect values? #12

GregTheDev opened this issue Mar 23, 2023 · 0 comments

Comments

@GregTheDev
Copy link

GregTheDev commented Mar 23, 2023

I've been experimenting with wwaEpv00 and wwaApco and seem to be getting different results depending on whether I use the current WWA NuGet package or source code.

Consider this input for wwaEpv00:
double jd1 = 2456122.0;
double jd2 = -0.374222409930591;

Using the NuGet package, SOFA C code (included in WWA source), liberfa I get these results:
pvh:
[0, 0]: 0.36358010848826561
[0, 1]: -0.87098205453928734
[0, 2]: -0.37758762761290249
[1, 0]: 0.015790881726547225
[1, 1]: 0.0055821572243759544
[1, 2]: 0.0024205553276501913

pvb
{double[2, 3]}
[0, 0]: 0.36128697138855309
[0, 1]: -0.87287395759745723
[0, 2]: -0.37843009179223269
[1, 0]: 0.01579627642463895
[1, 1]: 0.0055793863254509539
[1, 2]: 0.0024192303211176313

However if I run the same sample against the latest version of the WWA.Core source code I get different values:

pvh
{double[2, 3]}
[0, 0]: -1.4380401993025114
[0, 1]: 48.13081001851485
[0, 2]: 50.496624675136189
[1, 0]: -27.461656603117383
[1, 1]: -6.0043648152940641
[1, 2]: -3.2004034785635462

pvb
{double[2, 3]}
[0, 0]: -126.01563483201413
[0, 1]: -483.45362327412374
[0, 2]: -192.50804596930107
[1, 0]: -23.1220935093395
[1, 1]: 7.7476382322272448
[1, 2]: 2.7227051476989335

I see there were changes made to epv00 in Feb 2022, just not sure if it's expected that the result values have changed?

I noticed this because I was originally looking at wwaApco which seems to have a similar problem.

Given this input:
double jd1_tt = 2456122.0;
double jd2_tt = -0.3742224074074074;
double[,] ebpv = new double[2, 3] {
{ 0.36128697, -0.87287396, -0.37843009 },
{ 0.01579628, 0.00557939, 0.00241923 }
};
double[] ehp = new double[3] { 0.36358011, -0.87098205, -0.37758763 };
double x = 0.0012483996718683275;
double y = -2.4191277780194476e-05;
double s = 2.8198440882641448e-08;
double theta = 5.868498244632704;
double elong = -1.2915436464758039;
double phi = 0.7208209810736581;
double hm = 390.0000000015527;
double xp = 5.663587362550585e-07;
double yp = 1.973470449982449e-06;
double sp = -2.8551432482925797e-11;
double refa = 0.0;
double refb = -0.0;

When I invoke wwaApco using the NuGet package I get these results:
along: -1.2915436465043553
bm1: 0.99999999512048543
bpn: {double[3, 3]}
cphi: 0.75126413350351118
diurab: 0
eb: {double[3]}
eh: {double[3]}
em: 1.0165646807820918
eral: 4.5769545981283493
phi: 0
pmt: 12.530118487590943
refa: 0
refb: 0
sphi: 0.66000166796093673
v: {double[3]}
xpl: 2.0531311761394749E-06
ypl: -4.567827 644945285E-10

If I use the latest version of the source (as well as SOFA C code & liberfa) I get this:
along: -1.2915436465049144 // Last 4 digits different when compared to NuGet package
bm1: 0.99999999512048543
bpn: {double[3, 3]}
cphi: 0.75126413350351118
diurab: 0
eb: {double[3]}
eh: {double[3]}
em: 1.0165646807820918
eral: -1.706230709051797 // Different 4.5769545981283493 compared to -1.706230709051797
phi: 0 // -9.2559631349317831e+61 for SOFA, 2.999580946071453e-67 for liberfa
pmt: 12.530118487590943
refa: 0
refb: 0
sphi: 0.66000166796093673
v: {double[3]}
xpl: 2.0531311761393859E-06 // // Last 4 digits different when compared to NuGet package
ypl: -4.567827 0628706951E-10 // Different after the 6th digit when compared to NuGet package

So wwaApco seems closer to what I expect in the lastest source, but wwaEv00 seems worse.

Not sure if this is expected or if I'm doing something wrong?

Thanks
Greg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant