code: def __init__(self):
      self._env = None  # Initialises in each thread
  
      # When the outermost 'rasterio.Env()' executes '__enter__' it
      # probes the GDAL environment to see if any of the supplied
      # config options already exist, the assumption being that they
      # were set with 'osgeo.gdal.SetConfigOption()' or possibly
      # 'rasterio.env.set_gdal_config()'.  The discovered options are
      # reinstated when the outermost Rasterio environment exits.
      # Without this check any environment options that are present in
      # the GDAL environment and are also passed to 'rasterio.Env()'
      # will be unset when 'rasterio.Env()' tears down, regardless of
      # their value.  For example:
      #
      #   from osgeo import gdal import rasterio
      #
      #   gdal.SetConfigOption('key', 'value') with
      #   rasterio.Env(key='something'): pass
      #
      # The config option 'key' would be unset when 'Env()' exits.
      # A more comprehensive solution would also leverage
      # https://trac.osgeo.org/gdal/changeset/37273 but this gets
      # Rasterio + older versions of GDAL halfway there.  One major
      # assumption is that environment variables are not set directly
      # with 'osgeo.gdal.SetConfigOption()' OR
      # 'rasterio.env.set_gdal_config()' inside of a 'rasterio.Env()'.
      self._discovered_options = None
  
imports: from functools import wraps, total_ordering
  from inspect import getfullargspec
  import logging
  import os
  import re
  import threading
  import warnings
  import attr
  from rasterio._env import GDALEnv, get_gdal_config, set_gdal_config, GDALDataFinder, PROJDataFinder, set_proj_data_search_path
  from rasterio._version import gdal_version
  from rasterio.errors import EnvError, GDALVersionError, RasterioDeprecationWarning
  from rasterio.session import Session, DummySession
label_desc: Use image node_id 1 to create a new ThreadEnv object from inherited base classes: threading with example: obj = ThreadEnv()