41 {
42
44
46
47
49
50
51 if (argc < 6)
52 ERRMSG(
"Missing or invalid command-line arguments.\n\n"
53 "Usage: obsfmt <ctl> <obs_in> <obsfmt_in> <obs_out> <obsfmt_out> [KEY VALUE ...]\n\n"
54 "Use -h for full help.");
55
56
58
59
60 const int prof_in = (int)
scan_ctl(argc, argv,
"PROF_IN", -1,
"0", NULL);
61 const int prof_out = (int)
scan_ctl(argc, argv,
"PROF_OUT", -1,
"0", NULL);
62
63
64 ctl.
obsfmt = atoi(argv[3]);
65 read_obs(NULL, argv[2], &ctl, &obs, prof_in);
66
67
68 ctl.
obsfmt = atoi(argv[5]);
69 write_obs(NULL, argv[4], &ctl, &obs, prof_out);
70
71 return EXIT_SUCCESS;
72}
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs, int profile)
Read observation data from an input file.
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.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
int obsfmt
Observation data file format (1=ASCII, 2=binary, 3=netCDF).
Observation geometry and radiance data.