20 #include <HdfEosDef.h> 100 if (filename == NULL)
114 if (hdfstatus ==
FAIL)
134 const char *gridname,
143 char **attrlist_tmp = NULL;
148 if (gridname == NULL ||
149 num_attrs == NULL || attrlist == NULL)
153 gid =
GDattach(fid, (
char*)gridname);
159 if (hdfstatus ==
FAIL)
162 list = (
char*)malloc((count + 1) *
sizeof(char));
167 hdfstatus = nattrs =
GDinqattrs(gid,list,&count);
168 if (hdfstatus ==
FAIL)
173 if (hdfstatus ==
FAIL)
176 attrlist_tmp = (
char**)calloc(nattrs,
sizeof(
char*));
177 if (attrlist_tmp == NULL)
180 temp = strtok(list,
",");
184 attrlist_tmp[i] = (
char*)malloc((strlen(temp) + 1) *
sizeof(char));
185 if (attrlist_tmp[i] == NULL)
187 strcpy(attrlist_tmp[i],temp);
188 temp = strtok(NULL,
",");
194 *attrlist = attrlist_tmp;
200 if (attrlist_tmp != NULL)
203 if (num_attrs != NULL)
214 const char *gridname,
220 char **attrlist_tmp = NULL;
222 if (gridname == NULL ||
223 num_attrs == NULL || attrlist == NULL)
228 int nc_status =
nc_inq_ncid(ncid, gridname, &group_id);
235 attrlist_tmp = (
char**)calloc(nattrs,
sizeof(
char*));
236 if (attrlist_tmp == NULL)
239 for (
int i = 0; i < nattrs; ++i) {
244 attrlist_tmp[i] = (
char*)malloc((strlen(attr_name) + 1) *
sizeof(char));
245 if (attrlist_tmp[i] == NULL)
247 strcpy(attrlist_tmp[i],attr_name);
250 *attrlist = attrlist_tmp;
256 if (attrlist_tmp != NULL)
259 if (num_attrs != NULL)
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkStringListFree(int strcnt, char **strlist[])
Free string list.
int32 GDattach(int32, char *)
MTKt_status MtkGridAttrList(const char *filename, const char *gridname, int *num_attrs, char **attrlist[])
Get a list of grid attributes.
#define MTK_ERR_CODE_JUMP(code)
EXTERNL int nc_inq_varnatts(int ncid, int varid, int *nattsp)
EXTERNL int nc_inq_ncid(int ncid, const char *name, int *grp_ncid)
MTKt_status MtkGridAttrListNcid(int ncid, const char *gridname, int *num_attrs, char **attrlist[])
EXTERNL int nc_inq_attname(int ncid, int varid, int attnum, char *name)
MTKt_status MtkGridAttrListNC(const char *filename, const char *gridname, int *num_attrs, char **attrlist[])
MTKt_status MtkGridAttrListHDF(const char *filename, const char *gridname, int *num_attrs, char **attrlist[])
#define MTK_ERR_COND_JUMP(code)
MTKt_status MtkGridAttrListFid(int32 fid, const char *gridname, int *num_attrs, char **attrlist[])
Version of MtkGridAttrList that takes an HDF-EOS file identifier rather than a filename.
int32 GDinqattrs(int32, char *, int32 *)
int32 GDopen(char *, intn)
EXTERNL int nc_close(int ncid)
EXTERNL int nc_open(const char *path, int mode, int *ncidp)