20 #include <HdfEosDef.h> 41 const char *fieldname,
55 const char *fieldname,
92 const char *fieldname,
101 if (filename == NULL)
115 if (hdfstatus ==
FAIL)
135 const char *fieldname,
143 int32 sdInterfaceID =
FAIL;
151 int32 attr_index = 0;
153 char **attrlist_tmp = NULL;
156 if (fieldname == NULL ||
157 num_attrs == NULL || attrlist == NULL)
161 EHidinfo(fid, &HDFfid, &sdInterfaceID);
164 sd_id =
SDselect(sdInterfaceID,sds_index);
165 SDgetinfo(sd_id, name, &rank, dim_sizes, &data_type, &n_attrs);
167 attrlist_tmp = (
char**)calloc(n_attrs,
sizeof(
char**));
168 if (attrlist_tmp == NULL)
171 for (attr_index = 0; attr_index <
n_attrs; ++attr_index)
174 hdf_status =
SDattrinfo(sd_id, attr_index, attr_name, &hdf_datatype, &count);
175 if (hdf_status ==
FAIL)
178 attrlist_tmp[attr_index] = (
char*)malloc((strlen(attr_name) + 1) *
sizeof(char));
179 if (attrlist_tmp[attr_index] == NULL)
182 strcpy(attrlist_tmp[attr_index],attr_name);
184 *attrlist = attrlist_tmp;
190 if (attrlist_tmp != NULL)
193 if (num_attrs != NULL)
201 const char *fieldname,
206 char **attrlist_tmp = NULL;
209 if (fieldname == NULL ||
210 num_attrs == NULL || attrlist == NULL)
218 int nc_status =
nc_inq_grps(ncid, &number_group, NULL);
221 gids = (
int *)calloc(number_group,
sizeof(
int));
224 nc_status =
nc_inq_grps(ncid, &number_group, gids);
227 for (
int i = 0 ; i < number_group ; i++) {
230 int status =
MtkNCVarId(gid, fieldname, &var);
250 attrlist_tmp = (
char**)calloc(n_attrs,
sizeof(
char**));
251 if (attrlist_tmp == NULL)
254 for (
int attr_index = 0; attr_index <
n_attrs; ++attr_index)
261 attrlist_tmp[attr_index] = (
char*)malloc((strlen(attr_name) + 1) *
sizeof(char));
262 if (attrlist_tmp[attr_index] == NULL)
265 strcpy(attrlist_tmp[attr_index],attr_name);
267 *attrlist = attrlist_tmp;
276 if (attrlist_tmp != NULL)
279 if (num_attrs != NULL)
HDFLIBAPI int32 SDnametoindex(int32 fid, const char *name)
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkStringListFree(int strcnt, char **strlist[])
Free string list.
MTKt_status MtkFieldAttrListHDF(const char *filename, const char *fieldname, int *num_attrs, char **attrlist[])
#define MTK_ERR_CODE_JUMP(code)
EXTERNL int nc_inq_varnatts(int ncid, int varid, int *nattsp)
MTKt_status MtkFieldAttrListNC(const char *filename, const char *fieldname, int *num_attrs, char **attrlist[])
MTKt_status MtkFieldAttrList(const char *filename, const char *fieldname, int *num_attrs, char **attrlist[])
Get a list of field attributes.
HDFLIBAPI intn SDgetinfo(int32 sdsid, char *name, int32 *rank, int32 *dimsizes, int32 *nt, int32 *nattr)
EXTERNL int nc_inq_grps(int ncid, int *numgrps, int *ncids)
MTKt_status MtkFieldAttrListFid(int32 fid, const char *fieldname, int *num_attrs, char **attrlist[])
Version of MtkFieldAttrList that takes an HDF-EOS file identifier rather than a filename.
HDFLIBAPI int32 SDselect(int32 fid, int32 idx)
intn EHidinfo(int32, int32 *, int32 *)
HDFLIBAPI intn SDattrinfo(int32 id, int32 idx, char *name, int32 *nt, int32 *count)
EXTERNL int nc_inq_attname(int ncid, int varid, int attnum, char *name)
MTKt_status MtkFieldAttrListNcid(int ncid, const char *fieldname, int *num_attrs, char **attrlist[])
HDFFCLIBAPI intf intf * n_attrs
#define MTK_ERR_COND_JUMP(code)
int32 GDopen(char *, intn)
EXTERNL int nc_close(int ncid)
MTKt_status MtkNCVarId(int Ncid, const char *Name, MTKt_ncvarid *Var)
EXTERNL int nc_open(const char *path, int mode, int *ncidp)