class_docstr: Small class for inspecting a NetCDF4 file and retrieving its metadata/header data.
  
  File information can be accessed using bracket notation. Variables are
  accessed by using:
  
      wrapper["var_name"]
  
  Or:
  
      wrapper["group/subgroup/var_name"]
  
  Attributes can be accessed by appending "/attr/attr_name" to the
  item string:
  
      wrapper["group/subgroup/var_name/attr/units"]
  
  Or for global attributes:
  
      wrapper["/attr/platform_short_name"]
  
  Or for all of global attributes:
  
      wrapper["/attrs"]
  
  Note that loading datasets requires reopening the original file
  (unless those datasets are cached, see below), but to get just the
  shape of the dataset append "/shape" to the item string:
  
      wrapper["group/subgroup/var_name/shape"]
  
  If your file has many small data variables that are frequently accessed,
  you may choose to cache some of them.  You can do this by passing a number,
  any variable smaller than this number in bytes will be read into RAM.
  Warning, this part of the API is provisional and subject to change.
  
  You may get an additional speedup by passing ``cache_handle=True``.  This
  will keep the netCDF4 dataset handles open throughout the lifetime of the
  object, and instead of using `xarray.open_dataset` to open every data
  variable, a dask array will be created "manually".  This may be useful if
  you have a dataset distributed over many files, such as for FCI.  Note
  that the coordinates will be missing in this case.  If you use this option,
  ``xarray_kwargs`` will have no effect.
  
  Args:
      filename (str): File to read
      filename_info (dict): Dictionary with filename information
      filetype_info (dict): Dictionary with filetype information
      auto_maskandscale (bool): Apply mask and scale factors
      xarray_kwargs (dict): Addition arguments to `xarray.open_dataset`
      cache_var_size (int): Cache variables smaller than this size.
      cache_handle (bool): Keep files open for lifetime of filehandler.
class_docstr_tok: ["Small","class","for","inspecting","a","NetCDF4","file","and","retrieving","its","metadata\/header","data",".","File","information","can","be","accessed","using","bracket","notation",".","Variables","are","accessed","by","using",":","wrapper","[","``","var_name","''","]","Or",":","wrapper","[","``","group\/subgroup\/var_name","''","]","Attributes","can","be","accessed","by","appending","``","\/attr\/attr_name","''","to","the","item","string",":","wrapper","[","``","group\/subgroup\/var_name\/attr\/units","''","]","Or","for","global","attributes",":","wrapper","[","``","\/attr\/platform_short_name","''","]","Or","for","all","of","global","attributes",":","wrapper","[","``","\/attrs","''","]","Note","that","loading","datasets","requires","reopening","the","original","file","(","unless","those","datasets","are","cached",",","see","below",")",",","but","to","get","just","the","shape","of","the","dataset","append","``","\/shape","''","to","the","item","string",":","wrapper","[","``","group\/subgroup\/var_name\/shape","''","]","If","your","file","has","many","small","data","variables","that","are","frequently","accessed",",","you","may","choose","to","cache","some","of","them",".","You","can","do","this","by","passing","a","number",",","any","variable","smaller","than","this","number","in","bytes","will","be","read","into","RAM",".","Warning",",","this","part","of","the","API","is","provisional","and","subject","to","change",".","You","may","get","an","additional","speedup","by","passing","``","cache_handle=True","``",".","This","will","keep","the","netCDF4","dataset","handles","open","throughout","the","lifetime","of","the","object",",","and","instead","of","using","`","xarray.open_dataset","`","to","open","every","data","variable",",","a","dask","array","will","be","created","``","manually","''",".","This","may","be","useful","if","you","have","a","dataset","distributed","over","many","files",",","such","as","for","FCI",".","Note","that","the","coordinates","will","be","missing","in","this","case",".","If","you","use","this","option",",","``","xarray_kwargs","``","will","have","no","effect",".","Args",":","filename","(","str",")",":","File","to","read","filename_info","(","dict",")",":","Dictionary","with","filename","information","filetype_info","(","dict",")",":","Dictionary","with","filetype","information","auto_maskandscale","(","bool",")",":","Apply","mask","and","scale","factors","xarray_kwargs","(","dict",")",":","Addition","arguments","to","`","xarray.open_dataset","`","cache_var_size","(","int",")",":","Cache","variables","smaller","than","this","size",".","cache_handle","(","bool",")",":","Keep","files","open","for","lifetime","of","filehandler","."]
docstr: Initialize object.
docstr_tok: ["Initialize","object","."]
code: def __init__(
      self,
      filename,
      filename_info,
      filetype_info,
      auto_maskandscale=False,
      xarray_kwargs=None,
      cache_var_size=0,
      cache_handle=False,
  ):
      """Initialize object."""
      super(NetCDF4FileHandler, self).__init__(
          filename, filename_info, filetype_info
      )
      self.file_content = {}
      self.cached_file_content = {}
      self._use_h5netcdf = False
      try:
          file_handle = self._get_file_handle()
      except IOError:
          LOG.exception(
              "Failed reading file %s. Possibly corrupted file",
              self.filename,
          )
          raise
  
      self._set_file_handle_auto_maskandscale(
          file_handle, auto_maskandscale
      )
      self._set_xarray_kwargs(xarray_kwargs, auto_maskandscale)
  
      listed_variables = filetype_info.get("required_netcdf_variables")
      if listed_variables:
          self._collect_listed_variables(file_handle, listed_variables)
      else:
          self.collect_metadata("", file_handle)
          self.collect_dimensions("", file_handle)
      self.collect_cache_vars(cache_var_size)
  
      if cache_handle:
          self.file_handle = file_handle
      else:
          file_handle.close()
  
imports: import logging
  import dask.array
  import netCDF4
  import numpy
  import xarray
  from satpy.readers import open_file_or_filename
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.readers.utils import np2str
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 1 to create a new NetCDF4FileHandler object from inherited base classes: BaseFileHandler with example: obj = NetCDF4FileHandler(filename, filename_info, filetype_info, auto_maskandscale, xarray_kwargs, cache_var_size, cache_handle)