Go to the documentation of this file.
29 printf(
"-E- : Error allocating memory to bindx in get_par\n");
35 static int scan_processed = -1;
36 static float *parb, *parc, *par0, *para, *mu_est;
41 if (scan_processed != l2rec->l1rec->iscan || scan_processed == -1) {
45 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++) {
52 if (scan_processed != l2rec->l1rec->iscan || scan_processed == -1) {
55 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++)
61 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++) {
70 if (scan_processed == l2rec->l1rec->iscan && scan_processed != -1) {
71 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++)
75 int32_t ip, ib, ipb, iw;
88 static int firstCall =
TRUE;
90 l1str *
l1rec = l2rec->l1rec;
95 parb = (
float *) calloc(
l1rec->npix,
sizeof(
float));
96 parc = (
float *) calloc(
l1rec->npix,
sizeof(
float));
97 par0 = (
float *) calloc(
l1rec->npix,
sizeof(
float));
98 para = (
float *) calloc(
l1rec->npix,
sizeof(
float));
99 mu_est = (
float *) calloc(
l1rec->npix,
sizeof(
float));
104 unix2yds(l2rec->l1rec->scantime, &year, &
day, &sec);
105 if (strlen(
input->cld_rad1) == 0) {
106 printf(
"-Error-: rad1 file is not provided. Exiting ... \n ");
109 if (strlen(
input->cld_rad2) == 0) {
110 printf(
"-Error-: rad2 file is not provided. Exiting ... \n ");
113 if (strlen(
input->cld_rad3) == 0) {
114 printf(
"-Error-: rad3 file is not provided. Exiting ... \n ");
117 if (strlen(
input->anc_aerosol1) == 0) {
118 printf(
"-Error-: anc_aerosol1 file is not provided. Exiting ... \n ");
121 if (strlen(
input->anc_aerosol2) == 0) {
122 printf(
"-Error-: anc_aerosol2 file is not provided. Exiting ... \n ");
125 if (strlen(
input->anc_aerosol3) == 0) {
126 printf(
"-Error-: anc_aerosol3 file is not provided. Exiting ... \n ");
129 if (l2rec->l1rec->cld_rad ==
NULL) {
130 printf(
"-Error-: cloud rad structure has not been allocated. Exiting ... \n ");
136 size_t total_waves =
l1file->nbands;
138 size_t start_ib = total_waves;
151 for (ib = 0; ib < nwave; ib++)
157 for (ib = 0; ib < nwave; ib++)
163 for (ib = 0; ib < nwave; ib++)
169 for (ib = 0; ib < nwave; ib++)
175 for (ib = 0; ib < total_waves; ib++) {
176 if (
l1file->fwave[ib] >= 400) {
177 start_ib =
MIN(ib, start_ib);
179 if (
l1file->fwave[ib] < 700) {
180 end_ib =
MAX(ib, end_ib);
185 size_t band_step = (end_ib - start_ib) / (nwave - 1);
187 for (
size_t ib = 0; ib < nwave; ib++) {
188 bindx[ib] = ib * band_step + start_ib;
193 printf(
"PAR not supported for this sensor (%d).\n",
l1file->sensorID);
197 if ((
lambda = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
198 printf(
"-E- : Error allocating memory to lambda in get_par\n");
201 if ((Fobar = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
202 printf(
"-E- : Error allocating memory to Fobar in get_par\n");
205 if ((Taur = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
206 printf(
"-E- : Error allocating memory to Taur in get_par\n");
209 if ((kO3 = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
210 printf(
"-E- : Error allocating memory to kO3 in get_par\n");
217 for (iw = 0; iw < nwave; iw++) {
220 kO3[iw] =
l1file->k_oz[ib];
221 Fobar[iw] =
l1file->Fobar[ib];
222 Taur[iw] =
l1file->Tau_r[ib];
225 if ((Lt = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
226 printf(
"-E- : Error allocating memory to Lt in get_par\n");
229 for (ip = 0; ip <
l1rec->npix; ip++) {
231 for (ib = 0; ib < nwave; ib++) {
233 Lt[ib] =
l1rec->Lt[ipb];
237 if (Lt[0] <= 0.0 || (
l1rec->flags[ip] &
mask) != 0 ||
l1rec->solz[ip] > 90.0) {
262 par[ip] =
calc_par_impl_of_2023(l2rec, ip, nwave, Lt, taua, angst,
lambda, Fobar, kO3, Taur,
266 printf(
"PAR not supported for this sensor (%d).\n",
l1file->sensorID);
285 scan_processed = l2rec->l1rec->iscan;
288 static int32_t ini_obs = 0;
289 static float observed_time;
290 static int32_t index_obs;
295 int16_t year, month, mday;
297 unix2ymds(l2rec->l1rec->scantime, &year, &month, &mday, &sec);
298 observed_time = sec / 3600;
299 size_t ntimes = l2rec->l1rec->cld_rad->ntimes;
301 for (
size_t it = 0; it < ntimes; it++) {
302 float diff =
fabs(l2rec->l1rec->cld_rad->timecldrange[it] - observed_time);
303 if (min_diff >
diff) {
309 size_t npix = l2rec->l1rec->npix;
310 for (
size_t ip = 0; ip <
npix; ip++) {
311 taucld[ip] = l2rec->l1rec->cld_rad->taucld[ip][index_obs];
318 int16_t year, month, mday;
320 unix2ymds(l2rec->l1rec->scantime, &year, &month, &mday, &sec);
321 observed_time = sec / 3600;
322 size_t ntimes = l2rec->l1rec->cld_rad->ntimes;
324 for (
size_t it = 0; it < ntimes; it++) {
325 float diff =
fabs(l2rec->l1rec->cld_rad->timecldrange[it] - observed_time);
326 if (min_diff >
diff) {
332 size_t npix = l2rec->l1rec->npix;
333 for (
size_t ip = 0; ip <
npix; ip++) {
334 clfr[ip] = l2rec->l1rec->cld_rad->cfcld[ip][index_obs];
339 int32_t ip, ib, ipb, iw;
354 static int firstCall =
TRUE;
356 l1str *
l1rec = l2rec->l1rec;
364 unix2yds(l2rec->l1rec->scantime, &year, &
day, &sec);
381 for (ib = 0; ib < nwave; ib++)
387 for (ib = 0; ib < nwave; ib++)
393 for (ib = 0; ib < nwave; ib++)
399 for (ib = 0; ib < nwave; ib++)
403 printf(
"PAR not supported for this sensor (%d).\n",
l1file->sensorID);
407 if ((
lambda = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
408 printf(
"-E- : Error allocating memory to lambda in get_par\n");
411 if ((Fobar = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
412 printf(
"-E- : Error allocating memory to Fobar in get_par\n");
415 if ((Taur = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
416 printf(
"-E- : Error allocating memory to Taur in get_par\n");
419 if ((kO3 = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
420 printf(
"-E- : Error allocating memory to kO3 in get_par\n");
426 for (iw = 0; iw < nwave; iw++) {
429 kO3[iw] =
l1file->k_oz[ib];
430 Fobar[iw] =
l1file->Fobar[ib];
431 Taur[iw] =
l1file->Tau_r[ib];
434 if ((Lt = (
float *) calloc(nwave,
sizeof(
float))) ==
NULL) {
435 printf(
"-E- : Error allocating memory to Lt in get_par\n");
439 for (ip = 0; ip <
l1rec->npix; ip++) {
441 for (ib = 0; ib < nwave; ib++) {
443 Lt[ib] =
l1rec->Lt[ipb];
447 if (Lt[0] <= 0.0 || (
l1rec->flags[ip] &
mask) != 0 ||
l1rec->solz[ip] > 90.0) {
464 par[ip] =
calc_par(l2rec, ip, nwave, Lt, taua, angst,
lambda, Fobar, kO3, Taur);
468 printf(
"PAR not supported for this sensor (%d).\n",
l1file->sensorID);
481 if (scan_processed != l2rec->l1rec->iscan || scan_processed == -1) {
484 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++) {
491 if (scan_processed != l2rec->l1rec->iscan || scan_processed == -1) {
494 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++) {
502 if (scan_processed != l2rec->l1rec->iscan || scan_processed == -1) {
505 for (
size_t ip = 0; ip < l2rec->l1rec->npix; ip++) {
int32 l1file(int32 sdfid, int32 *nsamp, int32 *nscans, int16 *dtynum)
int smi_climatology_init(char *file, int day, int prodID)
void get_par_below_surface(l2str *l2rec, float par[])
float * par_planar_a_inst
float calc_par(l2str *l2rec, int ip, int nbands, float *Lt, float taua, float angstrom, float *wl, float *fo, float *ko3, float *taumolbar)
void calc_scalar_inst_par(l2str *l2rec, int ip, float par_above_ins, float *par_scalar_ins)
void get_par_scalar(l2str *l2rec, float par[])
void unix2ymds(double usec, int16_t *year, int16_t *mon, int16_t *day, double *secs)
void get_clfr(l2str *l2rec, float clfr[])
void get_taucld(l2str *l2rec, float taucld[])
void get_par2(l2str *l2rec, float par[])
float calc_par_impl_of_2023(l2str *l2rec, int ip, int nbands, float *Lt, float taua, float angstrom, float *wl, float *fo, float *ko3, float *taumolbar, float *parb, float *parc)
#define INSTRUMENT_SEAWIFS
void get_mu_cosine(l2str *l2rec, float mu[])
void get_ipar_scalar(l2str *l2rec, float ipar[])
a context in which it is NOT documented to do so subscript which cannot be easily calculated when extracting TONS attitude data from the Terra L0 files Corrected several defects in extraction of entrained ephemeris and and as HDF file for both the L1A and Geolocation enabling retrieval of South Polar DEM data Resolved Bug by changing to opent the geolocation file only after a successful read of the L1A and also by checking for fatal errors from not restoring C5 and to report how many of those high resolution values were water in the new WaterPresent SDS Added valid_range attribute to Land SeaMask Changed to bilinearly interpolate the geoid_height to remove artifacts at one degree lines Made corrections to const qualification of pointers allowed by new version of M API library Removed casts that are no longer for same not the geoid Corrected off by one error in calculation of high resolution offsets Corrected parsing of maneuver list configuration parameter Corrected to set Height SDS to fill values when geolocation when for elevation and land water mask
void unix2yds(double usec, short *year, short *day, double *secs)
subroutine diff(x, conec, n, dconecno, dn, dconecmk, units, u, inno, i, outno, o, input, deriv)
void get_par(l2str *l2rec, float par[])
float * par_planar_b_inst
float smi_climatology(float lon, float lat, int prodID)
void get_ipar2(l2str *l2rec, float ipar[])
void get_ipar_below_surface(l2str *l2rec, float ipar[])
void calc_scalar_par_mean_cosine(l2str *l2rec, int ip, float par_above, float par_c, float *scalar_par, float *mean_cosine)
int sensorId2InstrumentId(int sensorId)