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: Adapt units between °C and K.
  
  This will return a new XRImage, to make sure the old data and
  enhancement history aren't touched.
docstr_tok: ["Adapt","units","between","\u00b0C","and","K.","This","will","return","a","new","XRImage",",","to","make","sure","the","old","data","and","enhancement","history","are","n't","touched","."]
code: def _fix_units(self, image, quantity, unit):
      """Adapt units between °C and K.
  
      This will return a new XRImage, to make sure the old data and
      enhancement history aren't touched.
      """
      data_units = image.data.attrs.get("units")
      if (
          quantity.lower() == "temperature"
          and unit == "C"
          and data_units == "K"
      ):
          logger.debug("Adding offset for K → °C conversion")
          new_attrs = copy.deepcopy(image.data.attrs)
          im2 = type(image)(image.data.copy())
          im2.data.attrs = new_attrs
          # this scale/offset has to be applied before anything else
          im2.data.attrs["enhancement_history"].insert(
              0, {"scale": 1, "offset": 273.15}
          )
          return im2
      if unit != data_units and unit.lower() != "n/a":
          logger.warning(
              f"Writing {unit!s} to ninjogeotiff headers, but "
              f"data attributes have unit {data_units!s}. "
              "No conversion applied."
          )
  
      return image
  
imports: import copy
  import datetime
  import logging
  import numpy
  from .geotiff import GeoTIFFWriter
label_desc: Use image node_id 2 for calling the NinJoGeoTIFFWriter obj's underlying member method code with example usage: obj._fix_units(image, quantity, unit) and returns: image, im2