@@ -70,6 +70,7 @@ def check_api(inc_dirs,netcdf_lib_version):
7070 has_zstandard = False
7171 has_bzip2 = False
7272 has_blosc = False
73+ has_ncfilter = False
7374 has_set_alignment = False
7475
7576 for d in inc_dirs :
@@ -116,6 +117,8 @@ def check_api(inc_dirs,netcdf_lib_version):
116117 has_bzip2 = True
117118 if line .startswith ('EXTERNL int nc_def_var_blosc' ):
118119 has_blosc = True
120+ if line .startswith ('EXTERNL int nc_inq_filter_avail' ):
121+ has_ncfilter = True
119122
120123 ncmetapath = os .path .join (d ,'netcdf_meta.h' )
121124 if os .path .exists (ncmetapath ):
@@ -143,7 +146,7 @@ def check_api(inc_dirs,netcdf_lib_version):
143146 return has_rename_grp , has_nc_inq_path , has_nc_inq_format_extended , \
144147 has_cdf5_format , has_nc_open_mem , has_nc_create_mem , \
145148 has_parallel4_support , has_pnetcdf_support , has_szip_support , has_quantize , \
146- has_zstandard , has_bzip2 , has_blosc , has_set_alignment
149+ has_zstandard , has_bzip2 , has_blosc , has_set_alignment , has_ncfilter
147150
148151
149152def getnetcdfvers (libdirs ):
@@ -557,19 +560,20 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
557560 has_rename_grp , has_nc_inq_path , has_nc_inq_format_extended , \
558561 has_cdf5_format , has_nc_open_mem , has_nc_create_mem , \
559562 has_parallel4_support , has_pnetcdf_support , has_szip_support , has_quantize , \
560- has_zstandard , has_bzip2 , has_blosc , has_set_alignment = \
563+ has_zstandard , has_bzip2 , has_blosc , has_set_alignment , has_ncfilter = \
561564 check_api (inc_dirs ,netcdf_lib_version )
562565 # for netcdf 4.4.x CDF5 format is always enabled.
563566 if netcdf_lib_version is not None and \
564567 (netcdf_lib_version > "4.4" and netcdf_lib_version < "4.5" ):
565568 has_cdf5_format = True
566569
567570 # disable parallel support if mpi4py not available.
568- try :
569- import mpi4py
570- except ImportError :
571- has_parallel4_support = False
572- has_pnetcdf_support = False
571+ #try:
572+ # import mpi4py
573+ #except ImportError:
574+ # f.write('disabling mpi parallel support because mpi4py not found\n')
575+ # has_parallel4_support = False
576+ # has_pnetcdf_support = False
573577
574578 f = open (osp .join ('include' , 'constants.pyx' ), 'w' )
575579 if has_rename_grp :
@@ -671,9 +675,17 @@ def _populate_hdf5_info(dirstosearch, inc_dirs, libs, lib_dirs):
671675 sys .stdout .write ('netcdf lib does not have nc_set_alignment function\n ' )
672676 f .write ('DEF HAS_SET_ALIGNMENT = 0\n ' )
673677
678+ if has_ncfilter :
679+ sys .stdout .write ('netcdf lib has nc_inq_filter_avail function\n ' )
680+ f .write ('DEF HAS_NCFILTER = 1\n ' )
681+ else :
682+ sys .stdout .write ('netcdf lib does not have nc_inq_filter_avail function\n ' )
683+ f .write ('DEF HAS_NCFILTER = 0\n ' )
684+
674685 f .close ()
675686
676687 if has_parallel4_support or has_pnetcdf_support :
688+ import mpi4py
677689 inc_dirs .append (mpi4py .get_include ())
678690 # mpi_incdir should not be needed if using nc-config
679691 # (should be included in nc-config --cflags)
0 commit comments