From 245a212570b9803ba9e8b85fe73148deb145d127 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 2 Sep 2020 09:24:02 -0600 Subject: [PATCH] adding PIO_NCINT_def_var_deflate --- src/clib/pio_nc4.c | 3 +-- src/ncint/ncintdispatch.c | 25 ++++++++++++++++++++++++- src/ncint/ncintdispatch.h | 5 +++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/clib/pio_nc4.c b/src/clib/pio_nc4.c index 6fec416dcd9..becaf1cdf8b 100644 --- a/src/clib/pio_nc4.c +++ b/src/clib/pio_nc4.c @@ -21,8 +21,7 @@ * * @param ncid the ncid of the open file. * @param varid the ID of the variable. - * @param shuffle non-zero to turn on shuffle filter (can be good for - * integer data). + * @param shuffle non-zero to turn on shuffle filter. * @param deflate non-zero to turn on zlib compression for this * variable. * @param deflate_level 1 to 9, with 1 being faster and 9 being more diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index 6cd39f3caa2..ea06f272cf8 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -109,7 +109,7 @@ NC_Dispatch NCINT_dispatcher = { NC_NOTNC4_inq_enum_member, NC_NOTNC4_inq_enum_ident, NC_NOTNC4_def_opaque, - NC_NOTNC4_def_var_deflate, + PIO_NCINT_def_var_deflate, NC_NOTNC4_def_var_fletcher32, NC_NOTNC4_def_var_chunking, NC_NOTNC4_def_var_endian, @@ -951,3 +951,26 @@ PIO_NCINT_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, *equalp = typeid1 == typeid2 ? 1 : 0; return NC_NOERR; } + +/** + * @internal This functions sets deflate settings for a + * netCDF-4 variable. It is called by nc_def_var_deflate(). + * + * @param ncid the ncid of the open file. + * @param varid the ID of the variable. + * @param shuffle non-zero to turn on shuffle filter. + * @param deflate non-zero to turn on zlib compression for this + * variable. + * @param deflate_level 1 to 9, with 1 being faster and 9 being more + * compressed. + * + * @returns ::NC_NOERR for success + * @author Ed Hartnett + */ +int +PIO_NCINT_def_var_deflate(int ncid, int varid, int shuffle, int deflate, + int deflate_level) +{ + return PIOc_def_var_deflate(ncid, varid, shuffle, deflate, deflate_level); +} + diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 5e0e8d4ba00..065fc4d9574 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -145,6 +145,11 @@ extern "C" { PIO_NCINT_inq_type_equal(int ncid1, nc_type typeid1, int ncid2, nc_type typeid2, int *equalp); + extern int + PIO_NCINT_def_var_deflate(int ncid, int varid, int shuffle, int deflate, + int deflate_level); + + #if defined(__cplusplus) } #endif