Calculate the size for the HDF5 chunk.
(self, expectedrows: int)
| 367 | |
| 368 | # This is too specific for moving it into Leaf |
| 369 | def _calc_chunkshape(self, expectedrows: int) -> tuple[int]: |
| 370 | """Calculate the size for the HDF5 chunk.""" |
| 371 | # For computing the chunkshape for HDF5 VL types, we have to |
| 372 | # choose the itemsize of the *each* element of the atom and |
| 373 | # not the size of the entire atom. I don't know why this |
| 374 | # should be like this, perhaps I should report this to the |
| 375 | # HDF5 list. |
| 376 | # F. Alted 2006-11-23 |
| 377 | # elemsize = self.atom.atomsize() |
| 378 | elemsize = self._basesize |
| 379 | |
| 380 | # AV 2013-05-03 |
| 381 | # This is just a quick workaround tha allows to change the API for |
| 382 | # PyTables 3.0 release and remove the expected_mb parameter. |
| 383 | # The algorithm for computing the chunkshape should be rewritten as |
| 384 | # requested by gh-35. |
| 385 | expected_mb = expectedrows * elemsize / 1024**2 |
| 386 | |
| 387 | chunksize = calc_chunksize(expected_mb) |
| 388 | |
| 389 | # Set the chunkshape |
| 390 | chunkshape = chunksize // elemsize |
| 391 | # Safeguard against itemsizes being extremely large |
| 392 | if chunkshape == 0: |
| 393 | chunkshape = 1 |
| 394 | return (SizeType(chunkshape),) |
| 395 | |
| 396 | def _g_create(self) -> int: |
| 397 | """Create a variable length array (ragged array).""" |
no test coverage detected