AIRS Code Collection
Functions
orbit.c File Reference

Extract AIRS/Aqua orbit data. More...

#include "libairs.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Extract AIRS/Aqua orbit data.

Definition in file orbit.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 28 of file orbit.c.

30 {
31
32 static airs_rad_gran_t airs_rad_gran;
33
34 FILE *out;
35
36 /* Check arguments... */
37 if (argc < 3)
38 ERRMSG
39 ("Give parameters: <orbit.tab> <airs_l1b_file> [ <airs_l1b_file2> ... ]");
40
41 /* Create file... */
42 printf("Write orbit data: %s\n", argv[1]);
43 if (!(out = fopen(argv[1], "w")))
44 ERRMSG("Cannot create file!");
45
46 /* Write header... */
47 fprintf(out,
48 "# $1 = time (seconds since 01-JAN-2000, 00:00 UTC)\n"
49 "# $2 = satellite longitude [deg]\n"
50 "# $3 = satellite latitude [deg]\n"
51 "# $4 = footprint longitude [deg]\n"
52 "# $5 = footprint latitude [deg]\n");
53
54 /* Loop over files... */
55 for (int i = 2; i < argc; i++) {
56
57 /* Read AIRS data... */
58 printf("Read AIRS Level-1B data file: %s\n", argv[i]);
59 airs_rad_rdr(argv[i], &airs_rad_gran);
60
61 /* Write data... */
62 for (int track = 0; track < AIRS_RAD_GEOTRACK; track++) {
63 fprintf(out, "\n");
64 for (int xtrack = 0; xtrack < AIRS_RAD_GEOXTRACK; xtrack++)
65 fprintf(out, "%.2f %g %g %g %g\n",
66 airs_rad_gran.Time[track][xtrack] - 220838400,
67 airs_rad_gran.sat_lon[track],
68 airs_rad_gran.sat_lat[track],
69 airs_rad_gran.Longitude[track][xtrack],
70 airs_rad_gran.Latitude[track][xtrack]);
71 }
72 }
73
74 /* Close file... */
75 fclose(out);
76
77 return EXIT_SUCCESS;
78}
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237