MeeusJs icon indicating copy to clipboard operation
MeeusJs copied to clipboard

altitude

Open gatelli opened this issue 4 years ago • 1 comments

I found the calculation doesn't take into account the altitude, although the parameter h is included in coordinates. It doesn't modify anything for the results, and it should. Can you confirm that ? Thx

gatelli avatar Apr 23 '21 09:04 gatelli

This code shows a (tiny) difference in results:

a=new Date("2023-03-01 12:00:00Z");
jdo = new A.JulianDay(a)
coord1 = A.EclCoord.fromWgs84(42,12,0);
coord2 = A.EclCoord.fromWgs84(42,12,10000);
res1=A.Solar.topocentricPosition(jdo, coord1, true); // true/false = with/without refraction
res2=A.Solar.topocentricPosition(jdo, coord2, true)

console.log("Azimuth:")
console.log("Rad:" , res1.hz.az +Math.PI , res2.hz.az+Math.PI, (((res2.hz.az-res1.hz.az)/res1.hz.az)*100).toFixed(8) + "%");
console.log("Deg:" , res1.hz.az*180/Math.PI + 180, res2.hz.az*180/Math.PI + 180, (((res2.hz.az-res1.hz.az)/res1.hz.az)*100).toFixed(8) + "%");

console.log("Elevation:")
console.log("Rad:" , res1.hz.alt, res2.hz.alt, (((res2.hz.alt-res1.hz.alt)/res1.hz.alt)*100).toFixed(8) + "%");
console.log("Deg:" , res1.hz.alt*180/Math.PI, res2.hz.alt*180/Math.PI, (((res2.hz.alt-res1.hz.alt)/res1.hz.alt)*100).toFixed(8) + "%");

Output (alt = 0, alt = 10000, difference):

  • Airless:

    • Azimuth: 191.51809117720137 191.51809117719634 -0.00000000%
    • Elevation: 39.75331679175222 39.75331384737008 -0.00000741%
  • Refraction:

    • Azimuth: 191.51809117720137 191.51809117719634 -0.00000000%
    • Elevation: 39.772727982539074 39.77272504020162 -0.00000740%

Results from NASA Horizons (azimuth, elevation):

Altitude = 0:

  • Airless: 2023-Mar-01 12:00,*,m, 191.294395137, 39.841547638
  • Refracted: 2023-Mar-01 12:00,*,m, 191.294395137, 39.861788897

Altitude = 10000:

  • Airless: 2023-Mar-01 12:00,*,m, 191.294262981, 39.838616981
  • Refracted: 2023-Mar-01 12:00,*,m, 191.294262981, 39.858860327

Code output manually reordered as Horizons:

Altitude = 0

  • Airless: 191.51809117720137 , 39.75331679175222
  • Refraction: 191.51809117720137 , 39.772727982539074

Altitude = 10000

  • Airless: 191.51809117719634, 39.75331384737008
  • Refraction: 191.51809117719634 , 39.77272504020162

jumpjack avatar Mar 01 '23 08:03 jumpjack