37 {
38
39 static atm_t atm_i, atm_apr;
41 static obs_t obs_i, obs_meas;
43
44 FILE *dirlist;
45
46
47 int ntask = -1;
48 int rank = 0;
49 int size = 1;
50
51#ifdef MPI
52 MPI_Init(&argc, &argv);
53 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
54 MPI_Comm_size(MPI_COMM_WORLD, &size);
55#endif
56
57
58 if (argc < 3)
59 ERRMSG(
"Give parameters: <ctl> <dirlist>");
60
61
63
64
67
68
70
71
72 if (!(dirlist = fopen(argv[2], "r")))
73 ERRMSG(
"Cannot open directory list!");
74
75
76 while (fscanf(dirlist,
"%4999s", ret.
dir) != EOF) {
77
78
79 if ((++ntask) % size != rank)
80 continue;
81
82
83 if (size > 1) {
84 LOG(1,
"\nRetrieve in directory %s on rank %d of %d...\n",
85 ret.
dir, rank + 1, size);
86 } else
87 LOG(1,
"\nRetrieve in directory %s...\n", ret.
dir);
88
89
91
92
94
95
96 double chisq;
98 &chisq);
99
100
102 }
103
104
105 LOG(1,
"\nRetrieval done...");
106
107
109
110
112
113#ifdef MPI
114 MPI_Finalize();
115#endif
116
117 return EXIT_SUCCESS;
118}
void tbl_free(const ctl_t *ctl, tbl_t *tbl)
Free lookup table and all internally allocated memory.
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
void optimal_estimation(ret_t *ret, ctl_t *ctl, tbl_t *tbl, obs_t *obs_meas, obs_t *obs_i, atm_t *atm_apr, atm_t *atm_i, double *chisq)
Perform optimal estimation retrieval using Levenberg–Marquardt minimization.
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric input data from a file.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation data from an input file.
void read_ret(int argc, char *argv[], const ctl_t *ctl, ret_t *ret)
Read retrieval configuration and error parameters.
tbl_t * read_tbl(const ctl_t *ctl)
Read emissivity lookup tables from disk.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define TIMER(name, mode)
Start or stop a named timer.
#define LOG(level,...)
Print a log message with a specified logging level.
Atmospheric profile data.
Observation geometry and radiance data.
Retrieval control parameters.
char dir[LEN]
Working directory.
Emissivity look-up tables.