6#include <isce3/core/Constants.h>
7#include <isce3/except/Error.h>
20const hsize_t chunkSizeX = 128;
21const hsize_t chunkSizeY = 128;
34 std::vector<std::string> outList;
35 std::string searchStr;
36 std::string searchType;
41class IDataSet :
public H5::DataSet {
44 IDataSet() : H5::DataSet() {};
45 IDataSet(
const H5::DataSet& dset) : H5::DataSet(dset) {};
46 IDataSet(
const hid_t
id) : H5::DataSet(
id) {};
58 int getRank(
const std::string& v =
"");
77 std::string
toGDAL()
const;
82 template<
typename T>
inline void read(T& v,
const std::string& att =
"");
85 void read(std::string& v,
const std::string& att =
"");
88 template<
typename T>
inline void read(T* buf,
const std::string& att);
92 inline void read(std::vector<T>& buf,
const std::string& att);
96 inline void read(std::valarray<T>& buf,
const std::string& att);
125 inline void read(T* buf,
const int* startIn =
nullptr,
126 const int* countIn =
nullptr,
127 const int* strideIn =
nullptr);
132 inline void read(T* buf,
const std::vector<std::slice>* slicesIn);
136 template<
typename T>
inline void read(T* buf,
const std::gslice* gsliceIn);
139 template<
typename T>
inline void read(std::vector<T>& buf);
143 inline void read(std::vector<T>& buf,
const std::vector<int>* startIn,
144 const std::vector<int>* countIn,
145 const std::vector<int>* strideIn);
149 inline void read(std::vector<T>& buf,
150 const std::vector<std::slice>* slicesIn);
155 inline void read(std::vector<T>& buf,
const std::gslice* gsliceIn);
158 template<
typename T>
inline void read(std::valarray<T>& buf);
162 inline void read(std::valarray<T>& buf,
const std::valarray<int>* startIn,
163 const std::valarray<int>* countIn,
164 const std::valarray<int>* strideIn);
169 inline void read(std::valarray<T>& buf,
170 const std::vector<std::slice>* slicesIn);
175 inline void read(std::valarray<T>& buf,
const std::gslice* gsliceIn);
180 template<
typename T>
inline void write(
const std::vector<T>& buf);
184 template<
typename T,
size_t S>
185 inline void write(
const std::vector<T>& buf,
186 const std::array<int, S>& startIn,
187 const std::array<int, S>& countIn,
188 const std::array<int, S>& strideIn);
193 inline void write(
const std::vector<T>& buf,
194 const std::vector<std::slice>* slicesIn);
199 inline void write(
const std::vector<T>& buf,
const std::gslice* gsliceIn);
202 template<
typename T>
inline void write(
const std::valarray<T>& buf);
206 template<
typename T,
size_t S>
207 inline void write(
const std::valarray<T>& buf,
208 const std::array<int, S>& startIn,
209 const std::array<int, S>& countIn,
210 const std::array<int, S>& strideIn);
215 inline void write(
const std::valarray<T>& buf,
216 const std::vector<std::slice>* slicesIn);
221 inline void write(
const std::valarray<T>& buf,
const std::gslice* gsliceIn);
224 template<
typename T>
inline void write(
const T* buf,
const size_t sz);
228 template<
typename T,
size_t S>
229 inline void write(
const T* buf,
const std::array<int, S>& startIn,
230 const std::array<int, S>& countIn,
231 const std::array<int, S>& strideIn);
236 inline void write(
const T* buf,
const std::vector<std::slice>* slicesIn);
241 inline void write(
const T* buf,
const std::gslice* gsliceIn);
250 const std::vector<T>& values);
255 const std::valarray<T>& values);
259 template<
typename T,
typename T2,
size_t S>
261 const std::array<T2, S>& dims,
262 const std::vector<T>& values);
266 template<
typename T,
typename T2,
size_t S>
268 const std::array<T2, S>& dims,
269 const std::valarray<T>& values);
273 template<
typename T,
typename T2,
size_t S>
275 const std::array<T2, S>& dims,
const T* buffer);
279 H5::DataSpace
getDataSpace(
const int* startIn,
const int* countIn,
280 const int* strideIn);
283 H5::DataSpace
getDataSpace(
const std::vector<std::slice>* sliceIn);
286 H5::DataSpace
getDataSpace(
const std::gslice* gsliceIn);
289 H5::DataSpace
getDataSpace(
const size_t xidx,
const size_t yidx,
290 const size_t iowidth,
const size_t iolength,
294 template<
typename T>
void read(T* buffer,
const H5::DataSpace& dspace);
297 void createAttribute(
const std::string& name,
const H5::DataType& datatype,
298 const H5::DataSpace& dataspace,
const T* buffer);
301 void write(
const T* buf,
const H5::DataSpace& filespace);
304class IGroup :
public H5::Group {
307 IGroup() : H5::Group() {};
308 IGroup(
const H5::Group& group) : H5::Group(group) {};
309 IGroup(hid_t group) : H5::Group(group) {};
311 std::vector<std::string> getAttrs();
314 std::vector<std::string>
find(
const std::string name,
315 const std::string start =
".",
316 const std::string type =
"BOTH",
317 const std::string path =
"FULL");
329 template<
typename T>
inline void read(T& v,
const std::string& att);
332 void read(std::string& v,
const std::string& att);
335 template<
typename T>
inline void read(T* buf,
const std::string& att);
339 inline void read(std::vector<T>& buf,
const std::string& att);
343 inline void read(std::valarray<T>& buf,
const std::string& att);
349 IGroup
openGroup(
const H5std_string& name);
364 const std::vector<T>& data);
369 const std::valarray<T>& data);
377 template<
typename T,
typename T2,
size_t S>
379 const std::vector<T>& data,
380 const std::array<T2, S>& dims);
383 template<
typename T,
typename T2,
size_t S>
385 const std::valarray<T>& data,
386 const std::array<T2, S>& dims);
389 template<
typename T,
typename T2,
size_t S>
391 const std::array<T2, S>& dims);
394 template<
typename T,
typename T2,
size_t S>
396 const std::array<T2, S>& dims,
const int chunk = 0,
397 const int shuffle = 0,
const int deflate = 0);
406 const std::vector<T>& values);
411 const std::valarray<T>& values);
415 template<
typename T,
typename T2,
size_t S>
417 const std::array<T2, S>& dims,
418 const std::vector<T>& values);
422 template<
typename T,
typename T2,
size_t S>
424 const std::array<T2, S>& dims,
425 const std::valarray<T>& values);
429 template<
typename T,
typename T2,
size_t S>
431 const std::array<T2, S>& dims,
const T* buffer);
435 void createAttribute(
const std::string& name,
const H5::DataType& datatype,
436 const H5::DataSpace& dataspace,
const T* buffer);
439class IH5File :
public H5::H5File {
441 IH5File() : H5::H5File() {};
450 IH5File(
const H5std_string& name,
const char mode =
'r');
452 void openFile(
const H5std_string& name);
461 std::vector<std::string>
find(
const std::string name,
462 const std::string start =
"/",
463 const std::string type =
"BOTH",
464 const std::string path =
"FULL");
467 inline std::string
filename()
const {
return getFileName(); }
476#define ISCE_IO_IH5_ICC
478#undef ISCE_IO_IH5_ICC
Our derived dataset structure that includes utility functions.
Definition IH5.h:41
std::string getTypeClassStr(const std::string &v="")
Get the H5 data type of the dataset or given attribute.
Definition IH5.cpp:208
void write(const std::vector< T > &buf)
Writing std::vector data into a dataset.
Definition IH5.icc:525
std::string toGDAL() const
Generate GDALDataset Representation.
Definition IH5.cpp:350
H5::DataSpace getDataSpace(const std::string &v="")
Get a HDF5 DataSpace object corresponding to dataset or given attribute.
Definition IH5.cpp:127
std::vector< int > getDimensions(const std::string &v="")
Get the size of each dimension of the dataset or given attribute.
Definition IH5.cpp:172
std::vector< int > getChunkSize()
Get the storage chunk size of the dataset.
Definition IH5.cpp:276
void read(T &v, const std::string &att="")
Reading scalar (non string) dataset or attributes.
Definition IH5.icc:143
int getNumElements(const std::string &v="")
Get the total number of elements contained in dataset or given attribute.
Definition IH5.cpp:160
int getRank(const std::string &v="")
Get the number of dimension of dataset or given attribute.
Definition IH5.cpp:150
std::vector< std::string > getAttrs()
Get a list of attributes attached to dataset.
Definition IH5.cpp:252
void createAttribute(const std::string &name, const T &data)
Creating and writing a scalar as an attribute.
Definition IH5.icc:837
int getNumBits(const std::string &v="")
Get the number of bit used to store each dataset element.
Definition IH5.cpp:315
IGroup createGroup(const H5std_string &name)
Create a group within this group.
Definition IH5.cpp:757
std::string getPathname()
Return the path of the group from the file root.
Definition IH5.cpp:672
IGroup openGroup(const H5std_string &name)
Open a given group.
Definition IH5.cpp:720
H5::DataSpace getDataSpace(const std::string &name)
Return the H5::DataSpace of the given attribute.
Definition IH5.cpp:689
IDataSet openDataSet(const H5std_string &name)
Open a given dataset.
Definition IH5.cpp:712
IDataSet createDataSet(const std::string &name, const std::vector< T > &data, const std::array< T2, S > &dims)
Create a dataset (nD) and write the data from a vector container.
IDataSet createDataSet(const std::string &name, const std::vector< T > &data)
Create a dataset (1D) and write the data from a vector container.
IDataSet createDataSet(const std::string &name, const T *buffer, const size_t size)
Create a dataset (1D) and write a buffer's data.
IDataSet createDataSet(const std::string &name, const T &data)
Create a (non-string) scalar dataset and simultaneously write the data.
IDataSet createDataSet(const std::string &name, const T *data, const std::array< T2, S > &dims)
Create a dataset (nD) and write the data from a buffer.
IDataSet createDataSet(const std::string &name, const std::string &data)
Create a string scalar dataset and simultaneously write the data.
Definition IH5.cpp:782
int getNumElements(const std::string &name)
Return the number of elements in the given attribute.
Definition IH5.cpp:701
void createAttribute(const std::string &name, const T &data)
Creating and writing a scalar as an attribute.
Definition IH5.icc:1251
void read(T &v, const std::string &att)
Reading scalar attribute given by name.
Definition IH5.icc:865
IDataSet createDataSet(const std::string &name, const std::valarray< T > &data)
Create a dataset (1D) and write the data from a valarray container.
std::vector< std::string > find(const std::string name, const std::string start=".", const std::string type="BOTH", const std::string path="FULL")
Search function for given name in the group.
Definition IH5.cpp:662
IDataSet createDataSet(const std::string &name, const std::valarray< T > &data, const std::array< T2, S > &dims)
Create a dataset (nD) and write the data from a valarray container.
IDataSet createDataSet(const std::string &name, const std::array< T2, S > &dims, const int chunk=0, const int shuffle=0, const int deflate=0)
Create a datatset with compression options.
IDataSet openDataSet(const H5std_string &name)
Open a given dataset.
Definition IH5.cpp:794
std::string filename() const
Get filename of HDF5 file.
Definition IH5.h:467
std::vector< std::string > find(const std::string name, const std::string start="/", const std::string type="BOTH", const std::string path="FULL")
Searching for given name in file.
Definition IH5.cpp:846
IGroup openGroup(const H5std_string &name)
Open a given group.
Definition IH5.cpp:802
IGroup createGroup(const H5std_string &name)
Create a group.
Definition IH5.cpp:810
The isce3::io namespace.
Definition Constants.h:14
base interpolator is an abstract base class
Definition BinarySearchFunc.cpp:5