IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19730


Ignore:
Timestamp:
Sep 23, 2008, 6:05:08 PM (18 years ago)
Author:
eugene
Message:

various bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/skycalc/src/sunmoon.c

    r19719 r19730  
    2626  if ((N = get_argument (argc, argv, "-longitude"))) {
    2727    remove_argument (N, &argc, argv);
    28     longitude = atof (argv[N]) * (24.0 / 360.0);
     28    longitude = atof (argv[N]);
    2929    remove_argument (N, &argc, argv);
    3030  }
    3131
    32   longitude = MKO_LATITUDE; // MKO latitude in decimal degrees
     32  latitude = MKO_LATITUDE; // MKO latitude in decimal degrees
    3333  if ((N = get_argument (argc, argv, "-latitude"))) {
    3434    remove_argument (N, &argc, argv);
     
    4646  if (argc != 4) {
    4747    fprintf (stderr, "USAGE: sunmoon [-longitude long] [-latitude lat] [-elevation elev] (date) (ra) (dec)\n");
    48     fprintf (stderr, " longitude : W long in decimal degrees\n");
    49     fprintf (stderr, " latitude  : N lat in decimal degrees\n");
     48    fprintf (stderr, " longitude : W long in decimal HOURS\n");
     49    fprintf (stderr, " latitude  : N lat in decimal DEGREES\n");
    5050    fprintf (stderr, " elevation : meters above sea level\n");
    5151    fprintf (stderr, " ra & dec  : decimal degrees\n");
     
    7777  sid = SC_lst(jdnow, longitude);
    7878
    79   if (VERBOSE) fprintf (stderr, "jdnow: %lf, sid: $lf\n", jdnow, sid);
     79  if (VERBOSE) fprintf (stderr, "jdnow: %lf, sid: %lf\n", jdnow, sid);
    8080
    8181  // get the sun coordinates
    8282  SC_lpsun (jdnow, &sun_ra, &sun_dec);
    83   sun_ha = sid - sun_ra;
     83  sun_ha = (sid - sun_ra);
    8484  sun_ra *= 15.0;
    8585  sun_alt = SC_altit (sun_dec, sun_ha, latitude, &sun_az);
     
    9090  // get the moon coordintes
    9191  SC_accumoon (jdnow, latitude, sid, elevation, &geo_ra, &geo_dec, &geo_dist, &moon_ra, &moon_dec, &moon_dist);
    92   moon_ha = sid - moon_ra;
     92  moon_ha = (sid - moon_ra);
    9393  moon_ra *= 15.0; // convert to degrees
    9494  moon_alt = SC_altit (moon_dec, moon_ha, latitude, &moon_az);
     
    9797  if (VERBOSE) fprintf (stderr, "moon @ ra,dec = %f %f : alt, az = %f %f\n", moon_ra, moon_dec, moon_alt, moon_az);
    9898
    99   phase = (sun_ra - moon_ra - 180)/360.0;
    100   while (phase < -0.5) phase += 1.0;
    101   while (phase >  0.5) phase -= 1.0;
     99  phase = (moon_ra - sun_ra)/360.0;
     100  while (phase <  0.0) phase += 1.0;
     101  while (phase >  1.0) phase -= 1.0;
    102102
    103103  if (VERBOSE) fprintf (stderr, "sun @ %f %f dist %f\n", sun_ra, sun_dec, sun_angle);
Note: See TracChangeset for help on using the changeset viewer.