solunar 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b39e7ad43cb9de235dbbf1e86ebfa7e95c83fed
4
- data.tar.gz: a0eba39715589ab39f8d404cb34e37a63e6d97de
3
+ metadata.gz: f7ac775eac7d04b0bf2ea67b4aba8f71d16b4550
4
+ data.tar.gz: 850463008978210f2d6d523351849c37451f4815
5
5
  SHA512:
6
- metadata.gz: 5aa8fcc0c1a48af0f8724b4998af600afaa0f614f50a274ed45d49bfc7449d37f8c632e295dc75cd8c2915dc04283e6f06754d631c037aff3ef1fec88d3bfe26
7
- data.tar.gz: d901bb63b8fbf9dc3f1dfa3dc91c7f876aca9fc12a808c9c7472a39ce7d5bbeab46eebb4f0f6efe865d277d5030f585652f38ba262f72112f333d8edad158bac
6
+ metadata.gz: d4a0e8c1172fc436b7be1c31943f8f6ecdae07ab13c20105ddbae97a14d3d2656e3d0a9f713c5cc9ab22f6ad6c1810d3bffac507c4ce7f6f736b511b2e406dc0
7
+ data.tar.gz: 515778b64d590b5b2471f7b00583e4335c63eb0d950eacfeaf8821ad246a46bd1c12012a0e724cafcd8c756e162881f64872b8a55ee431dd2cf19e8165a3ddc3
Binary file
Binary file
@@ -44,23 +44,12 @@
44
44
  #define MOON_FAIL 4
45
45
  #define DTS_FAIL 5
46
46
  #define PHASE_FAIL 6
47
- #define ILLUM_16_FAIL 7
48
- #define ILLUM_17_FAIL 8
49
- #define ILLUM_18_FAIL 9
50
- #define ILLUM_19_FAIL 10
51
- #define ILLUM_20_FAIL 11
52
- #define ILLUM_21_FAIL 12
53
- #define ILLUM_22_FAIL 13
54
- #define ILLUM_23_FAIL 14
55
- #define ILLUM_24_FAIL 15
56
- #define ILLUM_25_FAIL 16
57
- #define ILLUM_26_FAIL 17
58
- #define ARG_ERROR 99
47
+
59
48
  //file information
60
- #define DATA_FILE_SIZE 4018
49
+ #define DATA_FILE_SIZE 25933
61
50
  #define JPL_DATE_SIZE 12
62
- #define PHASE_FILE_SIZE 544
63
- #define DST_FILE_SIZE 11
51
+ #define PHASE_FILE_SIZE 3513
52
+ #define DST_FILE_SIZE 71
64
53
  #define RST_MAX_TRIES 50
65
54
  #define JDATE_BASE 2457388.5 // January 1, 2016
66
55
  #define YES 1
