def _checkparams(clevel, shuffle, cname, quantize): if clevel is not None: if not isinstance(clevel, int): raise ValueError("`clevel` must be an int.") if clevel < 0: raise ValueError("`clevel` must be 0 or a positive integer.") if shuffle is not None: if not isinstance(shuffle, (bool, int)): raise ValueError("`shuffle` must be an int.") if shuffle not in [bcolz.NOSHUFFLE, bcolz.SHUFFLE, bcolz.BITSHUFFLE]: raise ValueError("`shuffle` value not allowed.") if (shuffle == bcolz.BITSHUFFLE and LooseVersion(bcolz.blosc_version()[0]) < LooseVersion("1.8.0")): raise ValueError("You need C-Blosc 1.8.0 or higher for using " "BITSHUFFLE.") # Store the cname as bytes object internally if cname is not None: list_cnames = bcolz.blosc_compressor_list() if cname not in list_cnames: raise ValueError( "Compressor '%s' is not available in this build" % cname) if quantize is not None: if not isinstance(quantize, int): raise ValueError("`quantize` must be an int.") if quantize < 0: raise ValueError("`quantize` must be 0 or a positive integer.") return clevel, shuffle, cname, quantize
def print_versions(): """Print all the versions of packages that bcolz relies on.""" print("-=" * 38) print("bcolz version: %s" % bcolz.__version__) if bcolz.git_description: print("bcolz git info: %s" % bcolz.git_description) print("NumPy version: %s" % np.__version__) tinfo = bcolz.blosc_version() blosc_cnames = bcolz.blosc_compressor_list() print("Blosc version: %s (%s)" % (tinfo[0], tinfo[1])) print("Blosc compressors: %s" % (blosc_cnames,)) if bcolz.numexpr_here: print("Numexpr version: %s" % bcolz.numexpr.__version__) else: print("Numexpr version: not available " "(version >= %s not detected)" % bcolz.min_numexpr_version) if bcolz.dask_here: print("Dask version: %s" % bcolz.dask.__version__) else: print("Dask version: not available " "(version >= %s not detected)" % bcolz.min_dask_version) print("Python version: %s" % sys.version) if os.name == "posix": (sysname, nodename, release, version, machine) = os.uname() print("Platform: %s-%s" % (sys.platform, machine)) print("Byte-ordering: %s" % sys.byteorder) print("Detected cores: %s" % bcolz.detect_number_of_cores()) print("-=" * 38)
def _checkparams(clevel, shuffle, cname, quantize): if clevel is not None: if not isinstance(clevel, int): raise ValueError("`clevel` must be an int.") if clevel < 0: raise ValueError("`clevel` must be 0 or a positive integer.") if shuffle is not None: if not isinstance(shuffle, (bool, int)): raise ValueError("`shuffle` must be an int.") if shuffle not in [ bcolz.NOSHUFFLE, bcolz.SHUFFLE, bcolz.BITSHUFFLE ]: raise ValueError("`shuffle` value not allowed.") if (shuffle == bcolz.BITSHUFFLE and parse_version( bcolz.blosc_version()[0]) < parse_version("1.8.0")): raise ValueError("You need C-Blosc 1.8.0 or higher for using " "BITSHUFFLE.") # Store the cname as bytes object internally if cname is not None: list_cnames = bcolz.blosc_compressor_list() if cname not in list_cnames: raise ValueError( "Compressor '%s' is not available in this build" % cname) if quantize is not None: if not isinstance(quantize, int): raise ValueError("`quantize` must be an int.") if quantize < 0: raise ValueError("`quantize` must be 0 or a positive integer.") return clevel, shuffle, cname, quantize
def print_versions(): """Print all the versions of packages that bcolz relies on.""" print("-=" * 38) print("bcolz version: %s" % bcolz.__version__) if bcolz.git_description: print("bcolz git info: %s" % bcolz.git_description) print("NumPy version: %s" % np.__version__) tinfo = bcolz.blosc_version() blosc_cnames = bcolz.blosc_compressor_list() print("Blosc version: %s (%s)" % (tinfo[0], tinfo[1])) print("Blosc compressors: %s" % (blosc_cnames, )) if bcolz.numexpr_here: print("Numexpr version: %s" % bcolz.numexpr.__version__) else: print("Numexpr version: not available " "(version >= %s not detected)" % bcolz.min_numexpr_version) if bcolz.dask_here: print("Dask version: %s" % bcolz.dask.__version__) else: print("Dask version: not available " "(version >= %s not detected)" % bcolz.min_dask_version) print("Python version: %s" % sys.version) if os.name == "posix": (sysname, nodename, release, version, machine) = os.uname() print("Platform: %s-%s" % (sys.platform, machine)) print("Byte-ordering: %s" % sys.byteorder) print("Detected cores: %s" % bcolz.detect_number_of_cores()) print("-=" * 38)
def _checkparams(clevel, shuffle, cname): if clevel is not None: if not isinstance(clevel, int): raise ValueError("`clevel` must be an int.") if clevel < 0: raise ValueError("clevel must be a positive integer") if shuffle is not None: if not isinstance(shuffle, (bool, int)): raise ValueError("`shuffle` must be a boolean.") shuffle = bool(shuffle) # Store the cname as bytes object internally if cname is not None: list_cnames = bcolz.blosc_compressor_list() if cname not in list_cnames: raise ValueError( "Compressor '%s' is not available in this build" % cname) return clevel, shuffle, cname
def _checkparams(clevel, shuffle, cname): if clevel is not None: if not isinstance(clevel, int): raise ValueError("`clevel` must be an int.") if clevel < 0: raise ValueError("clevel must be a positive integer") if shuffle is not None: if not isinstance(shuffle, (bool, int)): raise ValueError("`shuffle` must be a boolean.") shuffle = bool(shuffle) # Store the cname as bytes object internally if cname is not None: list_cnames = bcolz.blosc_compressor_list() if cname not in list_cnames: raise ValueError( "Compressor '%s' is not available in this build" % cname) return clevel, shuffle, cname
shape = (400, 100, 100, 100) def create_bcolz(arr, dirname): cparams = bcolz.cparams(clevel=5, cname='lz4') ca = bcolz.carray(arr, rootdir=dirname, mode='w', cparams=cparams, chunklen=1) ca.flush() return ca tinfo = bcolz.blosc_version() blosc_cnames = bcolz.blosc_compressor_list() print("-=" * 38) print("bcolz version: %s" % bcolz.__version__) tinfo = bcolz.blosc_version() print("Blosc version: %s (%s)" % (tinfo[0], tinfo[1])) print("-=" * 38) if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "-r", "--read-only", action="store_true", help="Read only bench.", ) parser.add_argument(