Changeset 3111 in Sophya for trunk/SophyaExt/XephemAstroLib/marsmoon.c
- Timestamp:
- Nov 22, 2006, 2:53:31 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaExt/XephemAstroLib/marsmoon.c
r2818 r3111 4 4 #include <stdlib.h> 5 5 #include <string.h> 6 #include <errno.h> 6 7 #include <math.h> 7 8 … … 24 25 }; 25 26 static double sizemjd; 26 27 /* file containing BDL coefficients */28 static char mbdlfn[] = "mars.9910";29 27 30 28 /* These values are from the Explanatory Supplement. … … 87 85 88 86 /* get moon x,y,z from BDL if possible */ 89 if ( dir &&use_bdl (JD, dir, md) < 0) {87 if (!dir || use_bdl (JD, dir, md) < 0) { 90 88 int i; 91 89 for (i = 1; i < M_NMOONS; i++) … … 122 120 char buf[1024]; 123 121 FILE *fp; 124 int i; 125 126 /* only valid 1999 through 2010 */ 127 if (JD < 2451179.50000 || JD >= 2455562.5) 122 char *fn; 123 int i; 124 125 /* check ranges and appropriate data file */ 126 if (JD < 2451179.50000) /* Jan 1 1999 UTC */ 127 return (-1); 128 if (JD < 2455562.5) /* Jan 1 2011 UTC */ 129 fn = "mars.9910"; 130 else if (JD < 2459215.5) /* Jan 1 2021 UTC */ 131 fn = "mars.1020"; 132 else 128 133 return (-1); 129 134 130 135 /* open */ 131 (void) sprintf (buf, "%s/%s", dir, mbdlfn);136 (void) sprintf (buf, "%s/%s", dir, fn); 132 137 fp = fopen (buf, "r"); 133 if (!fp) 134 return (-1); 138 if (!fp) { 139 fprintf (stderr, "%s: %s\n", fn, strerror(errno)); 140 return (-1); 141 } 135 142 136 143 /* use it */ 137 144 if ((i = read_bdl (fp, JD, x, y, z, buf)) < 0) { 138 fprintf (stderr, "%s: %s\n", mbdlfn, buf);145 fprintf (stderr, "%s: %s\n", fn, buf); 139 146 fclose (fp); 140 147 return (-1); 141 148 } 142 149 if (i != M_NMOONS-1) { 143 fprintf (stderr, "%s: BDL says %d moons, code expects %d", mbdlfn,150 fprintf (stderr, "%s: BDL says %d moons, code expects %d", fn, 144 151 i, M_NMOONS-1); 145 152 fclose (fp); … … 256 263 257 264 /* For RCS Only -- Do Not Edit */ 258 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: marsmoon.c,v $ $Date: 200 5-08-21 10:02:38 $ $Revision: 1.3$ $Name: not supported by cvs2svn $"};265 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: marsmoon.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.