JURASSIC
Functions
climatology.c File Reference

Prepare atmospheric data file from climatological data. More...

#include "jurassic.h"

Go to the source code of this file.

Functions

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

Detailed Description

Prepare atmospheric data file from climatological data.

Definition in file climatology.c.

Function Documentation

◆ main()

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

Definition at line 27 of file climatology.c.

29 {
30
31 static atm_t atm;
32 static ctl_t ctl;
33
34 double clk[NCL], sfeps[NSF];
35
36 /* Check arguments... */
37 if (argc < 3)
38 ERRMSG("Give parameters: <ctl> <atm>");
39
40 /* Read control parameters... */
41 read_ctl(argc, argv, &ctl);
42 double t0 = scan_ctl(argc, argv, "T0", -1, "0", NULL);
43 double t1 = scan_ctl(argc, argv, "T1", -1, "0", NULL);
44 double dt = scan_ctl(argc, argv, "DT", -1, "1", NULL);
45 double z0 = scan_ctl(argc, argv, "Z0", -1, "0", NULL);
46 double z1 = scan_ctl(argc, argv, "Z1", -1, "90", NULL);
47 double dz = scan_ctl(argc, argv, "DZ", -1, "1", NULL);
48 double clz = scan_ctl(argc, argv, "CLZ", -1, "0", NULL);
49 double cldz = scan_ctl(argc, argv, "CLDZ", -1, "0", NULL);
50 for (int icl = 0; icl < ctl.ncl; icl++)
51 clk[icl] = scan_ctl(argc, argv, "CLK", icl, "0", NULL);
52 double sfz = scan_ctl(argc, argv, "SFZ", -1, "0", NULL);
53 double sfp = scan_ctl(argc, argv, "SFP", -1, "0", NULL);
54 double sft = scan_ctl(argc, argv, "SFT", -1, "0", NULL);
55 for (int isf = 0; isf < ctl.nsf; isf++)
56 sfeps[isf] = scan_ctl(argc, argv, "SFEPS", isf, "1", NULL);
57
58 /* Set atmospheric grid... */
59 for (double t = t0; t <= t1; t += dt)
60 for (double z = z0; z <= z1; z += dz) {
61 atm.time[atm.np] = t;
62 atm.z[atm.np] = z;
63 if ((++atm.np) >= NP)
64 ERRMSG("Too many atmospheric grid points!");
65 }
66
67 /* Interpolate climatological data... */
68 climatology(&ctl, &atm);
69
70 /* Set cloud layer... */
71 atm.clz = clz;
72 atm.cldz = cldz;
73 for (int icl = 0; icl < ctl.ncl; icl++)
74 atm.clk[icl] = clk[icl];
75
76 /* Set surface layer... */
77 atm.sfz = sfz;
78 atm.sfp = sfp;
79 atm.sft = sft;
80 for (int isf = 0; isf < ctl.nsf; isf++)
81 atm.sfeps[isf] = sfeps[isf];
82
83 /* Write data to disk... */
84 write_atm(NULL, argv[2], &ctl, &atm);
85
86 return EXIT_SUCCESS;
87}
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
double scan_ctl(int argc, char *argv[], const char *varname, int arridx, const char *defvalue, char *value)
Search control parameter file for variable entry.
Definition: jurassic.c:5117
void climatology(const ctl_t *ctl, atm_t *atm)
Interpolate climatological data.
Definition: jurassic.c:123
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define NP
Maximum number of atmospheric data points.
Definition: jurassic.h:363
#define NSF
Maximum number of surface layer spectral grid points.
Definition: jurassic.h:373
#define NCL
Maximum number of cloud layer spectral grid points.
Definition: jurassic.h:348
Atmospheric data.
Definition: jurassic.h:488
double time[NP]
Time (seconds since 2000-01-01T00:00Z).
Definition: jurassic.h:494
double sfeps[NSF]
Surface emissivity.
Definition: jurassic.h:536
double sfz
Surface height [km].
Definition: jurassic.h:527
double sfp
Surface pressure [hPa].
Definition: jurassic.h:530
double clz
Cloud layer height [km].
Definition: jurassic.h:518
int np
Number of data points.
Definition: jurassic.h:491
double cldz
Cloud layer depth [km].
Definition: jurassic.h:521
double sft
Surface temperature [K].
Definition: jurassic.h:533
double z[NP]
Altitude [km].
Definition: jurassic.h:497
double clk[NCL]
Cloud layer extinction [km^-1].
Definition: jurassic.h:524
Forward model control parameters.
Definition: jurassic.h:541
int ncl
Number of cloud layer spectral grid points.
Definition: jurassic.h:562
int nsf
Number of surface layer spectral grid points.
Definition: jurassic.h:568
Here is the call graph for this function: