JURASSIC
Functions
obs2spec.c File Reference

Converter for spectra. More...

#include <omp.h>
#include "jurassic.h"

Go to the source code of this file.

Functions

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

Detailed Description

Converter for spectra.

Definition in file obs2spec.c.

Function Documentation

◆ main()

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

Definition at line 32 of file obs2spec.c.

34 {
35
36 static ctl_t ctl;
37
38 obs_t *obs;
39
40 FILE *out;
41
42 /* Check arguments... */
43 if (argc < 4)
44 ERRMSG("Give parameters: <ctl> <obs> <spec.tab>");
45
46 /* Allocate... */
47 ALLOC(obs, obs_t, 1);
48
49 /* Read control parameters... */
50 read_ctl(argc, argv, &ctl);
51
52 /* Read observation geometry... */
53 read_obs(".", argv[2], &ctl, obs);
54
55 /* Write info... */
56 LOG(1, "Write spectra: %s", argv[3]);
57
58 /* Create file... */
59 if (!(out = fopen(argv[3], "w")))
60 ERRMSG("Cannot create file!");
61
62 /* Write header... */
63 fprintf(out,
64 "# $1 = time (seconds since 2000-01-01T00:00Z)\n"
65 "# $2 = observer altitude [km]\n"
66 "# $3 = observer longitude [deg]\n"
67 "# $4 = observer latitude [deg]\n"
68 "# $5 = view point altitude [km]\n"
69 "# $6 = view point longitude [deg]\n"
70 "# $7 = view point latitude [deg]\n"
71 "# $8 = tangent point altitude [km]\n"
72 "# $9 = tangent point longitude [deg]\n"
73 "# $10 = tangent point latitude [deg]\n"
74 "# $11 = channel frequency [cm^-1]\n"
75 "# $12 = channel radiance [W/(m^2 sr cm^-1)]\n"
76 "# $13 = channel transmittance [1]\n");
77
78 /* Write data... */
79 for (int ir = 0; ir < obs->nr; ir++) {
80 fprintf(out, "\n");
81 for (int id = 0; id < ctl.nd; id++)
82 fprintf(out, "%.2f %g %g %g %g %g %g %g %g %g %.4f %g %g\n",
83 obs->time[ir], obs->obsz[ir], obs->obslon[ir], obs->obslat[ir],
84 obs->vpz[ir], obs->vplon[ir], obs->vplat[ir], obs->tpz[ir],
85 obs->tplon[ir], obs->tplat[ir], ctl.nu[id], obs->rad[id][ir],
86 obs->tau[id][ir]);
87 }
88
89 /* Close file... */
90 fclose(out);
91
92 /* Free... */
93 free(obs);
94
95 return EXIT_SUCCESS;
96}
void read_ctl(int argc, char *argv[], ctl_t *ctl)
Read forward model control parameters.
Definition: jurassic.c:4550
void read_obs(const char *dirname, const char *filename, const ctl_t *ctl, obs_t *obs)
Read observation data.
Definition: jurassic.c:4700
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define ALLOC(ptr, type, n)
Allocate memory.
Definition: jurassic.h:121
#define LOG(level,...)
Print log message.
Definition: jurassic.h:221
Forward model control parameters.
Definition: jurassic.h:541
double nu[ND]
Centroid wavenumber of each channel [cm^-1].
Definition: jurassic.h:553
int nd
Number of radiance channels.
Definition: jurassic.h:550
Observation geometry and radiance data.
Definition: jurassic.h:734
double tau[ND][NR]
Transmittance of ray path.
Definition: jurassic.h:770
double rad[ND][NR]
Radiance [W/(m^2 sr cm^-1)].
Definition: jurassic.h:773
double tplon[NR]
Tangent point longitude [deg].
Definition: jurassic.h:764
double vpz[NR]
View point altitude [km].
Definition: jurassic.h:752
double vplat[NR]
View point latitude [deg].
Definition: jurassic.h:758
double obslon[NR]
Observer longitude [deg].
Definition: jurassic.h:746
double obslat[NR]
Observer latitude [deg].
Definition: jurassic.h:749
double obsz[NR]
Observer altitude [km].
Definition: jurassic.h:743
double tplat[NR]
Tangent point latitude [deg].
Definition: jurassic.h:767
double vplon[NR]
View point longitude [deg].
Definition: jurassic.h:755
double time[NR]
Time (seconds since 2000-01-01T00:00Z).
Definition: jurassic.h:740
double tpz[NR]
Tangent point altitude [km].
Definition: jurassic.h:761
int nr
Number of ray paths.
Definition: jurassic.h:737
Here is the call graph for this function: