Go to the documentation of this file.
8 #define DEFAULT_CHUNK_SIZE 1000
25 size_t *chunksize,
int deflate_level) {
29 if (deflate_level < 1)
32 size_t dimlength, newchunk;
38 status = nc_inq_dimlen(nc_id, dimids[
i], &dimlength);
40 if (chunksize[
i] == 0) {
41 if (dimlength < 1000) {
42 chunksize[
i] = floor(dimlength / 3) + 1;
44 newchunk = floor(dimlength / 100) + 1;
45 if (newchunk > 1500) {
46 newchunk = floor(dimlength / 250) + 1;
50 chunksize[
i] = newchunk;
66 status = nc_def_var_chunking(nc_id, var_id, NC_CHUNKED, chunksize);
68 printf(
"-E- %s %d: %s \n", __FILE__, __LINE__,
73 status = nc_def_var_deflate(nc_id, var_id, NC_SHUFFLE, 9,
76 printf(
"-E- %s %d: %s \n", __FILE__, __LINE__,
95 size_t *chunksize,
int type_size,
int deflate_level) {
102 for (d = 0; d <
rank; d++)
104 size_t suggested_size;
105 status = nc_inq_dimlen(nc_id, dimids[d], &dimlength);
107 1 / (
double) (
rank)) * dimlength - .5);
108 if (suggested_size > dimlength)
109 suggested_size = dimlength;
110 chunksize[d] = suggested_size ? suggested_size : 1;
119 if (
status != NC_EBADCHUNK)
124 for (d = 0; d <
rank; d++)
125 chunksize[d] = chunksize[d] / 2 ? chunksize[d] / 2 : 1;
131 #define NC_ALLOWED_OVERHANG .1
132 for (d = 0; d <
rank; d++)
137 status = nc_def_var_chunking(nc_id, var_id, NC_CHUNKED, chunksize);
139 printf(
"-E- %s %d: %s \n", __FILE__, __LINE__,
145 if (deflate_level > 0) {
147 status = nc_def_var_deflate(nc_id, var_id, NC_SHUFFLE, deflate_level,
150 printf(
"-E- %s %d: %s \n", __FILE__, __LINE__,
163 dprod = (
double) type_len;
164 for (d = 0; d < ndims; d++) {
165 if (chunksizes[d] < 1)
167 dprod *= (
double) chunksizes[d];
170 if (dprod > (
double) NC_MAX_UINT)
void nc_init_compress(int32_t nc_id, int32_t var_id, int32_t *dimids, int32_t rank, size_t *chunksize, int deflate_level)
#define DEFAULT_CHUNK_SIZE
#define NC_ALLOWED_OVERHANG
int nc_init_compress2(int32_t nc_id, char *varnam, int32_t var_id, int32_t *dimids, int32_t rank, size_t *chunksize, int type_size, int deflate_level)
int check_chunksizes(size_t type_len, int32_t ndims, const size_t *chunksizes)
integer, parameter double
Extra metadata that will be written to the HDF4 file l2prod rank