def __init__(self, filename, filename_info, filetype_info, **kwargs): """Initialize the base reader.""" BaseFileHandler.__init__(self, filename, filename_info, filetype_info) try: self.sd = SD(self.filename) except HDF4Error as err: error_message = "Could not load data from file {}: {}".format( self.filename, err) raise ValueError(error_message) self.metadata = self._load_all_metadata_attributes()
def __init__(self, filename, filename_info, filetype_info): BaseFileHandler.__init__(self, filename, filename_info, filetype_info) try: self.sd = SD(self.filename) except HDF4Error as err: error_message = "Could not load data from file {}: {}".format( self.filename, err) raise ValueError(error_message) # Read metadata self.metadata = self.read_mda(self.sd.attributes()['CoreMetadata.0']) self.metadata.update( self.read_mda(self.sd.attributes()['StructMetadata.0'])) self.metadata.update( self.read_mda(self.sd.attributes()['ArchiveMetadata.0']))