class_docstr: Handle reading of generic image files.
class_docstr_tok: ["Handle","reading","of","generic","image","files","."]
docstr: Read the image.
docstr_tok: ["Read","the","image","."]
code: def read(self):
      """Read the image."""
      dataset = rasterio.open(self.finfo["filename"])
  
      # Create area definition
      if hasattr(dataset, "crs") and dataset.crs is not None:
          self.area = utils.get_area_def_from_raster(dataset)
  
      data = xr.open_dataset(
          self.finfo["filename"],
          engine="rasterio",
          chunks={"band": 1, "y": CHUNK_SIZE, "x": CHUNK_SIZE},
          mask_and_scale=False,
      )["band_data"]
      if hasattr(dataset, "nodatavals"):
          # The nodata values for the raster bands
          # copied from https://github.com/pydata/xarray/blob/v2023.03.0/xarray/backends/rasterio_.py#L322-L326
          nodatavals = tuple(
              np.nan if nodataval is None else nodataval
              for nodataval in dataset.nodatavals
          )
          data.attrs["nodatavals"] = nodatavals
  
      attrs = data.attrs.copy()
  
      # Rename to Satpy convention
      data = data.rename({"band": "bands"})
  
      # Rename bands to [R, G, B, A], or a subset of those
      data["bands"] = BANDS[data.bands.size]
  
      data.attrs = attrs
      self.dataset_name = "image"
      self.file_content[self.dataset_name] = data
  
file_path: satpy/satpy/readers/generic_image.py
imports: import logging
  import dask.array
  import numpy
  import rasterio
  import xarray
  from pyresample import utils
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 2 for calling the GenericImageFileHandler obj's underlying member method code with example usage: obj.read() without return types