mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
more quantize testing
This commit is contained in:
parent
2bfde9a5eb
commit
6645cce1c9
@ -223,27 +223,26 @@ main(int argc, char **argv)
|
||||
#define NDIM2 2
|
||||
|
||||
printf("\t**** testing quantization handling of non-floats...");
|
||||
{
|
||||
for (q = 0; q < NUM_QUANTIZE_MODES; q++)
|
||||
{
|
||||
int ncid;
|
||||
int dimid[NDIM2];
|
||||
int varid;
|
||||
int nsd_in, quantize_mode;
|
||||
int nsd_in, quantize_mode_in;
|
||||
int nsd_out = 3;
|
||||
#ifdef TESTNCZARR
|
||||
char file_name[4096];
|
||||
#else
|
||||
char file_name[NC_MAX_NAME + 1];
|
||||
#endif
|
||||
char file_name[NC_MAX_FILENAME + 1];
|
||||
int xtype[NTYPES] = {NC_CHAR, NC_SHORT, NC_INT, NC_BYTE, NC_UBYTE,
|
||||
NC_USHORT, NC_UINT, NC_INT64, NC_UINT64};
|
||||
int t;
|
||||
|
||||
printf("\t\t**** testing quantize algorithm %d...\n", quantize_mode[q]);
|
||||
for (t = 0; t < NTYPES; t++)
|
||||
{
|
||||
sprintf(file_name, "%s_bitgroom_type_%d.nc", TEST, xtype[t]);
|
||||
sprintf(file_name, "%s_quantize_%d_type_%d.nc", TEST, quantize_mode[q], xtype[t]);
|
||||
#ifdef TESTNCZARR
|
||||
{
|
||||
char url[4096];
|
||||
char url[NC_MAX_FILENAME + 1];
|
||||
snprintf(url,sizeof(url),template,file_name);
|
||||
strcpy(file_name,url);
|
||||
}
|
||||
@ -254,22 +253,23 @@ main(int argc, char **argv)
|
||||
if (nc_def_dim(ncid, Y_NAME, NY_BIG, &dimid[1])) ERR;
|
||||
if (nc_def_var(ncid, VAR_NAME, xtype[t], NDIM2, dimid, &varid)) ERR;
|
||||
|
||||
/* Bitgroom filter returns NC_EINVAL because this is not an
|
||||
* NC_FLOAT or NC_DOULBE. */
|
||||
if (nc_def_var_quantize(ncid, varid, NC_QUANTIZE_BITGROOM, nsd_out) != NC_EINVAL) ERR;
|
||||
/* Quantzie returns NC_EINVAL because this is not
|
||||
* an NC_FLOAT or NC_DOULBE. */
|
||||
if (nc_def_var_quantize(ncid, varid, quantize_mode[q], nsd_out) != NC_EINVAL) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
|
||||
/* Check file. */
|
||||
{
|
||||
if (nc_open(file_name, NC_NETCDF4, &ncid)) ERR;
|
||||
if (nc_inq_varid(ncid,VAR_NAME,&varid)) ERR;
|
||||
if (nc_inq_var_quantize(ncid, varid, &quantize_mode, &nsd_in))
|
||||
if (nc_inq_var_quantize(ncid, varid, &quantize_mode_in, &nsd_in))
|
||||
ERR;
|
||||
if (quantize_mode) ERR;
|
||||
if (quantize_mode_in) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
printf("\t**** testing quantization of scalars...");
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user