97 if (hdf_status ==
FAIL)
106 hdf_status =
SDend(sds_id);
107 if (hdf_status ==
FAIL)
114 if (sds_id !=
FAIL) {
115 hdf_status =
SDend(sds_id);
139 char *attr_buf = NULL;
147 hdf_status = attr_index =
SDfindattr(sds_id,
"coremetadata");
148 if (hdf_status ==
FAIL)
152 hdf_status =
SDattrinfo(sds_id, attr_index, attr_name, &data_type, &count);
153 if (hdf_status ==
FAIL)
157 attr_buf = (
char*)malloc((count + 1) *
sizeof(char));
158 if (attr_buf == NULL)
162 hdf_status =
SDreadattr(sds_id, attr_index, (VOIDP)attr_buf);
163 if (hdf_status ==
FAIL)
166 attr_buf[
count] =
'\0';
168 fn_start = strstr(attr_buf,
"MISR_AM1_");
169 if (fn_start == NULL) {
170 fn_start = strstr(attr_buf,
"MISR_HR_");
171 if (fn_start == NULL)
174 fn_end = strstr(attr_buf,
".hdf");
180 *lgid = (
char*)malloc((fn_end - fn_start + 1) *
sizeof(char));
181 strncpy(*lgid,fn_start,fn_end - fn_start);
182 (*lgid)[fn_end - fn_start] =
'\0';
189 if (attr_buf != NULL)
200 char *lgid_tmp = NULL;
211 lgid_tmp = calloc(len+1,
sizeof(
char));
223 if (lgid_tmp != NULL)
MTKt_status MtkFileLGID(const char *filename, char **lgid)
Determine local granual ID of MISR product file.
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkFileLGIDHDF(const char *filename, char **lgid)
EXTERNL int nc_get_att(int ncid, int varid, const char *name, void *ip)
#define MTK_ERR_CODE_JUMP(code)
EXTERNL int nc_inq_attlen(int ncid, int varid, const char *name, size_t *lenp)
HDFLIBAPI int32 SDstart(const char *name, int32 accs)
HDFLIBAPI intn SDreadattr(int32 id, int32 idx, void *buf)
MTKt_status MtkFileLGIDNcid(int ncid, char **lgid)
HDFLIBAPI intn SDend(int32 fid)
MTKt_status MtkFileLGIDFid(int32 sds_id, char **lgid)
Version of MtkFileLGID that takes an HDF SDS ID rather than a filename.
HDFLIBAPI int32 SDfindattr(int32 id, const char *attrname)
HDFLIBAPI intn SDattrinfo(int32 id, int32 idx, char *name, int32 *nt, int32 *count)
MTKt_status MtkFileLGIDNC(const char *filename, char **lgid)
#define MTK_ERR_COND_JUMP(code)
EXTERNL int nc_close(int ncid)
EXTERNL int nc_open(const char *path, int mode, int *ncidp)