Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def createVariable(self, varname, datatype, dimensions=(), zlib=False,
complevel=4, shuffle=True, fletcher32=False,
chunksizes=None, fill_value=None):
if len(dimensions) == 0: # it's a scalar
# rip off chunk and filter options for consistency with netCDF4-python
chunksizes = None
zlib = False
fletcher32 = False
shuffle = False
if datatype is str:
datatype = h5py.special_dtype(vlen=unicode)
kwds = {}
if zlib:
# only add compression related keyword arguments if relevant (h5py
# chokes otherwise)
kwds['compression'] = 'gzip'
kwds['compression_opts'] = complevel
kwds['shuffle'] = shuffle
return super(Group, self).create_variable(
varname, dimensions, dtype=datatype, fletcher32=fletcher32,
chunks=chunksizes, fillvalue=fill_value, **kwds)
def dtype(self):
dt = self._h5ds.dtype
if h5py.check_dtype(vlen=dt) is unicode:
return str
return dt