资源简介
hdf5-1.10.5源码安装包,下载比较困难,方便大家学习。
代码片段和文件信息
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice including *
* terms governing use modification and redistribution is contained in *
* the COPYING file which can be found at the root of the source code *
* distribution tree or in https://support.hdfgroup.org/ftp/HDF5/releases. *
* If you do not have access to either file you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* This example shows how to read data from a chunked dataset.
* We will read from the file created by extend.cpp
*/
#ifdef OLD_HEADER_FILENAME
#include
#else
#include
#endif
using std::cout;
using std::endl;
#include
#include “H5Cpp.h“
using namespace H5;
const H5std_string FILE_NAME( “SDSextendible.h5“ );
const H5std_string DATASET_NAME( “ExtendibleArray“ );
const int NX = 10;
const int NY = 5;
const int RANK = 2;
const int RANKC = 1;
int main (void)
{
hsize_t i j;
// Try block to detect exceptions raised by any of the calls inside it
try
{
/*
* Turn off the auto-printing when failure occurs so that we can
* handle the errors appropriately
*/
Exception::dontPrint();
/*
* Open the file and the dataset.
*/
H5File file( FILE_NAME H5F_ACC_RDONLY );
DataSet dataset = file.openDataSet( DATASET_NAME );
/*
* Get filespace for rank and dimension
*/
DataSpace filespace = dataset.getSpace();
/*
* Get number of dimensions in the file dataspace
*/
int rank = filespace.getSimpleExtentNdims();
/*
* Get and print the dimension sizes of the file dataspace
*/
hsize_t dims[2]; // dataset dimensions
rank = filespace.getSimpleExtentDims( dims );
cout << “dataset rank = “ << rank << “ dimensions “
<< (unsigned long)(dims[0]) << “ x “
<< (unsigned long)(dims[1]) << endl;
/*
* Define the memory space to read dataset.
*/
DataSpace mspace1(RANK dims);
/*
* Read dataset back and display.
*/
int data_out[NX][NY]; // buffer for dataset to be read
dataset.read( data_out PredType::NATIVE_INT mspace1 filespace );
cout << “\n“;
cout << “Dataset: \n“;
for (j = 0; j < dims[0]; j++)
{
for (i = 0; i < dims[1]; i++)
cout << data_out[j][i] << “ “;
cout << endl;
}
/*
* dataset rank 2 dimensions 10 x 5
* chunk rank 2 dimensions 2 x 5
* Dataset:
* 1 1 1 3 3
* 1 1 1 3 3
* 1 1 1 0 0
* 2 0 0 0 0
* 2 0 0 0 0
* 2 0 0 0 0
*
- 上一篇:数字控制系统:设计、辨识和实现
- 下一篇:JFVideoEncrypt
相关资源
- HDF5查看工具.rar
- hdf5 Linux下的安装包 以及make文件
- HDF5 HDF4 NC 格式数据解析操作类
- HDF5数据使用指南
- hdf5-1.10.1.tar.gz
- hdf5-1.10.4
- hdf5-1.8.18
- hdf5-1.8.17.tar.gz
- weights_SSD300.hdf5
- HDFView-2.14-win_64最新版HDFView
- hdf安装包hdf5-1.10.5-Std-win10_64-vs15.7z
- GeoTIFF转HDF5方法
- envi_hdf5.sav
- ENVI读取Hdf5小插件
- ENVI读取HDF5插件
- hdf5-1.8.21
- 利用IDL读取hdf5
评论
共有 条评论