Closed emifdez closed 4 years ago
The method works correctly, it was my mistake, I didn't think there was a day without sunrise, but it depends a lot on when the day starts.
testAscomSunsetRise.exe Hello World! Latitude: 26,695512 Longitude:100,03105 Time:10/12/2019 11:07:55 sunRiseSet cont :5 Array sunRiseSet:True Array sunRiseSet:1 Array sunRiseSet:1 Array sunRiseSet:23,9630359486981 Array sunRiseSet:10,4581370341065 Latitude: 26,695512 Longitude:100,03105 Time:11/12/2019 11:07:55 sunRiseSet cont :5 Array sunRiseSet:True Array sunRiseSet:1 Array sunRiseSet:1 Array sunRiseSet:23,9739061145482 Array sunRiseSet:10,4622385314266 Latitude: 26,695512 Longitude:100,03105 Time:12/12/2019 11:07:55 sunRiseSet cont :5 Array sunRiseSet:True Array sunRiseSet:1 Array sunRiseSet:1 Array sunRiseSet:23,9845795058531 Array sunRiseSet:10,4667449289712 Latitude: 26,695512 Longitude:100,03105 Time:13/12/2019 11:07:55 sunRiseSet cont :5 Array sunRiseSet:True Array sunRiseSet:1 Array sunRiseSet:1 Array sunRiseSet:23,9950463094445 Array sunRiseSet:10,4716517522506 Latitude: 26,695512 Longitude:100,03105 Time:14/12/2019 11:07:55 sunRiseSet cont :4 Array sunRiseSet:True Array sunRiseSet:0 Array sunRiseSet:1 Array sunRiseSet:10,4769542132567 Latitude: 26,695512 Longitude:100,03105 Time:15/12/2019 11:07:55 sunRiseSet cont :5 Array sunRiseSet:False Array sunRiseSet:1 Array sunRiseSet:1 Array sunRiseSet:0,00526805624205551 Array sunRiseSet:10,4826471728335
Hi, emifdez,
Yes, we live in a strange world, where some latitudes have days without a sunrise or sunset. I don't know if you saw this example in the ASCOM Developer help : Almanac Example.
The example output for 10th March shows the phenomenon you have run into where that day has no sun rise.
I'm going to close this because it's not an ASCOM bug but a "feature" of our world!
Regards, Peter
Hi Peter-Simpson,
Thank you very much for the answer and for the example.
I think we reopen the issue. I just executed almanac example, I think there is an error the method.
It is possible that where the sunrise event does not occur (you can see it for the Lijiang observatory in time zone UT, TZ=0, Year = 2020, Latitude = 26.695512, Longitude = 100.03105, date = Dec, 13th 2020). That is correct (when sunrise is late and goes from 23:59 to 00:00 (two days later)), but there must be another day where there are two sunrises. These two sunrises would occur on February 10, 2020, instead just write a single time (first sunrise would be around 00:00 and the other around 23:59).
I edited the next lines:
' Set the year and geographical location for this run Const Year As Integer = 2020 Const Latitude As Double = 26.695512 ' Positive to the North Const Longitude As Double = 100.03105 ' Positive to the East Const TimeZone As Double = 0' Positive to the East
And I set the EventType
' Set the event for which the Almanac is required: Sunrise/set, Moonrise/set, Civil, Nautical, Amateur Astronomical or Astronomical twilight ' or planet rise/set Const TypeOfEvent As EventType = EventType.SunRiseSunset
I attached the log text at the bottom.
I programing a test (similar to the first but I have executed from Feb 8th to Feb 15th of 2020).
The timespan between sunrises on 9th and 10th is more than 47 hours, That is not possible at Lijiang Observatory. If the time zone es 8, the timespan between adjacent ssunrises is normal (about 24hours).
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ASCOM;
namespace testAscomSunsetRise
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
ASCOM.Astrometry.AstroUtils.AstroUtils apUtil = new ASCOM.Astrometry.AstroUtils.AstroUtils();
System.Collections.ArrayList sunRiseSet = new System.Collections.ArrayList();
DateTime lastUpdate = new DateTime(2020, 2, 8, 0, 0, 0, DateTimeKind.Utc);
double lat = 26.695512;
double lon = 100.03105;
int Nrises = 0, Nsets = 0;
DateTime lastSunRise = lastUpdate;
DateTime lastSunSet = lastUpdate;
Console.WriteLine("Latitude: " + lat.ToString());
Console.WriteLine("Longitude:" + lon.ToString());
for (int i = 0; i < 8; i++)
{
Console.WriteLine("Day "+ i.ToString()+" Time:" + lastUpdate.ToString());
sunRiseSet = apUtil.EventTimes(ASCOM.Astrometry.EventType.SunRiseSunset, lastUpdate.Day, lastUpdate.Month, lastUpdate.Year, lat, lon, 0);
Console.WriteLine("sunRiseSet cont :" + sunRiseSet.Count.ToString());
int h = 0;
foreach (var e in sunRiseSet) {
Console.WriteLine(" Array sunRiseSet[" + h.ToString()+ "]= "+e.ToString());
h++;
}
Nrises = (int)sunRiseSet[1];
Nsets = (int)sunRiseSet[2];
Console.Write("Daylight: " + sunRiseSet[0].ToString());
Console.Write(". Number of sunrises: " + Nrises);
Console.WriteLine(". Number of sunsets: " + Nsets);
for (int j = 0; j < Nrises; j++) {
//SunRise
Console.WriteLine("Sunrise no " + j.ToString() + ": "+ ((double)sunRiseSet[3 + j]).ToString()+" ");
}
for (int j = 0; j < Nsets; j++)
{
//sunSet
Console.WriteLine("SunSet no " + j.ToString() + ": "+ ((double)sunRiseSet[3+Nrises + j]).ToString()+" ");
}
lastUpdate = lastUpdate.AddDays(1);
Console.ReadKey();
}
}
}
}
The output:
Hello World! Latitude: 26,695512 Longitude:100,03105 Day 0 Time:08/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= False Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 0,0258138171884994 Array sunRiseSet[4]= 11,1129847305732 Daylight: False. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 0,0258138171884994 SunSet no 0: 11,1129847305732 Day 1 Time:09/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= False Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 0,0152897281087689 Array sunRiseSet[4]= 11,1250268265302 Daylight: False. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 0,0152897281087689 SunSet no 0: 11,1250268265302 Day 2 Time:10/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= False Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 > Array sunRiseSet[3]= 0,00443739215988259 Array sunRiseSet[4]= 11,13696181783 Daylight: False. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 0,00443739215988259 SunSet no 0: 11,13696181783 Day 3 Time:11/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= True Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 > Array sunRiseSet[3]= 23,9817013329398 Array sunRiseSet[4]= 11,1487891795495 Daylight: True. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 23,9817013329398 SunSet no 0: 11,1487891795495 Day 4 Time:12/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= True Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 23,9698557427678 Array sunRiseSet[4]= 11,1605086423701 Daylight: True. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 23,9698557427678 SunSet no 0: 11,1605086423701 Day 5 Time:13/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= True Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 23,9577076991203 Array sunRiseSet[4]= 11,1721199818709 Daylight: True. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 23,9577076991203 SunSet no 0: 11,1721199818709 Day 6 Time:14/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= True Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 23,9452645724337 Array sunRiseSet[4]= 11,1836228607075 Daylight: True. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 23,9452645724337 SunSet no 0: 11,1836228607075 Day 7 Time:15/02/2020 0:00:00 sunRiseSet cont :5 Array sunRiseSet[0]= True Array sunRiseSet[1]= 1 Array sunRiseSet[2]= 1 Array sunRiseSet[3]= 23,9325335577893 Array sunRiseSet[4]= 11,1950167579983 Daylight: True. Number of sunrises: 1. Number of sunsets: 1 Sunrise no 0: 23,9325335577893 SunSet no 0: 11,1950167579983
18:15:14.301 Almanac Latitude: 26:41:44 N, Longitude: 100:01:52 E, Time Zone: 0 hours West of Greenwich, Year: 2020, Event: SunRiseSunset
18:15:14.301
18:15:14.301 Almanac Jan. Feb. Mar. Apr. May June July Aug. Sept. Oct. Nov. Dec.
18:15:14.301 Almanac Day Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set
18:15:14.332 Almanac 01 0008 1038 0005 1102 2343 1121 2310 1137 2241 1153 2226 1209 2230 1217 2245 1207 2300 1140 2313 1106 2330 1037 2352 1026
18:15:14.363 Almanac 02 0008 1039 0005 1102 2342 1122 2309 1138 2240 1153 2226 1210 2231 1217 2246 1207 2300 1139 2313 1105 2331 1036 2353 1026
18:15:14.393 Almanac 03 0009 1039 0004 1103 2341 1122 2308 1138 2239 1154 2226 1210 2231 1217 2246 1206 2301 1138 2314 1104 2332 1036 2353 1027
18:15:14.423 Almanac 04 0009 1040 0004 1104 2340 1123 2306 1139 2239 1154 2226 1210 2232 1217 2247 1205 2301 1137 2314 1103 2332 1035 2354 1027
18:15:14.453 Almanac 05 0009 1041 0003 1105 2339 1123 2305 1139 2238 1155 2226 1211 2232 1217 2247 1205 2302 1135 2315 1102 2333 1034 2355 1027
18:15:14.484 Almanac 06 0009 1041 0003 1105 2338 1124 2304 1140 2237 1155 2226 1211 2232 1217 2248 1204 2302 1134 2315 1101 2334 1034 2356 1027
18:15:14.515 Almanac 07 0010 1042 0002 1106 2337 1125 2303 1140 2237 1156 2226 1212 2233 1217 2248 1203 2302 1133 2316 1100 2334 1033 2356 1027
18:15:14.545 Almanac 08 0010 1043 0002 1107 2336 1125 2302 1141 2236 1156 2226 1212 2233 1217 2249 1202 2303 1132 2316 1059 2335 1033 2357 1027
18:15:14.576 Almanac 09 0010 1044 0001 1108 2335 1126 2301 1141 2235 1157 2226 1213 2234 1217 2249 1202 2303 1131 2317 1058 2336 1032 2358 1027
18:15:14.606 Almanac 10 0010 1044 0000 1108 2334 1126 2300 1142 2235 1157 2226 1213 2234 1217 2250 1201 2304 1130 2317 1057 2336 1032 2358 1028
18:15:14.638 Almanac 11 0010 1045 2359 1109 2332 1127 2259 1142 2234 1158 2226 1213 2235 1216 2250 1200 2304 1129 2318 1056 2337 1031 2359 1028
18:15:14.670 Almanac 12 0010 1046 2358 1110 2331 1127 2258 1143 2234 1159 2226 1214 2235 1216 2251 1159 2305 1128 2318 1054 2338 1031 2359 1028
18:15:14.703 Almanac 13 0010 1047 2357 1110 2330 1128 2257 1143 2233 1159 2226 1214 2236 1216 2251 1158 2305 1126 2319 1053 2339 1030 1029
18:15:14.735 Almanac 14 0010 1047 2357 1111 2329 1128 2256 1144 2232 1200 2226 1214 2236 1216 2252 1157 2305 1125 2319 1052 2339 1030 0000 1029
18:15:14.766 Almanac 15 0010 1048 2356 1112 2328 1129 2255 1144 2232 1200 2226 1215 2237 1215 2252 1157 2306 1124 2320 1052 2340 1029 0001 1029
18:15:14.796 Almanac 16 0010 1049 2355 1112 2327 1129 2254 1145 2231 1201 2226 1215 2237 1215 2253 1156 2306 1123 2320 1051 2341 1029 0001 1030
18:15:14.827 Almanac 17 0010 1050 2354 1113 2326 1130 2253 1145 2231 1201 2226 1215 2237 1215 2253 1155 2307 1122 2321 1050 2342 1029 0002 1030
18:15:14.858 Almanac 18 0010 1051 2354 1114 2325 1130 2252 1146 2231 1202 2227 1216 2238 1214 2254 1154 2307 1121 2322 1049 2342 1028 0003 1030
18:15:14.889 Almanac 19 0009 1051 2353 1114 2324 1131 2251 1146 2230 1202 2227 1216 2238 1214 2254 1153 2308 1120 2322 1048 2343 1028 0003 1031
18:15:14.921 Almanac 20 0009 1052 2352 1115 2323 1131 2250 1147 2230 1203 2227 1216 2239 1214 2255 1152 2308 1119 2323 1047 2344 1028 0004 1031
18:15:14.951 Almanac 21 0009 1053 2351 1116 2322 1132 2249 1147 2229 1203 2227 1216 2240 1213 2255 1151 2308 1117 2323 1046 2345 1027 0004 1032
18:15:14.982 Almanac 22 0009 1054 2350 1116 2321 1132 2249 1148 2229 1204 2228 1216 2240 1213 2255 1150 2309 1116 2324 1045 2345 1027 0005 1032
18:15:15.013 Almanac 23 0009 1055 2349 1117 2319 1133 2248 1148 2229 1205 2228 1217 2241 1212 2256 1149 2309 1115 2324 1044 2346 1027 0005 1033
18:15:15.043 Almanac 24 0008 1055 2348 1118 2318 1133 2247 1149 2228 1205 2228 1217 2241 1212 2256 1148 2310 1114 2325 1043 2347 1027 0006 1033
18:15:15.073 Almanac 25 0008 1056 2347 1118 2317 1134 2246 1149 2228 1206 2228 1217 2242 1211 2257 1147 2310 1113 2326 1042 2348 1027 0006 1034
18:15:15.105 Almanac 26 0008 1057 2347 1119 2316 1134 2245 1150 2228 1206 2229 1217 2242 1211 2257 1146 2311 1112 2326 1042 2348 1027 0006 1035
18:15:15.136 Almanac 27 0007 1058 2346 1119 2315 1135 2244 1150 2227 1207 2229 1217 2243 1210 2258 1145 2311 1111 2327 1041 2349 1027 0007 1035
18:15:15.168 Almanac 28 0007 1058 2345 1120 2314 1135 2243 1151 2227 1207 2229 1217 2243 1210 2258 1144 2312 1110 2328 1040 2350 1026 0007 1036
18:15:15.199 Almanac 29 0007 1059 2344 1121 2313 1136 2243 1151 2227 1208 2230 1217 2244 1209 2259 1143 2312 1108 2328 1039 2351 1026 0007 1036
18:15:15.299 Almanac 30 0006 1100 2312 1136 2242 1152 2227 1208 2230 1217 2244 1209 2259 1142 2312 1107 2329 1039 2351 1026 0008 1037
18:15:15.656 Almanac 31 0006 1101 2311 1137 2226 1209 2245 1208 2259 1141 2330 1038 0008 1038
18:15:15.656
18:15:15.656 **** Always risen or above the requested level ---- Always set or below the requested level
18:15:15.656 Spaces indicate no event Multiple events in a day are shown as multiple day lines
18:18:23.471 Almanac Latitude: 26:41:44 N, Longitude: 100:01:52 E, Time Zone: 8 hours East of Greenwich, Year: 2020, Event: SunRiseSunset
18:18:23.471
18:18:23.471 Almanac Jan. Feb. Mar. Apr. May June July Aug. Sept. Oct. Nov. Dec.
18:18:23.471 Almanac Day Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set Rise Set
18:18:23.514 Almanac 01 0808 1838 0805 1902 0744 1921 0711 1937 0642 1953 0626 2009 0630 2017 0645 2007 0659 1940 0712 1906 0730 1837 0751 1826
18:18:23.543 Almanac 02 0808 1839 0805 1902 0743 1922 0710 1938 0641 1953 0626 2010 0630 2017 0645 2007 0700 1939 0713 1905 0730 1836 0752 1826
18:18:23.571 Almanac 03 0809 1839 0804 1903 0742 1922 0709 1938 0640 1954 0626 2010 0631 2017 0646 2006 0700 1938 0713 1904 0731 1836 0753 1827
18:18:23.600 Almanac 04 0809 1840 0804 1904 0741 1923 0708 1939 0639 1954 0626 2010 0631 2017 0646 2005 0701 1937 0714 1903 0732 1835 0753 1827
18:18:23.629 Almanac 05 0809 1841 0803 1905 0740 1923 0706 1939 0639 1955 0626 2011 0632 2017 0647 2005 0701 1935 0714 1902 0732 1834 0754 1827
18:18:23.658 Almanac 06 0809 1841 0803 1905 0739 1924 0705 1940 0638 1955 0626 2011 0632 2017 0647 2004 0702 1934 0715 1901 0733 1834 0755 1827
18:18:23.687 Almanac 07 0810 1842 0802 1906 0738 1925 0704 1940 0637 1956 0626 2012 0632 2017 0648 2003 0702 1933 0715 1900 0734 1833 0756 1827
18:18:23.715 Almanac 08 0810 1843 0802 1907 0737 1925 0703 1941 0637 1956 0626 2012 0633 2017 0648 2002 0702 1932 0716 1859 0734 1833 0756 1827
18:18:23.744 Almanac 09 0810 1844 0801 1908 0736 1926 0702 1941 0636 1957 0626 2013 0633 2017 0649 2002 0703 1931 0716 1858 0735 1832 0757 1827
18:18:23.773 Almanac 10 0810 1844 0800 1908 0735 1926 0701 1942 0635 1957 0626 2013 0634 2017 0649 2001 0703 1930 0717 1857 0736 1832 0758 1828
18:18:23.802 Almanac 11 0810 1845 0800 1909 0734 1927 0700 1942 0635 1958 0626 2013 0634 2016 0650 2000 0704 1929 0717 1856 0736 1831 0758 1828
18:18:23.830 Almanac 12 0810 1846 0759 1910 0732 1927 0659 1943 0634 1959 0626 2014 0635 2016 0650 1959 0704 1928 0718 1854 0737 1831 0759 1828
18:18:23.859 Almanac 13 0810 1847 0758 1910 0731 1928 0658 1943 0634 1959 0626 2014 0635 2016 0651 1958 0705 1926 0718 1853 0738 1830 0800 1829
18:18:23.888 Almanac 14 0810 1847 0757 1911 0730 1928 0657 1944 0633 2000 0626 2014 0636 2016 0651 1957 0705 1925 0719 1852 0739 1830 0800 1829
18:18:23.917 Almanac 15 0810 1848 0757 1912 0729 1929 0656 1944 0632 2000 0626 2015 0636 2015 0652 1957 0705 1924 0719 1852 0739 1829 0801 1829
18:18:23.946 Almanac 16 0810 1849 0756 1912 0728 1929 0655 1945 0632 2001 0626 2015 0637 2015 0652 1956 0706 1923 0720 1851 0740 1829 0801 1830
18:18:23.974 Almanac 17 0810 1850 0755 1913 0727 1930 0654 1945 0631 2001 0626 2015 0637 2015 0653 1955 0706 1922 0720 1850 0741 1829 0802 1830
18:18:24.003 Almanac 18 0810 1851 0754 1914 0726 1930 0653 1946 0631 2002 0626 2016 0637 2014 0653 1954 0707 1921 0721 1849 0742 1828 0803 1830
18:18:24.031 Almanac 19 0809 1851 0754 1914 0725 1931 0652 1946 0631 2002 0627 2016 0638 2014 0654 1953 0707 1920 0722 1848 0742 1828 0803 1831
18:18:24.061 Almanac 20 0809 1852 0753 1915 0724 1931 0651 1947 0630 2003 0627 2016 0638 2014 0654 1952 0708 1919 0722 1847 0743 1828 0804 1831
18:18:24.090 Almanac 21 0809 1853 0752 1916 0723 1932 0650 1947 0630 2003 0627 2016 0639 2013 0655 1951 0708 1917 0723 1846 0744 1827 0804 1832
18:18:24.119 Almanac 22 0809 1854 0751 1916 0722 1932 0649 1948 0629 2004 0627 2016 0640 2013 0655 1950 0708 1916 0723 1845 0745 1827 0805 1832
18:18:24.148 Almanac 23 0809 1855 0750 1917 0721 1933 0649 1948 0629 2005 0628 2017 0640 2012 0655 1949 0709 1915 0724 1844 0745 1827 0805 1833
18:18:24.178 Almanac 24 0808 1855 0749 1918 0719 1933 0648 1949 0629 2005 0628 2017 0641 2012 0656 1948 0709 1914 0724 1843 0746 1827 0806 1833
18:18:24.207 Almanac 25 0808 1856 0748 1918 0718 1934 0647 1949 0628 2006 0628 2017 0641 2011 0656 1947 0710 1913 0725 1842 0747 1827 0806 1834
18:18:24.235 Almanac 26 0808 1857 0747 1919 0717 1934 0646 1950 0628 2006 0628 2017 0642 2011 0657 1946 0710 1912 0726 1842 0748 1827 0806 1835
18:18:24.265 Almanac 27 0807 1858 0747 1919 0716 1935 0645 1950 0628 2007 0629 2017 0642 2010 0657 1945 0711 1911 0726 1841 0748 1827 0807 1835
18:18:24.293 Almanac 28 0807 1858 0746 1920 0715 1935 0644 1951 0627 2007 0629 2017 0643 2010 0658 1944 0711 1910 0727 1840 0749 1826 0807 1836
18:18:24.322 Almanac 29 0807 1859 0745 1921 0714 1936 0643 1951 0627 2008 0629 2017 0643 2009 0658 1943 0712 1908 0728 1839 0750 1826 0807 1836
18:18:24.428 Almanac 30 0806 1900 0713 1936 0643 1952 0627 2008 0630 2017 0644 2009 0659 1942 0712 1907 0728 1839 0751 1826 0808 1837
18:18:24.782 Almanac 31 0806 1901 0712 1937 0627 2009 0644 2008 0659 1941 0729 1838 0808 1838
18:18:24.782
18:18:24.782 **** Always risen or above the requested level ---- Always set or below the requested level
18:18:24.782 Spaces indicate no event Multiple events in a day are shown as multiple day lines
I found a bug in ASCOM.Astrometry.AstroUtils.AstroUtils.EventTimes method. It doesn't return sunrise time events for latitude lat = 26.695512 and longitude lon = 100.03105 for the date of December 14, 2019 . I could observe that changed 1% latitude works correctly. It works if you change the time zone. I think it fails if the time is too close or is equal to 0:00. Attached code example: