public NetCdfVariable AddVariable(string varName, Type type, NetCdfDimension[] ncDimensions) { int varId; CheckResult(NetCdfWrapper.nc_def_var(id, varName, NetCdfWrapper.GetNetCdf3DataType(type), ncDimensions.Length, ncDimensions.Select(d => (int)d).ToArray(), out varId)); var ncVar = new NetCdfVariable(varId); // variable name is unique here, guaranteed by nc_def_var call above ncVariableLookupByName.Add(varName, ncVar); return(ncVar); }