JURASSIC
limb.c
Go to the documentation of this file.
1/*
2 This file is part of JURASSIC.
3
4 JURASSIC is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 JURASSIC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with JURASSIC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2003-2026 Forschungszentrum Juelich GmbH
18*/
19
25#include "jurassic.h"
26
27/* ------------------------------------------------------------
28 Functions...
29 ------------------------------------------------------------ */
30
32static void usage(
33 void);
34
35/* ------------------------------------------------------------
36 Main...
37 ------------------------------------------------------------ */
38
39int main(
40 int argc,
41 char *argv[]) {
42
43 static ctl_t ctl;
44 static obs_t obs;
45
46 /* Print usage information... */
47 USAGE;
48
49 /* Check arguments... */
50 if (argc < 3)
51 ERRMSG("Missing or invalid command-line arguments.\n\n"
52 "Usage: limb <ctl> <obs> [KEY VALUE ...]\n\n"
53 "Use -h for full help.");
54
55 /* Read control parameters... */
56 read_ctl(argc, argv, &ctl);
57 const double obsz = scan_ctl(argc, argv, "OBSZ", -1, "780", NULL);
58 const double t0 = scan_ctl(argc, argv, "T0", -1, "0", NULL);
59 const double t1 = scan_ctl(argc, argv, "T1", -1, "0", NULL);
60 const double dt = scan_ctl(argc, argv, "DT", -1, "1", NULL);
61 const double z0 = scan_ctl(argc, argv, "Z0", -1, "3", NULL);
62 const double z1 = scan_ctl(argc, argv, "Z1", -1, "68", NULL);
63 const double dz = scan_ctl(argc, argv, "DZ", -1, "1", NULL);
64
65 /* Create measurement geometry... */
66 for (double t = t0; t <= t1; t += dt)
67 for (double z = z0; z <= z1; z += dz) {
68 obs.time[obs.nr] = t;
69 obs.obsz[obs.nr] = obsz;
70 obs.vpz[obs.nr] = z;
71 obs.vplat[obs.nr] = 180 / M_PI * acos((RE + z) / (RE + obsz));
72 if ((++obs.nr) >= NR)
73 ERRMSG("Too many rays!");
74 }
75
76 /* Write observation data... */
77 write_obs(NULL, argv[2], &ctl, &obs, 0);
78
79 return EXIT_SUCCESS;
80}
81
82/*****************************************************************************/
83
84static void usage(
85 void) {
86 printf("\nJURASSIC limb-geometry tool.\n\n");
87 printf("Create observation geometry for a limb sounding instrument.\n\n");
88 printf("Usage:\n");
89 printf(" limb <ctl> <obs> [KEY VALUE ...]\n\n");
90 printf("Arguments:\n");
91 printf(" <ctl> Control file.\n");
92 printf(" <obs> Output observation geometry file.\n");
93 printf(" [KEY VALUE] Optional control parameters.\n\n");
94 printf("Tool-specific control parameters:\n");
95 printf(" OBSZ Observer altitude [km].\n");
96 printf(" T0, T1, DT Time range and spacing.\n");
97 printf(" Z0, Z1, DZ Tangent-altitude range and spacing.\n\n");
98 printf("Common control parameters:\n");
99 printf(" OBSFMT Output observation file format.\n");
100 printf
101 (" ND, NU[i] Spectral channels in observation files.\n\n");
102 printf("Further information:\n");
103 printf(" Manual: https://slcs-jsc.github.io/jurassic/\n");
104}
void usage(void)
Print command-line help.
Definition: formod.c:163
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
Definition: jurassic.c:5516
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.
Definition: jurassic.c:8275
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.
Definition: jurassic.c:6612
JURASSIC library declarations.
#define RE
Mean radius of Earth [km].
Definition: jurassic.h:224
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: jurassic.h:1325
#define USAGE
Print usage information on -h or --help.
Definition: jurassic.h:1206
#define NR
Maximum number of ray paths.
Definition: jurassic.h:318
int main(int argc, char *argv[])
Definition: limb.c:39
Control parameters.
Definition: jurassic.h:1428
Observation geometry and radiance data.
Definition: jurassic.h:1657
double vpz[NR]
View point altitude [km].
Definition: jurassic.h:1675
double vplat[NR]
View point latitude [deg].
Definition: jurassic.h:1681
double obsz[NR]
Observer altitude [km].
Definition: jurassic.h:1666
double time[NR]
Time (seconds since 2000-01-01T00:00Z).
Definition: jurassic.h:1663
int nr
Number of ray paths.
Definition: jurassic.h:1660