JURASSIC
interpolate.c
Go to the documentation of this file.
1/*
2 This file is part of JURASSIC.
3
4 JURASSIC is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 JURASSIC is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with JURASSIC. If not, see <http://www.gnu.org/licenses/>.
16
17 Copyright (C) 2003-2021 Forschungszentrum Juelich GmbH
18*/
19
25#include "jurassic.h"
26
27int main(
28 int argc,
29 char *argv[]) {
30
31 static atm_t atm_in, atm_pts;
32 static ctl_t ctl;
33
34 double k[NW], q[NG];
35
36 /* Interpolate atmospheric data... */
37
38 /* Check arguments... */
39 if (argc < 5)
40 ERRMSG("Give parameters: <ctl> <atm_in> <atm_pts> <atm_out>");
41
42 /* Read control parameters... */
43 read_ctl(argc, argv, &ctl);
44
45 /* Read atmospheric data... */
46 read_atm(NULL, argv[2], &ctl, &atm_in);
47 read_atm(NULL, argv[3], &ctl, &atm_pts);
48
49 /* Interpolate atmospheric data... */
50 for (int ip = 0; ip < atm_pts.np; ip++) {
51 intpol_atm(&ctl, &atm_in, atm_pts.z[ip],
52 &atm_pts.p[ip], &atm_pts.t[ip], q, k);
53 for (int ig = 0; ig < ctl.ng; ig++)
54 atm_pts.q[ig][ip] = q[ig];
55 for (int iw = 0; iw < ctl.nw; iw++)
56 atm_pts.k[iw][ip] = k[iw];
57 }
58
59 /* Save interpolated data... */
60 write_atm(NULL, argv[4], &ctl, &atm_pts);
61
62 return EXIT_SUCCESS;
63}
int main(int argc, char *argv[])
Definition: interpolate.c:27
void write_atm(const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm)
Write atmospheric data.
Definition: jurassic.c:5339
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
Definition: jurassic.c:4550
void intpol_atm(const ctl_t *ctl, const atm_t *atm, const double z, double *p, double *t, double *q, double *k)
Interpolate atmospheric data.
Definition: jurassic.c:3685
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm)
Read atmospheric data.
Definition: jurassic.c:4445
JURASSIC library declarations.
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define NG
Maximum number of emitters.
Definition: jurassic.h:358
#define NW
Maximum number of spectral windows.
Definition: jurassic.h:378
Atmospheric data.
Definition: jurassic.h:488
double k[NW][NP]
Extinction [km^-1].
Definition: jurassic.h:515
double t[NP]
Temperature [K].
Definition: jurassic.h:509
int np
Number of data points.
Definition: jurassic.h:491
double z[NP]
Altitude [km].
Definition: jurassic.h:497
double q[NG][NP]
Volume mixing ratio [ppv].
Definition: jurassic.h:512
double p[NP]
Pressure [hPa].
Definition: jurassic.h:506
Forward model control parameters.
Definition: jurassic.h:541
int nw
Number of spectral windows.
Definition: jurassic.h:556
int ng
Number of emitters.
Definition: jurassic.h:544