class_docstr: Get the reflective part of NIR bands.
class_docstr_tok: ["Get","the","reflective","part","of","NIR","bands","."]
docstr: Get the sunz from available data or compute it if unavailable.
docstr_tok: ["Get","the","sunz","from","available","data","or","compute","it","if","unavailable","."]
code: def _get_sun_zenith_from_provided_data(nir, optional_datasets, dtype):
      """Get the sunz from available data or compute it if unavailable."""
      sun_zenith = None
  
      for dataset in optional_datasets:
          if dataset.attrs.get("standard_name") == "solar_zenith_angle":
              sun_zenith = dataset.data
  
      if sun_zenith is None:
          if sun_zenith_angle is None:
              raise ImportError(
                  "Module pyorbital.astronomy needed to compute sun zenith angles."
              )
          lons, lats = nir.attrs["area"].get_lonlats(
              chunks=nir.data.chunks, dtype=dtype
          )
          sun_zenith = sun_zenith_angle(
              nir.attrs["start_time"], lons, lats
          )
      return sun_zenith
  
file_path: satpy/satpy/modifiers/spectral.py
imports: import logging
  import xarray
  from satpy.modifiers import ModifierBase
label_desc: Use image node_id 6 for calling the NIRReflectance obj's underlying member method code with example usage: obj._get_sun_zenith_from_provided_data(nir, optional_datasets, dtype) and returns: sun_zenith