30 {
31
33
34 FILE *out;
35
36 double dmin = 1e100, x0[3], x1[3];
37
38 int ichan, track = -1, track2, xtrack = -1, xtrack2, format;
39
40
41 if (argc < 7)
42 ERRMSG("Give parameters: <ctl> <iasi_l1b_file> "
43 "[index <track> <xtrack> | geo <lon> <lat>] <spec.tab>");
44
45
46 format = (int) scan_ctl(argc, argv, "FORMAT", -1, "1", NULL);
47
48
50
51
52 printf("Read IASI Level-1C data file: %s\n", argv[2]);
54
55
56 if (argv[3][0] == 'i') {
57 track = atoi(argv[4]);
58 xtrack = atoi(argv[5]);
59 }
60
61
62 else {
63 geo2cart(0, atof(argv[4]), atof(argv[5]), x0);
64 for (track2 = 0; track2 < iasi_rad->
ntrack; track2++)
65 for (xtrack2 = 0; xtrack2 <
L1_NXTRACK; xtrack2++) {
66 geo2cart(0, iasi_rad->
Longitude[track2][xtrack2],
67 iasi_rad->
Latitude[track2][xtrack2], x1);
68 if (DIST2(x0, x1) < dmin) {
69 dmin = DIST2(x0, x1);
70 track = track2;
71 xtrack = xtrack2;
72 }
73 }
74 if (dmin > 2500)
75 ERRMSG("Geolocation not covered by granule!");
76 }
77
78
79 if (track < 0 || track >= iasi_rad->
ntrack)
80 ERRMSG("Along-track index out of range!");
82 ERRMSG("Across-track index out of range!");
83
84
85 printf("Write spectrum: %s\n", argv[6]);
86 if (!(out = fopen(argv[6], "w")))
87 ERRMSG("Cannot create file!");
88
89
90 fprintf(out,
91 "# $1 = time (seconds since 01-JAN-2000, 00:00 UTC)\n"
92 "# $2 = satellite longitude [deg]\n"
93 "# $3 = satellite latitude [deg]\n"
94 "# $4 = footprint longitude [deg]\n"
95 "# $5 = footprint latitude [deg]\n"
96 "# $6 = wavenumber [cm^-1]\n"
97 "# $7 = brightness temperature [K]\n"
98 "# $8 = radiance [W/(m^2 sr cm^-1)]\n\n");
99
100
102 fprintf(out, "%.2f %g %g %g %g %g %g %g\n",
103 iasi_rad->
Time[track][xtrack],
108 iasi_rad->
freq[ichan],
109 BRIGHT(iasi_rad->
Rad[track][xtrack][ichan],
110 iasi_rad->
freq[ichan]),
111 iasi_rad->
Rad[track][xtrack][ichan]);
112
113
114 fclose(out);
115
116
117 free(iasi_rad);
118
119 return EXIT_SUCCESS;
120}
void iasi_read(int format, char *filename, iasi_rad_t *iasi_rad)
Read IASI Level-1 data.
#define L1_NXTRACK
Across-track size of IASI radiance granule (don't change).
#define IASI_L1_NCHAN
Number of channels of IASI radiance granule.
IASI converted Level-1 radiation data.
double Longitude[L1_NTRACK][L1_NXTRACK]
Longitude of the sounder pixel.
double Latitude[L1_NTRACK][L1_NXTRACK]
Latitude of the sounder pixel.
double Time[L1_NTRACK][L1_NXTRACK]
Seconds since 2000-01-01 for each sounder pixel.
double freq[IASI_L1_NCHAN]
channel wavenumber [cm^-1]
int ntrack
Number of along-track samples.
double Sat_lon[L1_NTRACK]
Estimated longitude of the satellite.
float Rad[L1_NTRACK][L1_NXTRACK][IASI_L1_NCHAN]
Radiance [W/(m^2 sr cm^-1)].
double Sat_lat[L1_NTRACK]
Estimated latitude of the satellite.