Perform kernel calculations in a single directory.
109 {
110
113
114
115 read_obs(wrkdir, obsfile, ctl, &obs);
116
117
118 read_atm(wrkdir, atmfile, ctl, &atm);
119
120
121 const size_t n =
atm2x(ctl, &atm, NULL, NULL, NULL);
122 const size_t m =
obs2y(ctl, &obs, NULL, NULL, NULL);
123
124
125 if (n == 0)
126 ERRMSG(
"No state vector elements!");
127 if (m == 0)
128 ERRMSG(
"No measurement vector elements!");
129
130
131 gsl_matrix *k = gsl_matrix_alloc(m, n);
132
133
134 kernel(ctl, tbl, &atm, &obs, k);
135
136
137 write_matrix(wrkdir, kernelfile, ctl, k, &atm, &obs,
"y",
"x",
"r");
138
139
140 gsl_matrix_free(k);
141}
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric profile data from an ASCII file.
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation geometry and radiance data from an ASCII file.
void kernel(const ctl_t *ctl, const tbl_t *tbl, atm_t *atm, obs_t *obs, gsl_matrix *k)
Compute the Jacobian (kernel) matrix by finite differences.
size_t obs2y(const ctl_t *ctl, const obs_t *obs, gsl_vector *y, int *ida, int *ira)
Convert observation radiances into a measurement vector.
size_t atm2x(const ctl_t *ctl, const atm_t *atm, gsl_vector *x, int *iqa, int *ipa)
Convert atmospheric data to state vector elements.
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)
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Atmospheric profile data.
Observation geometry and radiance data.