@@ -128,18 +117,78 @@ typedef struct {
128
117
 
129
118
  /*********************** constant arrays ****************************************************/
130
119
 
131
- const int year_days[11] = {
132
- 0, // 2016
133
- 366, // 2017
134
- 731, // 2018
135
- 1096, // 2019
136
- 1461, // 2020
137
- 1827, // 2021
138
- 2192, // 2022
139
- 2557, // 2023
140
- 2922, // 2024
141
- 3288, // 2025
142
- 3653, // 2026
120
+ const int year_days[71] = {
121
+ 0, // 1956
122
+ 366, // 1957
123
+ 731, // 1958
124
+ 1096, // 1959
125
+ 1461, // 1960
126
+ 1827, // 1961
127
+ 2192, // 1962
128
+ 2557, // 1963
129
+ 2922, // 1964
130
+ 3288, // 1965
131
+ 3653, // 1966
132
+ 4018, // 1967
133
+ 4383, // 1968
134
+ 4749, // 1969
135
+ 5114, // 1970
136
+ 5479, // 1971
137
+ 5844, // 1972
138
+ 6210, // 1973
139
+ 6575, // 1974
140
+ 6940, // 1975
141
+ 7305, // 1976
142
+ 7671, // 1977
143
+ 8036, // 1978
144
+ 8401, // 1979
145
+ 8766, // 1980
146
+ 9132, // 1981
147
+ 9497, // 1982
148
+ 9862, // 1983
149
+ 10227, // 1984
150
+ 10593, // 1985
151
+ 10958, // 1986
152
+ 11323, // 1987
153
+ 11688, // 1988
154
+ 12054, // 1989
155
+ 12419, // 1990
156
+ 12784, // 1991
157
+ 13149, // 1992
158
+ 13515, // 1993
159
+ 13880, // 1994
160
+ 14245, // 1995
161
+ 14610, // 1996
162
+ 14976, // 1997
163
+ 15341, // 1998
164
+ 15706, // 1999
165
+ 16071, // 2000
166
+ 16437, // 2001
167
+ 16802, // 2002
168
+ 17167, // 2003
169
+ 17532, // 2004
170
+ 17898, // 2005
171
+ 18263, // 2006
172
+ 18628, // 2007
173
+ 18993, // 2008
174
+ 19359, // 2009
175
+ 19724, // 2010
176
+ 20089, // 2011
177
+ 20454, // 2012
178
+ 20820, // 2013
179
+ 21185, // 2014
180
+ 21550, // 2015
181
+ 21915, // 2016
182
+ 22281, // 2017
183
+ 22646, // 2018
184
+ 23011, // 2019
185
+ 23376, // 2020
186
+ 23742, // 2021
187
+ 24107, // 2022
188
+ 24472, // 2023
189
+ 24837, // 2024
190
+ 25203, // 2025
191
+ 25568, // 2026
143
192
  };
144
193
  const int month_days[12] = {
145
194
  0, // JAN
@@ -176,20 +225,266 @@ char error_msg[][36] = {
176
225
  "Cannot open Sun file",
177
226
  "Cannot open Moon file",
178
227
  "Cannot open DST file",
179
- "Cannot open Phase file",
180
- "Cannot open 2016 Illumination file",
181
- "Cannot open 2017 Illumination file",
182
- "Cannot open 2018 Illumination file",
183
- "Cannot open 2019 Illumination file",
184
- "Cannot open 2020 Illumination file",
185
- "Cannot open 2021 Illumination file",
186
- "Cannot open 2022 Illumination file",
187
- "Cannot open 2023 Illumination file",
188
- "Cannot open 2024 Illumination file",
189
- "Cannot open 2025 Illumination file",
190
- "Cannot open 2026 Illumination file"
228
+ "Cannot open Phase file"
229
+ };
230
+ const int illum_wax_cres[4][13][8] = {
231
+ { // five days
232
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
233
+ { 3, 8, 16, 25, 35, 0, 0, 0, }, // 45% first quarter
234
+ { 3, 8, 16, 25, 35, 0, 0, 0, }, // 46% first quarter
235
+ { 3, 8, 16, 25, 36, 0, 0, 0, }, // 47% first quarter
236
+ { 3, 8, 16, 25, 36, 0, 0, 0, }, // 48% first quarter
237
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% first quarter
238
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% first quarter
239
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% first quarter
240
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% first quarter
241
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 53% first quarter
242
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 54% first quarter
243
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% first quarter
244
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% first quarter
245
+ },
246
+ { // six days
247
+ { 1, 3, 8, 15, 24, 34, 0, 0, }, // 44% first quarter
248
+ { 1, 3, 8, 15, 24, 34, 0, 0, }, // 45% first quarter
249
+ { 1, 4, 10, 17, 25, 36, 0, 0, }, // 46% first quarter
250
+ { 1, 5, 11, 18, 27, 36, 0, 0, }, // 47% first quarter
251
+ { 1, 5, 11, 18, 27, 36, 0, 0, }, // 48% first quarter
252
+ { 2, 6, 12, 19, 28, 39, 0, 0, }, // 49% first quarter
253
+ { 1, 6, 12, 20, 29, 40, 0, 0, }, // 50% first quarter
254
+ { 1, 6, 12, 20, 29, 40, 0, 0, }, // 51% first quarter
255
+ { 1, 6, 13, 21, 31, 42, 0, 0, }, // 52% first quarter
256
+ { 2, 6, 13, 21, 31, 42, 0, 0, }, // 53% first quarter
257
+ { 2, 6, 13, 21, 32, 43, 0, 0, }, // 54% first quarter
258
+ { 2, 6, 15, 23, 34, 44, 0, 0, }, // 55% first quarter
259
+ { 3, 6, 16, 25, 36, 46, 0, 0, }, // 56% first quarter
260
+ },
261
+ { // seven days
262
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
263
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 45% first quarter
264
+ { 1, 3, 7, 13, 20, 28, 37, 0, }, // 46% first quarter
265
+ { 1, 3, 8, 14, 21, 29, 38, 0, }, // 47% first quarter
266
+ { 1, 4, 8, 14, 21, 29, 39, 0, }, // 48% first quarter
267
+ { 1, 4, 8, 14, 21, 30, 39, 0, }, // 49% first quarter
268
+ { 1, 4, 9, 15, 22, 31, 40, 0, }, // 50% first quarter
269
+ { 2, 5, 10, 16, 24, 32, 42, 0, }, // 51% first quarter
270
+ { 2, 5, 10, 17, 25, 33, 43, 0, }, // 52% first quarter
271
+ { 2, 5, 10, 17, 25, 34, 43, 0, }, // 53% first quarter
272
+ { 2, 5, 11, 17, 25, 34, 44, 0, }, // 54% first quarter
273
+ { 2, 6, 12, 18, 26, 35, 45, 0, }, // 55% first quarter
274
+ { 2, 6, 12, 18, 26, 35, 45, 0, }, // 56% first quarter
275
+ },
276
+ { // eight days
277
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
278
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 45% first quarter
279
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 46% first quarter
280
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 47% first quarter
281
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 48% first quarter
282
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% first quarter
283
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% first quarter
284
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% first quarter
285
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% first quarter
286
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 53% first quarter
287
+ { 0, 3, 6, 12, 18, 26, 35, 45, }, // 54% first quarter
288
+ { 0, 3, 6, 12, 18, 26, 35, 45, }, // 55% first quarter
289
+ { 0, 3, 7, 12, 19, 27, 36, 46, }, // 56% first quarter
290
+ },
291
+ };
292
+ const int illum_wax_gibb[4][13][8] = {
293
+ { // five days
294
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
295
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 45% first quarter
296
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 46% first quarter
297
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 47% first quarter
298
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 48% first quarter
299
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% first quarter
300
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% first quarter
301
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% first quarter
302
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% first quarter
303
+ { 64, 75, 84, 92, 97, 0, 0, 0, }, // 53% first quarter
304
+ { 65, 75, 85, 92, 97, 0, 0, 0, }, // 54% first quarter
305
+ { 66, 76, 86, 93, 98, 0, 0, 0, }, // 55% first quarter
306
+ { 67, 77, 86, 93, 98, 0, 0, 0, }, // 56% first quarter
307
+ },
308
+ { // six days
309
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
310
+ { 57, 68, 78, 87, 94, 98, 0, 0, }, // 45% first quarter
311
+ { 57, 68, 78, 87, 94, 98, 0, 0, }, // 46% first quarter
312
+ { 58, 69, 79, 88, 94, 98, 0, 0, }, // 47% first quarter
313
+ { 59, 70, 80, 89, 95, 99, 0, 0, }, // 48% first quarter
314
+ { 60, 70, 79, 87, 94, 99, 0, 0, }, // 49% first quarter
315
+ { 61, 72, 82, 90, 96, 99, 0, 0, }, // 50% first quarter
316
+ { 62, 72, 81, 89, 95, 99, 0, 0, }, // 51% first quarter
317
+ { 63, 73, 82, 89, 94, 98, 0, 0, }, // 52% first quarter
318
+ { 62, 72, 82, 89, 95, 99, 0, 0, }, // 53% first quarter
319
+ { 64, 74, 82, 90, 96, 99, 0, 0, }, // 54% first quarter
320
+ { 65, 75, 83, 90, 96, 99, 0, 0, }, // 55% first quarter
321
+ { 66, 76, 85, 92, 95, 100, 0, 0, }, // 56% first quarter
322
+ },
323
+ { // seven days
324
+ { 0 , 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
325
+ { 56, 66, 75, 83, 89, 94, 98, 0, }, // 45% first quarter
326
+ { 57, 67, 76, 84, 90, 95, 99, 0, }, // 46% first quarter
327
+ { 57, 67, 76, 84, 90, 95, 99, 0, }, // 47% first quarter
328
+ { 58, 68, 76, 85, 91, 96, 99, 0, }, // 48% first quarter
329
+ { 60, 69, 78, 86, 92, 96, 99, 0, }, // 49% first quarter
330
+ { 60, 70, 78, 86, 92, 96, 99, 0, }, // 50% first quarter
331
+ { 61, 71, 79, 86, 92, 96, 99, 0, }, // 51% first quarter
332
+ { 63, 72, 80, 87, 93, 97, 99, 0, }, // 52% first quarter
333
+ { 63, 73, 81, 88, 93, 97, 99, 0, }, // 53% first quarter
334
+ { 64, 73, 81, 88, 93, 97, 100, 0, }, // 54% first quarter
335
+ { 64, 74, 82, 89, 94, 98, 100, 0, }, // 55% first quarter
336
+ { 66, 75, 83, 89, 94, 98, 100, 0, }, // 56% first quarter
337
+ },
338
+ { // eight days
339
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% first quarter
340
+ { 56, 66, 75, 83, 89, 95, 98, 100, }, // 45% first quarter
341
+ { 56, 66, 75, 83, 89, 95, 98, 100, }, // 46% first quarter
342
+ { 57, 67, 75, 83, 90, 95, 98, 100, }, // 47% first quarter
343
+ { 57, 67, 75, 83, 90, 95, 98, 100, }, // 48% first quarter
344
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% first quarter
345
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% first quarter
346
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% first quarter
347
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% first quarter
348
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 53% first quarter
349
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 54% first quarter
350
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% first quarter
351
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% first quarter
352
+ },
353
+ };
354
+ const int illum_wan_gibb[4][13][8] = {
355
+ { // five days
356
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% last quarter
357
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 45% last quarter
358
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 46% last quarter
359
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 47% last quarter
360
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 48% last quarter
361
+ { 95, 89, 81, 71, 61, 0, 0, 0, }, // 49% last quarter
362
+ { 96, 90, 82, 72, 62, 0, 0, 0, }, // 50% last quarter
363
+ { 96, 91, 83, 73, 62, 0, 0, 0, }, // 51% last quarter
364
+ { 96, 90, 82, 72, 62, 0, 0, 0, }, // 52% last quarter
365
+ { 97, 92, 84, 75, 64, 0, 0, 0, }, // 53% last quarter
366
+ { 97, 92, 85, 75, 65, 0, 0, 0, }, // 54% last quarter
367
+ { 98, 93, 86, 77, 66, 0, 0, 0, }, // 55% last quarter
368
+ { 98, 93, 87, 78, 77, 0, 0, 0, }, // 56% last quarter
369
+ },
370
+ { // six days
371
+ { 97, 93, 86, 77, 67, 56, 0, 0, }, // 44% last quarter
372
+ { 97, 93, 86, 77, 67, 56, 0, 0, }, // 45% last quarter
373
+ { 99, 95, 88, 79, 69, 58, 0, 0, }, // 46% last quarter
374
+ { 99, 95, 88, 80, 70, 59, 0, 0, }, // 47% last quarter
375
+ { 99, 95, 89, 80, 70, 59, 0, 0, }, // 48% last quarter
376
+ { 98, 94, 89, 80, 69, 59, 0, 0, }, // 49% last quarter
377
+ { 98, 94, 89, 81, 72, 61, 0, 0, }, // 50% last quarter
378
+ { 99, 95, 89, 81, 71, 61, 0, 0, }, // 51% last quarter
379
+ { 98, 93, 87, 79, 71, 61, 0, 0, }, // 52% last quarter
380
+ { 99, 96, 91, 84, 74, 63, 0, 0, }, // 53% last quarter
381
+ { 99, 96, 91, 84, 75, 65, 0, 0, }, // 54% last quarter
382
+ { 99, 96, 91, 85, 75, 65, 0, 0, }, // 55% last quarter
383
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
384
+ },
385
+ { // seven days
386
+ { 98, 94, 89, 81, 72, 60, 53, 0, }, // 44% last quarter
387
+ { 98, 94, 89, 82, 73, 61, 54, 0, }, // 45% last quarter
388
+ { 98, 94, 89, 83, 73, 65, 55, 0, }, // 46% last quarter
389
+ { 99, 97, 92, 86, 78, 68, 58, 0, }, // 47% last quarter
390
+ { 99, 97, 92, 86, 78, 69, 59, 0, }, // 48% last quarter
391
+ { 99, 95, 91, 85, 77, 69, 59, 0, }, // 49% last quarter
392
+ { 99, 96, 91, 85, 78, 69, 60, 0, }, // 50% last quarter
393
+ { 99, 97, 92, 85, 78, 69, 60, 0, }, // 51% last quarter
394
+ { 99, 96, 92, 86, 79, 71, 62, 0, }, // 52% last quarter
395
+ { 99, 97, 93, 87, 80, 72, 63, 0, }, // 53% last quarter
396
+ { 99, 97, 93, 87, 80, 72, 63, 0, }, // 54% last quarter
397
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% last quarter
398
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
399
+ },
400
+ { // eight days
401
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% last quarter
402
+ {100, 98, 94, 89, 82, 74, 66, 56, }, // 45% last quarter
403
+ {100, 98, 94, 89, 82, 74, 66, 56, }, // 46% last quarter
404
+ {100, 98, 94, 89, 82, 74, 66, 56, }, // 47% last quarter
405
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 48% last quarter
406
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% last quarter
407
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% last quarter
408
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% last quarter
409
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% last quarter
410
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 53% last quarter
411
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 54% last quarter
412
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% last quarter
413
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
414
+ },
415
+ };
416
+ const int illum_wan_cres[4][13][8] = {
417
+ { // five days
418
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% last quarter
419
+ { 34, 24, 15, 8, 3, 0, 0, 0, }, // 45% last quarter
420
+ { 35, 25, 16, 8, 3, 0, 0, 0, }, // 46% last quarter
421
+ { 36, 26, 16, 8, 3, 0, 0, 0, }, // 47% last quarter
422
+ { 37, 26, 16, 8, 3, 0, 0, 0, }, // 48% last quarter
423
+ { 38, 27, 17, 8, 3, 0, 0, 0, }, // 49% last quarter
424
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% last quarter
425
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% last quarter
426
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 52% last quarter
427
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 53% last quarter
428
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 54% last quarter
429
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% last quarter
430
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
431
+ },
432
+ { // six days
433
+ { 33, 23, 14, 7, 3, 0, 0, 0, }, // 44% last quarter
434
+ { 36, 25, 17, 10, 6, 2, 0, 0, }, // 45% last quarter
435
+ { 36, 26, 17, 10, 5, 2, 0, 0, }, // 46% last quarter
436
+ { 37, 27, 18, 10, 5, 1, 0, 0, }, // 47% last quarter
437
+ { 37, 27, 18, 10, 5, 1, 0, 0, }, // 48% last quarter
438
+ { 39, 28, 19, 11, 4, 1, 0, 0, }, // 49% last quarter
439
+ { 39, 28, 19, 11, 4, 1, 0, 0, }, // 50% last quarter
440
+ { 40, 29, 19, 12, 4, 1, 0, 0, }, // 51% last quarter
441
+ { 42, 30, 21, 13, 8, 3, 0, 0, }, // 52% last quarter
442
+ { 43, 31, 22, 14, 6, 2, 0, 0, }, // 53% last quarter
443
+ { 44, 33, 23, 14, 6, 2, 0, 0, }, // 54% last quarter
444
+ { 45, 33, 24, 15, 6, 2, 0, 0, }, // 55% last quarter
445
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
446
+ },
447
+ { // seven days
448
+ { 35, 26, 19, 12, 7, 3, 1, 0, }, // 44% last quarter
449
+ { 35, 26, 19, 12, 7, 3, 1, 0, }, // 45% last quarter
450
+ { 36, 27, 19, 12, 7, 3, 1, 0, }, // 46% last quarter
451
+ { 38, 29, 21, 14, 8, 3, 1, 0, }, // 47% last quarter
452
+ { 39, 30, 22, 14, 8, 4, 1, 0, }, // 48% last quarter
453
+ { 40, 31, 22, 15, 9, 4, 1, 0, }, // 49% last quarter
454
+ { 40, 31, 22, 15, 8, 3, 1, 0, }, // 50% last quarter
455
+ { 40, 30, 21, 14, 8, 4, 1, 0, }, // 51% last quarter
456
+ { 42, 33, 25, 17, 10, 5, 2, 0, }, // 52% last quarter
457
+ { 44, 34, 25, 17, 10, 4, 1, 0, }, // 53% last quarter
458
+ { 44, 35, 26, 17, 10, 5, 1, 0, }, // 54% last quarter
459
+ { 43, 32, 22, 14, 7, 3, 0, 0, }, // 55% last quarter
460
+ { 44, 35, 25, 16, 10, 5, 0, 0, }, // 56% last quarter
461
+ },
462
+ { // eight days
463
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 44% last quarter
464
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 45% last quarter
465
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 46% last quarter
466
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 47% last quarter
467
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 48% last quarter
468
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 49% last quarter
469
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 50% last quarter
470
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 51% last quarter
471
+ { 44, 34, 26, 19, 11, 6, 2, 0, }, // 52% last quarter
472
+ { 44, 34, 26, 19, 11, 6, 2, 0, }, // 53% last quarter
473
+ { 44, 34, 26, 19, 11, 6, 2, 0, }, // 54% last quarter
474
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 55% last quarter
475
+ { 0, 0, 0, 0, 0, 0, 0, 0, }, // 56% last quarter
476
+ },
477
+ };
478
+ const int illum_estimates[4][24] = { // (hours since phase time)
479
+ { 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // new moon
480
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
481
+ { 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, // first quarter
482
+ 51, 50, 50, 48, 48, 48, 48, 47, 47, 47, 48, 46, },
483
+ { 99, 99, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, // full moon
484
+ 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, },
485
+ { 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 49, 49, // last quarter
486
+ 50, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, },
191
487
  };
192
-
193
488
  /*********************** function prototypes ************************************************/
194
489
 
195
490
  int TestBuildDataFile(void);
@@ -230,49 +525,8 @@ Uuncomment one of these to control whether the executable will enter the Console
230
525
  a one cay summary, the Club Mode, to porepare the Club File, or the build Mode, to build a new
231
526
  data file from a revised DST file. */
232
527
 
233
- //define CONSOLE_MODE
234
528
  #define CLUB_MODE
235
- //#define BUILD_MODE
236
-
237
- /*********************** Main
238
-
239
- This is the entry point for the program.
240
529
 
241
- RETURN VALUE: EXIT_SUCCESS or Error Code
242
-
243
- PARAMETERS: Varies depending on mode
244
- */
245
- /*#ifdef CONSOLE_MODE
246
- int main()
247
- {
248
- enum { BUILD = 'B', CLUB = 'C', DISPLAY = 'D' };
249
- int task;
250
- char line[100];
251
-
252
- printf("Enter: Club File, Display Summary, Build Data File: ");
253
- fgets(line, sizeof line, stdin);
254
- if (line[0] == '\n') strcpy(line, "Club");
255
- task = line[0];
256
- switch (task)
257
- {
258
- case BUILD:
259
- case BUILD + 32:
260
- printf("\nBUILD DATA FILE\n\n");
261
- TestBuildDataFile();
262
- break;
263
- case DISPLAY:
264
- case DISPLAY + 32:
265
- printf("\nDISPLAY SUMMARY\n\n");
266
- TestSummary();
267
- break;
268
- default:
269
- printf("\nCLUB FILE\n\n");
270
- TestClubFile();
271
- break;
272
- }
273
- return 0;
274
- }
275
- #endif*/
276
530
 
277
531
  static VALUE generate(VALUE self, VALUE r_date_str, VALUE r_count, VALUE r_lat,
278
532
  VALUE r_lon, VALUE r_gmt_offset, VALUE r_dst_offset, VALUE r_military_time, VALUE r_path)
@@ -308,9 +562,12 @@ static VALUE generate(VALUE self, VALUE r_date_str, VALUE r_count, VALUE r_lat,
308
562
  int outputLength;
309
563
  outputLength = count*251;
310
564
  char output[outputLength];
565
+ rb_eval_string("puts 'Step 1'");
311
566
  result = ClubFile( club_name, date_str, count, lat, lon,
312
567
  gmt_offset, dst_time, am_pm, data_name, output, path);
568
+ rb_eval_string("puts 'Step 1.5'");
313
569
  ret_v = rb_str_new2(result);
570
+ rb_eval_string("puts 'Step Final'");
314
571
 
315
572
  return ret_v;
316
573
  }
@@ -649,6 +906,7 @@ PARAMETERS: name of Club File
649
906
  char* ClubFile(char *club_name, char *start_date, int count, double lat, double lon,
650
907
  int gmt_offset, int dst_time, int am_pm, char *data_name, char *output, char *path)
651
908
  {
909
+ rb_eval_string("puts \"Step 2\"");
652
910
  FILE *file;
653
911
  int i;
654
912
  int n;
@@ -686,9 +944,12 @@ char* ClubFile(char *club_name, char *start_date, int count, double lat, double
686
944
  jdate = ConvertDate(start_date);
687
945
  for (i = 0; i < count; i++)
688
946
  {
947
+ rb_eval_string("puts \"Step 3\"");
689
948
  success = Solunar(&solunar, jdate + i, lat, lon, gmt_offset, dst_time, data_filename);
949
+ rb_eval_string("puts \"Step 4\"");
690
950
  if (success == EXIT_SUCCESS)
691
951
  {
952
+ rb_eval_string("puts \"Step 5\"");
692
953
  FmtTimeStr(s_ris, solunar.sun.ris, am_pm);
693
954
  FmtTimeStr(s_trn, solunar.sun.trn, am_pm);
694
955
  FmtTimeStr(s_set, solunar.sun.set, am_pm);
@@ -750,14 +1011,14 @@ double ConvertDate(char* string)
750
1011
  year = atoi(string);
751
1012
  month = atoi(string + 5);
752
1013
  day = atoi(string + 8);
753
- if ((year < 2016) || (year > 2026)) error = YES;
1014
+ if ((year < 1956) || (year > 2026)) error = YES;
754
1015
  if ((month < 1) || (month > 12)) error = YES;
755
1016
  if ((day < 1) || ((year % 4 == 0) && (day > l[month - 1]))) error = YES;
756
1017
  if ((day < 1) || ((year % 4 != 0) && (day > m[month - 1]))) error = YES;
757
1018
  if (error == NO)
758
1019
  {
759
1020
  result = JDATE_BASE;
760
- result += year_days[year - 2016];
1021
+ result += year_days[year - 1956];
761
1022
  result += year % 4 == 0? leap_days[month - 1]: month_days[month - 1];
762
1023
  result += day - 1;
763
1024
  }
@@ -1040,10 +1301,119 @@ PARAMETERS: none
1040
1301
  */
1041
1302
  int GetIllumData(void)
1042
1303
  {
1304
+ ///past
1305
+ enum {NEW_MOON_EST = 0, FIRST_QTR_EST = 1, FULL_MOON_EST = 2, LAST_QTR_EST = 3};
1306
+ ///
1043
1307
  int index;
1044
1308
  int success;
1045
-
1309
+ ///past
1310
+ int n;
1311
+ int phase_time;
1312
+ int time_offset;
1313
+ int day_offset;
1314
+ int new_moon_illum;
1315
+ int first_qtr_illum;
1316
+ int full_moon_illum;
1317
+ int last_qtr_illum;
1318
+ int new_moon_index;
1319
+ int first_qtr_index;
1320
+ int full_moon_index;
1321
+ int last_qtr_index;
1322
+ int days;
1323
+ int index_2016;
1324
+
1325
+ index_2016 = year_days[2016 - 1956];
1326
+
1327
+ // initial new moon illumination and index
1046
1328
  index = 0;
1329
+ while (jpl_temp[index].phase != NEW_MOON) index++;
1330
+ phase_time = jpl_temp[index].phase_time;
1331
+ time_offset = jpl_temp[index].dst == YES ? 300 : 360;
1332
+ day_offset = phase_time < time_offset ? 1 : 0;
1333
+ if (day_offset == 1) phase_time += MINUTES_PER_DAY;
1334
+ phase_time -= time_offset;
1335
+ new_moon_index = index - day_offset;
1336
+ phase_time = (int)((phase_time + 30) / 60);
1337
+ new_moon_illum = illum_estimates[NEW_MOON_EST][phase_time];
1338
+ jpl_temp[new_moon_index].illum = new_moon_illum;
1339
+
1340
+ while (index < index_2016)
1341
+ {
1342
+ // first quarter illumination and index
1343
+ while (jpl_temp[index].phase != FIRST_QTR) index++;
1344
+ phase_time = jpl_temp[index].phase_time;
1345
+ time_offset = jpl_temp[index].dst == YES ? 300 : 360;
1346
+ day_offset = phase_time < time_offset ? 1 : 0;
1347
+ if (day_offset == 1) phase_time += MINUTES_PER_DAY;
1348
+ phase_time -= time_offset;
1349
+ first_qtr_index = index - day_offset;
1350
+ phase_time = (int)((phase_time + 30) / 60);
1351
+ first_qtr_illum = illum_estimates[FIRST_QTR_EST][phase_time];
1352
+ jpl_temp[first_qtr_index].illum = first_qtr_illum;
1353
+
1354
+ // full moon illumination and index
1355
+ while (jpl_temp[index].phase != FULL_MOON) index++;
1356
+ phase_time = jpl_temp[index].phase_time;
1357
+ time_offset = jpl_temp[index].dst == YES ? 300 : 360;
1358
+ day_offset = phase_time < time_offset ? 1 : 0;
1359
+ if (day_offset == 1) phase_time += MINUTES_PER_DAY;
1360
+ phase_time -= time_offset;
1361
+ full_moon_index = index - day_offset;
1362
+ phase_time = (int)((phase_time + 30) / 60);
1363
+ full_moon_illum = illum_estimates[FULL_MOON_EST][phase_time];
1364
+ jpl_temp[full_moon_index].illum = full_moon_illum;
1365
+
1366
+ // waxing crescent illuminations
1367
+ days = first_qtr_index - new_moon_index - 1;
1368
+ for (n = 0; n < days; n++)
1369
+ {
1370
+ jpl_temp[new_moon_index + 1 + n].illum = illum_wax_cres[days - 5][first_qtr_illum - 44][n];
1371
+ }
1372
+ days = full_moon_index - first_qtr_index - 1;
1373
+ for (n = 0; n < days; n++)
1374
+ {
1375
+ jpl_temp[first_qtr_index + 1 + n].illum = illum_wax_gibb[days - 5][first_qtr_illum - 44][n];
1376
+ }
1377
+
1378
+ // last quarter illumination and index
1379
+ while (jpl_temp[index].phase != LAST_QTR) index++;
1380
+ phase_time = jpl_temp[index].phase_time;
1381
+ time_offset = jpl_temp[index].dst == YES ? 300 : 360;
1382
+ day_offset = phase_time < time_offset ? 1 : 0;
1383
+ if (day_offset == 1) phase_time += MINUTES_PER_DAY;
1384
+ phase_time -= time_offset;
1385
+ last_qtr_index = index - day_offset;
1386
+ phase_time = (int)((phase_time + 30) / 60);
1387
+ last_qtr_illum = illum_estimates[LAST_QTR_EST][phase_time];
1388
+ jpl_temp[last_qtr_index].illum = last_qtr_illum;
1389
+
1390
+ // new moon illumination and index
1391
+ while (jpl_temp[index].phase != NEW_MOON) index++;
1392
+ phase_time = jpl_temp[index].phase_time;
1393
+ time_offset = jpl_temp[index].dst == YES ? 300 : 360;
1394
+ day_offset = phase_time < time_offset ? 1 : 0;
1395
+ if (day_offset == 1) phase_time += MINUTES_PER_DAY;
1396
+ phase_time -= time_offset;
1397
+ new_moon_index = index - day_offset;
1398
+ phase_time = (int)((phase_time + 30) / 60);
1399
+ new_moon_illum = illum_estimates[NEW_MOON_EST][phase_time];
1400
+ jpl_temp[new_moon_index].illum = new_moon_illum;
1401
+
1402
+ // waning crescent illuminations
1403
+ days = last_qtr_index - full_moon_index - 1;
1404
+ for (n = 0; n < days; n++)
1405
+ {
1406
+ jpl_temp[full_moon_index + 1 + n].illum = illum_wan_gibb[days - 5][last_qtr_illum - 44][n];
1407
+ }
1408
+ days = new_moon_index - last_qtr_index - 1;
1409
+ for (n = 0; n < days; n++)
1410
+ {
1411
+ jpl_temp[last_qtr_index + 1 + n].illum = illum_wan_cres[days - 5][last_qtr_illum - 44][n];
1412
+ }
1413
+ }
1414
+ // index = 0;
1415
+ index = index_2016;
1416
+ ///
1047
1417
  success = EXIT_SUCCESS;
1048
1418
  if (success == EXIT_SUCCESS) success = GetIllumYear(ILLUM_16_FILE, &index);
1049
1419
  if (success == EXIT_SUCCESS) success = GetIllumYear(ILLUM_17_FILE, &index);
data/lib/solunar.rb CHANGED
@@ -1,25 +1,25 @@
1
1
  class Solunar
2
2
 
3
3
  NAME = "solunar"
4
- VERSION = '0.0.8'
4
+ VERSION = '0.0.9'
5
5
  def version
6
- "0.0.8"
6
+ "0.0.9"
7
7
  end
8
8
 
9
9
  def test
10
- get_data("2017-05-01",10,29.2108,-81.0228,-5,1,0)
10
+ get_data("2017-05-01",100,29.2108,-81.0228,-5,1,0)
11
11
  end
12
12
 
13
13
  def get_data(date,count,lat,lon,tz_offset_hours,dst_offset_hours,military_time)
14
14
  forecast = Array.new
15
15
  dir = "#{Gem.dir}/gems/#{Solunar::NAME}-#{Solunar::VERSION}/data/"
16
16
  res = generate(date,count,lat,lon,(tz_offset_hours*-60.0).to_i,(dst_offset_hours*60.0).to_i,military_time,dir)
17
+ puts "Got a result"
17
18
  #Most data comes from the "generate" function, which lives in solunar.c
18
19
  #Major feed times are currently defined as two hours starting at the moon underfoot and moon transit
19
20
  #Minor feed times are one hour after moon rise and moon set
20
21
  res.split(";").each do |line|
21
22
  next unless line.split(",").length > 7
22
- puts line
23
23
  segments = line.split(",")
24
24
  day = Hash.new
25
25
  sun = Hash.new
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solunar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - "\"Sullivan"
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-28 00:00:00.000000000 Z
13
+ date: 2016-11-29 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: A gem that wraps the C code from Rick Dawson that computes the sun and
16
16
  moon times based on date and coordinates. Takes a series of arguments, and returns
@@ -22,9 +22,7 @@ extensions:
22
22
  - ext/solunar/extconf.rb
23
23
  extra_rdoc_files: []
24
24
  files:
25
- - data/DST_Files/Test.txt
26
25
  - data/DST_Files/USA.txt
27
- - data/Data_Files/Test.bin
28
26
  - data/Data_Files/USA.bin
29
27
  - data/Source_Files/Moon.txt
30
28
  - data/Source_Files/Phase.TXT
@@ -40,9 +38,7 @@ files:
40
38
  - data/Source_Files/ilum_2024.txt
41
39
  - data/Source_Files/ilum_2025.txt
42
40
  - data/Source_Files/ilum_2026.txt
43
- - ext/solunar/DST_Files/Test.txt
44
41
  - ext/solunar/DST_Files/USA.txt
45
- - ext/solunar/Data_Files/Test.bin
46
42
  - ext/solunar/Data_Files/USA.bin
47
43
  - ext/solunar/Source_Files/Moon.txt
48
44
  - ext/solunar/Source_Files/Phase.TXT
@@ -82,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
78
  version: '0'
83
79
  requirements: []
84
80
  rubyforge_project:
85
- rubygems_version: 2.4.3
81
+ rubygems_version: 2.6.8
86
82
  signing_key:
87
83
  specification_version: 4
88
84
  summary: Solunar Forecasting Gem
@@ -1,11 +0,0 @@
1
- 2016/03/13, 2016/11/06
2
- 2017/03/12, 2017/11/05
3
- 2018/03/11, 2018/11/04
4
- 2019/03/10, 2019/11/03
5
- 2020/03/08, 2020/11/01
6
- 2021/03/14, 2021/11/07
7
- 2022/03/13, 2022/11/06
8
- 2023/03/12, 2023/11/05
9
- 2024/03/10, 2024/11/03
10
- 2025/03/09, 2025/11/02
11
- 2026/03/08, 2026/11/01
Binary file
@@ -1,11 +0,0 @@
1
- 2016/03/13, 2016/11/06
2
- 2017/03/12, 2017/11/05
3
- 2018/03/11, 2018/11/04
4
- 2019/03/10, 2019/11/03
5
- 2020/03/08, 2020/11/01
6
- 2021/03/14, 2021/11/07
7
- 2022/03/13, 2022/11/06
8
- 2023/03/12, 2023/11/05
9
- 2024/03/10, 2024/11/03
10
- 2025/03/09, 2025/11/02
11
- 2026/03/08, 2026/11/01
Binary file