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