Go to the documentation of this file.
4 #define DSIGN(A, B) (B >= 0 ? fabs(A) : -fabs(A))
5 #define ERROR_RET(x, err) {err = x; if(err) return err;}
8 float *fout,
float *
func, int32_t ir) {
10 double t2 =
fabs(dt2);
11 if (t1 == 0.0e0 || t2 == 0.0e0) t2 = 1.e0;
12 double w1 = t2 / (t1 + t2);
13 double w2 = t1 / (t1 + t2);
14 if (w1 > 1.0e0) w2 = 0.0e0;
15 if (w2 > 1.0e0) w1 = 0.0e0;
16 for (
int n = 0; n < *
nband; n++) {
18 for (
int i = 0;
i < ipt;
i++) {
20 int flag1 =
f1[n][
i] >= mimx[0] &&
f1[n][
i] <= mimx[1];
21 int flag2 =
f1[n][
i] >= mimx[0] &&
f1[n][
i] <= mimx[1];
22 int sw = flag1 * 2 + flag2;
37 fout[
k] = w1 *
f1[n][
i] + w2 *
f2[n][
i];
49 int spaceint(
float *ll,
float *
lat,
float *
lon,
float **
f, int32_t *ipt, int32_t *
nband,
float *mimx,
float *def,
52 const static int nc[4] = {1, 10, 100, 1000};
53 const static int n1[4][3] = {{1, 2, 4},
57 const static int n2[6][5] = {{11, 1, 2, 4, 3},
64 const static int n3[4][2] = {{111, 4},
68 float llft[2], urht[2];
70 const static double error_tolerance = 1e-9;
71 llft[1 - 1] =
lat[1 - 1];
72 llft[2 - 1] =
lon[1 - 1];
73 urht[1 - 1] =
lat[3 - 1];
74 urht[2 - 1] =
lon[3 - 1];
76 float xp = ll[1] - llft[1];
77 if (fabsf(xp) > 180.0
f) { xp =
DSIGN(360.0
f - fabsf(xp), xp); }
78 float yp = ll[0] - llft[0];
79 float dx = urht[1] - llft[1];
80 if (fabsf(dx) > 180.
f) dx =
DSIGN(360.0
f - fabsf(dx), dx);
81 float dy = urht[0] - llft[0];
83 for (
int n = 0; n < *
nband; n++) {
88 for (
int i = 0;
i < npt;
i++) {
90 if (
g[
i] < mimx[0] ||
g[
i] > mimx[1]) {
99 for (
int i = 0;
i < npt;
i++) {
100 if (ncc == n1[
i][0]) {
101 g[
i] = (
g[n1[
i][1]] +
g[n1[
i][2]]) / 2.
f;
106 for (
int i = 0;
i < 6;
i++) {
107 if (ncc == n2[
i][0]) {
108 g[n2[
i][1]] =
g[n2[
i][3]];
109 g[n2[
i][2]] =
g[n2[
i][4]];
114 for (
int i = 0;
i < npt;
i++) {
115 if (ncc == n3[
i][0]) {
116 fout[n] =
g[n3[
i][1]];
130 if (fabsf(dx) < error_tolerance)
133 a[1] = (
g[3] -
a[0]) / dx;
134 if (fabsf(dy) < error_tolerance)
137 a[2] = (
g[1] -
a[0]) / dy;
138 if (fabsf(dd) < error_tolerance)
141 a[3] = (
a[0] -
g[1] +
g[2] -
g[3]) / dd;
142 fout[n] =
a[0] +
a[1] * xp + yp *
a[2] + yp * xp *
a[3];
149 float *data_list1,
double *dt1,
float *data_list2,
double *dt2,
150 int32_t *ipt, int32_t *
nband,
float rng[2],
float *def,
151 int32_t *intporder,
float *dummy,
float *dataout,
float *unc,
152 int32_t *int_bad, int32_t *row, int32_t *col) {
156 const int ntot = *
nband * *row;
157 int int_bad1, int_bad2;
158 if (rng[1] > rng[0]) {
166 for (
int i = 0;
i < ntot;
i++) {
170 switch (*intporder) {
172 spaceint(in_latlon,
lat,
lon, &data_list1, ipt,
nband, mimx, def, (
float *) fout1, &int_bad1), ret_);
173 ERROR_RET(
spaceint(in_latlon,
lat,
lon, &data_list2, ipt,
nband, mimx, def, (
float *) fout2, &int_bad2),
176 timeint( fout1, fout2, *dt1, *dt2, 1,
nband, mimx, def, dataout, unc, *row),
178 *int_bad = int_bad1 || int_bad2;
180 case 110:
ERROR_RET(
spaceint(in_latlon,
lat,
lon, &data_list1, ipt,
nband, mimx, def, dataout, int_bad),
184 timeint( fout1, fout2, *dt1, *dt2, *ipt,
nband, mimx, def, dataout, unc, *row),
188 timeint(fout1, fout2, *dt1, *dt2, *ipt,
nband, mimx, def, dummy, unc, *ipt),
190 ERROR_RET(
spaceint(in_latlon,
lat,
lon, &dummy, ipt,
nband, mimx, def, dataout, int_bad),
double precision function f(R1)
subroutine func(x, conec, n, bconecno, bn, units, u, inno, i, outno, o, Input, Targ, p, sqerr)
int timeint(float f1[][MAX_BAND], float f2[][MAX_BAND], double dt1, double dt2, int32_t ipt, int32_t *nband, float *mimx, float *def, float *fout, float *func, int32_t ir)
int dataintp(float in_latlon[2], float *lat, float *lon, float *data_list1, double *dt1, float *data_list2, double *dt2, int32_t *ipt, int32_t *nband, float rng[2], float *def, int32_t *intporder, float *dummy, float *dataout, float *unc, int32_t *int_bad, int32_t *row, int32_t *col)
#define ERROR_RET(x, err)
PGE01 indicating that PGE02 PGE01 V6 for and PGE01 V2 for MOD03 were used to produce the granule By convention adopted in all MODIS Terra PGE02 code versions are The fourth digit of the PGE02 version denotes the LUT version used to produce the granule The source of the metadata environment variable ProcessingCenter was changed from a QA LUT value to the Process Configuration A sign used in error in the second order term was changed to a
int spaceint(float *ll, float *lat, float *lon, float **f, int32_t *ipt, int32_t *nband, float *mimx, float *def, float *fout, int32_t *int_bad)