From 222ad0dd241bff4fb777fe89b6bed5a9bc4f4527 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Thu, 19 Sep 2024 18:19:19 -0500 Subject: [PATCH 1/2] Add check to accomodate move away from _FillValue in libnetcdf. --- src/clib/pio.h | 5 +++++ src/clib/pio_nc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/clib/pio.h b/src/clib/pio.h index a4b20b752..e7a94f8e4 100644 --- a/src/clib/pio.h +++ b/src/clib/pio.h @@ -27,6 +27,11 @@ (((NC_VERSION_MAJOR == Maj) && (NC_VERSION_MINOR == Min) && (NC_VERSION_PATCH >= Pat)) || \ ((NC_VERSION_MAJOR == Maj) && (NC_VERSION_MINOR > Min)) || (NC_VERSION_MAJOR > Maj)) +#if defined(NC_FillValue) +#define NCDF_FillValue NC_FillValue +#elif defined(_FillValue) +#define NCDF_Fillvalue _FillValue +#endif /** PIO_OFFSET is an integer type of size sufficient to represent the * size (in bytes) of the largest file supported by MPI. This is not diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index 2808e45ec..c5649e0a8 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -2430,7 +2430,7 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) { ierr = nc_set_fill(file->fh, NC_FILL, NULL); if (!ierr) - ierr = nc_put_att(file->fh, varid, _FillValue, xtype, 1, fill_valuep); + ierr = nc_put_att(file->fh, varid, NCDF_FillValue, xtype, 1, fill_valuep); } } else From 53a48a568ef92d7b3d1159b340f996453b80b90b Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Thu, 19 Sep 2024 18:26:10 -0500 Subject: [PATCH 2/2] Correct second usage of _FillValue --- src/clib/pio_nc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index c5649e0a8..20d374daf 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -2574,7 +2574,7 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) if (!ierr && fill_valuep) { - ierr = nc_get_att(file->fh, varid, _FillValue, fill_valuep); + ierr = nc_get_att(file->fh, varid, NCDF_FillValue, fill_valuep); if (ierr == NC_ENOTATT) { char char_fill_value = NC_FILL_CHAR;