2
----------------------------------------------------------------------------
3
| Copyright (C) 2002 Emergent IT Inc. and Raytheon Systems Company |
4
----------------------------------------------------------------------------
7
#include <HE5_config.h>
8
#include <HE5_HdfEosDef.h>
13
/* In this program we (1) open the "ZA.he5" HDF-EOS file, */
14
/* (2) attach to the "ZA1" za, and (3) define the fields */
15
/* ----------------------------------------------------- */
22
int comp_level[ 5 ] = {0,0,0,0,0};
28
hsize_t chunk_dims[ 3 ];
29
char fillvalue[100] = "charname";
32
/* Open the file, "ZA.he5", using the H5F_ACC_RDWR access code */
33
/* ---------------------------------------------------------- */
34
zafid = HE5_ZAopen("ZA.he5", H5F_ACC_RDWR);
37
ZAid = HE5_ZAattach(zafid, "ZA1");
40
status = HE5_ZAdefine(ZAid, "Density", "MyTrack1", NULL, H5T_NATIVE_FLOAT);
41
printf("Status returned by HE5_ZAdefine(...\"Density\",...) : %d\n",status);
43
status = HE5_ZAdefine(ZAid, "Temperature", "MyTrack1,MyTrack2",NULL, H5T_NATIVE_FLOAT);
44
printf("Status returned by HE5_ZAdefine(...\"Temperature\",...) : %d\n",status);
46
status = HE5_ZAdefine(ZAid, "Presure", "Res2tr,Res2xtr", NULL, H5T_NATIVE_DOUBLE);
47
printf("Status returned by HE5_ZAdefine(...\"Presure\",...) : %d\n",status);
49
status = HE5_ZAsetfillvalue(ZAid, "Test_string", HE5T_CHARSTRING, fillvalue);
50
printf("Status returned by HE5_ZAsetfillvalue(...\"Test_string\",...) : %d\n",status);
52
status = HE5_ZAdefine(ZAid, "Test_string", "MyTrack2", NULL, HE5T_CHARSTRING);
53
printf("Status returned by HE5_ZAdefine(...\"Test_string\",...) : %d\n",status);
56
/* Define Appendable Field */
57
/* ----------------------- */
59
/* First, define chunking */
60
/* (the appendable dataset must be chunked) */
61
/* ---------------------------------------- */
66
status = HE5_ZAdefchunk(ZAid, RANK, chunk_dims);
67
printf("\tStatus returned by HE5_ZAdefchunk() : %d\n",status);
69
/* Second, define compression scheme */
70
/* --------------------------------- */
72
/* set the value of compression code: */
73
/* HDFE_COMP_NONE 0 */
75
/* HDFE_COMP_NBIT 2 */
76
/* HDFE_COMP_SKPHUFF 3 */
77
/* HDFE_COMP_DEFLATE 4 */
78
/* HDFE_COMP_SZIP_CHIP 5 */
79
/* HDFE_COMP_SZIP_K13 6 */
80
/* HDFE_COMP_SZIP_EC 7 */
81
/* HDFE_COMP_SZIP_NN 8 */
82
/* HDFE_COMP_SZIP_K13orEC 9 */
83
/* HDFE_COMP_SZIP_K13orNN 10 */
84
/* HDFE_COMP_SHUF_DEFLATE 11 */
85
/* HDFE_COMP_SHUF_SZIP_CHIP 12 */
86
/* HDFE_COMP_SHUF_SZIP_K13 13 */
87
/* HDFE_COMP_SHUF_SZIP_EC 14 */
88
/* HDFE_COMP_SHUF_SZIP_NN 15 */
89
/* HDFE_COMP_SHUF_SZIP_K13orEC 16 */
90
/* HDFE_COMP_SHUF_SZIP_K13orNN 17 */
94
/* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
95
/* ------------------------------------------------------------- */
97
/*comp_level[0] = 0;*/
99
#ifdef HAVE_FILTER_SZIP_ENCODER
100
status = HE5_ZAdefcomp(ZAid,comp_code, comp_level);
101
printf("\tStatus returned by HE5_ZAdefcomp() : %d\n",status);
103
printf("SZIP encoder is not available. The data compression test is skipped.\n");
106
status = HE5_ZAdefine(ZAid, "Spectra", "Bands,Res2tr,Res2xtr", NULL, H5T_NATIVE_FLOAT);
107
printf("Status returned by HE5_ZAdefine(...\"Spectra\",...) : %d\n",status);
109
/* Define Appendable Field */
110
/* ----------------------- */
112
/* First, define chunking */
113
/* (the appendable dataset must be chunked) */
114
/* ---------------------------------------- */
117
status = HE5_ZAdefchunk(ZAid, rank, chunk_dims);
118
printf("\tStatus returned by HE5_ZAdefchunk() : %d\n",status);
120
/* Second, define compression scheme */
121
/* --------------------------------- */
123
/* set the value of compression code: */
124
/* HDFE_COMP_NONE 0 */
125
/* HDFE_COMP_RLE 1 */
126
/* HDFE_COMP_NBIT 2 */
127
/* HDFE_COMP_SKPHUFF 3 */
128
/* HDFE_COMP_DEFLATE 4 */
129
/* HDFE_COMP_SZIP_CHIP 5 */
130
/* HDFE_COMP_SZIP_K13 6 */
131
/* HDFE_COMP_SZIP_EC 7 */
132
/* HDFE_COMP_SZIP_NN 8 */
133
/* HDFE_COMP_SZIP_K13orEC 9 */
134
/* HDFE_COMP_SZIP_K13orNN 10 */
135
/* HDFE_COMP_SHUF_DEFLATE 11 */
136
/* HDFE_COMP_SHUF_SZIP_CHIP 12 */
137
/* HDFE_COMP_SHUF_SZIP_K13 13 */
138
/* HDFE_COMP_SHUF_SZIP_EC 14 */
139
/* HDFE_COMP_SHUF_SZIP_NN 15 */
140
/* HDFE_COMP_SHUF_SZIP_K13orEC 16 */
141
/* HDFE_COMP_SHUF_SZIP_K13orNN 17 */
145
/* Set compression level: value 0,1,2,3,4,5,6,7,8,9,10,16, or 32 */
146
/* ------------------------------------------------------------- */
148
/*comp_level[0] = 0;*/
150
#ifdef HAVE_FILTER_SZIP_ENCODER
151
status = HE5_ZAdefcomp(ZAid,comp_code, comp_level);
152
printf("\tStatus returned by HE5_ZAdefcomp() : %d\n",status);
154
printf("SZIP encoder is not available. The data compression test is skipped.\n");
157
status = HE5_ZAdefine(ZAid, "Count", "MyTrack1", "Unlim", H5T_NATIVE_INT);
158
printf("Status returned by HE5_ZAdefine(...\"Count\",...) : %d\n",status);
163
status = HE5_ZAdetach(ZAid);
164
status = HE5_ZAclose(zafid);