/************************************************************** S_REGRLI.C This function regrids an array with or without gaps, leaving BADFLOAT in the gaps. There is still no checking for monotonicity of either grid, or for the same sense of change in both. The function returns the number of good points in the new array. The function of changing decreasing into increasing grids could be done in a modified version of regrid() itself. */ #include "common.h" #include "vector.h" /* Note: in the variables, a second character of 'o' means "old", and 'n' means "new", that is, the regridded version. */ int s_regridli(float *zo, float *fo, float *zn, float *fn, int no, int nn) { int i; int in0 = 0, inm; int io0, io1; int n0, nout; int ngood = 0; /* Find the valid range of zn. It is the first range with no gaps. */ while ((in0 < nn) && !good_float(zn[in0])) in0++; inm = in0; while ((inm < nn) && good_float(zn[inm])) inm++; /* Initialize fn as bad everywhere. */ for (i=0; i 1) { regridli(zo+io0, fo+io0, zn+in0, fn+in0, io1-io0, inm-in0, &n0, &nout); ngood += nout; } io0 = io1; } return (ngood); }