/// <summary>
        /// Reads the variables from the netcdf file, needed when opening a new file
        /// </summary>
        /// <returns></returns>
        private void UpdateVariableLookup(ref IDictionary <string, NetCdfVariable> lookup)
        {
            lookup.Clear();

            int nVars;

            CheckResult(NetCdfWrapper.nc_inq_nvars(id, out nVars));

            var variables = Enumerable.Range(0, nVars).Select(vi => new NetCdfVariable(vi)).ToList();

            foreach (var ncVar in variables)
            {
                lookup.Add(GetVariableName(ncVar), ncVar);
            }
        }