예제 #1
0
        public Dictionary <string, object> GetAttributes(NetCdfVariable ncVariable)
        {
            var nameValueDictionary = new Dictionary <string, object>();

            int nAtts;

            CheckResult(NetCdfWrapper.nc_inq_varnatts(id, ncVariable, out nAtts));

            for (int i = 0; i < nAtts; ++i)
            {
                var nameBuilder = new StringBuilder((int)NetCdfWrapper.Limits.NC_MAX_NAME);
                NetCdfWrapper.nc_inq_attname(id, ncVariable, i, nameBuilder);
                var name = nameBuilder.ToString();

                var attribute = GetAttribute(ncVariable, name);
                nameValueDictionary.Add(attribute.Name, attribute.Value);
            }

            return(nameValueDictionary);
        }