How to use the h5netcdf.legacyapi.HasAttributesMixin function in h5netcdf

To help you get started, we’ve selected a few h5netcdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shoyer / h5netcdf / h5netcdf / legacyapi.py View on Github external
def filters(self):
        complevel = self._h5ds.compression_opts
        return {'complevel': 0 if complevel is None else complevel,
                'fletcher32': self._h5ds.fletcher32,
                'shuffle': self._h5ds.shuffle,
                'zlib': self._h5ds.compression == 'gzip'}

    @property
    def dtype(self):
        dt = self._h5ds.dtype
        if h5py.check_dtype(vlen=dt) is unicode:
            return str
        return dt


class Group(core.Group, HasAttributesMixin):
    _cls_name = 'h5netcdf.legacyapi.Group'
    _variable_cls = Variable

    @property
    def _group_cls(self):
        return Group

    createGroup = core.Group.create_group
    createDimension = core.Group._create_dimension

    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