From 945ce9583f1b74a69811299f6685441044815267 Mon Sep 17 00:00:00 2001 From: myang6 Date: Tue, 27 Jan 2026 16:37:02 -0500 Subject: [PATCH] HYRAX-1951, implement a BES key to turn off the compression of floating-point data in the fileout netCDF. --- modules/fileout_netcdf/FONcArray.cc | 5 +++++ modules/fileout_netcdf/FONcNames.h | 3 +++ modules/fileout_netcdf/FONcRequestHandler.cc | 3 +++ modules/fileout_netcdf/FONcRequestHandler.h | 1 + 4 files changed, 12 insertions(+) diff --git a/modules/fileout_netcdf/FONcArray.cc b/modules/fileout_netcdf/FONcArray.cc index 8ba73ec086..d8d952777b 100644 --- a/modules/fileout_netcdf/FONcArray.cc +++ b/modules/fileout_netcdf/FONcArray.cc @@ -699,6 +699,10 @@ void FONcArray::define(int ncid) { FONcRequestHandler::use_shuffle) shuffle = 1; + if (NC_SHORT == d_array_type || NC_USHORT == d_array_type || NC_INT == d_array_type || + NC_UINT == d_array_type || NC_INT64 == d_array_type || NC_UINT64 == d_array_type || + FONcRequestHandler::no_use_compression_for_float == false) { + int deflate = 1; int deflate_level = 4; stax = nc_def_var_deflate(ncid, d_varid, shuffle, deflate, deflate_level); @@ -708,6 +712,7 @@ void FONcArray::define(int ncid) { + d_varname; FONcUtils::handle_error(stax, err, __FILE__, __LINE__); } + } } // We find that increasing the chunk cache size only benefits large-size character array for NASA files. diff --git a/modules/fileout_netcdf/FONcNames.h b/modules/fileout_netcdf/FONcNames.h index b5c7cb5b79..ea58d35935 100644 --- a/modules/fileout_netcdf/FONcNames.h +++ b/modules/fileout_netcdf/FONcNames.h @@ -43,6 +43,9 @@ #define FONC_NC3_CLASSIC_FORMAT false #define FONC_NC3_CLASSIC_FORMAT_KEY "FONc.NC3ClassicFormat" +#define FONC_NO_COMPRESSION_FLOAT false +#define FONC_NO_COMPRESSION_FLOAT_KEY "FONc.NoCompressionForFloat" + #define FONC_RETURN_AS_NETCDF3 "netcdf" #define FONC_RETURN_AS_NETCDF4 "netcdf-4" #define FONC_NC4_CLASSIC_MODEL "NC4_CLASSIC_MODEL" diff --git a/modules/fileout_netcdf/FONcRequestHandler.cc b/modules/fileout_netcdf/FONcRequestHandler.cc index 13b4fe7989..cd23f78397 100644 --- a/modules/fileout_netcdf/FONcRequestHandler.cc +++ b/modules/fileout_netcdf/FONcRequestHandler.cc @@ -51,6 +51,7 @@ std::string FONcRequestHandler::temp_dir; bool FONcRequestHandler::byte_to_short; bool FONcRequestHandler::use_compression; bool FONcRequestHandler::use_shuffle; +bool FONcRequestHandler::no_use_compression_for_float; unsigned long long FONcRequestHandler::chunk_size; bool FONcRequestHandler::classic_model; bool FONcRequestHandler::reduce_dim; @@ -159,6 +160,8 @@ FONcRequestHandler::FONcRequestHandler( const string &name ) read_key_value(FONC_USE_SHUFFLE_KEY, FONcRequestHandler::use_shuffle, FONC_USE_SHUFFLE); + read_key_value(FONC_NO_COMPRESSION_FLOAT_KEY, FONcRequestHandler::no_use_compression_for_float, FONC_NO_COMPRESSION_FLOAT); + read_key_value(FONC_CHUNK_SIZE_KEY, FONcRequestHandler::chunk_size, FONC_CHUNK_SIZE); read_key_value(FONC_CLASSIC_MODEL_KEY, FONcRequestHandler::classic_model, FONC_CLASSIC_MODEL); diff --git a/modules/fileout_netcdf/FONcRequestHandler.h b/modules/fileout_netcdf/FONcRequestHandler.h index 8f3b17cd0c..5e197d4fdb 100644 --- a/modules/fileout_netcdf/FONcRequestHandler.h +++ b/modules/fileout_netcdf/FONcRequestHandler.h @@ -53,6 +53,7 @@ class FONcRequestHandler: public BESRequestHandler { static bool byte_to_short; static bool use_compression; static bool use_shuffle; + static bool no_use_compression_for_float; static unsigned long long chunk_size; static bool classic_model; static bool reduce_dim;