From c2492f10adddabeff3a6214c99e149c77346f0d4 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 2 Sep 2020 10:23:57 -0600 Subject: [PATCH] dealing with der_var_endian and def_var_chunking in netcdf integration layer --- src/ncint/ncintdispatch.c | 33 +++++++++++++++++++++++++++++++-- src/ncint/ncintdispatch.h | 5 ++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/ncint/ncintdispatch.c b/src/ncint/ncintdispatch.c index ea06f272cf8..b43f9bbfc69 100644 --- a/src/ncint/ncintdispatch.c +++ b/src/ncint/ncintdispatch.c @@ -111,8 +111,8 @@ NC_Dispatch NCINT_dispatcher = { NC_NOTNC4_def_opaque, PIO_NCINT_def_var_deflate, NC_NOTNC4_def_var_fletcher32, - NC_NOTNC4_def_var_chunking, - NC_NOTNC4_def_var_endian, + PIO_NCINT_def_var_chunking, + PIOc_def_var_endian, NC_NOTNC4_def_var_filter, NC_NOTNC4_set_var_chunk_cache, NC_NOTNC4_get_var_chunk_cache, @@ -974,3 +974,32 @@ PIO_NCINT_def_var_deflate(int ncid, int varid, int shuffle, int deflate, return PIOc_def_var_deflate(ncid, varid, shuffle, deflate, deflate_level); } +/** + * @internal Set chunksizes for a variable. + * + * This function only applies to netCDF-4 files. When used with netCDF + * classic files, the error PIO_ENOTNC4 will be returned. + * + * Chunksizes have important performance repercussions. NetCDF + * attempts to choose sensible chunk sizes by default, but for best + * performance check chunking against access patterns. + * + * See the netCDF + * variable documentation for details about the operation of this + * function. + * + * @param ncid the ncid of the open file. + * @param varid the ID of the variable to set chunksizes for. + * @param storage NC_CONTIGUOUS or NC_CHUNKED. + * @param chunksizesp an array of chunksizes. Must have a chunksize for + * every variable dimension. + * @return PIO_NOERR for success, otherwise an error code. + * @ingroup PIO_def_var_c + * @author Ed Hartnett + */ +int +PIO_NCINT_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp) +{ + return PIOc_def_var_chunking(ncid, varid, storage, (const PIO_Offset *)chunksizesp); +} diff --git a/src/ncint/ncintdispatch.h b/src/ncint/ncintdispatch.h index 065fc4d9574..7204993b634 100644 --- a/src/ncint/ncintdispatch.h +++ b/src/ncint/ncintdispatch.h @@ -148,7 +148,10 @@ extern "C" { extern int PIO_NCINT_def_var_deflate(int ncid, int varid, int shuffle, int deflate, int deflate_level); - + + extern int + PIO_NCINT_def_var_chunking(int ncid, int varid, int storage, const size_t *chunksizesp); + #if defined(__cplusplus) }