34 {
35
37
38 char metbase[LEN];
39
40
42
43
44 if (argc < 4)
45 ERRMSG("Give parameters: <ctl> <out.nc> <gps1.nc> [<gps2.nc> ...]");
46
47
48 const double dt_met = scan_ctl(argc, argv, "DT_MET", -1, "21600", NULL);
49 const double gauss_dx = scan_ctl(argc, argv, "GAUSS_DX", -1, "-999", NULL);
50 const double gauss_dy = scan_ctl(argc, argv, "GAUSS_DY", -1, "-999", NULL);
51 const double grid_zmin = scan_ctl(argc, argv, "GRID_ZMIN", -1, "0", NULL);
52 const double grid_zmax = scan_ctl(argc, argv, "GRID_ZMAX", -1, "40", NULL);
53 const int grid_nz = (int) scan_ctl(argc, argv, "GRID_NZ", -1, "-1", NULL);
54 const double ham_dz = scan_ctl(argc, argv, "HAM_DZ", -1, "-999", NULL);
55 const double ham_dz2 = scan_ctl(argc, argv, "HAM_DZ2", -1, "-999", NULL);
56 scan_ctl(argc, argv, "METBASE", -1, "", metbase);
57 const int poly_dim = (int) scan_ctl(argc, argv, "POLY_DIM", -1, "5", NULL);
58 const double poly_zmin = scan_ctl(argc, argv, "POLY_ZMIN", -1, "0", NULL);
59 const double poly_zmax = scan_ctl(argc, argv, "POLY_ZMAX", -1, "40", NULL);
60
61
62 for (int iarg = 3; iarg < argc; iarg++) {
63 FILE *in;
64 if (!(in = fopen(argv[iarg], "r")))
65 continue;
66 else {
67 fclose(in);
69 }
70 }
71
72
74 ERRMSG("No profiles found!");
75
76
77 if (grid_nz > 0)
78 grid_gps(gps, grid_zmin, grid_zmax, grid_nz);
79
80
82
83
84 if (gauss_dx > 0 && gauss_dy > 0)
85 gauss(gps, gauss_dx, gauss_dy);
86
87
88 if (ham_dz > 0)
90
91
92 if (ham_dz2 > 0)
94
95
96 if (metbase[0] != '-')
98
99
100 if (poly_dim > 0)
101 poly(gps, poly_dim, poly_zmin, poly_zmax);
102
103
105
106
107 free(gps);
108
109 return EXIT_SUCCESS;
110}
void write_gps(char *filename, gps_t *gps)
Write GPS-RO data file.
void gauss(gps_t *gps, double dx, double dy)
Calculate horizontal Gaussian mean to extract perturbations.
void poly(gps_t *gps, int dim, double zmin, double zmax)
Remove polynomial fit from perturbation profile.
void grid_gps(gps_t *gps, double zmin, double zmax, int nz)
Interpolate GPS data to regular altitude grid.
void hamming_low_pass(gps_t *gps, double dz)
Apply vertical Hamming filter to extract perturbations.
void detrend_met(gps_t *gps, char *metbase, double dt_met)
Detrending by means of meteo data.
void read_gps_prof(char *filename, gps_t *gps)
Read GPS-RO profile.
void hamming_high_pass(gps_t *gps, double dz)
Apply vertical Hamming filter to reduce noise.
void tropopause(gps_t *gps)
Find tropopause height.
int nds
Number of profiles.