static public NetcdfDataset wrap ( NetcdfFile ncfile , Set < Enhance > mode ) throws IOException { if ( ncfile instanceof NetcdfDataset ) { NetcdfDataset ncd = ( NetcdfDataset ) ncfile ; if ( ! ncd . enhanceNeeded ( mode ) ) return ( NetcdfDataset ) ncfile ; } // enhancement requires wrappping, to not modify underlying dataset, eg if cached // perhaps need a method variant that allows the ncfile to be modified return new NetcdfDataset ( ncfile , mode ) ; }
Make NetcdfFile into NetcdfDataset with given enhance mode