JURASSIC
climatology.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;
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}
int main(int argc, char *argv[])
Definition: climatology.c:27
void climatology(ctl_t *ctl, atm_t *atm)
Interpolate climatological data.
Definition: jurassic.c:134
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
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:5138
JURASSIC library declarations.
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:217
#define NP
Maximum number of atmospheric data points.
Definition: jurassic.h:343
#define NSF
Maximum number of surface layer spectral grid points.
Definition: jurassic.h:353
#define NCL
Maximum number of cloud layer spectral grid points.
Definition: jurassic.h:328
Atmospheric data.
Definition: jurassic.h:468
double time[NP]
Time (seconds since 2000-01-01T00:00Z).
Definition: jurassic.h:474
double sfeps[NSF]
Surface emissivity.
Definition: jurassic.h:516
double sfz
Surface height [km].
Definition: jurassic.h:507
double sfp
Surface pressure [hPa].
Definition: jurassic.h:510
double clz
Cloud layer height [km].
Definition: jurassic.h:498
int np
Number of data points.
Definition: jurassic.h:471
double cldz
Cloud layer depth [km].
Definition: jurassic.h:501
double sft
Surface temperature [K].
Definition: jurassic.h:513
double z[NP]
Altitude [km].
Definition: jurassic.h:477
double clk[NCL]
Cloud layer extinction [km^-1].
Definition: jurassic.h:504
Forward model control parameters.
Definition: jurassic.h:521
int ncl
Number of cloud layer spectral grid points.
Definition: jurassic.h:542
int nsf
Number of surface layer spectral grid points.
Definition: jurassic.h:548