Changeset 3111 in Sophya for trunk/SophyaExt/XephemAstroLib/umoon.c
- Timestamp:
- Nov 22, 2006, 2:53:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XephemAstroLib/umoon.c
r2818 r3111 4 4 #include <stdlib.h> 5 5 #include <string.h> 6 #include <errno.h> 6 7 #include <math.h> 7 8 … … 28 29 static double sizemjd; /* size at last mjd */ 29 30 30 /* file containing BDL coefficients */31 static char ubdlfn[] = "uranus.9910";32 33 31 /* These values are from the Explanatory Supplement. 34 32 * Precession degrades them gradually over time. … … 92 90 93 91 /* get moon x,y,z from BDL if possible */ 94 if ( dir &&use_bdl (JD, dir, md) < 0) {92 if (!dir || use_bdl (JD, dir, md) < 0) { 95 93 int i; 96 94 for (i = 1; i < U_NMOONS; i++) … … 127 125 char buf[1024]; 128 126 FILE *fp; 129 int i; 130 131 /* only valid 1999 through 2010 */ 132 if (JD < 2451179.50000 || JD >= 2455562.5) 127 char *fn; 128 int i; 129 130 /* check ranges and appropriate data file */ 131 if (JD < 2451179.50000) /* Jan 1 1999 UTC */ 132 return (-1); 133 if (JD < 2455562.5) /* Jan 1 2011 UTC */ 134 fn = "uranus.9910"; 135 else if (JD < 2459215.5) /* Jan 1 2021 UTC */ 136 fn = "uranus.1020"; 137 else 133 138 return (-1); 134 139 135 140 /* open */ 136 (void) sprintf (buf, "%s/%s", dir, ubdlfn);141 (void) sprintf (buf, "%s/%s", dir, fn); 137 142 fp = fopen (buf, "r"); 138 if (!fp) 139 return (-1); 143 if (!fp) { 144 fprintf (stderr, "%s: %s\n", fn, strerror(errno)); 145 return (-1); 146 } 140 147 141 148 /* use it */ 142 149 if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) { 143 fprintf (stderr, "%s: %s\n", ubdlfn, buf);150 fprintf (stderr, "%s: %s\n", fn, buf); 144 151 fclose (fp); 145 152 return (-1); 146 153 } 147 154 if (i != U_NMOONS-1) { 148 fprintf (stderr, "%s: BDL says %d moons, code expects %d", ubdlfn,155 fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn, 149 156 i, U_NMOONS-1); 150 157 fclose (fp); … … 261 268 262 269 /* For RCS Only -- Do Not Edit */ 263 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: umoon.c,v $ $Date: 200 5-08-21 10:02:40 $ $Revision: 1.3$ $Name: not supported by cvs2svn $"};270 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: umoon.c,v $ $Date: 2006-11-22 13:53:31 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Note:
See TracChangeset
for help on using the changeset viewer.