mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-18 15:55:12 +08:00
Make variable easier to compress
Make the data in the variable `var1` easier to compress so that the compression tests will be more robust. The zlib_ng library, for example, at level 1 does not compress a sequence of integers very well which resulted in the NetCDF-4 compressed file being larger than the uncompressed NetCDF-3 file. With the change above, the variable contains `0,0,0,1,1,1,2,2,2,...,` which compresses at level 1 and the compression test is more robust.
This commit is contained in:
parent
84f0696e7d
commit
c3f20c88e9
@ -36,7 +36,7 @@ main(int argc, char **argv) { /* create a compressible file, for testing */
|
||||
if (nc_def_var(ncid, "var1", NC_INT, VAR1_RANK, var1_dims, &varid)) ERR;
|
||||
if (nc_enddef (ncid)) ERR;
|
||||
for(i=0; i < DIM1_LEN; i++) {
|
||||
var1_data[i] = i;
|
||||
var1_data[i] = i / 3;
|
||||
}
|
||||
if (nc_put_var(ncid, varid, var1_data)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
@ -47,7 +47,7 @@ main(int argc, char **argv) { /* create a compressible file, for testing */
|
||||
if (nc_def_var(ncid, "var1", NC_INT, VAR1_RANK, var1_dims, &varid)) ERR;
|
||||
if (nc_enddef (ncid)) ERR;
|
||||
for(i=0; i < DIM1_LEN; i++) {
|
||||
var1_data[i] = i;
|
||||
var1_data[i] = i / 3;
|
||||
}
|
||||
if (nc_put_var(ncid, varid, var1_data)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
Loading…
Reference in New Issue
Block a user