JURASSIC
brightness.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 /* Check arguments... */
32 if (argc != 3 && argc != 7)
33 ERRMSG
34 ("Give parameters: [ <rad> <nu> | "
35 " <rad0> <rad1> <drad> <nu0> <nu1> <dnu> ]");
36
37 /* Calculate single value... */
38 if (argc == 3) {
39
40 /* Read arguments... */
41 double rad = atof(argv[1]);
42 double nu = atof(argv[2]);
43
44 /* Compute brightness temperature... */
45 printf("%.10g\n", brightness(rad, nu));
46
47 }
48
49 /* Calculate table... */
50 else if (argc == 7) {
51
52 /* Read arguments... */
53 double rad0 = atof(argv[1]);
54 double rad1 = atof(argv[2]);
55 double drad = atof(argv[3]);
56 double nu0 = atof(argv[4]);
57 double nu1 = atof(argv[5]);
58 double dnu = atof(argv[6]);
59
60 /* Write header... */
61 printf("# $1 = radiance [W/(m^2 sr cm^-1)]\n"
62 "# $2 = wavenumber [cm^-1]\n"
63 "# $3 = brightness temperature [K]\n");
64
65 /* Compute brightness temperature... */
66 for (double rad = rad0; rad <= rad1; rad += drad) {
67 printf("\n");
68 for (double nu = nu0; nu <= nu1; nu += dnu)
69 printf("%.10g %.4f %.10g\n", rad, nu, brightness(rad, nu));
70 }
71 }
72
73 return EXIT_SUCCESS;
74}
int main(int argc, char *argv[])
Definition: brightness.c:27
double brightness(double rad, double nu)
Compute brightness temperature.
Definition: jurassic.c:109
JURASSIC library declarations.
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:217