dap4/d4cdm/src/main/java/dap4/cdm/CDMUtil.java
static public NetcdfFile unwrapfile(NetcdfFile file)
    {
        for(; ; ) {
            if(file instanceof NetcdfDataset) {
                NetcdfDataset ds = (NetcdfDataset) file;
                file = ds.getReferencedFile();
                if(file == null) break;
            } else break;
        }
        return file;
    }
static public NetcdfFile unwrapfile(NetcdfFile file)
    {
        for(; ; ) {
            if(file instanceof NetcdfDataset) {
                NetcdfDataset ds = (NetcdfDataset) file;
                file = ds.getReferencedFile();
                if(file == null) break;
            } else break;
        }
        return file;
    }
NetcdfDataset can wrap a NetcdfFile.
Goal of this procedure is to get down to the
lowest level NetcdfFile instance.

@param file NetcdfFile or NetcdfDataset
@return the lowest level NetcdfFile instance