Esempio n. 1
0
        public Dictionary <string, string> GetDatasetAttributes(string datasetName)
        {
            StringBuilder sds_name = new StringBuilder();
            int           rank     = 0;

            int[] dimsizes = new int[MAX_DIMSIZES];
            HDF4Helper.DataTypeDefinitions datatype;
            int attCount = 0;

            try
            {
                int dsIndex = HDF4Helper.SDnametoindex(sd_id, datasetName);
                System.Diagnostics.Debug.WriteLine($"name:{datasetName} index:{dsIndex}");
                int dsObjId = HDF4Helper.SDselect(sd_id, dsIndex);
                System.Diagnostics.Debug.WriteLine($"dsObjId:{dsObjId}");
                HDF4Helper.SDgetinfo(dsObjId, sds_name, out rank, dimsizes, out datatype, out attCount);
                //int dsCount = 0;
                //HDF4Helper.SDfileinfo(id, out dsCount, out attCount);
                if (attCount == 0)
                {
                    return(null);
                }
                return(GetAttributes(dsObjId, attCount));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Esempio n. 2
0
 public string GetAttributeValue(string datasetName, string attributeName)
 {
     try
     {
         int dsIndex  = HDF4Helper.SDnametoindex(sd_id, datasetName);
         int dsObjId  = HDF4Helper.SDselect(sd_id, dsIndex);
         int attIndex = HDF4Helper.SDfindattr(dsObjId, attributeName);
         return(ReadAttribute(dsObjId, attIndex));
     }
     finally
     {
     }
 }
Esempio n. 3
0
        public bool GetDataSizeInfos(string datasetName, out int rank, out int[] dimsizes, out HDF4Helper.DataTypeDefinitions hdf4Type, out Type dataType, out int dataTypeSize)
        {
            StringBuilder sds_name = new StringBuilder();

            rank         = 0;
            dimsizes     = new int[MAX_DIMSIZES];
            dataType     = typeof(UInt16);
            hdf4Type     = HDF4Helper.DataTypeDefinitions.DFNT_NUINT16;
            dataTypeSize = 0;

            int dsIndex  = HDF4Helper.SDnametoindex(sd_id, datasetName);
            int dsObjId  = HDF4Helper.SDselect(sd_id, dsIndex);
            int attCount = 0;

            HDF4Helper.SDgetinfo(dsObjId, sds_name, out rank, dimsizes, out hdf4Type, out attCount);
            if (rank != 0)
            {
                dataType = GetTypeFromHDF4DataType(hdf4Type, out dataTypeSize);
                return(true);
            }

            return(false);
        }