# Buggy code
def read_band(self, key, info):
    """Read the data."""
    shape = int(np.ceil(self.mda["data_field_length"] / 8.0))
    if self.mda["number_of_bits_per_pixel"] == 16:
        dtype = ">u2"
        shape /= 2
    elif self.mda["number_of_bits_per_pixel"] in [8, 10]:
        dtype = np.uint8
    shape = (shape,)
    data = np.memmap(
        self.filename,
        mode="r",
        offset=self.mda["total_header_length"],
        dtype=dtype,
        shape=shape,
    )
    data = da.from_array(data, chunks=shape[0])
    if self.mda["number_of_bits_per_pixel"] == 10:
        data = dec10216(data)
    data = data.reshape((self.mda["number_of_lines"], self.mda["number_of_columns"]))
    return data


# Traceback (TypeError)
filenames=find_files_and_readers(base_dir='./DK01_201101010030/', reader='hrit_jma')
scn = Scene(filenames=filenames)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-5fb0dc98e3f1> in <module>()
1 filenames=find_files_and_readers(base_dir='./DK01_201101010030/', reader='hrit_jma')
----> 2 scn = Scene(filenames=filenames)

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/scene.py in __init__(self, filenames, reader, filter_parameters, reader_kwargs, ppp_config_dir, base_dir, sensor, start_time, end_time, area)
148         self.readers = self.create_reader_instances(filenames=filenames,
149                                                     reader=reader,
--> 150                                                     reader_kwargs=reader_kwargs)
151         self.attrs.update(self._compute_metadata_from_readers())
152         self.datasets = DatasetDict()

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/scene.py in create_reader_instances(self, filenames, reader, reader_kwargs)
193                             reader=reader,
194                             reader_kwargs=reader_kwargs,
--> 195                             ppp_config_dir=self.ppp_config_dir)
196
197     @property

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/__init__.py in load_readers(filenames, reader, reader_kwargs, ppp_config_dir)
587             loadables = reader_instance.select_files_from_pathnames(readers_files)
588         if loadables:
--> 589             reader_instance.create_filehandlers(loadables)
590             reader_instances[reader_instance.name] = reader_instance
591             remaining_filenames -= set(loadables)

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/yaml_reader.py in create_filehandlers(self, filenames)
485         for filetype, filetype_info in self.sorted_filetype_items():
486             filehandlers = self.new_filehandlers_for_filetype(filetype_info,
--> 487                                                               filename_set)
488
489             filename_set -= set([fhd.filename for fhd in filehandlers])

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/yaml_reader.py in new_filehandlers_for_filetype(self, filetype_info, filenames)
472                                                           filename_iter)
473         filtered_iter = self.filter_fh_by_metadata(filehandler_iter)
--> 474         return list(filtered_iter)
475
476     def create_filehandlers(self, filenames):

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/yaml_reader.py in filter_fh_by_metadata(self, filehandlers)
445     def filter_fh_by_metadata(self, filehandlers):
446         """Filter out filehandlers using provide filter parameters."""
--> 447         for filehandler in filehandlers:
448             filehandler.metadata['start_time'] = filehandler.start_time
449             filehandler.metadata['end_time'] = filehandler.end_time

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/yaml_reader.py in new_filehandler_instances(self, filetype_info, filename_items)
389                 continue
390
--> 391             yield filetype_cls(filename, filename_info, filetype_info, *req_fh)
392
393     def time_matches(self, fstart, fend):

/mnt/c/Users/harry/gdrive/work/2018-02_rerun/data_sources/mtsat/ext/satpy/satpy/readers/hrit_jma.py in __init__(self, filename, filename_info, filetype_info)
116         self.mda['planned_start_segment_number'] = 1
117
--> 118         items = self.mda['image_data_function'].split('\r')
119         if items[0].startswith('$HALFTONE'):
120             self.calibration_table = []

TypeError: a bytes-like object is required, not 'str'

# Fixed code
def read_band(self, key, info):
    """Read the data."""
    shape = int(np.ceil(self.mda["data_field_length"] / 8.0))
    if self.mda["number_of_bits_per_pixel"] == 16:
        dtype = ">u2"
        shape //= 2
    elif self.mda["number_of_bits_per_pixel"] in [8, 10]:
        dtype = np.uint8
    shape = (shape,)
    data = np.memmap(
        self.filename,
        mode="r",
        offset=self.mda["total_header_length"],
        dtype=dtype,
        shape=shape,
    )
    data = da.from_array(data, chunks=shape[0])
    if self.mda["number_of_bits_per_pixel"] == 10:
        data = dec10216(data)
    data = data.reshape((self.mda["number_of_lines"], self.mda["number_of_columns"]))
    return data