38 const char *kernelfile);
54 ERRMSG(
"Give parameters: <ctl> <obs> <atm> <kernel>");
63 scan_ctl(argc, argv,
"DIRLIST", -1,
"-", dirlist);
69 if (dirlist[0] ==
'-')
70 call_kernel(&ctl, tbl, NULL, argv[2], argv[3], argv[4]);
77 if (!(in = fopen(dirlist,
"r")))
78 ERRMSG(
"Cannot open directory list!");
82 while (fscanf(in,
"%4999s", wrkdir) != EOF) {
85 LOG(1,
"\nWorking directory: %s", wrkdir);
88 call_kernel(&ctl, tbl, wrkdir, argv[2], argv[3], argv[4]);
109 const char *kernelfile) {
115 read_obs(wrkdir, obsfile, ctl, &obs);
118 read_atm(wrkdir, atmfile, ctl, &atm);
121 const size_t n =
atm2x(ctl, &atm, NULL, NULL, NULL);
122 const size_t m =
obs2y(ctl, &obs, NULL, NULL, NULL);
126 ERRMSG(
"No state vector elements!");
128 ERRMSG(
"No measurement vector elements!");
131 gsl_matrix *k = gsl_matrix_alloc(m, n);
134 kernel(ctl, tbl, &atm, &obs, k);
137 write_matrix(wrkdir, kernelfile, ctl, k, &atm, &obs,
"y",
"x",
"r");
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric data.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation data.
void kernel(const ctl_t *ctl, const tbl_t *tbl, atm_t *atm, obs_t *obs, gsl_matrix *k)
Compute Jacobians.
double scan_ctl(int argc, char *argv[], const char *varname, const int arridx, const char *defvalue, char *value)
Search control parameter file for variable entry.
tbl_t * read_tbl(const ctl_t *ctl)
Read look-up table data.
size_t obs2y(const ctl_t *ctl, const obs_t *obs, gsl_vector *y, int *ida, int *ira)
Compose measurement vector.
size_t atm2x(const ctl_t *ctl, const atm_t *atm, gsl_vector *x, int *iqa, int *ipa)
Compose state vector or parameter vector.
void write_matrix(const char *dirname, const char *filename, const ctl_t *ctl, const gsl_matrix *matrix, const atm_t *atm, const obs_t *obs, const char *rowspace, const char *colspace, const char *sort)
Write matrix.
JURASSIC library declarations.
#define LEN
Maximum length of ASCII data lines.
#define ERRMSG(...)
Print error message and quit program.
#define LOG(level,...)
Print log message.
int main(int argc, char *argv[])
void call_kernel(const ctl_t *ctl, const tbl_t *tbl, const char *wrkdir, const char *obsfile, const char *atmfile, const char *kernelfile)
Perform kernel calculations in a single directory.
Forward model control parameters.
int write_matrix
Write matrix file (0=no, 1=yes).
Observation geometry and radiance data.
Emissivity look-up tables.