[MINC-development] default file type (HDF5 vs NetCDF)

Jonathan HARLAP jharlap at bic.mni.mcgill.ca
Wed May 31 10:34:13 EDT 2006


Heylas,

I know I've raised this before, but now that I understand what's going 
on a little better I'd like to propose a small change:

In libsrc/netcdf_convenience.c the function micreatex reads:

     if ((cmode & MI2_CREATE_V1) != 0) {
         fd = nccreate(path, cmode);
     }
     else if (miget_cfg_bool(MICFG_FORCE_V2) || (cmode & MI2_CREATE_V2) 
!= 0) {
	fd = hdf_create(path, cmode, opts_ptr);
     }
     else {
         if (mi_nc_files == 0 && mi_h5_files != 0) {
             /* Create an HDF5 file. */
             fd = hdf_create(path, cmode, opts_ptr);
         }
         else {
             /* Create a NetCDF file. */
             fd = nccreate(path, cmode);
         }
     }


I propose changing the line "if (mi_nc_files == 0 && mi_h5_files != 0)" 
to read " if (mi_nc_files == 0)"

The reason is that currently the code will default to creating HDF5 
files only if a program has already opened an HDF5 file.  The change 
proposed would make it such that the library will only create CDF files 
if a program has already opened a CDF file.  This won't influence any of 
the minc tools normally used on a day-to-day basis, but will change the 
default output of file format converters that don't read any minc files 
before creating an output file.

I didn't put this in CVS yet as I don't know what your process is for 
getting this kind of functionality change into the library.

Cheers,
J


More information about the MINC-development mailing list