43 static atm_t atm_in, atm_pts;
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.");
63 read_atm(NULL, argv[2], &ctl, &atm_in, 0);
64 read_atm(NULL, argv[3], &ctl, &atm_pts, 0);
67 for (
int ip = 0; ip < atm_pts.
np; 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];
77 write_atm(NULL, argv[4], &ctl, &atm_pts, 0);
86 printf(
"\nJURASSIC interpolation tool.\n\n");
87 printf(
"Interpolate atmospheric state variables from one atmospheric\n");
88 printf(
"profile to the grid defined by another profile.\n\n");
91 (
" interpolate <ctl> <atm_in> <atm_pts> <atm_out> [KEY VALUE ...]\n\n");
92 printf(
"Arguments:\n");
93 printf(
" <ctl> Control file.\n");
94 printf(
" <atm_in> Input atmospheric data file.\n");
95 printf(
" <atm_pts> Atmospheric file defining interpolation points.\n");
96 printf(
" <atm_out> Output atmospheric data file.\n");
97 printf(
" [KEY VALUE] Optional control parameters.\n\n");
98 printf(
"Common control parameters:\n");
99 printf(
" ATMFMT Atmospheric file format.\n");
100 printf(
" NG, EMITTER[i] Active emitters.\n");
101 printf(
" NW, WINDOW[i] Extinction-window layout.\n");
102 printf(
" NCL, CLNU[i] Cloud spectral grid.\n");
103 printf(
" NSF, SFNU[i] Surface spectral grid.\n\n");
104 printf(
"Further information:\n");
105 printf(
" Manual: https://slcs-jsc.github.io/jurassic/\n");
int main(int argc, char *argv[])
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.
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read model control parameters from command-line and configuration input.
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.
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.
JURASSIC library declarations.
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
#define USAGE
Print usage information on -h or --help.
#define NG
Maximum number of emitters.
#define NW
Maximum number of spectral windows.
Atmospheric profile data.
double k[NW][NP]
Extinction [km^-1].
double t[NP]
Temperature [K].
int np
Number of data points.
double z[NP]
Altitude [km].
double q[NG][NP]
Volume mixing ratio [ppv].
double p[NP]
Pressure [hPa].
int nw
Number of spectral windows.
int ng
Number of emitters.