class_docstr: Writer for GeoTIFFs with NinJo tags.
  
  This writer is experimental.  API may be subject to change.
  
  For information, see module docstring and documentation for
  :meth:`~NinJoGeoTIFFWriter.save_image`.
class_docstr_tok: ["Writer","for","GeoTIFFs","with","NinJo","tags",".","This","writer","is","experimental",".","API","may","be","subject","to","change",".","For","information",",","see","module","docstring","and","documentation","for",":","meth",":","`","~NinJoGeoTIFFWriter.save_image","`","."]
docstr: Save image along with NinJo tags.
  
  Save image along with NinJo tags.  Interface as for GeoTIFF,
  except NinJo expects some additional tags.  Those tags will be
  prepended with ``ninjo_`` and added as GDALMetaData.
  
  Writing such images requires trollimage 1.16 or newer.
  
  Importing such images with NinJo requires NinJo 7 or newer.
  
  Args:
      image (:class:`~trollimage.xrimage.XRImage`):
          Image to save.
      filename (str): Where to save the file.
      fill_value (int): Which pixel value is fill value?
      compute (bool): To compute or not to compute, that is the question.
      keep_palette (bool):
          As for parent GeoTIFF :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
      cmap (:class:`trollimage.colormap.Colormap`):
          As for parent :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
      overviews (list):
          As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
      overviews_minsize (int):
          As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
      overviews_resampling (str):
          As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
      tags (dict): Extra (not NinJo) tags to add to GDAL MetaData
      config_files (Any): Not directly used by this writer, supported
          for compatibility with other writers.
  
  Remaining keyword arguments are either passed as GDAL options,
  if contained in ``self.GDAL_OPTIONS``, or they are passed
  to :class:`NinJoTagGenerator`, which will include them as
  NinJo tags in GDALMetadata.  Supported tags are defined in
  ``NinJoTagGenerator.optional_tags``.  The meaning of those (and
  other) tags are defined in the NinJo documentation (see module
  documentation for a link to NinJoPedia).  The following tags
  are mandatory and must be provided as keyword arguments:
  
      ChannelID (int)
          NinJo Channel ID
      DataType (int)
          NinJo Data Type
      SatelliteNameID (int)
          NinJo Satellite ID
      PhysicUnit (str)
          NinJo label for unit (example: "C").  If PhysicValue is set to
          "Temperature", PhysicUnit is set to "C", but data attributes
          incidate the data have unit "K", then the writer will adapt the
          header ``ninjo_AxisIntercept`` such that data are interpreted
          in units of "C".  If PhysicUnit is set to "N/A", no
          AxisIntercept and Gradient tags will be written.
      PhysicValue (str)
          NinJo label for quantity (example: "temperature")
