Go to the documentation of this file.
13 #define LAC_PIXEL_NUM 1285
14 #define GAC_PIXEL_NUM 248
15 #define NREC_IN_BUF 10
19 #define MASK_HIGHLT1 16
20 #define GENBUFSIZ NREC_IN_BUF*sizeof(float)*40
106 float32 inst_temp[40];
109 float32 sen_mat[3 * 3];
116 int32
get_l1a_rec(int32 sd_id, int32 recno, cal_mod_struc *cal_mod,
117 int16 *l1a_dum, float32 **l1b_data,
int16 **l2_flags) {
124 int32
start[3] = {0, 0, 0};
131 float Styp_frac = 0.9;
140 static int32 crec = -1;
141 static int16 recursive_flag = 0;
142 static int16 n_read = 0;
143 static int32 max_rec_in_rdbuf;
146 static int32 stray_light_scan_no;
148 static float *st_l1b_data;
149 static int16 *st_l2_flags;
151 static int32 initial = 1;
152 static byte first = 1;
165 if (first || recno < crec) {
166 max_rec_in_rdbuf = recno - 1;
167 stray_light_scan_no = recno;
172 if (crec >
nscan)
return 0;
175 if (crec > max_rec_in_rdbuf) {
190 for (irec = 0; irec < n_read; irec++) {
191 start[0] = recno - 1 + irec;
192 SDreaddata(SDselect(sd_id, SDnametoindex(sd_id,
"l1a_data")),
194 for (ipix = 0; ipix <
npix; ipix++)
195 for (idet = 0; idet < 8; idet++)
197 band_buf[ipix * 8 + idet];
201 rdSDS(sd_id,
"gain", recno - 1, 0, n_read, 8, (
VOIDP) genBuf);
202 for (
i = 0;
i < n_read;
i++)
203 memcpy(&rdBuf[
i].
gain, &genBuf[
i * 8 * 2], 8 * 2);
205 rdSDS(sd_id,
"tdi", recno - 1, 0, n_read, 8, (
VOIDP) genBuf);
206 for (
i = 0;
i < n_read;
i++)
207 memcpy(&rdBuf[
i].
tdi, &genBuf[
i * 8 * 2], 8 * 2);
209 rdSDS(sd_id,
"scan_temp", recno - 1, 0, n_read, 8, (
VOIDP) genBuf);
210 for (
i = 0;
i < n_read;
i++)
211 memcpy(&rdBuf[
i].scan_temp, &genBuf[
i * 8 * 2], 8 * 2);
213 rdSDS(sd_id,
"inst_ana", recno - 1, 0, n_read, 40, (
VOIDP) genBuf);
214 for (
i = 0;
i < n_read;
i++)
215 memcpy(&rdBuf[
i].inst_temp, &genBuf[
i * 40 * 4], 40 * 4);
217 rdSDS(sd_id,
"orb_vec", recno - 1, 0, n_read, 3, (
VOIDP) genBuf);
218 for (
i = 0;
i < n_read;
i++)
219 memcpy(&rdBuf[
i].orb_vec, &genBuf[
i * 3 * 4], 3 * 4);
221 rdSDS(sd_id,
"sun_ref", recno - 1, 0, n_read, 3, (
VOIDP) genBuf);
222 for (
i = 0;
i < n_read;
i++)
223 memcpy(&rdBuf[
i].sun_ref, &genBuf[
i * 3 * 4], 3 * 4);
225 rdSDS(sd_id,
"scan_ell", recno - 1, 0, n_read, 6, (
VOIDP) genBuf);
226 for (
i = 0;
i < n_read;
i++)
227 memcpy(&rdBuf[
i].
scan_ell, &genBuf[
i * 6 * 4], 6 * 4);
230 start[0] = recno - 1;
235 SDreaddata(SDselect(sd_id, SDnametoindex(sd_id,
"sen_mat")),
237 for (
i = 0;
i < n_read;
i++)
238 memcpy(&rdBuf[
i].sen_mat, &genBuf[
i * 9 * 4], 9 * 4);
241 offset = max_rec_in_rdbuf + 1;
242 max_rec_in_rdbuf += n_read;
245 if ((crec -
offset) >= 0) {
248 gain_ptr = rdBuf[
j].
gain;
254 rdBuf[
j].scan_temp, rdBuf[
j].inst_temp,
side[recno - 1],
264 if (!recursive_flag) {
273 gain_ptr = bkBuf[
j].
gain;
276 if (!recursive_flag) {
290 if (!recursive_flag) {
291 for (ipix = 0; ipix <
npix; ipix++) {
295 for (idet = 6; (idet < 8)&&(hi_Lt[ipix] ==
FALSE); idet++) {
296 pixvalue = l1a_ptr[ipix +
npix * idet];
302 hi_Lt[ipix] = ((pixvalue - pixdark) >= kneevalue);
313 for (ipix = 0; ipix <
npix; ipix++)
316 }
else if (!recursive_flag) {
319 if (stray_light_scan_no != scan_no) {
324 l1a_dum, &st_l1b_data, &st_l2_flags);
337 for (ipix = 0; ipix <
npix; ipix++) {
353 char *cal_path =
file->calfile;
373 "-E %s Line %d: Error opening %s for reading.\n",
374 __FILE__, __LINE__,
file->name);
406 if (strcmp(
dtype,
"GAC") == 0)
415 if (cal_path ==
NULL) {
417 "-E %s Line %d: No calibration file specified.\n",
438 "-E- %s line %d: Error applying calibration table \"%s\".\n",
439 __FILE__, __LINE__, cal_path);
452 if (strcmp(
dtype,
"GAC") == 0)
463 msec = (int32 *) calloc(
nscan,
sizeof (int32));
473 tilt = (float32 *) calloc(
nscan,
sizeof (float32));
487 static cal_mod_struc cal_mod;
488 static int16 *l2_flags;
489 static float32 *l1b_data;
494 int32 nwave =
l1rec->l1file->nbands;
505 static int32 prev_recnum = -1;
507 static int16 first = 1;
509 static int16 tilt_flags[20];
510 static int16 tilt_ranges[2 * 20];
518 printf(
"Reading out-of-sequence %d %d\n",
recnum, prev_recnum);
535 for (
i = 0;
i < ntilts;
i++) {
536 if (tilt_ranges[2 *
i] <=
recnum + 1 && tilt_ranges[2 *
i + 1] >=
recnum)
556 for (
i = prev_recnum + 1;
i <=
recnum;
i++)
558 &l1b_data, &l2_flags);
574 for (ipix = 0; ipix <
file->npix; ipix++) {
575 if (
l1rec->sena[ipix] > 180) {
576 l1rec->sena[ipix] -= 360.0;
578 if (
l1rec->sola[ipix] > 180) {
579 l1rec->sola[ipix] -= 360.0;
582 for (iw = 0; iw < nwave; iw++) {
584 l1rec->Lt [ipix * nwave + ib] = l1b_data[iw *
npix + ipix];
587 l1rec->hilt [ipix] = ((l2_flags[ipix] &
HILT) > 0);
588 l1rec->navwarn[ipix] = (nflag[7] & 1) | (nflag[0] & 1);
596 int16_t year =
syear;
601 if (
day > (365 + (year % 4 == 0))) {
634 SDreaddata(SDselect(
file->sd_id, SDnametoindex(
file->sd_id,
"sen_mat")),
float32 pcal_counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
float64 t_const[BANDS_DIMS_1A]
double yds2unix(int16_t year, int16_t day, double secs)
float64 ms1_exponential_1[BANDS_DIMS_1A]
float32 fp_temps[256][BANDS_DIMS_1A]
float32 xlon[LAC_PIXEL_NUM]
void read_caltable(char *cal_path)
float64 ms1_linear_2[BANDS_DIMS_1A]
float64 ms2_exponential_2[BANDS_DIMS_1A]
float32 rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
float32 pcal_rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
int geonav_(FLOAT32 pos[3], FLOAT32 rm[3][3], FLOAT32 coef[6], FLOAT32 sunref[3], INT32 *spix, INT32 *ipix, INT32 *npix, FLOAT32 lat[], FLOAT32 lon[], FLOAT32 solz[], FLOAT32 sola[], FLOAT32 senz[], FLOAT32 sena[])
short l2_flags_buffer[LAC_PIXEL_NUM]
int openl1a_seawifs(filehandle *file)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed file
int readl1a_seawifs(filehandle *file, int32_t recnum, l1str *l1rec)
float32 sola[LAC_PIXEL_NUM]
float64 ms1_const[BANDS_DIMS_1A]
float64 ms2_const[BANDS_DIMS_1A]
float32 cal_rads[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
double zulu2unix(char *zulu)
if(BUILD_JPL) add_executable(interp_hycom interp_hycom.f) add_executable(interp_hycom_ascii interp_hycom_ascii.f) add_executable(tec tec.c) add_executable(swh swh.c) target_link_libraries(interp_hycom netcdff dfutils $
float64 inst_tref[BANDS_DIMS_1A]
int rdSDS(int32 fileID, const char sdsname[], int32 start1, int32 start2, int32 edges1, int32 edges2, VOIDP array_data)
float64 ms1_exponential_2[BANDS_DIMS_1A]
void geonav_lonlat_(float *orb_vec, float *sen_mat, float *scan_ell, float *sun_ref, int32 *nsta, int32 *ninc, int32 *npix, float ylat[], float xlon[])
int readl1a_lonlat_seawifs(filehandle *file, int32_t recnum, l1str *l1rec)
float32 counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
int closel1a_seawifs(filehandle *file)
int32_t l1b_rad(int syear, int sday, int32_t smsec, int32_t msec, char *dtype, int32_t nsta, int32_t ninc, int32_t npix, float *dark_mean, short *gain, short *tdi, short *scan_temp, float *inst_temp, int mside, short *l1a_data, float *l1b_data, cal_mod_struc *cal_mod)
float64 cal_offs[BANDS_DIMS_1A]
float32 cal_counts[BANDS_DIMS_1A][GAINS_DIMS_1A][KNEES_DIMS_1A]
int dark_rest_stat(int16 *data, int nrec, float *dark_mean, float *dark_std)
float32 ylat[LAC_PIXEL_NUM]
float32 sena[LAC_PIXEL_NUM]
float32 scan_mod[2][1285]
int scan_ell(float p[3], double sm[3][3], double coef[10])
float64 fp_tcorr[BANDS_DIMS_1A]
int32_t stray_light_corr(int32_t *initial, float Ltyp_frac, float Styp_frac, int32_t nscans, int32_t nsamples, int32_t scan_no, char *dtype, int16_t gn, float *rads, float *l1b_data, int32_t *sl_scan, int16_t *l2_flags, int32_t *AS_pixels)
float64 t_exponential_2[BANDS_DIMS_1A]
int32 get_l1a_rec(int32 sd_id, int32 recno, cal_mod_struc *cal_mod, int16 *l1a_dum, float32 **l1b_data, int16 **l2_flags)
float64 t_linear_2[BANDS_DIMS_1A]
float64 t_linear_1[BANDS_DIMS_1A]
int getHDFattr(int32 fileID, const char attrname[], const char sdsname[], VOIDP data)
float64 ms2_linear_2[BANDS_DIMS_1A]
float64 inst_tcorr[BANDS_DIMS_1A]
float64 fp_tref[BANDS_DIMS_1A]
float64 t_exponential_1[BANDS_DIMS_1A]
float64 ms2_linear_1[BANDS_DIMS_1A]
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")
float64 ms2_exponential_1[BANDS_DIMS_1A]
float64 ms1_linear_1[BANDS_DIMS_1A]
float32 solz[LAC_PIXEL_NUM]
float32 senz[LAC_PIXEL_NUM]