41 {
42
44
45 static FILE *out;
46
47 static double numin[
NB], numax[
NB], rad[
NB];
48
49 static int iarg, ib, ichan, n, nb, track, xtrack, format;
50
51
52 if (argc < 4)
53 ERRMSG("Give parameters: <ctl> <out.tab> <l1b_file1> [<l1b_file2> ...]");
54
55
57
58
59 nb = (int) scan_ctl(argc, argv, "NB", -1, "1", NULL);
61 ERRMSG("Too many bands!");
62 for (ib = 0; ib < nb; ib++) {
63 numin[ib] = scan_ctl(argc, argv, "NUMIN", ib, "", NULL);
64 numax[ib] = scan_ctl(argc, argv, "NUMAX", ib, "", NULL);
65 }
66 format = (int) scan_ctl(argc, argv, "FORMAT", -1, "1", NULL);
67
68
69 printf("Write band data: %s\n", argv[2]);
70 if (!(out = fopen(argv[2], "w")))
71 ERRMSG("Cannot create file!");
72
73
74 for (iarg = 3; iarg < argc; iarg++) {
75
76
77 printf("Read IASI Level-1C data file: %s\n", argv[iarg]);
79
80
81 if (iarg == 3) {
82 fprintf(out,
83 "# $1 = time [s]\n"
84 "# $2 = footprint longitude [deg]\n"
85 "# $3 = footprint latitude [deg]\n"
86 "# $4 = satellite altitude [km]\n"
87 "# $5 = satellite longitude [deg]\n"
88 "# $6 = satellite latitude [deg]\n");
89 for (ib = 0; ib < nb; ib++)
90 fprintf(out,
91 "# $%d = BT(%.2f/cm...%.2f/cm) [K]\n",
92 7 + ib, numin[ib], numax[ib]);
93 }
94
95
96 for (track = 0; track < iasi_rad->
ntrack; track++) {
97
98
99 fprintf(out, "\n");
100
101
102 for (xtrack = 0; xtrack <
L1_NXTRACK; xtrack++) {
103
104
105 fprintf(out, "%.2f %.4f %.4f %.3f %.4f %.4f",
106 iasi_rad->
Time[track][xtrack],
109 iasi_rad->
Sat_z[track],
111
112
113 for (ib = 0; ib < nb; ib++) {
114
115
116 n = 0;
117 rad[ib] = 0;
119 if (iasi_rad->
freq[ichan] >= numin[ib]
120 && iasi_rad->
freq[ichan] <= numax[ib]
121 && gsl_finite(iasi_rad->
Rad[track][xtrack][ichan])) {
122 rad[ib] += iasi_rad->
Rad[track][xtrack][ichan];
123 n++;
124 }
125 if (n > 0)
126 rad[ib] /= n;
127 else
128 rad[ib] = GSL_NAN;
129
130
131 rad[ib] = BRIGHT(rad[ib], 0.5 * (numin[ib] + numax[ib]));
132
133
134 fprintf(out, " %.3f", rad[ib]);
135 }
136
137
138 fprintf(out, "\n");
139 }
140 }
141 }
142
143
144 fclose(out);
145
146
147 free(iasi_rad);
148
149 return EXIT_SUCCESS;
150}
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.
double Sat_z[L1_NTRACK]
Altitude 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.