Skip to content

Commit

Permalink
Check that all datasets are the same length
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Pals committed Feb 13, 2020
1 parent 6fb77d0 commit 40cd57b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/hdf/io/Hdf5Handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,18 @@ void Hdf5Handler::initialize(
m_logger->get(LogLevel::Info) << "Opening dataset '"
<< datasetName << "' with dimension name '" << dimName
<< "'" << std::endl;
// Will throw if dataset doesn't exists. Gives adequate error message
H5::DataSet dset = m_h5File.get()->openDataSet(datasetName);
m_dsets.push_back(dset);
H5::DataSpace dspace = dset.getSpace();
m_dsets.push_back(dset);
m_dspaces.push_back(dspace);
m_numPoints = dspace.getSelectNpoints();
if(index == 0) {
m_numPoints = dspace.getSelectNpoints();
} else {
if(m_numPoints != dspace.getSelectNpoints()) {
throw pdal_error("All given datasets must have the same length");
}
}
H5::DSetCreatPropList plist = dset.getCreatePlist();
if(plist.getLayout() == H5D_CHUNKED) {
int dimensionality = plist.getChunk(1, &chunkSize);
Expand Down

0 comments on commit 40cd57b

Please sign in to comment.