class_docstr: Base file handler for HDF EOS data for both L1b and L2 products.
class_docstr_tok: ["Base","file","handler","for","HDF","EOS","data","for","both","L1b","and","L2","products","."]
docstr: Unscale byte data and mask invalid/fill values.
  
  MODIS requires unscaling the in-file bytes in an unexpected way::
  
      data = (byte_value - add_offset) * scale_factor
  
  See the below L1B User's Guide Appendix C for more information:
  
  https://mcst.gsfc.nasa.gov/sites/default/files/file_attachments/M1054E_PUG_2017_0901_V6.2.2_Terra_V6.2.1_Aqua.pdf
docstr_tok: ["Unscale","byte","data","and","mask","invalid\/fill","values",".","MODIS","requires","unscaling","the","in-file","bytes","in","an","unexpected","way",":",":","data","=","(","byte_value","-","add_offset",")","*","scale_factor","See","the","below","L1B","User","'s","Guide","Appendix","C","for","more","information",":","https",":","\/\/mcst.gsfc.nasa.gov\/sites\/default\/files\/file_attachments\/M1054E_PUG_2017_0901_V6.2.2_Terra_V6.2.1_Aqua.pdf"]
code: def _scale_and_mask_data_array(self, data, is_category=False):
      """Unscale byte data and mask invalid/fill values.
  
      MODIS requires unscaling the in-file bytes in an unexpected way::
  
          data = (byte_value - add_offset) * scale_factor
  
      See the below L1B User's Guide Appendix C for more information:
  
      https://mcst.gsfc.nasa.gov/sites/default/files/file_attachments/M1054E_PUG_2017_0901_V6.2.2_Terra_V6.2.1_Aqua.pdf
  
      """
      good_mask, new_fill = self._get_good_data_mask(
          data, is_category=is_category
      )
      scale_factor = data.attrs.pop("scale_factor", None)
      add_offset = data.attrs.pop("add_offset", None)
      # don't scale category products, even though scale_factor may equal 1
      # we still need to convert integers to floats
      if scale_factor is not None and not is_category:
          if add_offset is not None and add_offset != 0:
              data = data - np.float32(add_offset)
          data = data * np.float32(scale_factor)
  
      if good_mask is not None:
          data = data.where(good_mask, new_fill)
      return data
  
imports: from __future__ import annotations
  import logging
  import re
  from ast import literal_eval
  from contextlib import suppress
  from datetime import datetime
  import numpy
  import xarray
  from pyhdf.error import HDF4Error
  from pyhdf.SD import SD
  from satpy import DataID
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.utils import normalize_low_res_chunks
label_desc: Use image node_id 15 for calling the HDFEOSBaseFileReader obj's underlying member method code with example usage: obj._scale_and_mask_data_array(data, is_category) and returns: data