1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
use crate::macros as pa_m;
use crate::util as pa_u;

/// Calculate approximate position of the Moon.
///
/// ## Arguments
/// * `lct_hour` -- Local civil time, in hours.
/// * `lct_min` -- Local civil time, in minutes.
/// * `lct_sec` -- Local civil time, in seconds.
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
///
/// ## Returns
/// * `moon_ra_hour` -- Right ascension of Moon (hour part)
/// * `moon_ra_min` -- Right ascension of Moon (minutes part)
/// * `moon_ra_sec` -- Right ascension of Moon (seconds part)
/// * `moon_dec_deg` -- Declination of Moon (degrees part)
/// * `moon_dec_min` -- Declination of Moon (minutes part)
/// * `moon_dec_sec` -- Declination of Moon (seconds part)
pub fn approximate_position_of_moon(
    lct_hour: f64,
    lct_min: f64,
    lct_sec: f64,
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
) -> (f64, f64, f64, f64, f64, f64) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let l0 = 91.9293359879052;
    let p0 = 130.143076320618;
    let n0 = 291.682546643194;
    let i: f64 = 5.145396;

    let gdate_day = pa_m::lct_gday(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_month = pa_m::lct_gmonth(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_year = pa_m::lct_gyear(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    let ut_hours = pa_m::lct_ut(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let d_days = pa_m::cd_jd(gdate_day, gdate_month, gdate_year) - pa_m::cd_jd(0.0, 1, 2010)
        + ut_hours / 24.0;
    let sun_long_deg = pa_m::sun_long(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let sun_mean_anomaly_rad = pa_m::sun_mean_anomaly(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let lm_deg = pa_m::unwind_deg(13.1763966 * d_days + l0);
    let mm_deg = pa_m::unwind_deg(lm_deg - 0.1114041 * d_days - p0);
    let n_deg = pa_m::unwind_deg(n0 - (0.0529539 * d_days));
    let ev_deg = 1.2739 * ((2.0 * (lm_deg - sun_long_deg) - mm_deg).to_radians()).sin();
    let ae_deg = 0.1858 * (sun_mean_anomaly_rad).sin();
    let a3_deg = 0.37 * (sun_mean_anomaly_rad).sin();
    let mmd_deg = mm_deg + ev_deg - ae_deg - a3_deg;
    let ec_deg = 6.2886 * mmd_deg.to_radians().sin();
    let a4_deg = 0.214 * (2.0 * (mmd_deg).to_radians()).sin();
    let ld_deg = lm_deg + ev_deg + ec_deg - ae_deg + a4_deg;
    let v_deg = 0.6583 * (2.0 * (ld_deg - sun_long_deg).to_radians()).sin();
    let ldd_deg = ld_deg + v_deg;
    let nd_deg = n_deg - 0.16 * (sun_mean_anomaly_rad).sin();
    let y = ((ldd_deg - nd_deg).to_radians()).sin() * i.to_radians().cos();
    let x = (ldd_deg - nd_deg).to_radians().cos();

    let moon_long_deg = pa_m::unwind_deg(pa_m::degrees(y.atan2(x)) + nd_deg);
    let moon_lat_deg =
        pa_m::degrees(((ldd_deg - nd_deg).to_radians().sin() * i.to_radians().sin()).asin());
    let moon_ra_hours1 = pa_m::dd_dh(pa_m::ec_ra(
        moon_long_deg,
        0.0,
        0.0,
        moon_lat_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ));
    let moon_dec_deg1 = pa_m::ec_dec(
        moon_long_deg,
        0.0,
        0.0,
        moon_lat_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    );

    let moon_ra_hour = pa_m::dh_hour(moon_ra_hours1);
    let moon_ra_min = pa_m::dh_min(moon_ra_hours1);
    let moon_ra_sec = pa_m::dh_sec(moon_ra_hours1);
    let moon_dec_deg = pa_m::dd_deg(moon_dec_deg1);
    let moon_dec_min = pa_m::dd_min(moon_dec_deg1);
    let moon_dec_sec = pa_m::dd_sec(moon_dec_deg1);

    return (
        moon_ra_hour as f64,
        moon_ra_min as f64,
        moon_ra_sec,
        moon_dec_deg,
        moon_dec_min,
        moon_dec_sec,
    );
}

/// Calculate approximate position of the Moon.
///
/// ## Arguments
/// * `lct_hour` -- Local civil time, in hours.
/// * `lct_min` -- Local civil time, in minutes.
/// * `lct_sec` -- Local civil time, in seconds.
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
///
/// ## Returns
/// * `moon_ra_hour` -- Right ascension of Moon (hour part)
/// * `moon_ra_min` -- Right ascension of Moon (minutes part)
/// * `moon_ra_sec` -- Right ascension of Moon (seconds part)
/// * `moon_dec_deg` -- Declination of Moon (degrees part)
/// * `moon_dec_min` -- Declination of Moon (minutes part)
/// * `moon_dec_sec` -- Declination of Moon (seconds part)
/// * `earth_moon_dist_km` -- Distance from Earth to Moon (km)
/// * `moon_hor_parallax_deg` -- Horizontal parallax of Moon (degrees)
pub fn precise_position_of_moon(
    lct_hour: f64,
    lct_min: f64,
    lct_sec: f64,
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
) -> (f64, f64, f64, f64, f64, f64, f64, f64) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let gdate_day = pa_m::lct_gday(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_month = pa_m::lct_gmonth(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_year = pa_m::lct_gyear(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    let _ut_hours = pa_m::lct_ut(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    let (moon_ecliptic_longitude_deg, moon_ecliptic_latitude_deg, moon_horizontal_parallax_deg) =
        pa_m::moon_long_lat_hp(
            lct_hour,
            lct_min,
            lct_sec,
            daylight_saving,
            zone_correction_hours,
            local_date_day,
            local_date_month,
            local_date_year,
        );

    let nutation_in_longitude_deg = pa_m::nutat_long(gdate_day, gdate_month, gdate_year);
    let corrected_long_deg = moon_ecliptic_longitude_deg + nutation_in_longitude_deg;
    let earth_moon_distance_km = 6378.14 / moon_horizontal_parallax_deg.to_radians().sin();
    let moon_ra_hours_1 = pa_m::dd_dh(pa_m::ec_ra(
        corrected_long_deg,
        0.0,
        0.0,
        moon_ecliptic_latitude_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ));
    let moon_dec_deg1 = pa_m::ec_dec(
        corrected_long_deg,
        0.0,
        0.0,
        moon_ecliptic_latitude_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    );

    let moon_ra_hour = pa_m::dh_hour(moon_ra_hours_1);
    let moon_ra_min = pa_m::dh_min(moon_ra_hours_1);
    let moon_ra_sec = pa_m::dh_sec(moon_ra_hours_1);
    let moon_dec_deg = pa_m::dd_deg(moon_dec_deg1);
    let moon_dec_min = pa_m::dd_min(moon_dec_deg1);
    let moon_dec_sec = pa_m::dd_sec(moon_dec_deg1);
    let earth_moon_dist_km = pa_u::round_f64(earth_moon_distance_km, 0);
    let moon_hor_parallax_deg = pa_u::round_f64(moon_horizontal_parallax_deg, 6);

    return (
        moon_ra_hour as f64,
        moon_ra_min as f64,
        moon_ra_sec,
        moon_dec_deg,
        moon_dec_min,
        moon_dec_sec,
        earth_moon_dist_km,
        moon_hor_parallax_deg,
    );
}

/// Calculate Moon phase and position angle of bright limb.
///
/// ## Arguments
/// * `lct_hour` -- Local civil time, in hours.
/// * `lct_min` -- Local civil time, in minutes.
/// * `lct_sec` -- Local civil time, in seconds.
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
/// * `accuracy_level` -- "A" (approximate) or "P" (precise)
///
/// ## Returns
/// * `moon_phase` -- Phase of Moon, between 0 and 1, where 0 is New and 1 is Full.
/// * `pa_bright_limb_deg` -- Position angle of the bright limb (degrees)
pub fn moon_phase(
    lct_hour: f64,
    lct_min: f64,
    lct_sec: f64,
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
    accuracy_level: String,
) -> (f64, f64) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let gdate_day = pa_m::lct_gday(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_month = pa_m::lct_gmonth(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let gdate_year = pa_m::lct_gyear(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    let sun_long_deg = pa_m::sun_long(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let (moon_ecliptic_longitude_deg, moon_ecliptic_latitude_deg, _moon_horizontal_parallax_deg) =
        pa_m::moon_long_lat_hp(
            lct_hour,
            lct_min,
            lct_sec,
            daylight_saving,
            zone_correction_hours,
            local_date_day,
            local_date_month,
            local_date_year,
        );
    let d_rad = (moon_ecliptic_longitude_deg - sun_long_deg).to_radians();

    let moon_phase1 = if accuracy_level.to_string() == "P" {
        pa_m::moon_phase(
            lct_hour,
            lct_min,
            lct_sec,
            daylight_saving,
            zone_correction_hours,
            local_date_day,
            local_date_month,
            local_date_year,
        )
    } else {
        (1.0 - (d_rad).cos()) / 2.0
    };

    let sun_ra_rad = (pa_m::ec_ra(
        sun_long_deg,
        0.0,
        0.0,
        0.0,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ))
    .to_radians();
    let moon_ra_rad = (pa_m::ec_ra(
        moon_ecliptic_longitude_deg,
        0.0,
        0.0,
        moon_ecliptic_latitude_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ))
    .to_radians();
    let sun_dec_rad = (pa_m::ec_dec(
        sun_long_deg,
        0.0,
        0.0,
        0.0,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ))
    .to_radians();
    let moon_dec_rad = (pa_m::ec_dec(
        moon_ecliptic_longitude_deg,
        0.0,
        0.0,
        moon_ecliptic_latitude_deg,
        0.0,
        0.0,
        gdate_day,
        gdate_month,
        gdate_year,
    ))
    .to_radians();

    let y = (sun_dec_rad).cos() * (sun_ra_rad - moon_ra_rad).sin();
    let x = (moon_dec_rad).cos() * (sun_dec_rad).sin()
        - (moon_dec_rad).sin() * (sun_dec_rad).cos() * (sun_ra_rad - moon_ra_rad).cos();

    let chi_deg = pa_m::degrees(y.atan2(x));

    let moon_phase = pa_u::round_f64(moon_phase1, 2);
    let pa_bright_limb_deg = pa_u::round_f64(chi_deg, 2);

    return (moon_phase, pa_bright_limb_deg);
}

/// Calculate new moon and full moon instances.
///
/// ## Arguments
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
///
/// ## Returns
/// * `nm_local_time_hour` -- new Moon instant - local time (hour)
/// * `nm_local_time_min` -- new Moon instant - local time (minutes)
/// * `nm_local_date_day` -- new Moon instance - local date (day)
/// * `nm_local_date_month` -- new Moon instance - local date (month)
/// * `nm_local_date_year` -- new Moon instance - local date (year)
/// * `fm_local_time_hour` -- full Moon instant - local time (hour)
/// * `fm_local_time_min` -- full Moon instant - local time (minutes)
/// * `fm_local_date_day` -- full Moon instance - local date (day)
/// * `fm_local_date_month` -- full Moon instance - local date (month)
/// * `fm_local_date_year` -- full Moon instance - local date (year)
pub fn times_of_new_moon_and_full_moon(
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
) -> (f64, f64, f64, u32, u32, f64, f64, f64, u32, u32) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let jd_of_new_moon_days = pa_m::new_moon(
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let jd_of_full_moon_days = pa_m::full_moon(
        3,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    let g_date_of_new_moon_day = pa_m::jdc_day(jd_of_new_moon_days);
    let integer_day1 = g_date_of_new_moon_day.floor();
    let g_date_of_new_moon_month = pa_m::jdc_month(jd_of_new_moon_days);
    let g_date_of_new_moon_year = pa_m::jdc_year(jd_of_new_moon_days);

    let g_date_of_full_moon_day = pa_m::jdc_day(jd_of_full_moon_days);
    let integer_day2 = g_date_of_full_moon_day.floor();
    let g_date_of_full_moon_month = pa_m::jdc_month(jd_of_full_moon_days);
    let g_date_of_full_moon_year = pa_m::jdc_year(jd_of_full_moon_days);

    let ut_of_new_moon_hours = 24.0 * (g_date_of_new_moon_day - integer_day1);
    let ut_of_full_moon_hours = 24.0 * (g_date_of_full_moon_day - integer_day2);
    let lct_of_new_moon_hours = pa_m::ut_lct(
        ut_of_new_moon_hours + 0.008333,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day1,
        g_date_of_new_moon_month,
        g_date_of_new_moon_year,
    );
    let lct_of_full_moon_hours = pa_m::ut_lct(
        ut_of_full_moon_hours + 0.008333,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day2,
        g_date_of_full_moon_month,
        g_date_of_full_moon_year,
    );

    let nm_local_time_hour = pa_m::dh_hour(lct_of_new_moon_hours);
    let nm_local_time_min = pa_m::dh_min(lct_of_new_moon_hours);
    let nm_local_date_day = pa_m::ut_lc_day(
        ut_of_new_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day1,
        g_date_of_new_moon_month,
        g_date_of_new_moon_year,
    );
    let nm_local_date_month = pa_m::ut_lc_month(
        ut_of_new_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day1,
        g_date_of_new_moon_month,
        g_date_of_new_moon_year,
    );
    let nm_local_date_year = pa_m::ut_lc_year(
        ut_of_new_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day1,
        g_date_of_new_moon_month,
        g_date_of_new_moon_year,
    );
    let fm_local_time_hour = pa_m::dh_hour(lct_of_full_moon_hours);
    let fm_local_time_min = pa_m::dh_min(lct_of_full_moon_hours);
    let fm_local_date_day = pa_m::ut_lc_day(
        ut_of_full_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day2,
        g_date_of_full_moon_month,
        g_date_of_full_moon_year,
    );
    let fm_local_date_month = pa_m::ut_lc_month(
        ut_of_full_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day2,
        g_date_of_full_moon_month,
        g_date_of_full_moon_year,
    );
    let fm_local_date_year = pa_m::ut_lc_year(
        ut_of_full_moon_hours,
        0.0,
        0.0,
        daylight_saving,
        zone_correction_hours,
        integer_day2,
        g_date_of_full_moon_month,
        g_date_of_full_moon_year,
    );

    return (
        nm_local_time_hour as f64,
        nm_local_time_min as f64,
        nm_local_date_day,
        nm_local_date_month,
        nm_local_date_year,
        fm_local_time_hour as f64,
        fm_local_time_min as f64,
        fm_local_date_day,
        fm_local_date_month,
        fm_local_date_year,
    );
}

/// Calculate Moon's distance, angular diameter, and horizontal parallax.
///
/// ## Arguments
/// * `lct_hour` -- Local civil time, in hours.
/// * `lct_min` -- Local civil time, in minutes.
/// * `lct_sec` -- Local civil time, in seconds.
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
///
/// ## Returns
/// * `earth_moon_dist` -- Earth-Moon distance (km)
/// * `ang_diameter_deg` -- Angular diameter (degrees part)
/// * `ang_diameter_min` -- Angular diameter (minutes part)
/// * `hor_parallax_deg` -- Horizontal parallax (degrees part)
/// * `hor_parallax_min` -- Horizontal parallax (minutes part)
/// * `hor_parallax_sec` -- Horizontal parallax (seconds part)
pub fn moon_dist_ang_diam_hor_parallax(
    lct_hour: f64,
    lct_min: f64,
    lct_sec: f64,
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
) -> (f64, f64, f64, f64, f64, f64) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let moon_distance = pa_m::moon_dist(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let moon_angular_diameter = pa_m::moon_size(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );
    let moon_horizontal_parallax = pa_m::moon_hp(
        lct_hour,
        lct_min,
        lct_sec,
        daylight_saving,
        zone_correction_hours,
        local_date_day,
        local_date_month,
        local_date_year,
    );

    // earth_moon_dist = round(moon_distance,-1)
    let earth_moon_dist = pa_u::round_f64(moon_distance, 0);
    let ang_diameter_deg = pa_m::dd_deg(moon_angular_diameter + 0.008333);
    let ang_diameter_min = pa_m::dd_min(moon_angular_diameter + 0.008333);
    let hor_parallax_deg = pa_m::dd_deg(moon_horizontal_parallax);
    let hor_parallax_min = pa_m::dd_min(moon_horizontal_parallax);
    let hor_parallax_sec = pa_m::dd_sec(moon_horizontal_parallax);

    return (
        earth_moon_dist,
        ang_diameter_deg,
        ang_diameter_min,
        hor_parallax_deg,
        hor_parallax_min,
        hor_parallax_sec,
    );
}

/// Calculate date/time of local moonrise and moonset.
///
/// ## Arguments
/// * `local_date_day` -- Local date, day part.
/// * `local_date_month` -- Local date, month part.
/// * `local_date_year` -- Local date, year part.
/// * `is_daylight_saving` -- Is daylight savings in effect?
/// * `zone_correction_hours` -- Time zone correction, in hours.
/// * `geog_long_deg` -- Geographical longitude, in degrees.
/// * `geog_lat_deg` -- Geographical latitude, in degrees.
///
/// ## Returns
/// * `mr_lt_hour` -- Moonrise, local time (hour part)
/// * `mr_lt_min` -- Moonrise, local time (minutes part)
/// * `mr_local_date_day` -- Moonrise, local date (day)
/// * `mr_local_date_month` -- Moonrise, local date (month)
/// * `mr_local_date_year` -- Moonrise, local date (year)
/// * `mr_azimuth_deg` -- Moonrise, azimuth (degrees)
/// * `ms_lt_hour` -- Moonset, local time (hour part)
/// * `ms_lt_min` -- Moonset, local time (minutes part)
/// * `ms_local_date_day` -- Moonset, local date (day)
/// * `ms_local_date_month` -- Moonset, local date (month)
/// * `ms_local_date_year` -- Moonset, local date (year)
/// * `ms_azimuth_deg` -- Moonset, azimuth (degrees)
pub fn moonrise_and_moonset(
    local_date_day: f64,
    local_date_month: u32,
    local_date_year: u32,
    is_daylight_saving: bool,
    zone_correction_hours: i32,
    geog_long_deg: f64,
    geog_lat_deg: f64,
) -> (f64, f64, f64, u32, u32, f64, f64, f64, f64, u32, u32, f64) {
    let daylight_saving = if is_daylight_saving == true { 1 } else { 0 };

    let local_time_of_moonrise_hours = pa_m::moon_rise_lct(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );
    let _local_moonrise_status1 = pa_m::e_moon_rise(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );
    let (local_date_of_moonrise_day, local_date_of_moonrise_month, local_date_of_moonrise_year) =
        pa_m::moon_rise_lc_dmy(
            local_date_day,
            local_date_month,
            local_date_year,
            daylight_saving,
            zone_correction_hours,
            geog_long_deg,
            geog_lat_deg,
        );
    let local_azimuth_deg1 = pa_m::moon_rise_az(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );

    let local_time_of_moonset_hours = pa_m::moon_set_lct(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );
    let _local_moonset_status1 = pa_m::e_moon_set(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );
    let (local_date_of_moonset_day, local_date_of_moonset_month, local_date_of_moonset_year) =
        pa_m::moon_set_lc_dmy(
            local_date_day,
            local_date_month,
            local_date_year,
            daylight_saving,
            zone_correction_hours,
            geog_long_deg,
            geog_lat_deg,
        );
    let local_azimuth_deg2 = pa_m::moon_set_az(
        local_date_day,
        local_date_month,
        local_date_year,
        daylight_saving,
        zone_correction_hours,
        geog_long_deg,
        geog_lat_deg,
    );

    let mr_lt_hour = pa_m::dh_hour(local_time_of_moonrise_hours + 0.008333);
    let mr_lt_min = pa_m::dh_min(local_time_of_moonrise_hours + 0.008333);
    let mr_local_date_day = local_date_of_moonrise_day;
    let mr_local_date_month = local_date_of_moonrise_month;
    let mr_local_date_year = local_date_of_moonrise_year;
    let mr_azimuth_deg = pa_u::round_f64(local_azimuth_deg1, 2);
    let ms_lt_hour = pa_m::dh_hour(local_time_of_moonset_hours + 0.008333);
    let ms_lt_min = pa_m::dh_min(local_time_of_moonset_hours + 0.008333);
    let ms_local_date_day = local_date_of_moonset_day;
    let ms_local_date_month = local_date_of_moonset_month;
    let ms_local_date_year = local_date_of_moonset_year;
    let ms_azimuth_deg = pa_u::round_f64(local_azimuth_deg2, 2);

    return (
        mr_lt_hour as f64,
        mr_lt_min as f64,
        mr_local_date_day,
        mr_local_date_month,
        mr_local_date_year,
        mr_azimuth_deg,
        ms_lt_hour as f64,
        ms_lt_min as f64,
        ms_local_date_day,
        ms_local_date_month,
        ms_local_date_year,
        ms_azimuth_deg,
    );
}