Go to the documentation of this file.
10 int const scan_number,
11 int const sample_number,
12 double *
const sample_enc
128 static double last_scan_time = -
DBL_MAX;
129 static int scan_success=0;
130 static double *enc_array;
132 enc_array = calloc(
MAX_PADDED,
sizeof(
double));
137 char filefunc[] = __FILE__
", GEO_interp_mirr_enc";
141 || sample_number < 0 || sample_number >=
MAX_PADDED ||
145 sprintf(msgbuf,
"sample_enc = %p, scan = %d, frame = %d, impulse = %d",
146 (
void *)sample_enc, scan_number, sample_number,
158 int i, d, ndata, order;
159 double q, tzero, sqrt_arg;
162 double sumt=0.0, sumt2=0.0, sume=0.0, sumet=0.0;
163 double denom, delta_t;
164 int padded_samples = 0;
165 Imsl_d_spline *encoder_spline=
NULL;
188 denom = ndata*sumt2-sumt*sumt;
190 slope = ndata*sumet-sumt*sume;
200 sprintf(msgbuf,
"%d", scan_number);
223 for (
i = 0;
i < order;
i++)
227 for(
i=order;
i<ndata;
i++)
235 for(
i=ndata;
i<ndata+order;
i++)
243 IMSL_ORDER, order, IMSL_KNOTS, knots, 0);
245 sprintf(msgbuf,
"imsl_d_spline_interp():%ld",
248 free(encoder_spline);
252 for (d = 0; d <
DERIVS; d++)
255 encoder_spline, IMSL_DERIV, d, 0);
257 (aNaN == aNaN &&
derivs[d] == aNaN) )
259 sprintf(msgbuf,
"imsl_d_spline_value() for derivs [%d],\n"
262 free(encoder_spline);
278 if (sqrt_arg < 0 ||
derivs[1] < 0 ) {
279 sprintf(msgbuf,
"%d", scan_number);
281 free(encoder_spline);
286 q = -(
derivs[1]+sqrt(sqrt_arg))*0.5;
307 sprintf(msgbuf,
"%d: derivs[2] too small", scan_number);
309 free(encoder_spline);
319 sprintf(msgbuf,
"%d, q too small", scan_number);
321 free(encoder_spline);
333 for (
i = 0;
i < ndata+order;
i++)
334 encoder_spline->knots[0][
i] -= tzero;
343 IMSL_GRID_USER, padded_samples,
sample_time, enc_array, 0);
346 modsmf(
MODIS_E_GEO,
"imsl_d_spline_value()", filefunc);
350 free(encoder_spline);
357 *sample_enc = enc_array[sample_number] +
int GEO_interp_mirr_enc(int const scan_number, int const sample_number, double *const sample_enc)
#define MODIS_E_GEO_MIRR_MOTION
double * mirr_impulse_time[MAX_SCAN_NUMBER]
int16_t * denom[MAXNFILES]
#define MODIS_E_BAD_INPUT_ARG
double IMSL_DECL imsl_d_machine(int n)
void derivs(float x, float y[], float dydx[])
double IMSL_DECL imsl_d_spline_value(double x, Imsl_d_spline *sp,...)
#define GEO_DOUBLE_FILLVALUE
long IMSL_DECL imsl_error_code(void)
subroutine diff(x, conec, n, dconecno, dn, dconecmk, units, u, inno, i, outno, o, input, deriv)
Imsl_d_spline *IMSL_DECL imsl_d_spline_interp(int ndata, double xdata[], double fdata[],...)
const int MAX_SCAN_NUMBER
#define MAX_IMPULSE_NUMBER
double scan_start_time[MAX_SCAN_NUMBER]
#define MODIS_E_GEO_NO_ZERO_ENCODER
for(i=0;i< NROOTS;i++) s[i]
double * mirr_impulse_enc[MAX_SCAN_NUMBER]
int num_impulse[MAX_SCAN_NUMBER]