AIRS Code Collection
Macros | Functions
ret2tab.c File Reference

Write retrieval data to ASCII file. More...

#include "libairs.h"

Go to the source code of this file.

Macros

#define CHECK(x)   ((x)!=-9999 ? (x) : GSL_NAN)
 

Functions

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

Detailed Description

Write retrieval data to ASCII file.

Definition in file ret2tab.c.

Macro Definition Documentation

◆ CHECK

#define CHECK (   x)    ((x)!=-9999 ? (x) : GSL_NAN)

Definition at line 33 of file ret2tab.c.

Function Documentation

◆ main()

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

Definition at line 39 of file ret2tab.c.

41 {
42
43 static airs_ret_gran_t airs_ret_gran;
44
45 FILE *out;
46
47 /* Check arguments... */
48 if (argc != 4)
49 ERRMSG("Give parameters: <airs_l2_file> <layer> <airs.tab>");
50
51 /* Get arguments... */
52 const int lay = atoi(argv[2]);
53
54 /* Read AIRS data... */
55 printf("Read AIRS Level-2 data file: %s\n", argv[1]);
56 airs_ret_rdr(argv[1], &airs_ret_gran);
57
58 /* Create output file... */
59 printf("Write ASCII file: %s\n", argv[3]);
60 if (!(out = fopen(argv[3], "w")))
61 ERRMSG("Cannot create file!");
62
63 /* Write header... */
64 fprintf(out,
65 "# $1 = time (seconds since 01-JAN-2000, 00:00 UTC)\n"
66 "# $2 = altitude [km]\n"
67 "# $3 = longitude [deg]\n"
68 "# $4 = latitude [deg]\n"
69 "# $5 = pressure [hPa]\n"
70 "# $6 = temperature [K]\n"
71 "# $7 = H2O mass mixing ratio\n"
72 "# $8 = O3 volume mixing ratio\n"
73 "# $9 = CH4 volume mixing ratio\n"
74 "# $10 = CO volume mixing ratio\n");
75
76 /* Write data to stdout... */
77 for (int track = 0; track < AIRS_RET_GEOTRACK; track++) {
78 fprintf(out, "\n");
79 for (int xtrack = 0; xtrack < AIRS_RET_GEOXTRACK; xtrack++)
80 fprintf(out, "%.2f %g %g %g %g %g %g %g %g %g\n",
81 airs_ret_gran.Time[track][xtrack] - 220838400,
82 CHECK(airs_ret_gran.GP_Height[track][xtrack][lay]) / 1000,
83 CHECK(airs_ret_gran.Longitude[track][xtrack]),
84 CHECK(airs_ret_gran.Latitude[track][xtrack]),
85 CHECK(airs_ret_gran.pressStd[lay]),
86 CHECK(airs_ret_gran.TAirStd[track][xtrack][lay]),
87 CHECK(airs_ret_gran.H2OMMRStd[track][xtrack][lay]),
88 CHECK(airs_ret_gran.O3VMRStd[track][xtrack][lay]),
89 CHECK(airs_ret_gran.COVMRLevStd[track][xtrack][lay]),
90 CHECK(airs_ret_gran.CH4VMRLevStd[track][xtrack][lay]));
91 }
92
93 /* Close file... */
94 fclose(out);
95
96 return EXIT_SUCCESS;
97}
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define CHECK(x)
Definition: ret2tab.c:33