#include #include "hdfi.h" #include int get_position(string,scclock,pos_gse) struct dsc$descriptor_s *string; float64 *scclock; /* use float64 for spacecraft clock, since some */ /* ancillary functions need sub-second resolution */ float32 pos_gse[3]; { uint32 ACE_position_GSE(); /* function in ancil_subs.c */ char c; char newstring[100] = ""; int j; /* Convert Fortran character string to C character string */ for (j = 0; j < string->dsc$w_length; ++j) { c = string->dsc$a_pointer[j]; /* extract Fortran string characters */ if ( c != ' ' ) strcat(newstring,&c); /* build C character string */ } printf("ACE ancillary read routine GET_position\n"); printf("File name is <%s>\n", newstring); if (*scclock==0 | newstring[0]==' ') { printf("Usage: get_position hdf_file scclock\n"); return(1); } /* load the data from the HDF file */ /* init_ACEancillary() exits if there is an error */ init_ACEancillary(newstring); /* get the position (km) in GSE coordinates corresponding to the spacecraft clock */ if((ACE_position_GSE(*scclock, pos_gse)) == -1){ fprintf(stdout,"scclock out of bounds\n"); fprintf(stdout,"SCCLOCK = %f\n",*scclock); } else fprintf(stdout,"%f %f %f\n",pos_gse[0],pos_gse[1],pos_gse[2]); return(0); }