File: he5_za_datainfo.c

package info (click to toggle)
hdf-eos5 2%3A2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,692 kB
  • sloc: ansic: 92,051; fortran: 31,463; sh: 11,395; makefile: 492
file content (106 lines) | stat: -rwxr-xr-x 3,312 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
 ----------------------------------------------------------------------------
 |    Copyright (C) 2002   Emergent IT Inc. and Raytheon Systems Company    |  
 ----------------------------------------------------------------------------  
 */


#include   <HE5_HdfEosDef.h>


#define FILENAME   "ZA.he5"
#define OBJECT     "ZA1"


int main(void)
{
  herr_t       status     = FAIL;

  int          fieldgroup = FAIL;

  hid_t        fid      = FAIL;
  hid_t        ZAid     = FAIL;
  hid_t        datatype = FAIL;

  H5T_class_t  classid = H5T_NO_CLASS;     
  H5T_order_t  order   = H5T_ORDER_ERROR;

  size_t       size    = 0;


  /* Open the HDF-EOS ZA file */
  /* ------------------------ */
  fid = HE5_ZAopen(FILENAME, H5F_ACC_RDONLY);
  printf("File ID returned by HE5_ZAopen() :         %ld \n", (long) fid);
    
  /* Attach to the "ZA1" za */
  /* ---------------------- */
  ZAid = HE5_ZAattach(fid, OBJECT);
  printf("ZA ID returned by HE5_ZAattach() :      %ld \n", (long) ZAid);

  /* Inquire data type information for the "Spectra" field */
  /* ----------------------------------------------------- */
  fieldgroup = HE5_HDFE_DATAGROUP;
  status = HE5_ZAinqdatatype(ZAid, "Spectra", NULL, fieldgroup, &datatype, &classid, &order, &size);
  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
  if (status != FAIL)
	{
	  printf("\tdatatype:    %ld \n", (long) datatype);
	  printf("\tclass ID:    %d \n", classid);
	  printf("\torder:       %d \n", order);
	  printf("\tsize:        %d \n", (int)size);        
	}

  /* Inquire data type information for the attributes */
  /* ------------------------------------------------ */
  fieldgroup = HE5_HDFE_ATTRGROUP;
  status = HE5_ZAinqdatatype(ZAid, NULL, "GlobalAttribute", fieldgroup, &datatype, &classid, &order, &size);
  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
  if (status != FAIL)
	{
	  printf("\tdatatype:    %ld \n", (long) datatype);
	  printf("\tclass ID:    %d \n", classid);
	  printf("\torder:       %d \n", order);
	  printf("\tsize:        %d \n", (int)size);        
	}

  fieldgroup = HE5_HDFE_GRPATTRGROUP;
  status = HE5_ZAinqdatatype(ZAid, NULL, "GroupAttribute", fieldgroup, &datatype, &classid, &order, &size);
  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
  if (status != FAIL)
	{
	  printf("\tdatatype:    %ld \n", (long) datatype);
	  printf("\tclass ID:    %d \n", classid);
	  printf("\torder:       %d \n", order);
	  printf("\tsize:        %d \n", (int)size);        
	}

  fieldgroup = HE5_HDFE_LOCATTRGROUP;
  status = HE5_ZAinqdatatype(ZAid, "Density", "LocalAttribute", fieldgroup, &datatype, &classid, &order, &size);
  printf("Status returned by HE5_ZAinqdatatype() :   %d \n", status);
  if (status != FAIL)
	{
	  printf("\tdatatype:    %ld \n", (long) datatype);
	  printf("\tclass ID:    %d \n", classid);
	  printf("\torder:       %d \n", order);
	  printf("\tsize:        %d \n", (int)size);        
	}


  /* Detach from the za */
  /* ------------------ */
  status = HE5_ZAdetach(ZAid);
  printf("Status returned by HE5_ZAdetach() :        %d \n", status);

  /* Close the file */
  /* -------------- */
  status = HE5_ZAclose(fid);
  printf("Status returned by HE5_ZAclose() :         %d \n", status);
    
  return(0);
    
}