IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 18718


Ignore:
Timestamp:
Jul 24, 2008, 3:54:50 PM (18 years ago)
Author:
eugene
Message:

added a new radec conversion function

Location:
trunk/Ohana/src/opihi
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r17283 r18718  
    4141$(SRC)/precess.$(ARCH).o           \
    4242$(SRC)/profile.$(ARCH).o           \
     43$(SRC)/radec.$(ARCH).o     \
    4344$(SRC)/region.$(ARCH).o    \
    4445$(SRC)/rotcurve.$(ARCH).o          \
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r17283 r18718  
    2727int precess                 PROTO((int, char **));
    2828int profile                 PROTO((int, char **));
     29int radec                   PROTO((int, char **));
    2930int region                  PROTO((int, char **));
    3031int rotcurve                PROTO((int, char **));
     
    6263  {1, "precess",     precess,      "precess coordinates"},
    6364  {1, "profile",     profile,      "radial profile at X, Y"},
     65  {1, "radec",       radec,        "convert to/from radec in hms or dd"},
    6466  {1, "region",      region,       "define sky region for plot"},
    6567  {1, "rotcurve",    rotcurve,     "convert CO images to polar coords"},
  • trunk/Ohana/src/opihi/lib.data/convert.c

    r14590 r18718  
    77int hh_hms (double hh, int *hr, int *mn, double *sc) {
    88
    9   int flag;
     9  int N, flag;
    1010
    1111  flag = SIGN(hh);
    12   hh *= flag;
    13   hh = 24.0*(hh/24.0 - (int)(hh/24.0));
    14   *sc = 60.0*(60.0*hh - (int)(60.0*hh));
    15   *mn = 60.0*(hh - (int)hh);
     12  hh = fabs(hh);
     13
     14  // rationalize hh to range -24.0 < hh < 24.0
     15  if (hh >= 24.0) {
     16    N = (int)(hh/24.0);
     17    hh -= 24.0*N;
     18  }
     19
    1620  *hr = (int) hh;
     21  *mn = (int) 60*(hh - *hr);
     22  *sc = 3600.0*(hh - *hr - *mn / 60.0);
     23  if (*sc > 59.99) {
     24    *sc = 0.0;
     25    *mn += 1.0;
     26  }
    1727  *hr *= flag;
    1828  return (TRUE);
     
    4959      sprintf (line, "-%02d:%02d:%05.2f", abs(hr), mn, sc);
    5060    } else {
    51       sprintf (line, "%02d:%02d:%05.2f", hr, mn, sc);
     61      sprintf (line, "+%02d:%02d:%05.2f", hr, mn, sc);
    5262    }
    5363  }     
     
    6474    sprintf (line, "-%02d:%02d:%05.2f", abs(dg), mn, sc);
    6575  } else {
    66     sprintf (line, "%02d:%02d:%05.2f", dg, mn, sc);
     76    sprintf (line, "+%02d:%02d:%05.2f", dg, mn, sc);
    6777  }
    6878  return (TRUE);
Note: See TracChangeset for help on using the changeset viewer.