docstr_tok: ["Save","image","along","with","NinJo","tags",".","Save","image","along","with","NinJo","tags",".","Interface","as","for","GeoTIFF",",","except","NinJo","expects","some","additional","tags",".","Those","tags","will","be","prepended","with","``","ninjo_","``","and","added","as","GDALMetaData",".","Writing","such","images","requires","trollimage","1.16","or","newer",".","Importing","such","images","with","NinJo","requires","NinJo","7","or","newer",".","Args",":","image","(",":","class",":","`","~trollimage.xrimage.XRImage","`",")",":","Image","to","save",".","filename","(","str",")",":","Where","to","save","the","file",".","fill_value","(","int",")",":","Which","pixel","value","is","fill","value","?","compute","(","bool",")",":","To","compute","or","not","to","compute",",","that","is","the","question",".","keep_palette","(","bool",")",":","As","for","parent","GeoTIFF",":","meth",":","`","~satpy.writers.geotiff.GeoTIFFWriter.save_image","`",".","cmap","(",":","class",":","`","trollimage.colormap.Colormap","`",")",":","As","for","parent",":","meth",":","`","~satpy.writers.geotiff.GeoTIFFWriter.save_image","`",".","overviews","(","list",")",":","As","for",":","meth",":","`","~satpy.writers.geotiff.GeoTIFFWriter.save_image","`",".","overviews_minsize","(","int",")",":","As","for",":","meth",":","`","~satpy.writers.geotiff.GeoTIFFWriter.save_image","`",".","overviews_resampling","(","str",")",":","As","for",":","meth",":","`","~satpy.writers.geotiff.GeoTIFFWriter.save_image","`",".","tags","(","dict",")",":","Extra","(","not","NinJo",")","tags","to","add","to","GDAL","MetaData","config_files","(","Any",")",":","Not","directly","used","by","this","writer",",","supported","for","compatibility","with","other","writers",".","Remaining","keyword","arguments","are","either","passed","as","GDAL","options",",","if","contained","in","``","self.GDAL_OPTIONS","``",",","or","they","are","passed","to",":","class",":","`","NinJoTagGenerator","`",",","which","will","include","them","as","NinJo","tags","in","GDALMetadata",".","Supported","tags","are","defined","in","``","NinJoTagGenerator.optional_tags","``",".","The","meaning","of","those","(","and","other",")","tags","are","defined","in","the","NinJo","documentation","(","see","module","documentation","for","a","link","to","NinJoPedia",")",".","The","following","tags","are","mandatory","and","must","be","provided","as","keyword","arguments",":","ChannelID","(","int",")","NinJo","Channel","ID","DataType","(","int",")","NinJo","Data","Type","SatelliteNameID","(","int",")","NinJo","Satellite","ID","PhysicUnit","(","str",")","NinJo","label","for","unit","(","example",":","``","C","''",")",".","If","PhysicValue","is","set","to","``","Temperature","''",",","PhysicUnit","is","set","to","``","C","''",",","but","data","attributes","incidate","the","data","have","unit","``","K","''",",","then","the","writer","will","adapt","the","header","``","ninjo_AxisIntercept","``","such","that","data","are","interpreted","in","units","of","``","C","''",".","If","PhysicUnit","is","set","to","``","N\/A","''",",","no","AxisIntercept","and","Gradient","tags","will","be","written",".","PhysicValue","(","str",")","NinJo","label","for","quantity","(","example",":","``","temperature","''",")"]
code: def save_image(  # noqa: D417
      self,
      image,
      filename=None,
      fill_value=None,
      compute=True,
      keep_palette=False,
      cmap=None,
      overviews=None,
      overviews_minsize=256,
      overviews_resampling=None,
      tags=None,
      config_files=None,
      *,
      ChannelID,
      DataType,
      PhysicUnit,
      PhysicValue,
      SatelliteNameID,
      **kwargs,
  ):
      """Save image along with NinJo tags.
  
      Save image along with NinJo tags.  Interface as for GeoTIFF,
      except NinJo expects some additional tags.  Those tags will be
      prepended with ``ninjo_`` and added as GDALMetaData.
  
      Writing such images requires trollimage 1.16 or newer.
  
      Importing such images with NinJo requires NinJo 7 or newer.
  
      Args:
          image (:class:`~trollimage.xrimage.XRImage`):
              Image to save.
          filename (str): Where to save the file.
          fill_value (int): Which pixel value is fill value?
          compute (bool): To compute or not to compute, that is the question.
          keep_palette (bool):
              As for parent GeoTIFF :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
          cmap (:class:`trollimage.colormap.Colormap`):
              As for parent :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
          overviews (list):
              As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
          overviews_minsize (int):
              As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
          overviews_resampling (str):
              As for :meth:`~satpy.writers.geotiff.GeoTIFFWriter.save_image`.
          tags (dict): Extra (not NinJo) tags to add to GDAL MetaData
          config_files (Any): Not directly used by this writer, supported
              for compatibility with other writers.
  
      Remaining keyword arguments are either passed as GDAL options,
      if contained in ``self.GDAL_OPTIONS``, or they are passed
      to :class:`NinJoTagGenerator`, which will include them as
      NinJo tags in GDALMetadata.  Supported tags are defined in
      ``NinJoTagGenerator.optional_tags``.  The meaning of those (and
      other) tags are defined in the NinJo documentation (see module
      documentation for a link to NinJoPedia).  The following tags
      are mandatory and must be provided as keyword arguments:
  
          ChannelID (int)
              NinJo Channel ID
          DataType (int)
              NinJo Data Type
          SatelliteNameID (int)
              NinJo Satellite ID
          PhysicUnit (str)
              NinJo label for unit (example: "C").  If PhysicValue is set to
              "Temperature", PhysicUnit is set to "C", but data attributes
              incidate the data have unit "K", then the writer will adapt the
              header ``ninjo_AxisIntercept`` such that data are interpreted
              in units of "C".  If PhysicUnit is set to "N/A", no
              AxisIntercept and Gradient tags will be written.
          PhysicValue (str)
              NinJo label for quantity (example: "temperature")
  
      """
      dataset = image.data
  
      # filename not passed on to writer by Scene.save_dataset, but I need
      # it!
      filename = filename or self.get_filename(**dataset.attrs)
  
      gdal_opts = {}
      ntg_opts = {}
      for k, v in kwargs.items():
          if k in self.GDAL_OPTIONS:
              gdal_opts[k] = v
          else:
              ntg_opts[k] = v
  
      ntg = NinJoTagGenerator(
          image,
          fill_value=fill_value,
          filename=filename,
          ChannelID=ChannelID,
          DataType=DataType,
          PhysicUnit=PhysicUnit,
          PhysicValue=PhysicValue,
          SatelliteNameID=SatelliteNameID,
          **ntg_opts,
      )
      ninjo_tags = {
          f"ninjo_{k:s}": v for (k, v) in ntg.get_all_tags().items()
      }
      image = self._fix_units(image, PhysicValue, PhysicUnit)
  
      return super().save_image(
          image,
          filename=filename,
          fill_value=fill_value,
          compute=compute,
          keep_palette=keep_palette,
          cmap=cmap,
          overviews=overviews,
          overviews_minsize=overviews_minsize,
          overviews_resampling=overviews_resampling,
          tags={**(tags or {}), **ninjo_tags},
          scale_offset_tags=(
              self.scale_offset_tag_names
              if self._check_include_scale_offset(image, PhysicUnit)
              else None
          ),
          **gdal_opts,
      )
  
imports: import copy
  import datetime
  import logging
  import numpy
  from .geotiff import GeoTIFFWriter
label_desc: Use image node_id 1 for calling the NinJoGeoTIFFWriter obj's underlying member method code with example usage: obj.save_image(image, filename, fill_value, compute, keep_palette, cmap, overviews, overviews_minsize, overviews_resampling, tags, config_files) and returns: super