protected NetCdfVariable(NetCDFDataSet dataSet, int varid, string name, string[] dims, bool assignID) : base(dataSet, name, dims, assignID) { this.initializing = true; this.varid = varid; int res; // SByte can map to NC_BYTE or NC_CHAR if (typeof(DataType) == typeof(byte)) { res = NetCDF.nc_inq_vartype(dataSet.NcId, varid, out var nativeType); NetCDFDataSet.HandleResult(res); isNcChar = NcType.NC_CHAR == nativeType; } UpdateDimIds(); // Reading attributes int nattrs; res = NetCDF.nc_inq_varnatts(dataSet.NcId, varid, out nattrs); AttributeTypeMap atm = new AttributeTypeMap(dataSet.NcId, varid); NetCDFDataSet.HandleResult(res); for (int i = 0; i < nattrs; i++) { // Name string aname; res = NetCDF.nc_inq_attname(dataSet.NcId, varid, i, out aname); NetCDFDataSet.HandleResult(res); // Skip out internal attribute if (aname == AttributeTypeMap.AttributeName || aname == AttributeTypeMap.AttributeVarSpecialType) { continue; } if (aname == AttributeTypeMap.AttributeVarActualShape) { isPresentedAttrActualShape = true; continue; } // Type object value = dataSet.ReadNetCdfAttribute(varid, aname, atm); if (aname == Metadata.KeyForMissingValue && typeof(DateTime) == typeof(DataType)) { if (value is string) { value = DateTime.Parse((string)value); } } Metadata[aname] = value; } Initialize(); initializing = false; }