JURASSIC
Functions
planck.c File Reference

Convert brightness temperature to radiance. More...

#include "jurassic.h"

Go to the source code of this file.

Functions

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

Detailed Description

Convert brightness temperature to radiance.

Definition in file planck.c.

Function Documentation

◆ main()

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

Definition at line 27 of file planck.c.

29 {
30
31 /* Check arguments... */
32 if (argc != 3 && argc != 7)
33 ERRMSG
34 ("Give parameters: [ <t> <nu> | <t0> <t1> <dt> <nu0> <nu1> <dnu> ]");
35
36 /* Calculate single value... */
37 if (argc == 3) {
38
39 /* Read arguments... */
40 double t = atof(argv[1]);
41 double nu = atof(argv[2]);
42
43 /* Compute Planck function... */
44 printf("%.10g\n", planck(t, nu));
45 }
46
47 /* Calculate table... */
48 else if (argc == 7) {
49
50 /* Read arguments... */
51 double t0 = atof(argv[1]);
52 double t1 = atof(argv[2]);
53 double dt = atof(argv[3]);
54 double nu0 = atof(argv[4]);
55 double nu1 = atof(argv[5]);
56 double dnu = atof(argv[6]);
57
58 /* Write header... */
59 printf("# $1 = brightness temperature [K]\n"
60 "# $2 = wavenumber [cm^-1]\n"
61 "# $3 = radiance [W/(m^2 sr cm^-1)]\n");
62
63 /* Compute Planck function... */
64 for (double t = t0; t <= t1; t += dt) {
65 printf("\n");
66 for (double nu = nu0; nu <= nu1; nu += dnu)
67 printf("%.10g %.4f %.10g\n", t, nu, planck(t, nu));
68 }
69 }
70
71 return EXIT_SUCCESS;
72}
double planck(double t, double nu)
Compute Planck function.
Definition: jurassic.c:4207
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:217
Here is the call graph for this function: