22 #include <HdfEosDef.h> 54 const char *fieldname,
60 status =
MtkReadBlockNC(filename, gridname, fieldname, block, databuf);
69 const char *fieldname,
105 const char *gridname,
106 const char *fieldname,
143 const char *gridname,
144 const char *fieldname,
158 char *basefield = NULL;
160 int *extradims = NULL;
170 gid =
GDattach(fid, (
char*)gridname);
176 hdfstatus =
GDfieldinfo(gid, basefield, &rank, dims, &hdf_datatype, dimlist);
187 start[0] = block - 1;
195 for (i = 3; i <
rank; i++) {
196 start[i] = extradims[i-3];
200 hdfstatus =
GDreadfield(gid, basefield, start, NULL, edge,
207 *databuf = databuf_tmp;
214 if (basefield != NULL) free(basefield);
215 if (extradims != NULL) free(extradims);
222 const char *gridname,
223 const char *fieldname,
229 char *basefield = NULL;
231 int *extradims = NULL;
260 nc_status =
nc_inq_varid(group_id,
"Block_Number", &bvarid);
264 nc_status =
nc_inq_var(group_id, bvarid, NULL, NULL, NULL, dimid, NULL);
268 nc_status =
nc_inq_dimlen(group_id, dimid[0], &number_block);
271 int block_numbers[180];
276 for (
size_t i = 0 ; i < number_block ; i++) {
277 if (block_numbers[i] == block) {
287 nc_status =
nc_inq_varid(group_id,
"Block_Start_X_Index", &xvarid);
291 nc_status =
nc_inq_varid(group_id,
"Block_Start_Y_Index", &yvarid);
313 status =
MtkNCVarId(group_id, basefield, &var);
339 for (
int i = 2; i <
rank; i++) {
340 start[i] = extradims[i-2];
349 *databuf = databuf_tmp;
355 if (basefield != NULL) free(basefield);
356 if (extradims != NULL) free(extradims);
HDFFCLIBAPI intf intf intf * count
MTKt_status MtkNcToMtkDataTypeConvert(nc_type nc_datatype, MTKt_DataType *datatype)
MTKt_status MtkDataBufferAllocate(int nline, int nsample, MTKt_DataType datatype, MTKt_DataBuffer *databuf)
Allocate Data Buffer.
HDFFCLIBAPI _fcd _fcd intf intf * datatype
int32 GDattach(int32, char *)
MTKt_status MtkReadBlockNcid(int ncid, const char *gridname, const char *fieldname, int block, MTKt_DataBuffer *databuf)
EXTERNL int nc_get_att(int ncid, int varid, const char *name, void *ip)
HDFFCLIBAPI void intf dims[]
MTKt_status MtkReadBlockHDF(const char *filename, const char *gridname, const char *fieldname, int block, MTKt_DataBuffer *databuf)
MTKt_status MtkParseFieldname(const char *fieldname, char **basefieldname, int *ndim, int **dimlist)
Parses extra dimensions from fieldnames.
EXTERNL int nc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int *dimidsp, int *nattsp)
#define MTK_ERR_CODE_JUMP(code)
2-dimensional Data Buffer
MTKt_status MtkHdfToMtkDataTypeConvert(int32 hdf_datatype, MTKt_DataType *datatype)
Convert HDF data type to MISR Toolkit data type.
MTKt_status MtkReadBlockNC(const char *filename, const char *gridname, const char *fieldname, int block, MTKt_DataBuffer *databuf)
#define MTKT_DATABUFFER_INIT
MTKt_status MtkDataBufferFree(MTKt_DataBuffer *databuf)
Free data buffer.
EXTERNL int nc_inq_vartype(int ncid, int varid, nc_type *xtypep)
MTKt_status MtkReadBlock(const char *filename, const char *gridname, const char *fieldname, int block, MTKt_DataBuffer *databuf)
Read block of data.
EXTERNL int nc_get_var_int(int ncid, int varid, int *ip)
EXTERNL int nc_get_var1_int(int ncid, int varid, const size_t *indexp, int *ip)
intn GDfieldinfo(int32, char *, int32 *, int32 [], int32 *, char *)
EXTERNL int nc_inq_dimlen(int ncid, int dimid, size_t *lenp)
MTKt_status MtkReadBlockFid(int32 fid, const char *gridname, const char *fieldname, int block, MTKt_DataBuffer *databuf)
Version of MtkReadBlock that takes an HDF-EOS file identifier rather than a filename.
HDFFCLIBAPI intf intf start[]
EXTERNL int nc_get_vara(int ncid, int varid, const size_t *startp, const size_t *countp, void *ip)
EXTERNL int nc_inq_varid(int ncid, const char *name, int *varidp)
intn GDreadfield(int32, char *, int32 [], int32 [], int32 [], VOIDP)
#define MTK_ERR_COND_JUMP(code)
EXTERNL int nc_inq_varndims(int ncid, int varid, int *ndimsp)
int32 GDopen(char *, intn)
EXTERNL int nc_close(int ncid)
MTKt_status MtkNCVarId(int Ncid, const char *Name, MTKt_ncvarid *Var)
EXTERNL int nc_inq_grp_ncid(int ncid, const char *grp_name, int *grp_ncid)
EXTERNL int nc_open(const char *path, int mode, int *ncidp)