示例#1
0
 private void ReadAttribute()
 {
     HDFAttribute[] sdAttributes = new HDFAttribute[_num_attrs];
     for (int i = 0; i < _num_attrs; i++)
     {
         sdAttributes[i] = HDFAttribute.Load(_sds_id, i);
     }
     _sdAttributes = sdAttributes;
 }
示例#2
0
        /** get the root group and all the alone objects */
        private void getRootGroup()
        {
            sw.Restart();
            //LoadVgroups(_file_id);//暂时取消加载整个树结构,目前这个加载比较慢,暂时也用不着。
            sw.Stop();
            em = sw.ElapsedMilliseconds;
            Console.WriteLine("LoadVgroups" + em + "毫秒");

            sw.Restart();
            int num_ds     = 0;
            int num_global = 0;

            status            = HDF4Helper.SDfileinfo(_sd_id, out num_ds, out num_global);
            _num_datasets     = num_ds;
            _num_global_attrs = num_global;
            for (int i = 0; i < num_ds; i++)
            {
                H4SDS ds = H4SDS.Load(_sd_id, i);
                _datasets.Add(ds);
            }
            for (int i = 0; i < num_global; i++)
            {
                HDFAttribute global_attr = HDFAttribute.Load(_sd_id, i);
                _global_attrs.Add(global_attr);
            }
            sw.Stop();
            em = sw.ElapsedMilliseconds;
            Console.WriteLine("SDfileinfo" + em + "毫秒");


            sw.Restart();
            //Finding All Vdatas that are Not Members of a Vgroup: VSlone
            //初始化Vdata(读取表格数据,表格列名称参数)
            int[] ref_array = new int[1024];
            HDF4API.VSlone(_file_id, ref_array, 1024);

            //初始化Vdata(读取表格数据,表格列名称参数) istat;
            int vdata_ref;
            int istat = HDF4API.Vstart(_file_id);

            vdata_ref = -1;
            List <H4Vdata> vdatas = new List <H4Vdata>();

            while ((vdata_ref = HDF4API.VSgetid(_file_id, vdata_ref)) != HDFConstants.FAIL)
            {
                H4Vdata vdata = LoadVdata(_file_id, vdata_ref);
                vdatas.Add(vdata);
            }
            _vdatas = vdatas;
            sw.Stop();
            em = sw.ElapsedMilliseconds;
            Console.WriteLine("VSlone" + em + "毫秒");
        }
示例#3
0
        public static HDFAttribute Load(int sd_id, int attr_index)
        {
            int           status    = 0;
            StringBuilder attr_name = new StringBuilder();

            GeoDo.HDF4.HDF4Helper.DataTypeDefinitions data_type;
            int count;

            status = HDF4Helper.SDattrinfo(sd_id, attr_index, attr_name, out data_type, out count);
            HDFAttribute ds = new HDFAttribute();

            ds._sd_id      = sd_id;
            ds._attr_index = attr_index;
            ds._name       = attr_name.ToString();
            ds._data_type  = data_type;
            ds._count      = count;
            return(ds);
        }