Go to the documentation of this file.
12 #define NUM_GEO_DATA 6
14 static char *geo_name[] = {
"latitude",
"longitude",
"sensor_azimuth",
15 "sensor_zenith",
"solar_azimuth",
"solar_zenith"};
35 static hico_private_t* allocatePrivateData() {
37 hico_private_t* pData = (hico_private_t*) calloc(1,
sizeof (hico_private_t));
38 pData->lt_slope = 1.0;
39 pData->fileID = (h5io_str*) calloc(1,
sizeof (h5io_str));
40 pData->ds_id = (h5io_str*) calloc(1,
sizeof (h5io_str));
42 pData->geo_dat_id[
i] = (h5io_str*) calloc(1,
sizeof (h5io_str));
43 pData->orientation = 0;
51 free(pData->rad_data);
57 free(pData->geo_dat_id[
i]);
63 int year, month,
day, hour, minute;
77 hico_private_t* pData;
80 char orientationStr[10];
82 pData = allocatePrivateData();
83 file->private_data = pData;
86 H5Eset_auto(H5E_DEFAULT,
NULL,
NULL);
89 fprintf(
stderr,
"-E- %s Line %d: Failure to open %s\n",
90 __FILE__, __LINE__,
file->name);
96 if (
h5io_set_grp(pData->fileID,
"products", &gid) != 0) {
97 fprintf(
stderr,
"-E- %s Line %d: Unable to open group products\n",
105 fprintf(
stderr,
"-E- %s Line %d: Unable to open data set: Lt\n",
115 if (
h5io_info(pData->ds_id,
NULL, &f_class, &f_native_typ, &ndim, dims, &sto_len)
117 fprintf(
stderr,
"-E- %s Line %d: Unable to get data set dimensions\n",
124 pData->numBands = dims[2];
126 pData->fwhm = (
float*) malloc(
sizeof (
float)*pData->numBands);
127 if (pData->fwhm ==
NULL) {
129 "-E- %s Line %d: Unable to allocate data for wavelength bandwidth\n",
136 wvls = (
float*) malloc(
sizeof (
float) * pData->numBands);
139 "-E- %s Line %d: Unable to allocate data for wavelengths\n",
148 if (
h5io_rd_attr(pData->ds_id,
"fwhm", (
void *) pData->fwhm) != 0) {
150 "-E- %s Line %d: Unable to read the wavelength bandwidth (fwhm) attribute\n",
159 if (
h5io_rd_attr(pData->ds_id,
"wavelengths", (
void *) wvls) != 0) {
161 "-E- %s Line %d: Unable to read the wavelength attribute\n",
171 pData->wave_ix = (
int*) malloc(
sizeof (
int) *
file->nbands);
172 if (pData->wave_ix ==
NULL) {
174 "-E- %s Line %d: Unable to allocate data for wavelength index array\n",
185 for (
i = 0;
i <
file->nbands;
i++) {
186 pData->wave_ix[
i] =
windex(Lambda[
i], wvls, pData->numBands);
192 "metadata/FGDC/Identification_Information/Time_Period_of_Content",
195 "-E- %s Line %d: Unable to open group Time_Period_of_Content\n",
203 bzero(&sdate,
sizeof (sdate));
204 if (
h5io_rd_attr(&gid,
"Beginning_Date", (
void *) &sdate) != 0) {
206 "-E- %s Line %d: Unable to read the Beginning_Date attribute:\n",
215 bzero(&stime,
sizeof (stime));
216 if (
h5io_rd_attr(&gid,
"Beginning_Time", (
void *) &stime) != 0) {
218 "-E- %s Line %d: Unable to read the Beginning_Date attribute:\n",
227 bzero(&edate,
sizeof (edate));
228 if (
h5io_rd_attr(&gid,
"Ending_Date", (
void *) &edate) != 0) {
230 "-E- %s Line %d: Unable to read the Beginning_Date attribute:\n",
239 bzero(&etime,
sizeof (etime));
240 if (
h5io_rd_attr(&gid,
"Ending_Time", (
void *) &etime) != 0) {
242 "-E- %s Line %d: Unable to read the Beginning_Date attribute:\n",
253 sscanf(sdate,
"%04d%02d%02d", &
year, &month, &
day);
254 sscanf(stime,
"%02d%02d%02d", &hour, &minute, &sec);
257 if (
h5io_rd_attr(pData->ds_id,
"scale_factor", (
void *) &pData->lt_slope) != 0) {
258 if (
h5io_rd_attr(pData->ds_id,
"slope", (
void *) &pData->lt_slope) != 0) {
260 "-E- %s Line %d: Unable to read the Lt slope attribute:\n",
269 if (
h5io_rd_attr(pData->ds_id,
"add_offset", (
void *) &pData->lt_intercept) != 0) {
270 if (
h5io_rd_attr(pData->ds_id,
"intercept", (
void *) &pData->lt_intercept) != 0) {
272 "-E- %s Line %d: Unable to read the Lt intercept attribute:\n",
285 sprintf(g_path,
"navigation/%s", geo_name[ids]);
286 if (
h5io_set_ds(pData->fileID, g_path, pData->geo_dat_id[ids]) != 0) {
289 if(ids == 0 || ids == 1) {
290 sprintf(g_path,
"navigation/%ss", geo_name[ids]);
291 if (
h5io_set_ds(pData->fileID, g_path, pData->geo_dat_id[ids]) != 0) {
293 "-E- %s Line %d: Unable to set ds # %d in geolocation file\n",
294 __FILE__, __LINE__, ids);
305 if (
h5io_set_grp(pData->fileID,
"metadata/HICO/Calibration", &gid) != 0) {
307 "-E- %s Line %d: Unable to open group metadata/HICO/Calibration\n",
317 bzero(&orientationStr,
sizeof (orientationStr));
318 if (
h5io_rd_attr(&gid,
"hico_orientation_from_quaternion", (
void *) &orientationStr) != 0) {
319 if (
h5io_rd_attr(&gid,
"hico_orientation_from_quaternion ", (
void *) &orientationStr) != 0) {
321 "-E- %s Line %d: Unable to read the hico_orientation_from_quaternion attribute:\n",
332 if (strstr(orientationStr,
"-XVV")) {
333 pData->orientation = 1;
335 pData->orientation = 0;
338 file->npix = dims[1];
339 file->nscan = dims[0];
343 pData->rad_data = (uint16_t *) calloc(
file->npix, sizeof (uint16_t));
354 hico_private_t* pData = (hico_private_t*)
file->private_data;
356 l1rec->scantime =
yds2unix(pData->syear, pData->sday, (
double) ((pData->smsec +
scan * dmsec) / 1.e3));
384 if (pData->orientation) {
395 "-E- %s Line %d: Failed to geonav scan %d of parm %d\n",
396 __FILE__, __LINE__,
scan, igeo);
402 if (pData->orientation) {
412 for (ib = 0; ib <
l1rec->l1file->nbands; ib++) {
413 start[2] = pData->wave_ix[ib];
416 "-E- %s Line %d: Failed to read scan %d of band %d\n",
417 __FILE__, __LINE__,
scan, ib);
421 for (ip = 0; ip <
file->npix; ip++) {
422 ipb = ip *
l1rec->l1file->nbands + ib;
424 if (pData->rad_data[ip] > 0) {
425 l1rec->Lt[ipb] = ((
float) (pData->rad_data[ip]) * pData->lt_slope
426 + pData->lt_intercept) / 10.0;
439 hico_private_t* pData = (hico_private_t*)
file->private_data;
444 "-E- %s Line %d: Failed to close navigation data %s\n",
445 __FILE__, __LINE__, geo_name[
i]);
451 fprintf(
stderr,
"-E- %s Line %d: Failed to close Lt data set\n",
457 fprintf(
stderr,
"-E- %s Line %d: Failed to close HDF5 file %s\n",
458 __FILE__, __LINE__,
file->name);
double yds2unix(int16_t year, int16_t day, double secs)
int h5io_openr(char *file, int opt, h5io_str *id)
MOD_PR01 Production producing one five minute granule of output data in each run It can be configured to produce as many as three five minute granules per run Each execution with one construction record and one date file for each dataset In normal these are created by which splits them out of the hour datasets For LANCE they are created by which merges all session MODIS L0 datasets overlapping the requested time and extracts from the merged data those packets which fall within that time period Each scan of data is stored in the L1A granule that covers the start time of that scan
int h5io_info(h5io_str *id, char *attr_name, H5T_class_t *class, hid_t *native_typ, int *ndim, int *dim_siz, int *sto_len)
int h5io_close(h5io_str *id)
int readl1_hico_h5(filehandle *file, int32_t scan, l1str *l1rec, int lonlat)
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 h5io_set_grp(h5io_str *id, char *path_name, h5io_str *grp_id)
int h5io_set_ds(h5io_str *id, char *path_name, h5io_str *ds_id)
subroutine lonlat(alon, alat, xlon, ylat)
int h5io_rd_ds_slice(h5io_str *ds_id, int *start, int *count, void *data)
int h5io_rd_attr(h5io_str *id, char *attr_name, void *data)
void freePrivateData(oli_t *data)
int openl1_hico_h5(filehandle *file)
void ymdhms2ydmsec(int yy, int mm, int dd, int hh, int mn, int sc, int32_t *year, int32_t *day, int32_t *msec)
h5io_str * geo_dat_id[NUM_GEO_DATA]
int windex(float wave, float twave[], int ntwave)
int32_t rdsensorinfo(int32_t, int32_t, const char *, void **)
for(i=0;i< NROOTS;i++) s[i]
int closel1_hico_h5(filehandle *file)
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")