51 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
52 "Usage: zenith <ctl> <obs> [KEY VALUE ...]\n\n"
53 "Use -h for full help.");
57 const double t0 =
scan_ctl(argc, argv,
"T0", -1,
"0", NULL);
58 const double t1 =
scan_ctl(argc, argv,
"T1", -1,
"0", NULL);
59 const double dt =
scan_ctl(argc, argv,
"DT", -1,
"1", NULL);
60 const double vpz =
scan_ctl(argc, argv,
"VPZ", -1,
"700", NULL);
61 const double theta0 =
scan_ctl(argc, argv,
"THETA0", -1,
"-90.0", NULL);
62 const double theta1 =
scan_ctl(argc, argv,
"THETA1", -1,
"90.0", NULL);
63 const double dtheta =
scan_ctl(argc, argv,
"DTHETA", -1,
"3.0", NULL);
64 const double obsz =
scan_ctl(argc, argv,
"OBSZ", -1,
"0", NULL);
67 const double ro =
RE + obsz;
68 const double rv =
RE + vpz;
71 for (
double t = t0; t <= t1; t += dt) {
72 for (
double theta = theta0; theta <= theta1 + 1e-12; theta += dtheta) {
79 const double th =
DEG2RAD(theta);
80 const double sth = sin(th);
81 const double cth = cos(th);
94 double disc = rv * rv - ro * ro * sth * sth;
96 if (disc > -1e-12 * rv * rv)
107 const double sq = sqrt(disc);
108 const double s1 = -ro * cth - sq;
109 const double s2 = -ro * cth + sq;
115 if (s2 >= 0.0 && s2 < s)
123 const double bx = s * sth;
124 const double bz = ro + s * cth;
132 const double beta = atan2(bx, bz);
137 obs.
vpz[obs.
nr] = vpz;
157 printf(
"\nJURASSIC zenith-geometry tool.\n\n");
158 printf(
"Create observation geometry for zenith observations in the\n");
159 printf(
"meridional 2-D setup used by JURASSIC.\n\n");
161 printf(
" zenith <ctl> <obs> [KEY VALUE ...]\n\n");
162 printf(
"Arguments:\n");
163 printf(
" <ctl> Control file.\n");
164 printf(
" <obs> Output observation geometry file.\n");
165 printf(
" [KEY VALUE] Optional control parameters.\n\n");
166 printf(
"Tool-specific control parameters:\n");
167 printf(
" VPZ View-point altitude [km].\n");
168 printf(
" OBSZ Observer altitude [km].\n");
169 printf(
" T0, T1, DT Time range and spacing.\n");
170 printf(
" THETA0, THETA1 Zenith-angle range.\n");
171 printf(
" DTHETA Zenith-angle spacing.\n\n");
172 printf(
"Common control parameters:\n");
173 printf(
" OBSFMT Output observation file format.\n");
175 (
" ND, NU[i] Spectral channels in observation files.\n\n");
176 printf(
"Further information:\n");
177 printf(
" Manual: https://slcs-jsc.github.io/jurassic/\n");
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void write_obs(const char *dirname, const char *filename, const ctl_t *ctl, const obs_t *obs, int profile)
Write observation data to an output file in ASCII or binary format.
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 RE
Mean radius of Earth [km].
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
#define DEG2RAD(deg)
Convert degrees to radians.
#define RAD2DEG(rad)
Convert radians to degrees.
#define NR
Maximum number of ray paths.
Observation geometry and radiance data.
double vpz[NR]
View point altitude [km].
double vplat[NR]
View point latitude [deg].
double obsz[NR]
Observer altitude [km].
double time[NR]
Time (seconds since 2000-01-01T00:00Z).
int nr
Number of ray paths.
int main(int argc, char *argv[])