<<<<<< README for orbit data of EXOS-D. >>>>>> Ver 1.0 Feb. 13, 1992 by H. Hayakawa Ver 1.1 Aug. 12, 1992 by H. Hayakawa Ver 2.0 Aug. 2, 1993 by H. Hayakawa Ver 2.1 Sep. 1, 1995 by K. Kobayashi This document describe the format and sample programs to read the orbit data for the EXOS-D science data base. ++++++++++++++++++++++++++++ +++ Part 1 : Data Format +++ ++++++++++++++++++++++++++++ 0) Location of Files : /sdb/yymm on yugiri or akebono 1) File Name : yymm.orb 2) Record size : 74 bytes / record 3) File Format : First record containes start time, end time and the number of data records in the file. They are written with ASCII codes as follows. yymmddhhmmss(start time) yymmddhhmmss(end time) #(data records) If you are using MS-DOS machines, you can see these informations by typing the command [type filename]. e.g. A> type 8910.orb 891001000000 891101000130 22321 <#(data)> All the other records are data records. 4) Data Record Format : Data records consist of 2 bytes time tag and 4 data packages ( 18 bytes each). no. name length unit note ------------------------------------------------ 0 time tag I2 2min. Package 0 2 Height-0 I2 0.2 km geodetic 4 CLAT-0 I2(S) 0.01 deg corrected coordinate 6 CMLT-0 I2(S) 0.001 hr. corrected coordinate 8 LAT-0 I2(S) 0.01 Geodetic Latitude 10 LON-0 I2 0.01 Geodetic Longitude 12 GLAT-0 I2(S) 0.01 deg Geomagnetic Latitude 14 GMLT-0 I2(S) 1/1500 hr. MLT(-12 => +12 hour) 16 GCLAT-0 I2(S) 0.01 deg Geodetic Latitude at footprint 18 GCLON-0 I2 0.01 deg Geodetic Longitude at footprint Package 1 20 Height-1 I2 0.2 km 22 CLAT-1 I2(S) 0.01 deg corrected coordinate 24 CMLT-1 I2(S) 0.001 hr. corrected coordinate 26 LAT-1 I2(S) 0.01 Geodetic Latitude 28 LON-1 I2 0.01 Geodetic Longitude 30 GLAT-1 I2(S) 0.01 deg Geomagnetic Latitude 32 GMLT-1 I2(S) 1/1500 hr. MLT(-12 => +12 hour) 34 GCLAT-1 I2(S) 0.01 deg Geodetic Latitude at footprint 36 GCLON-1 I2 0.01 deg Geodetic Longitude at footprint Package 2 38 Height-2 I2 0.2 km 40 CLAT-2 I2(S) 0.01 deg corrected coordinate 42 CMLT-2 I2(S) 0.001 hr. corrected coordinate 44 LAT-2 I2(S) 0.01 Geodetic Latitude 46 LON-2 I2 0.01 Geodetic Longitude 48 GLAT-2 I2(S) 0.01 deg Geomagnetic Latitude 50 GMLT-2 I2(S) 1/1500 hr. MLT(-12 => +12 hour) 52 GCLAT-2 I2(S) 0.01 deg Geodetic Latitude at footprint 54 GCLON-2 I2 0.01 deg Geodetic Longitude at footprint Package 3 56 Height-3 I2 0.2 km 58 CLAT-3 I2(S) 0.01 deg corrected coordinate 60 CMLT-3 I2(S) 0.001 hr. corrected coordinate 62 LAT-3 I2(S) 0.01 Geodetic Latitude 64 LON-3 I2 0.01 Geodetic Longitude 66 GLAT-3 I2(S) 0.01 deg Geomagnetic Latitude 68 GMLT-3 I2(S) 1/1500 hr. MLT(-12 => +12 hour) 70 GCLAT-3 I2(S) 0.01 deg Geodetic Latitude at footprint 72 GCLON-3 I2 0.01 deg Geodetic Longitude at footprint Note: 2 bytes data are always lower byte first. ( Same as 80xxx series MPU ) Variables sould be declared as "signed" type when "length" of Date_Record_Format is "I2(S)". While we could not convert usual_orbit_coordinate_system to corrected_coordinate_system ( near the equator ), CLAT and CMLT values are "0x8000" ( = -32768 ). Corresponding time for each four data package (package 0 - 3) is derived as T = (start time) + (time tag) * 2 min + (package no) * 30 sec ++++++++++++++++++++++++++++++++ +++ Part 2 : Sample Programs +++ ++++++++++++++++++++++++++++++++ <<< MS-DOS Machine. (Borland-C) >>> ------------------------------------------------------------------------- #include #include #include /* This program assumes that argv[1] points the name of orbit data. Therefore calling sequence of this program is program_name orbit_file_name i.e. A>readorb 8910.orb ( In this case, this program is compiles under the name readorb.) */ int main(int argc, char *argv[]) { int orb_file; unsigned char buf[74]; short int cur_hour,cur_min,cur_sec; unsigned short int tmp,*ptr_i,no,i; signed int tmk; /* by K */ short int st_hour,st_min,st_sec; long int st_day,st_time,cur_day; float ht,clat,cmlt,lat,lon,glat,gmlt,gclat,gclon; /* open orbit file */ if(-1==(orb_file=open(argv[1],O_RDONLY|O_BINARY))) { printf("Can't open file :%s\n",argv[1]); exit(1); } /* read message record */ if(74 != read(orb_file,buf,74)) { printf("Abnormal file format.\n"); close(orb_file); exit(1); } sscanf(buf,"%6lD",&st_day); sscanf(&buf[6],"%6lD",&st_time); st_hour = st_time / 10000; st_sec = st_time - st_hour * 10000; st_min = st_sec / 100; st_sec -= st_min * 100; printf(" time height CLAT CMLT lat lon GLAT GMLT GCLAT GCLON\n"); printf(" (km) (deg) (hr) (deg) (deg) (deg) (hr) (deg) (deg)\n"); /* read data record */ while(74==read(orb_file,buf,74)) { no = (int)buf[0]; cur_day = st_day + no/720; /* get current day */ no -= int(no/720)*720; no *= 2; cur_hour = st_hour; cur_min = no + st_min; /* get current minute */ while(60 <= cur_min) { cur_min -= 60; cur_hour += 1; if(24<=cur_hour) { cur_hour -= 24; cur_day += 1; } } cur_sec = 0; ptr_i = &buf[2]; /* decode each package data */ for(i=0;i<4;i++) { tmp = *ptr_i++; ht = (float)tmp * 0.2; tmk = *ptr_i++; clat = (float)tmk * 0.01; /* CLAT; -90 -> 90 */ tmk = *ptr_i++; cmlt = (float)tmk * 0.001; /* CMLT; -12 -> 12 */ tmk = *ptr_i++; lat = (float)tmk * 0.01; /* LAT; -90 -> 90 */ tmp = *ptr_i++; lon = (float)tmp * 0.01; /* LON; 0 -> 360 */ tmk = *ptr_i++; glat = (float)tmk * 0.01; /* GLAT; -90 -> 90 */ tmk = *ptr_i++; gmlt = (float)tmk / 1500; /* GMLT; -12 -> 12 */ tmk = *ptr_i++; gclat = (float)tmk * 0.01; /* GCLAT; -90 -> 90 */ tmp = *ptr_i++; gclon = (float)tmp * 0.01; /* GCLON; 0 -> 360 */ printf(" %02d%02d%02d %7.1f %6.1f %6.2f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n", cur_hour,cur_min,cur_sec, ht, clat, cmlt, lat, lon, glat,gmlt,gclat,gclon); /* calculate time for next data */ cur_sec += 30; if(60 <= cur_sec) { cur_min += 1; cur_sec -=60; if(60 <= cur_min) { cur_hour += 1; cur_min -= 60; if(24 <= cur_hour) { cur_hour -= 24; } } } } } close(orb_file); return(0); } <<< UNIX Machine. (SUN) >>> ------------------------------------------------------------------------- #include #include /* This program assumes that argv[1] points the name of orbit data. Therefore calling sequence of this program is program_name orbit_file_name i.e. A>readorb 8910.orb ( In this case, this program is compiles under the name readorb.) */ int main(int argc, char *argv[]) { int orb_file; unsigned char buf[74],*ptr_c; unsigned char lo_byte,hi_byte; char lo_s_byte,hi_s_byte; /* by K*/ short int cur_hour,cur_min,cur_sec; short int st_hour,st_min,st_sec; unsigned short int no,i; unsigned int tmp; signed int tmk; /* by K*/ long st_day,st_time,cur_day; float ht,clat,cmlt,lat,lon,glat,gmlt,gclat,gclon; /* open orbit file */ if(2 < argc) { printf("No orbit data is assigned.\n"); exit(1); } if(-1==(orb_file=open(argv[1],O_RDONLY))) { printf("Can't open file :%s\n",argv[1]); exit(1); } /* read message record */ if ( 74 != (i=read(orb_file,buf,74)) ) { printf("Abnormal file length(%d).\n",i); close(orb_file); exit(1); } sscanf(buf,"%6lD",&st_day); sscanf(&buf[6],"%6lD",&st_time); printf("orbit data %06ld\n",st_day); st_hour = st_time / 10000; st_sec = st_time % 10000; st_min = st_sec / 100; st_sec = st_sec % 100; printf(" day time height CLAT CMLT lat lon GLAT GMLT GCLAT GCLON\n"); printf(" (km) (deg) (hr) (deg) (deg) (deg) (hr) (deg) (deg)\n"); /* read data record */ while(74==read(orb_file,buf,74)) { ptr_c = buf; no = *ptr_c + (int)*(ptr_c+1)*256; ptr_c +=2; cur_day = st_day + no/720; /* "no"/720 -> days */ no = no % 720; no *= 2; cur_hour = st_hour; cur_min = no + st_min; /* get current minute */ while(60 <= cur_min) { cur_min -= 60; cur_hour += 1; } if(24 <= cur_hour) { cur_hour -= 24; cur_day += 1; } cur_sec = st_sec; /* decode each package data */ for(i=0;i<4;i++) { lo_byte = *ptr_c++; hi_byte = *ptr_c++; tmp = ( (unsigned int)hi_byte << 8 ) | lo_byte; ht = (float)tmp * 0.2; lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ clat = (float)tmk * 0.01; /* CLAT; -90 -> 90 */ lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ cmlt = (float)tmk * 0.001; /* CMLT; -12 -> 12 */ lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ lat = (float)tmk * 0.01; /* XXLAT; -90 -> 90 */ lo_byte = *ptr_c++; hi_byte = *ptr_c++; tmp = ( (unsigned int)hi_byte << 8 ) | lo_byte; lon = (float)tmp * 0.01; /* XXLON; 0 -> 360 */ lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ glat = (float)tmk * 0.01; /* GLAT; -90 -> 90 */ lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ gmlt = (float)tmk / 1500; /* GMLT; -12 -> 12 */ lo_byte = *ptr_c++; hi_s_byte = *ptr_c++; /* by K*/ tmk = ( (signed int)hi_s_byte << 8 ) | lo_byte; /* by K*/ gclat = (float)tmk * 0.01; lo_byte = *ptr_c++; hi_byte = *ptr_c++; tmp = ( (unsigned int)hi_byte << 8 ) | lo_byte; gclon = (float)tmp * 0.01; printf("%06ld %02d%02d%02d %7.1f %6.1f %6.2f %6.1f %6.1f %6.1f %6.1f %6.1f %6.1f\n", cur_day, cur_hour,cur_min,cur_sec, ht, clat, cmlt, lat, lon, glat,gmlt,gclat,gclon); /* calculate time for next data */ cur_sec += 30; if(60 <= cur_sec) { cur_min += 1; cur_sec -=60; if(60 <= cur_min) { cur_hour += 1; cur_min -= 60; if(24 <= cur_hour) { cur_hour -= 24; } } } } } close(orb_file); exit(0); }