class_docstr: MERSI-2/MERSI-LL L1B file reader.
docstr: Mask the data using fill_value and valid_range attributes.
docstr_tok: ["Mask","the","data","using","fill_value","and","valid_range","attributes","."]
code: def _mask_data(self, data, dataset_id, attrs):
      """Mask the data using fill_value and valid_range attributes."""
      fill_value = attrs.pop(
          "FillValue", np.nan
      )  # covered by valid_range
      valid_range = attrs.pop("valid_range", None)
      if dataset_id.get("calibration") == "counts":
          # preserve integer type of counts if possible
          attrs["_FillValue"] = fill_value
          new_fill = data.dtype.type(fill_value)
      else:
          new_fill = np.nan
      if valid_range is not None:
          # Due to a bug in the valid_range upper limit in the 10.8(24) and 12.0(25)
          # in the HDF data, this is hardcoded here.
          if (
              dataset_id["name"] in ["24", "25"]
              and valid_range[1] == 4095
          ):
              valid_range[1] = 25000
          # typically bad_values == 65535, saturated == 65534
          # dead detector == 65533
          data = data.where(
              (data >= valid_range[0]) & (data <= valid_range[1]),
              new_fill,
          )
      return data
  
file_path: satpy/satpy/readers/mersi_l1b.py
imports: from datetime import datetime
  import dask.array
  import numpy
  from pyspectral.blackbody import blackbody_wn_rad2temp
  from satpy.readers.hdf5_utils import HDF5FileHandler
label_desc: Use image node_id 8 for calling the MERSIL1B obj's underlying member method code with example usage: obj._mask_data(data, dataset_id, attrs) and returns: data