JURASSIC
Functions
brightness.c File Reference

Convert radiance to brightness temperature. More...

#include "jurassic.h"

Go to the source code of this file.

Functions

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

Detailed Description

Convert radiance to brightness temperature.

Definition in file brightness.c.

Function Documentation

◆ main()

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

Definition at line 39 of file brightness.c.

41 {
42
43 /* Print usage information... */
44 USAGE;
45
46 /* Check arguments... */
47 if (argc != 3 && argc != 7)
48 ERRMSG
49 ("Missing or invalid command-line arguments.\n\n"
50 "Usage: brightness <rad> <nu>\n"
51 " or: brightness <rad0> <rad1> <drad> <nu0> <nu1> <dnu>\n\n"
52 "Use -h for full help.");
53
54 /* Calculate single value... */
55 if (argc == 3) {
56
57 /* Read arguments... */
58 double rad = atof(argv[1]);
59 double nu = atof(argv[2]);
60
61 /* Compute brightness temperature... */
62 printf("%.10g\n", BRIGHT(rad, nu));
63
64 }
65
66 /* Calculate table... */
67 else if (argc == 7) {
68
69 /* Read arguments... */
70 double rad0 = atof(argv[1]);
71 double rad1 = atof(argv[2]);
72 double drad = atof(argv[3]);
73 double nu0 = atof(argv[4]);
74 double nu1 = atof(argv[5]);
75 double dnu = atof(argv[6]);
76
77 /* Write header... */
78 printf("# $1 = radiance [W/(m^2 sr cm^-1)]\n"
79 "# $2 = wavenumber [cm^-1]\n"
80 "# $3 = brightness temperature [K]\n");
81
82 /* Compute brightness temperature... */
83 for (double rad = rad0; rad <= rad1; rad += drad) {
84 printf("\n");
85 for (double nu = nu0; nu <= nu1; nu += dnu)
86 printf("%.10g %.4f %.10g\n", rad, nu, BRIGHT(rad, nu));
87 }
88 }
89
90 return EXIT_SUCCESS;
91}
#define BRIGHT(rad, nu)
Compute brightness temperature from radiance.
Definition: jurassic.h:448
#define ERRMSG(...)
Print an error message with contextual information and terminate the program.
Definition: jurassic.h:1325
#define USAGE
Print usage information on -h or --help.
Definition: jurassic.h:1206