Changeset 2529 for XIOS3/trunk/src/io/netCdfInterface.cpp
- Timestamp:
- 07/18/23 15:12:50 (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS3/trunk/src/io/netCdfInterface.cpp
r2426 r2529 11 11 #include "netCdfException.hpp" 12 12 #include "mem_checker.hpp" 13 #include <string> 14 #include <sys/stat.h> 13 15 14 16 namespace xios … … 776 778 throw CNetCdfException(e); 777 779 } 778 780 781 return status; 782 } 783 784 int CNetCdfInterface::defVarFilter(int ncid, int varId, unsigned int filterId , size_t filterNbrParams, unsigned int* filterParams) 785 { 786 const char* cplugin = getenv("HDF5_PLUGIN_PATH") ; 787 bool filterAvailable( false ); 788 789 StdString pluginLibName; 790 if ( filterId == 32017 ) // 32017 = SZ 791 { 792 pluginLibName = "libhdf5sz.so"; 793 } 794 if (cplugin) 795 { 796 string plugin( cplugin ); 797 string libsz( plugin+"/"+pluginLibName ); 798 struct stat sb; 799 if (stat(libsz.c_str(), &sb) == 0) filterAvailable = true; 800 } 801 if (!filterAvailable) 802 { 803 StdStringStream sstr; 804 sstr << "Error when calling function nc_def_var_filter(...)" << std::endl; 805 sstr << "The SZ filter required for " << varId << " is not available." 806 << "Check that $HDF5_PLUGIN_PATH/"<< pluginLibName <<" exists." ; 807 StdString e = sstr.str(); 808 throw CNetCdfException(e); 809 } 810 811 int status = nc_def_var_filter(ncid, varId, filterId, filterNbrParams, filterParams); 812 if (NC_NOERR != status) 813 { 814 StdString errormsg(nc_strerror(status)); 815 StdStringStream sstr; 816 817 sstr << "Error when calling function nc_def_var_filter(...)" << std::endl; 818 sstr << errormsg << std::endl; 819 sstr << "Unable to set the compression filter of the variable with id: " << varId 820 << " and plugin: " << filterId << std::endl; 821 StdString e = sstr.str(); 822 throw CNetCdfException(e); 823 } 824 779 825 return status; 780 826 }
Note: See TracChangeset
for help on using the changeset viewer.