38 char filename[2 *
LEN], losbase[
LEN];
44 ERRMSG(
"Give parameters: <ctl> <obs> <atm> <raytrace.tab>");
50 scan_ctl(argc, argv,
"LOSBASE", -1,
"los", losbase);
59 LOG(1,
"Write raytrace data: %s", argv[4]);
62 if (!(out = fopen(argv[4],
"w")))
63 ERRMSG(
"Cannot create file!");
67 "# $1 = time (seconds since 2000-01-01T00:00Z)\n"
68 "# $2 = observer altitude [km]\n"
69 "# $3 = observer longitude [deg]\n"
70 "# $4 = observer latitude [deg]\n"
71 "# $5 = view point altitude [km]\n"
72 "# $6 = view point longitude [deg]\n"
73 "# $7 = view point latitude [deg]\n"
74 "# $8 = tangent point altitude [km]\n"
75 "# $9 = tangent point longitude [deg]\n"
76 "# $10 = tangent point latitude [deg]\n"
77 "# $11 = ray path index\n" "# $12 = ray path length [km]\n");
78 for (
int ig = 0; ig < ctl.
ng; ig++)
79 fprintf(out,
"# $%d = %s column density [molec/cm^2]\n",
84 for (
int ir = 0; ir < obs.
nr; ir++) {
87 raytrace(&ctl, &atm, &obs, &los, ir);
90 sprintf(filename,
"%s.%d.tab", losbase, ir);
93 LOG(1,
"Write LOS data: %s", filename);
96 if (!(out2 = fopen(filename,
"w")))
97 ERRMSG(
"Cannot create file!");
101 "# $1 = time (seconds since 2000-01-01T00:00Z)\n"
102 "# $2 = altitude [km]\n"
103 "# $3 = longitude [deg]\n"
104 "# $4 = latitude [deg]\n"
105 "# $5 = pressure [hPa]\n" "# $6 = temperature [K]\n");
106 for (
int ig = 0; ig < ctl.
ng; ig++)
107 fprintf(out2,
"# $%d = %s volume mixing ratio [ppv]\n",
109 for (
int iw = 0; iw < ctl.
nw; iw++)
110 fprintf(out2,
"# $%d = extinction (window %d) [km^-1]\n",
111 7 + ctl.
ng + iw, iw);
115 for (
int ip = 0; ip < los.
np; ip++) {
116 fprintf(out2,
"%.2f %g %g %g %g %g", obs.
time[ir], los.
z[ip],
117 los.
lon[ip], los.
lat[ip], los.
p[ip], los.
t[ip]);
118 for (
int ig = 0; ig < ctl.
ng; ig++)
119 fprintf(out2,
" %g", los.
q[ip][ig]);
120 for (
int iw = 0; iw < ctl.
nw; iw++)
121 fprintf(out2,
" %g", los.
k[ip][iw]);
130 for (
int ig = 0; ig < ctl.
ng; ig++)
132 for (
int ip = 0; ip < los.
np; ip++) {
134 for (
int ig = 0; ig < ctl.
ng; ig++)
135 u[ig] += los.
u[ip][ig];
139 fprintf(out,
"%.2f %g %g %g %g %g %g %g %g %g %d %g",
143 for (
int ig = 0; ig < ctl.
ng; ig++)
144 fprintf(out,
" %g", u[ig]);
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void raytrace(const ctl_t *ctl, const atm_t *atm, obs_t *obs, los_t *los, const int ir)
Perform line-of-sight (LOS) ray tracing through the atmosphere.
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric profile data from an ASCII file.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation geometry and radiance data from an ASCII file.
double scan_ctl(int argc, char *argv[], const char *varname, const int arridx, const char *defvalue, char *value)
Scan control file or command-line arguments for a configuration variable.
JURASSIC library declarations.
#define LEN
Maximum length of ASCII data lines.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define NG
Maximum number of emitters.
#define LOG(level,...)
Print a log message with a specified logging level.
int main(int argc, char *argv[])
Atmospheric profile data.
int nw
Number of spectral windows.
int ng
Number of emitters.
char emitter[NG][LEN]
Name of each emitter.
double z[NLOS]
Altitude [km].
double q[NLOS][NG]
Volume mixing ratio [ppv].
double lon[NLOS]
Longitude [deg].
double ds[NLOS]
Segment length [km].
int np
Number of LOS points.
double u[NLOS][NG]
Column density [molecules/cm^2].
double lat[NLOS]
Latitude [deg].
double k[NLOS][ND]
Extinction [km^-1].
double t[NLOS]
Temperature [K].
double p[NLOS]
Pressure [hPa].
Observation geometry and radiance data.
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.