class_docstr: Reader for NUCAPS NetCDF4 files.
class_docstr_tok: ["Reader","for","NUCAPS","NetCDF4","files","."]
code: def _filter_dataset_keys_outside_pressure_levels(
      self, dataset_keys, pressure_levels
  ):
      for ds_id in dataset_keys.copy():
          ds_info = self.all_ids[ds_id]
          ds_level = ds_info.get("pressure_level")
          if ds_level is not None:
              if pressure_levels is True:
                  # they want all pressure levels
                  continue
              elif (
                  len(pressure_levels) == 2
                  and pressure_levels[0]
                  <= ds_level
                  <= pressure_levels[1]
              ):
                  # given a min and a max pressure level
                  continue
              elif np.isclose(pressure_levels, ds_level).any():
                  # they asked for this specific pressure level
                  continue
              else:
                  # they don't want this dataset at this pressure level
                  LOG.debug("Removing dataset to load: %s", ds_id)
                  dataset_keys.remove(ds_id)
                  continue
  
imports: import logging
  from collections import defaultdict
  import numpy
  import pandas
  import xarray
  from satpy.readers.netcdf_utils import NetCDF4FileHandler
  from satpy.readers.yaml_reader import FileYAMLReader
label_desc: Use image node_id 4 for calling the NUCAPSReader obj's underlying member method code with example usage: obj._filter_dataset_keys_outside_pressure_levels(dataset_keys, pressure_levels) without return types