AIRS Code Collection
orbit.c
Go to the documentation of this file.
1/*
2 This file is part of the AIRS Code Collection.
3
4 the AIRS Code Collections is free software: you can redistribute it
5 and/or modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation, either version 3 of
7 the License, or (at your option) any later version.
8
9 The AIRS Code Collection is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with the AIRS Code Collection. If not, see
16 <http://www.gnu.org/licenses/>.
17
18 Copyright (C) 2019-2025 Forschungszentrum Juelich GmbH
19*/
20
26#include "libairs.h"
27
28int main(
29 int argc,
30 char *argv[]) {
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
AIRS Code Collection library declarations.
int main(int argc, char *argv[])
Definition: orbit.c:28