40 double lz, ptmax[
NZ], var[
NZ], w, wmax, se[
NZ], sz[
NZ], t0 = 10.0,
41 grid_zmin, grid_zmax, ham_dz, ham_dz2;
43 int idx, iphi, iz, iz2, nphi = 360, sn = 0, grid_nz;
50 ERRMSG(
"Give parameters: <ctl> <sens.tab> <response.tab>");
53 grid_zmin = scan_ctl(argc, argv,
"GRID_ZMIN", -1,
"0", NULL);
54 grid_zmax = scan_ctl(argc, argv,
"GRID_ZMAX", -1,
"60", NULL);
55 grid_nz = (int) scan_ctl(argc, argv,
"GRID_NZ", -1,
"601", NULL);
56 ham_dz = scan_ctl(argc, argv,
"HAM_DZ", -1,
"6.0", NULL);
57 ham_dz2 = scan_ctl(argc, argv,
"HAM_DZ2", -1,
"0.4", NULL);
60 if (argv[2][0] !=
'-') {
61 read_shape(argv[2], sz, se, &sn);
63 ERRMSG(
"Too many data points!");
67 printf(
"Write response data: %s\n", argv[3]);
68 if (!(out = fopen(argv[3],
"w")))
69 ERRMSG(
"Cannot create file!");
73 "# $1 = vertical wavelength [km]\n"
74 "# $2 = altitude [km]\n"
75 "# $3 = response (amplitude) [%%]\n"
76 "# $4 = response (variance) [%%]\n");
81 for (iz = 0; iz < gps->
nz[0]; iz++)
83 LIN(0.0, grid_zmin, grid_nz - 1.0, grid_zmax, (
double) iz);
86 for (lz = 0.1; lz <= 20.0; lz += 0.1) {
89 printf(
"Calculate %g km...\n", lz);
92 for (iz = 0; iz < gps->
nz[0]; iz++)
93 ptmax[iz] = var[iz] = 0;
96 for (iphi = 0; iphi < nphi; iphi++) {
99 for (iz = 0; iz < gps->
nz[0]; iz++)
100 gps->
t[0][iz] = 250.0 + t0 * sin(2. * M_PI / lz * gps->
z[0][iz]
102 2. * M_PI * (
double) iphi /
114 if (argv[2][0] !=
'-') {
116 for (iz2 = 0; iz2 < gps->
nz[0]; iz2++) {
117 if (gps->
z[0][iz2] < sz[0] || gps->
z[0][iz2] > sz[sn - 1])
120 idx = locate_irr(sz, sn, gps->
z[0][iz2]);
122 LIN(sz[idx], se[idx], sz[idx + 1], se[idx + 1], gps->
z[0][iz2]);
124 gps->
pt[0][iz2] *= w;
125 wmax = GSL_MAX(w, wmax);
128 for (iz2 = 0; iz2 < gps->
nz[0]; iz2++)
129 gps->
pt[0][iz2] /= wmax;
133 for (iz = 0; iz < gps->
nz[0]; iz++) {
134 ptmax[iz] = GSL_MAX(ptmax[iz], gps->
pt[0][iz]);
135 var[iz] += gsl_pow_2(gps->
pt[0][iz]) / nphi;
141 for (iz = 0; iz < gps->
nz[0]; iz++)
142 fprintf(out,
"%g %g %g %g\n", lz, gps->
z[0][iz], ptmax[iz] / t0,
143 2.0 * var[iz] / gsl_pow_2(t0));
void hamming_low_pass(gps_t *gps, double dz)
Apply vertical Hamming filter to extract perturbations.
void hamming_high_pass(gps_t *gps, double dz)
Apply vertical Hamming filter to reduce noise.
GPS Code Collection library declarations.
#define NZ
Maximum number of altitudes per GPS-RO profile.
int main(int argc, char *argv[])
double pt[NDS][NZ]
Temperature perturbation [K].
double t[NDS][NZ]
Temperature [K].
int nz[NDS]
Number of altitudes per profile.
int nds
Number of profiles.
double z[NDS][NZ]
Altitude [km].