GPS Code Collection
Functions
map.c File Reference

Extract temperature maps. More...

#include "libgps.h"

Go to the source code of this file.

Functions

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

Detailed Description

Extract temperature maps.

Definition in file map.c.

Function Documentation

◆ main()

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

Definition at line 28 of file map.c.

30 {
31
32 gps_t *gps;
33
34 FILE *out;
35
36 /* Allocate... */
37 ALLOC(gps, gps_t, 1);
38
39 /* Check arguments... */
40 if (argc < 4)
41 ERRMSG("Give parameters: <ctl> <gps.nc> <map.tab>");
42
43 /* Get control parameters... */
44 const double z = scan_ctl(argc, argv, "Z", -1, "20", NULL);
45
46 /* Read gps data... */
47 read_gps(argv[2], gps);
48
49 /* Create output file... */
50 printf("Write map data: %s\n", argv[3]);
51 if (!(out = fopen(argv[3], "w")))
52 ERRMSG("Cannot create file!");
53
54 /* Write header... */
55 fprintf(out,
56 "# $1 = time [sec]\n"
57 "# $2 = altitude [km]\n"
58 "# $3 = longitude [deg]\n"
59 "# $4 = latitude [deg]\n"
60 "# $5 = pressure [hPa]\n"
61 "# $6 = temperature [K]\n"
62 "# $7 = water vapor vmr [ppm]\n"
63 "# $8 = temperature perturbation [K]\n"
64 "# $9 = tropopause height [km]\n\n");
65
66 /* Write data... */
67 for (int ids = 0; ids < gps->nds; ids++)
68 for (int iz = 0; iz < gps->nz[ids]; iz++)
69 if (fabs(gps->z[ids][iz] - z) < 0.01) {
70 fprintf(out, "%.2f %g %g %g %g %g %g %g %g\n",
71 gps->time[ids], gps->z[ids][iz], gps->lon[ids][iz],
72 gps->lat[ids][iz], gps->p[ids][iz], gps->t[ids][iz],
73 gps->wv[ids][iz], gps->pt[ids][iz], gps->th[ids]);
74 break;
75 }
76
77 /* Close file... */
78 fclose(out);
79
80 /* Free... */
81 free(gps);
82
83 return EXIT_SUCCESS;
84}
void read_gps(char *filename, gps_t *gps)
Read GPS-RO data file.
Definition: libgps.c:632
GPS-RO profile data.
Definition: libgps.h:153
double time[NDS]
Time (seconds since 2000-01-01T00:00Z).
Definition: libgps.h:162
double pt[NDS][NZ]
Temperature perturbation [K].
Definition: libgps.h:183
double t[NDS][NZ]
Temperature [K].
Definition: libgps.h:177
double wv[NDS][NZ]
Water vapor volume mixing ratio [ppm].
Definition: libgps.h:180
int nz[NDS]
Number of altitudes per profile.
Definition: libgps.h:159
double lon[NDS][NZ]
Longitude [deg].
Definition: libgps.h:168
int nds
Number of profiles.
Definition: libgps.h:156
double p[NDS][NZ]
Pressure [hPa].
Definition: libgps.h:174
double th[NDS]
Tropopause height [km].
Definition: libgps.h:186
double z[NDS][NZ]
Altitude [km].
Definition: libgps.h:165
double lat[NDS][NZ]
Latitude [deg].
Definition: libgps.h:171
Here is the call graph for this function: