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 39 of file interpolate.c.

41 {
42
43 static atm_t atm_in, atm_pts;
44 static ctl_t ctl;
45
46 double k[NW], q[NG];
47
48 /* Print usage information... */
49 USAGE;
50
51 /* Interpolate atmospheric data... */
52
53 /* Check arguments... */
54 if (argc < 5)
55 ERRMSG("Missing or invalid command-line arguments.\n\n"
56 "Usage: interpolate <ctl> <atm_in> <atm_pts> <atm_out> [KEY VALUE ...]\n\n"
57 "Use -h for full help.");
58
59 /* Read control parameters... */
60 read_ctl(argc, argv, &ctl);
61
62 /* Read atmospheric data... */
63 read_atm(NULL, argv[2], &ctl, &atm_in, 0);
64 read_atm(NULL, argv[3], &ctl, &atm_pts, 0);
65
66 /* Interpolate atmospheric data... */
67 for (int ip = 0; ip < atm_pts.np; ip++) {
68 intpol_atm(&ctl, &atm_in, atm_pts.z[ip],
69 &atm_pts.p[ip], &atm_pts.t[ip], q, k);
70 for (int ig = 0; ig < ctl.ng; ig++)
71 atm_pts.q[ig][ip] = q[ig];
72 for (int iw = 0; iw < ctl.nw; iw++)
73 atm_pts.k[iw][ip] = k[iw];
74 }
75
76 /* Save interpolated data... */
77 write_atm(NULL, argv[4], &ctl, &atm_pts, 0);
78
79 return EXIT_SUCCESS;
80}
void write_atm(const char *dirname, const char *filename, const ctl_t *ctl, const atm_t *atm, int profile)
Write atmospheric data to a file.
Definition: jurassic.c:7307
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
Definition: jurassic.c:5516
void intpol_atm(const ctl_t *ctl, const atm_t *atm, const double z, double *p, double *t, double *q, double *k)
Interpolate atmospheric state variables at a given altitude.
Definition: jurassic.c:4049
void read_atm(const char *dirname, const char *filename, const ctl_t *ctl, atm_t *atm, int profile)
Read atmospheric input data from a file.
Definition: jurassic.c:5193
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: jurassic.h:1325
#define USAGE
Print usage information on -h or --help.
Definition: jurassic.h:1206
#define NG
Maximum number of emitters.
Definition: jurassic.h:298
#define NW
Maximum number of spectral windows.
Definition: jurassic.h:338
Atmospheric profile data.
Definition: jurassic.h:1375
double k[NW][NP]
Extinction [km^-1].
Definition: jurassic.h:1402
double t[NP]
Temperature [K].
Definition: jurassic.h:1396
int np
Number of data points.
Definition: jurassic.h:1378
double z[NP]
Altitude [km].
Definition: jurassic.h:1384
double q[NG][NP]
Volume mixing ratio [ppv].
Definition: jurassic.h:1399
double p[NP]
Pressure [hPa].
Definition: jurassic.h:1393
Control parameters.
Definition: jurassic.h:1428
int nw
Number of spectral windows.
Definition: jurassic.h:1455
int ng
Number of emitters.
Definition: jurassic.h:1431
Here is the call graph for this function: