Skip to content

out of order rise/transit/set times #7

Open

Description

@GorillaSapiens

Attempting to use libnova 0.15.0 near the poles, I get many anomalous outputs from ln_get_solar_rst(). Generally, I get rise/transit/set times that do not occur in order. My expectation is that rise/transit/set should be in order increasing in time.

Please see example code and output attached.

$ uname -a
Linux incursion 5.13.0-30-generic #33-Ubuntu SMP Fri Feb 4 17:03:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

(cd libnova-0.15.0/src; gcc -c .c -I.)
ar r libnova.a libnova-0.15.0/src/
.o
gcc -g -Wall -Ofast tester.c libnova.a -I libnova-0.15.0/src -lm -o tester

Activity

  1. GorillaSapiens commented on Mar 1, 2022

    @GorillaSapiens
    Author

    not sure that attachment happened.

    #include <stdio.h>
    #include <stdlib.h>

    #include <math.h>

    #include <libnova/solar.h>
    #include <libnova/lunar.h>
    #include <libnova/julian_day.h>
    #include <libnova/rise_set.h>
    #include <libnova/transform.h>

    int ln_get_solar_astronomical_rst(
    double JD,
    struct ln_lnlat_posn * observer,
    struct ln_rst_time * rst)
    {
    return ln_get_solar_rst_horizon(
    JD, observer, LN_SOLAR_ASTRONOMICAL_HORIZON, rst);
    }

    int ln_get_solar_civil_rst(
    double JD,
    struct ln_lnlat_posn * observer,
    struct ln_rst_time * rst)
    {
    return ln_get_solar_rst_horizon (
    JD, observer, LN_SOLAR_CIVIL_HORIZON, rst);
    }

    int ln_get_solar_nautical_rst(
    double JD,
    struct ln_lnlat_posn * observer,
    struct ln_rst_time * rst)
    {
    return ln_get_solar_rst_horizon (
    JD, observer, LN_SOLAR_NAUTIC_HORIZON, rst);
    }

    static void print_date (char *title, struct ln_zonedate *date)
    {
    printf("%s\t%04d-%02d-%02d %02d:%02d:%02.6f\n",
    title,
    date->years, date->months, date->days,
    date->hours, date->minutes, date->seconds);
    }

    int main (int argc, const char *argv[])
    {
    struct ln_equ_posn equ;
    struct ln_rst_time rst;
    struct ln_zonedate rise, set, transit;
    struct ln_lnlat_posn observer;
    struct ln_helio_posn pos;
    double JD;

    /* observers location (nearish south pole), used to calc rst /
    observer.lat = -85.0; /
    85.00 S /
    observer.lng = 115.0; /
    115.00 E */

    /* get Julian day from local time */
    //JD = ln_get_julian_from_sys();
    JD = 2459649.399739; // around 2022-03-01 16:36 US/Eastern

    for (int i = 0; i < 366; i++, JD += 1.0) { // one year
    /* geometric coordinates */
    ln_get_solar_geom_coords(JD, &pos);

      /* ra, dec */
      ln_get_solar_equ_coords(JD, &equ);
    
      if (ln_get_solar_rst(JD, &observer, &rst) == 0) {
         if (!(rst.rise < rst.transit && rst.transit < rst.set)) {
            printf("=== SOLAR ANOMOLY JD=%f\n", JD);
    
            ln_get_local_date(rst.rise, &rise);
            ln_get_local_date(rst.transit, &transit);
            ln_get_local_date(rst.set, &set);
            print_date("Rise", &rise);
            print_date("Transit", &transit);
            print_date("Set", &set);
            printf("\n");
         }
      }
    
      if (ln_get_solar_civil_rst(JD, &observer, &rst) == 0) {
         if (!(rst.rise < rst.transit && rst.transit < rst.set)) {
            printf("=== CIVIL ANOMOLY JD=%f\n", JD);
    
            ln_get_local_date(rst.rise, &rise);
            ln_get_local_date(rst.transit, &transit);
            ln_get_local_date(rst.set, &set);
            print_date("Rise", &rise);
            print_date("Transit", &transit);
            print_date("Set", &set);
            printf("\n");
         }
      }
    
      if (ln_get_solar_nautical_rst(JD, &observer, &rst) == 0) {
         if (!(rst.rise < rst.transit && rst.transit < rst.set)) {
            printf("=== NAUTICAL ANOMOLY JD=%f\n", JD);
    
            ln_get_local_date(rst.rise, &rise);
            ln_get_local_date(rst.transit, &transit);
            ln_get_local_date(rst.set, &set);
            print_date("Rise", &rise);
            print_date("Transit", &transit);
            print_date("Set", &set);
            printf("\n");
         }
      }
    
      if (ln_get_solar_astronomical_rst(JD, &observer, &rst) == 0) {
         if (!(rst.rise < rst.transit && rst.transit < rst.set)) {
            printf("=== ASTRONOMICAL ANOMOLY JD=%f\n", JD);
    
            ln_get_local_date(rst.rise, &rise);
            ln_get_local_date(rst.transit, &transit);
            ln_get_local_date(rst.set, &set);
            print_date("Rise", &rise);
            print_date("Transit", &transit);
            print_date("Set", &set);
            printf("\n");
         }
      }
    

    }

    return 0;
    }

    === SOLAR ANOMOLY JD=2459649.399739
    Rise 2022-03-11 13:23:30.581432
    Transit 2022-03-10 23:28:57.943031
    Set 2022-03-11 09:39:48.453349

    === SOLAR ANOMOLY JD=2459650.399739
    Rise 2022-03-12 13:53:39.632332
    Transit 2022-03-11 23:28:42.162428
    Set 2022-03-12 09:09:24.728540

    === SOLAR ANOMOLY JD=2459651.399739
    Rise 2022-03-13 14:21:23.778204
    Transit 2022-03-12 23:28:26.064387
    Set 2022-03-13 08:41:20.414562

    === SOLAR ANOMOLY JD=2459652.399739
    Rise 2022-03-14 14:46:11.559995
    Transit 2022-03-13 23:28:9.670309
    Set 2022-03-14 08:16:11.675089

    === SOLAR ANOMOLY JD=2459653.399739
    Rise 2022-03-15 15:08:55.096233
    Transit 2022-03-14 23:27:53.002084
    Set 2022-03-15 07:53:7.133172

    === SOLAR ANOMOLY JD=2459654.399739
    Rise 2022-03-16 15:30:10.024340
    Transit 2022-03-15 23:27:36.082320
    Set 2022-03-16 07:31:31.477798

    === SOLAR ANOMOLY JD=2459655.399739
    Rise 2022-03-17 15:50:20.278770
    Transit 2022-03-16 23:27:18.934274
    Set 2022-03-17 07:11:1.016880

    === SOLAR ANOMOLY JD=2459656.399739
    Rise 2022-03-18 16:09:42.813080
    Transit 2022-03-17 23:27:1.581763
    Set 2022-03-18 06:51:19.028521

    === SOLAR ANOMOLY JD=2459657.399739
    Rise 2022-03-19 16:28:30.341384
    Transit 2022-03-18 23:26:44.049048
    Set 2022-03-19 06:32:13.045962

    === SOLAR ANOMOLY JD=2459658.399739
    Rise 2022-03-20 16:46:52.934598
    Transit 2022-03-19 23:26:26.360671
    Set 2022-03-20 06:13:33.276216

    === CIVIL ANOMOLY JD=2459688.399739
    Rise 2022-04-18 23:26:39.871923
    Transit 2022-04-18 23:18:2.151657
    Set 2022-04-18 23:04:22.485172

    === SOLAR ANOMOLY JD=2459844.399739
    Rise 2022-09-22 16:41:5.323167
    Transit 2022-09-21 23:11:41.743743
    Set 2022-09-22 05:33:23.168549

    === SOLAR ANOMOLY JD=2459845.399739
    Rise 2022-09-23 16:22:56.847316
    Transit 2022-09-22 23:11:20.659729
    Set 2022-09-23 05:51:12.111815

    === SOLAR ANOMOLY JD=2459846.399739
    Rise 2022-09-24 16:04:30.058952
    Transit 2022-09-23 23:10:59.701766
    Set 2022-09-24 06:09:17.441595

    === SOLAR ANOMOLY JD=2459847.399739
    Rise 2022-09-25 15:45:37.169704
    Transit 2022-09-24 23:10:38.887556
    Set 2022-09-25 06:27:47.327186

    === SOLAR ANOMOLY JD=2459848.399739
    Rise 2022-09-26 15:26:8.697909
    Transit 2022-09-25 23:10:18.234198
    Set 2022-09-26 06:46:51.563104

    === SOLAR ANOMOLY JD=2459849.399739
    Rise 2022-09-27 15:05:52.498309
    Transit 2022-09-26 23:09:57.758389
    Set 2022-09-27 07:06:42.558294

    === SOLAR ANOMOLY JD=2459850.399739
    Rise 2022-09-28 14:44:32.128952
    Transit 2022-09-27 23:09:37.476503
    Set 2022-09-28 07:27:36.983958

    === SOLAR ANOMOLY JD=2459851.399739
    Rise 2022-09-29 14:21:43.854176
    Transit 2022-09-28 23:09:17.404956
    Set 2022-09-29 07:49:58.786336

    === SOLAR ANOMOLY JD=2459852.399739
    Rise 2022-09-30 13:56:50.520011
    Transit 2022-09-29 23:08:57.560163
    Set 2022-09-30 08:14:25.332435

    === SOLAR ANOMOLY JD=2459853.399739
    Rise 2022-10-01 13:28:47.073258
    Transit 2022-09-30 23:08:37.959103
    Set 2022-10-01 08:42:1.940871

    === SOLAR ANOMOLY JD=2459854.399739
    Rise 2022-10-02 12:55:17.735937
    Transit 2022-10-01 23:08:18.619558
    Set 2022-10-02 09:15:4.881392

    === SOLAR ANOMOLY JD=2459855.399739
    Rise 2022-10-03 12:09:44.475365
    Transit 2022-10-02 23:07:59.560156
    Set 2022-10-03 10:00:14.021194

    === SOLAR ANOMOLY JD=2459856.399739
    Rise 2022-10-04 09:46:17.784611
    Transit 2022-10-03 23:07:40.800572
    Set 2022-10-04 12:24:43.153452

    === SOLAR ANOMOLY JD=2460014.399739
    Rise 2023-03-11 13:18:42.077425
    Transit 2023-03-10 23:28:57.171158
    Set 2023-03-11 09:44:24.137551

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions