Skip to content

Commit d2b1ecc

Browse files
author
Martin D. Weinberg
committed
Added Python doc strings
1 parent 7bdd491 commit d2b1ecc

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

expui/BiorthBasis.H

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ namespace BasisClasses
120120
unsigned H5compress = 5;
121121
unsigned H5chunk = 1024*1024; // (1 MB)
122122
bool H5shuffle = true;
123+
bool H5szip = false;
123124
//@}
124125

125126
//! Round time key to emulated fixed-point arithmetic
@@ -290,11 +291,12 @@ namespace BasisClasses
290291
void setCovarFloatType(bool flt) { floatType = flt; }
291292

292293
//! HDF5 compression settings
293-
void setCovarH5Compress(unsigned level, unsigned chunksize, bool shuffle)
294+
void setCovarH5Compress(unsigned level, unsigned chunksize, bool shuffle, bool szip=false)
294295
{
295296
H5compress = level;
296297
H5chunk = chunksize;
297298
H5shuffle = shuffle;
299+
H5szip = szip;
298300
}
299301

300302
//! Make covariance after accumulation

expui/BiorthBasis.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4890,14 +4890,22 @@ namespace BasisClasses
48904890
("rankSize", HighFive::DataSpace::From(nmax)).write(nmax);
48914891

48924892
if (H5compress) {
4893+
// Szip parameters
4894+
const int options_mask = H5_SZIP_NN_OPTION_MASK;
4895+
const int pixels_per_block = 8;
4896+
48934897
// Properties for coefficients
48944898
//
48954899
unsigned int csz2 = nmax * ltot * sampleSize;
48964900
HighFive::Chunking data_dims2{std::min<unsigned>(csz2, H5chunk), 1};
48974901

48984902
dcpl2.add(data_dims2);
48994903
if (H5shuffle) dcpl2.add(HighFive::Shuffle());
4900-
dcpl2.add(HighFive::Deflate(H5compress));
4904+
if (H5szip) {
4905+
dcpl2.add(HighFive::Szip(options_mask, pixels_per_block));
4906+
} else {
4907+
dcpl2.add(HighFive::Deflate(H5compress));
4908+
}
49014909

49024910
// Properties for covariance
49034911
//
@@ -4906,7 +4914,11 @@ namespace BasisClasses
49064914

49074915
dcpl3.add(data_dims3);
49084916
if (H5shuffle) dcpl3.add(HighFive::Shuffle());
4909-
dcpl3.add(HighFive::Deflate(H5compress));
4917+
if (H5szip) {
4918+
dcpl3.add(HighFive::Szip(options_mask, pixels_per_block));
4919+
} else {
4920+
dcpl3.add(HighFive::Deflate(H5compress));
4921+
}
49104922
}
49114923

49124924
// Pack the coefficient data

pyEXP/BasisWrappers.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,21 +1434,26 @@ void BasisFactoryClasses(py::module &m)
14341434
)")
14351435
.def("setCovarH5Compress", &BasisClasses::BiorthBasis::setCovarH5Compress,
14361436
R"(
1437-
Set the HDF5 compression level for covariance storage in HDF5.
1437+
Set the HDF5 compression level for covariance storage in HDF5. The Szip
1438+
compression algorithm may also be enabled but seems to not have better
1439+
performance for these data than the standard Gzip compression. Gzip with
1440+
level 5 and shuffling is enabled by default.
14381441
14391442
Parameters
14401443
----------
14411444
compress : int
1442-
HDF5 compression level 0-9 (default: 5)
1445+
HDF5 Gzip compression level 0-9 (default: 5)
14431446
chunkSize : int
14441447
HDF5 chunk size for dataset storage (default: 1024*1024)
14451448
shuffle : bool
14461449
Use shuffle filter if true (default: true)
1450+
szip : bool
1451+
Use Szip compression algorithm (default: false)
14471452
14481453
Returns
14491454
-------
14501455
None
1451-
)", py::arg("compress")=5, py::arg("chunkSize")=1024*1024, py::arg("shuffle")=true)
1456+
)", py::arg("compress")=5, py::arg("chunkSize")=1024*1024, py::arg("shuffle")=true, py::arg("azip")=false)
14521457
.def("getFields", &BasisClasses::BiorthBasis::getFields,
14531458
R"(
14541459
Return the field evaluations for a given cartesian position. The

0 commit comments

Comments
 (0)