42 {
43
45
47
48 FILE *out;
49
50
52
53
54 if (argc < 4)
55 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
56 "Usage: obs2spec <ctl> <obs> <spec.tab> [KEY VALUE ...]\n\n"
57 "Use -h for full help.");
58
59
61
62
64
65
66 read_obs(NULL, argv[2], &ctl, obs, 0);
67
68
69 LOG(1,
"Write spectra: %s", argv[3]);
70
71
72 if (!(out = fopen(argv[3], "w")))
73 ERRMSG(
"Cannot create file!");
74
75
76 fprintf(out,
77 "# $1 = time (seconds since 2000-01-01T00:00Z)\n"
78 "# $2 = observer altitude [km]\n"
79 "# $3 = observer longitude [deg]\n"
80 "# $4 = observer latitude [deg]\n"
81 "# $5 = view point altitude [km]\n"
82 "# $6 = view point longitude [deg]\n"
83 "# $7 = view point latitude [deg]\n"
84 "# $8 = tangent point altitude [km]\n"
85 "# $9 = tangent point longitude [deg]\n"
86 "# $10 = tangent point latitude [deg]\n"
87 "# $11 = channel frequency [cm^-1]\n"
88 "# $12 = channel radiance [W/(m^2 sr cm^-1)]\n"
89 "# $13 = channel transmittance [1]\n");
90
91
92 for (
int ir = 0; ir < obs->
nr; ir++) {
93 fprintf(out, "\n");
94 for (
int id = 0;
id < ctl.
nd;
id++)
95 fprintf(out, "%.2f %g %g %g %g %g %g %g %g %g %.4f %g %g\n",
100 }
101
102
103 fclose(out);
104
105
106 free(obs);
107
108 return EXIT_SUCCESS;
109}
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs, int profile)
Read observation data from an input file.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
#define ALLOC(ptr, type, n)
Allocate memory for an array.
#define LOG(level,...)
Print a log message with a specified logging level.
double nu[ND]
Centroid wavenumber of each channel [cm^-1].
int nd
Number of radiance channels.
Observation geometry and radiance data.
double tau[ND][NR]
Transmittance of ray path.
double rad[ND][NR]
Radiance [W/(m^2 sr cm^-1)].
double tplon[NR]
Tangent point longitude [deg].
double vpz[NR]
View point altitude [km].
double vplat[NR]
View point latitude [deg].
double obslon[NR]
Observer longitude [deg].
double obslat[NR]
Observer latitude [deg].
double obsz[NR]
Observer altitude [km].
double tplat[NR]
Tangent point latitude [deg].
double vplon[NR]
View point longitude [deg].
double time[NR]
Time (seconds since 2000-01-01T00:00Z).
double tpz[NR]
Tangent point altitude [km].
int nr
Number of ray paths.