-
Notifications
You must be signed in to change notification settings - Fork 86
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
Considering elevation for Salah times #146
Comments
Thats an interesting observation. Generally speaking if you're at a high elevation you can expect to see sunrise/sunset times change by about 1 minute for every 1600 meters. There has been a lot of requests to do this, I will look into how we will do it correctly. I believe what may be needed to implement this is both the elevation of the user and the elevation of the horizon. It would be wrong if developers simply supplied the user's elevation and assumed that was enough to change sunrise/sunset. (see https://public.nrao.edu/ask/altitude-correction-for-time-of-sunrise-and-sunset/) Just because another library gives the option for elevation with no explanation does not mean that is more accurate. If we implement this we will need to do it in a way that makes it very clear to the developer that both elevations are needed (user and horizon) - which is very hard to know unless you have topographical data not just GPS coordinates. |
The developer would essentially need to use an API like https://developers.google.com/maps/documentation/elevation/start to get the elevation of the horizon. This could be further complicated by needing to know the horizon elevation for both sunrise and sunset, if we look at the use case of Morocco it has sea level to the West but a mountain range to the East. |
If we look at the wikipedia page on the sunrise equation (https://en.wikipedia.org/wiki/Sunrise_equation#Hour_angle) they state the same thing, that elevation correction assumes that the horizon is sea level which is not true outside of airplanes, towers, etc. |
@z3bi Thanks brother , I've done my some further research for the horizon issue and I came to a conclusion that the horizon elevation could (or better) or in some cases (like in narrow valleys) should be neglected. Please see this fatwa https://islamqa.info/ar/answers/365222/ You can see in the pdf that Sunrise time at 500m altitude 3 minutes after sea level at South KSA where he mentioned should be 1 plus minutes at North KSA and would always increase with latitude and differ between different seasons. Which made me assured that my personal observation was correct. |
Thank you for this information but this fatawa is for the opposite problem. People who are at a lower elevation than the horizon and the fatwa is to ignore the hills on the horizon. For adjusting sunrise and sunset based on a user having a higher elevation we HAVE to have the horizon elevation otherwise we are just making up an incorrect number. What the adjustment is accounting for is that we are able to see the rays of sun sooner for sunrise and longer for sunset and that 100% depends on understanding the horizon. Also based on physics it’s not possible for sunrise/sunset to change more than 1 minute per every 1600 meters. If you have astronomical calculations to suggest otherwise please share them. |
Earth is not a perfect sphere, I think the 1 minute difference for every 1600m is assumed at equator only and not from 0 to 1600m, but for higher altitudes like if you go up from 3000 to 4600m - however not sure as I did not get a good resource about this specific info. However I've found a good resource from astronomy center where I find also that they have a calculation program, I did not test it yet, but they state in the program page that: Could be found on archive as website is currently down: https://web.archive.org/web/20221129145023/https://www.astronomycenter.net/accut.html?l=en |
So I investigated the github repo you posted above and saw they are using the Time4J library. Looking at the source code I see that when the altitude of the user is given, it's applied to sunrise and sunset to adjust the "apparent solar altitude". The sunrise and sunset equations actually compute when the center of the sun is at the horizon, however we want to know when the tip of the sun first becomes visible (sunrise) or fully disappears (sunset). The solar altitude normally used is 50'. We get this value by adding the radius of the sun 16' with the atmospheric refraction of 34' (how the light bends over the horizon). This value for atmospheric refraction assumes average atmospheric conditions and temperatures. Time4J adjusts the apparent solar altitude angle in two different ways:
Consider the use case of the city of Denver, Colorado. This city has an altitude of 5,000 ft above sea level. But the entire city is at that elevation, not just a single point. So when you look to the horizon, that horizon is also at 5,000 ft above sea level. This means you are not gaining any ability to see below the horizon. We can add in the same kinds of adjustment to the adhan library, but we will absolutely need the developer to supply the altitude at the horizon to ensure accuracy. |
Jazaku Allahu khayran for clarification. |
We can assume that horizon altitude is at sea level by default. As "Accurate Times" of astronomycenter assumes. Also, you can embed any suitable atmospheric model to compensate for different air properties temprature/pressure/density for a give location and altitude for standard case. Some models allow to correct for latitude and day-of-year (or season) for better accuracy. |
Finally astronomycenter website is back online, they have a very good page on calculating prayer times with equations but it was missing on archive , - now it's saved there - https://www.astronomycenter.net/article/2001_salat.html Archived version https://web.archive.org/web/20230301091546/https://www.astronomycenter.net/article/2001_salat.html They have different notes and equations in the page for elevations and horizon issue. Better to read them there. |
@Raviu56 alhamdulillah it seems they confirm what I have been saying 2- أن يكون أفق المنطقة الواقعة فوق مستوى سطح البحر يقع على نفس ارتفاع المنطقة، ومثل هذا ينطبق على الهضاب الواسعة، فقد يكون ارتفاع المنطقة 500 م فوق مستوى سطح البحر مثلا، إلا أن جميع المنطقة المحيطة بها تقع على نفس هذا الارتفاع، فالمنظر بالنسبة للراصد مستوي، وفي هذه الحالة فإن الارتفاع عن مستوى سطح البحر لا يؤثر على وقت الشروق أو الغروب، أي أنه يجب اعتبار المنطقة واقعة على مستوى سطح البحر.
Based on this I think the plan of adding a parameter for the horizon altitude makes sense |
@z3bi Yes, I've read the whole article and I did not quote anything specific because I think all useful and relevant. What I understand from the whole article is that:
|
@Raviu56 I agree with points 1-3 but I'm not sure I agree that assuming a sea level horizon is correct (also Asr prayer doesn't change at all based on altitude) |
For AlAsr I mean the end/final/maximum time which is just before AlMaghrib. |
ok that makes sense |
Ok, let me explain why I think assuming sea level horizon would be a failsafe option (a horizon altitude option should be added but in case it's unknown/undetermined)
So suppose that someone who would try to apply those sentences is monitoring Sunset with a some mountains both to the east and the west with different random altitudes, he would be looking the mountains' top tips on the East side until all Sun rays disappear, this would in many cases mean it would be like monitoring from the top of the eastern mountain with steeper angle. Also look for this sentence which is about Sunset I've carefully read your comment before about this fatwa, just please re-read it carefully as I'm sure the quotes mentioned in it are still relevant and it says when in doubt one should be in safe side , which in our case to consider sea level horizon so safer for Fajr and Maghrib - and iftar in Ramadan, which I think is valid for most cases except for the case you mentioned where a city is located on a high plateau that extends to the horizon. |
Please also read those fatwas carefully. https://islamqa.info/ar/answers/232822 - archived It mentions this hadith and many quotes explaining the cases of mountains underneath
And this fatwa too |
@Raviu56 I have read through these and I still don't see a justification for pretending the horizon is at sea level. Mountains are an obstruction of the horizon and are special cases. A plateau has a true horizon and shouldn't be ignored. Ultimately the app developer can choose to supply a horizon altitude of 0 if they believe that is the right choice. But as a library we will not be defaulting any values since that will only serve to hide how this actually works. |
Cannot wait to see this implemented :) May Allah be with you |
I haven't read these carefully, but does it mean there's 2 horizon altitudes to consider ? one for west and one for east ? (does mountain change altitude of horizon?) |
this website https://www.muwaqqit.com/ takes elevation into consideration and some other factors, there is some technical documentation available. |
Will this feature be worked on? |
Assalamo alaykom,
Jazakum Allahu khayran for your library.
I see this is not a duplicate of previous altitude closed issues. As one has been discussing Aeroplane altitudes. And for the other it was very old and I'm introducing more info.
There is one problem that most Prayer times app does not take into account which is Altitude/elevation above sea level of the location point.
This is really a big problem and can make difference of minutes of prayer time. The app assumes everything is at sea level which is not the case usually.
Consider those 2 locations:
36.34444/30.12013/~35m
36.33877/30.05053/~1650m
Distance between them is around 6300m while elevation difference is over 1600m which diffidently should have much effect on prayer time.
You can watch this video in Arabic language
https://www.youtube.com/watch?v=yIaVmmRXLcI
I think you should seek help from https://www.astronomycenter.net/ on how to take elevations into account
I've seen your comments here #126 (comment) and here #16 (comment)
The solution for your comment is simply a simply option to enable/disable elevation correction.
Check this application, please, it's for Sunrise and Sunset time calculations. Its default calculation method called time4a-time4j takes elevation into account and you can with simple click turn on/off elevation and see how much it affects Sunrise/Sunset times . You can make use of its code and calculations used too.
https://github.com/forrestguice/SuntimesWidget
You know for AlFajr prayer time, it's limited by Sunrise, and many people could wake-up few minutes before Sunrise and actually there can miss it if they depend on a calculation method that does not consider elevation/altitude
I should add my personal experience here: I've monitored the Sunrise many times from my house of 450m elevation above sea level, and it's almost always 4 to 5 minutes before Sunrise calculated by most applications and online sites for my location.
This is actually too much. When I used the mention Suntimes app it has shown very accurate results compared to most prayer times apps and compensated for those 4 minutes.
The text was updated successfully, but these errors were encountered: