41 {
42
44
46
47
49
50
51 if (argc < 6)
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.");
55
56
58
59
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);
62
63
64 ctl.
atmfmt = atoi(argv[3]);
65 read_atm(NULL, argv[2], &ctl, &atm, prof_in);
66
67
68 ctl.
atmfmt = atoi(argv[5]);
69 write_atm(NULL, argv[4], &ctl, &atm, prof_out);
70
71 return EXIT_SUCCESS;
72}
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.
#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).