JURASSIC
Functions
interpolate.c File Reference

Interpolate atmospheric data to another spatial grid. More...

#include "jurassic.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Interpolate atmospheric data to another spatial grid.

Definition in file interpolate.c.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 27 of file interpolate.c.

29 {
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}
void read_atm(const char *dirname, const char *filename, ctl_t *ctl, atm_t *atm)
Read atmospheric data.
Definition: jurassic.c:4456
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
Definition: jurassic.c:4561
void write_atm(const char *dirname, const char *filename, ctl_t *ctl, atm_t *atm)
Write atmospheric data.
Definition: jurassic.c:5361
void intpol_atm(ctl_t *ctl, atm_t *atm, double z, double *p, double *t, double *q, double *k)
Interpolate atmospheric data.
Definition: jurassic.c:3687
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:217
#define NG
Maximum number of emitters.
Definition: jurassic.h:338
#define NW
Maximum number of spectral windows.
Definition: jurassic.h:358
Atmospheric data.
Definition: jurassic.h:468
double k[NW][NP]
Extinction [km^-1].
Definition: jurassic.h:495
double t[NP]
Temperature [K].
Definition: jurassic.h:489
int np
Number of data points.
Definition: jurassic.h:471
double z[NP]
Altitude [km].
Definition: jurassic.h:477
double q[NG][NP]
Volume mixing ratio [ppv].
Definition: jurassic.h:492
double p[NP]
Pressure [hPa].
Definition: jurassic.h:486
Forward model control parameters.
Definition: jurassic.h:521
int nw
Number of spectral windows.
Definition: jurassic.h:536
int ng
Number of emitters.
Definition: jurassic.h:524
Here is the call graph for this function: