31 static atm_t atm, atm2;
38 char filename[
LEN], losbase[
LEN];
44 ERRMSG(
"Give parameters: <ctl> <obs> <atm>");
50 scan_ctl(argc, argv,
"LOSBASE", -1,
"los", losbase);
59 LOG(1,
"Write raytrace data: raytrace.tab");
62 if (!(out = fopen(
"raytrace.tab",
"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);
91 for (
int ip = 0; ip < los.
np; ip++) {
93 atm2.
z[ip] = los.
z[ip];
94 atm2.
lon[ip] = los.
lon[ip];
95 atm2.
lat[ip] = los.
lat[ip];
96 atm2.
p[ip] = los.
p[ip];
97 atm2.
t[ip] = los.
t[ip];
98 for (
int ig = 0; ig < ctl.
ng; ig++)
99 atm2.
q[ig][ip] = los.
q[ip][ig];
100 for (
int iw = 0; iw < ctl.
nw; iw++)
101 atm2.
k[iw][ip] = NAN;
105 sprintf(filename,
"los.%d", ir);
110 for (
int ig = 0; ig < ctl.
ng; ig++)
112 for (
int ip = 0; ip < los.
np; ip++) {
114 for (
int ig = 0; ig < ctl.
ng; ig++)
115 u[ig] += los.
u[ip][ig];
119 fprintf(out,
"%.2f %g %g %g %g %g %g %g %g %g %d %g",
123 for (
int ig = 0; ig < ctl.
ng; ig++)
124 fprintf(out,
" %g", u[ig]);
void write_atm(const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm)
Write atmospheric data.
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
void raytrace(const ctl_t *ctl, const atm_t *atm, obs_t *obs, los_t *los, const int ir)
Do ray-tracing to determine LOS.
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric data.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation data.
double scan_ctl(int argc, char *argv[], const char *varname, int arridx, const char *defvalue, char *value)
Search control parameter file for variable entry.
JURASSIC library declarations.
#define LEN
Maximum length of ASCII data lines.
#define ERRMSG(...)
Print error message and quit program.
#define NG
Maximum number of emitters.
#define LOG(level,...)
Print log message.
int main(int argc, char *argv[])
double time[NP]
Time (seconds since 2000-01-01T00:00Z).
double k[NW][NP]
Extinction [km^-1].
double lat[NP]
Latitude [deg].
double lon[NP]
Longitude [deg].
double t[NP]
Temperature [K].
int np
Number of data points.
double z[NP]
Altitude [km].
double q[NG][NP]
Volume mixing ratio [ppv].
double p[NP]
Pressure [hPa].
Forward model control parameters.
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 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.