52 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
53 "Usage: atmfmt <ctl> <atm_in> <atmfmt_in> <atm_out> <atmfmt_out> [KEY VALUE ...]\n\n"
54 "Use -h for full help.");
60 int prof_in = (int)
scan_ctl(argc, argv,
"PROF_IN", -1,
"0", NULL);
61 int prof_out = (int)
scan_ctl(argc, argv,
"PROF_OUT", -1,
"0", NULL);
64 ctl.
atmfmt = atoi(argv[3]);
65 read_atm(NULL, argv[2], &ctl, &atm, prof_in);
68 ctl.
atmfmt = atoi(argv[5]);
69 write_atm(NULL, argv[4], &ctl, &atm, prof_out);
78 printf(
"\nJURASSIC atmospheric-format converter.\n\n");
80 (
"Convert atmospheric input files between supported ATMFMT formats.\n\n");
82 printf(
" atmfmt <ctl> <atm_in> <atmfmt_in> <atm_out> <atmfmt_out>\n");
83 printf(
" [KEY VALUE ...]\n\n");
84 printf(
"Arguments:\n");
85 printf(
" <ctl> Control file.\n");
86 printf(
" <atm_in> Input atmospheric data file.\n");
87 printf(
" <atmfmt_in> Input atmospheric file format identifier.\n");
88 printf(
" <atm_out> Output atmospheric data file.\n");
89 printf(
" <atmfmt_out> Output atmospheric file format identifier.\n");
90 printf(
" [KEY VALUE] Optional control parameters.\n\n");
91 printf(
"Tool-specific control parameters:\n");
92 printf(
" PROF_IN <n> Read profile index <n> from the input file.\n");
93 printf(
" PROF_OUT <n> Write output as profile index <n>.\n\n");
94 printf(
"Common control parameters:\n");
95 printf(
" NG, EMITTER[i] Active emitters in atmospheric files.\n");
96 printf(
" NW, WINDOW[i] Extinction-window layout.\n");
97 printf(
" NCL, CLNU[i] Cloud spectral grid.\n");
98 printf(
" NSF, SFNU[i] Surface spectral grid.\n\n");
99 printf(
"Further information:\n");
100 printf(
" Manual: https://slcs-jsc.github.io/jurassic/\n");
int main(int argc, char *argv[])
void write_atm(const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm, int profile)
Write atmospheric data to a file.
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm, int profile)
Read atmospheric input data from a 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 ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
Atmospheric profile data.
int atmfmt
Atmospheric data file format (1=ASCII, 2=binary, 3=netCDF).