Skip to content

Commit

Permalink
Fixed some issues with coding style.
Browse files Browse the repository at this point in the history
  • Loading branch information
lars2015 committed Apr 22, 2024
1 parent 40aeb0b commit f3c1ef4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions src/formod.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ int main(

#else

FILE *in;

char dirlist[LEN], task[LEN], wrkdir[LEN];
char dirlist[LEN], task[LEN];

/* Get task... */
scan_ctl(argc, argv, "TASK", -1, "-", task);
Expand All @@ -95,10 +93,12 @@ int main(
else {

/* Open directory list... */
FILE *in;
if (!(in = fopen(dirlist, "r")))
ERRMSG("Cannot open directory list!");

/* Loop over directories... */
char wrkdir[LEN];
while (fscanf(in, "%s", wrkdir) != EOF) {

/* Write info... */
Expand Down Expand Up @@ -130,8 +130,6 @@ void call_formod(
static atm_t atm, atm2;
static obs_t obs, obs2;

char filename[LEN];

/* Read observation geometry... */
read_obs(wrkdir, obsfile, ctl, &obs);

Expand Down Expand Up @@ -201,6 +199,8 @@ void call_formod(
/* Compute contributions... */
if (task[0] == 'c' || task[0] == 'C') {

char filename[LEN];

/* Switch off continua... */
ctl->ctm_co2 = 0;
ctl->ctm_h2o = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/invert.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ int main(
static char line[LEN];

static double rtime[NLMAX], rz[NLMAX], rlon[NLMAX], rlat[NLMAX], obs_meas,
obs_sim, scl = 1.0, scl_old, scl_err, c0, c1, cov00, cov01, cov11,
sumsq, x[NMAX], x2[NMAX], y[NMAX], y_err[NMAX], y2[NMAX], y2_err[NMAX],
obs_sim, scl = 1.0, scl_err, c0, c1, cov00, cov01, cov11, sumsq,
x[NMAX], x2[NMAX], y[NMAX], y_err[NMAX], y2[NMAX], y2_err[NMAX],
y2_sim[NMAX], y2_sim_err[NMAX], w2[NMAX], dt, tol, obs_err;

static float rp[NLMAX], rt[NLMAX], rso2[NLMAX], rh2o[NLMAX],
Expand Down Expand Up @@ -255,7 +255,7 @@ int main(
ERRMSG("Check INVERT_FIT!");

/* Get new scaling factor... */
scl_old = scl;
double scl_old = scl;
scl_err = scl * sqrt(cov11);
scl *= c1;

Expand Down
10 changes: 5 additions & 5 deletions src/retrieval.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,11 @@ void optimal_estimation(

char filename[2 * LEN];

double chisq, chisq_old, disq = 0, lmpar = 0.001;
double chisq, disq = 0, lmpar = 0.001;

int icl, ig, ip, isf, it = 0, it2, iw;

size_t i, j, m, n;
size_t i, m, n;

/* ------------------------------------------------------------
Initialize...
Expand Down Expand Up @@ -571,7 +571,7 @@ void optimal_estimation(
for (it = 1; it <= ret->conv_itmax; it++) {

/* Store current cost function value... */
chisq_old = chisq;
double chisq_old = chisq;

/* Compute kernel matrix K_i... */
if (it > 1 && it % ret->kernel_recomp == 0)
Expand Down Expand Up @@ -697,7 +697,7 @@ void optimal_estimation(

/* Compute correlation matrix... */
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
for (size_t j = 0; j < n; j++)
gsl_matrix_set(corr, i, j, gsl_matrix_get(cov, i, j)
/ sqrt(gsl_matrix_get(cov, i, i))
/ sqrt(gsl_matrix_get(cov, j, j)));
Expand All @@ -707,7 +707,7 @@ void optimal_estimation(
/* Compute gain matrix...
G = cov * K^T * S_eps^{-1} */
for (i = 0; i < n; i++)
for (j = 0; j < m; j++)
for (size_t j = 0; j < m; j++)
gsl_matrix_set(auxnm, i, j, gsl_matrix_get(k_i, j, i)
* POW2(gsl_vector_get(sig_eps_inv, j)));
gsl_blas_dgemm(CblasNoTrans, CblasNoTrans, 1.0, cov, auxnm, 0.0, gain);
Expand Down
3 changes: 2 additions & 1 deletion src/tblgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main(

FILE *in;

static char line[MAXLINE], *tok;
static char line[MAXLINE];

static double dnu, abs[MAXNPTS], epsold, f, filt[MAXNF],
nu, nu0, nu1, nuf[MAXNF], press, r0, temp, u;
Expand Down Expand Up @@ -88,6 +88,7 @@ int main(
ERRMSG("Too many points in optical depth spectrum!");
i = 0;
while (fgets(line, MAXLINE, in)) {
char *tok;
if ((tok = strtok(line, " \t\n")) != NULL) {
sscanf(tok, "%lg", &abs[i]);
abs[i] /= u;
Expand Down

0 comments on commit f3c1ef4

Please sign in to comment.