Changeset 3111 in Sophya for trunk/SophyaExt/XephemAstroLib/jupmoon.c
- Timestamp:
- Nov 22, 2006, 2:53:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XephemAstroLib/jupmoon.c
r2818 r3111 4 4 #include <stdlib.h> 5 5 #include <string.h> 6 #include <errno.h> 6 7 #include <math.h> 7 8 … … 31 32 static double cmlIImjd; /* " II " */ 32 33 33 /* file containing BDL coefficients */34 static char jbdlfn[] = "jupiter.9910";35 36 34 /* These values are from the Explanatory Supplement. 37 35 * Precession degrades them gradually over time. … … 134 132 char buf[1024]; 135 133 FILE *fp; 136 int i; 137 138 /* only valid 1999 through 2010 */ 139 if (JD < 2451179.50000 || JD >= 2455562.5) 134 char *fn; 135 int i; 136 137 /* check ranges and appropriate data file */ 138 if (JD < 2451179.50000) /* Jan 1 1999 UTC */ 139 return (-1); 140 if (JD < 2455562.5) /* Jan 1 2011 UTC */ 141 fn = "jupiter.9910"; 142 else if (JD < 2459215.5) /* Jan 1 2021 UTC */ 143 fn = "jupiter.1020"; 144 else 140 145 return (-1); 141 146 142 147 /* open */ 143 (void) sprintf (buf, "%s/%s", dir, jbdlfn);148 (void) sprintf (buf, "%s/%s", dir, fn); 144 149 fp = fopen (buf, "r"); 145 if (!fp) 146 return (-1); 150 if (!fp) { 151 fprintf (stderr, "%s: %s\n", fn, strerror(errno)); 152 return (-1); 153 } 147 154 148 155 /* use it */ 149 156 if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) { 150 fprintf (stderr, "%s: %s\n", jbdlfn, buf);157 fprintf (stderr, "%s: %s\n", fn, buf); 151 158 fclose (fp); 152 159 return (-1); 153 160 } 154 161 if (i != J_NMOONS-1) { 155 fprintf (stderr, "%s: BDL says %d moons, code expects %d", jbdlfn,162 fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn, 156 163 i, J_NMOONS-1); 157 164 fclose (fp); … … 382 389 383 390 /* For RCS Only -- Do Not Edit */ 384 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: jupmoon.c,v $ $Date: 200 5-08-21 10:02:37 $ $Revision: 1.3$ $Name: not supported by cvs2svn $"};391 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: jupmoon.c,v $ $Date: 2006-11-22 13:53:29 $ $Revision: 1.4 $ $Name: not supported by cvs2svn $"};
Note:
See TracChangeset
for help on using the changeset viewer.