code: def info(
      ctx,
      input,
      aspect,
      indent,
      namespace,
      meta_member,
      verbose,
      bidx,
      masked,
  ):
      """Print metadata about the dataset as JSON.
  
      Optionally print a single metadata item as a string.
      """
      with ctx.obj["env"], rasterio.open(input) as src:
          info = dict(src.profile)
          info["shape"] = (info["height"], info["width"])
          info["bounds"] = src.bounds
  
          if src.crs:
              epsg = src.crs.to_epsg()
              if epsg:
                  info["crs"] = "EPSG:{}".format(epsg)
              else:
                  info["crs"] = src.crs.to_string()
          else:
              info["crs"] = None
  
          info["res"] = src.res
          info["colorinterp"] = [ci.name for ci in src.colorinterp]
          info["units"] = [units or None for units in src.units]
          info["descriptions"] = src.descriptions
          info["indexes"] = src.indexes
          info["mask_flags"] = [
              [flag.name for flag in flags]
              for flags in src.mask_flag_enums
          ]
  
          if src.crs:
              info["lnglat"] = src.lnglat()
  
          gcps, gcps_crs = src.gcps
  
          if gcps:
              info["gcps"] = {"points": [p.asdict() for p in gcps]}
              if gcps_crs:
                  epsg = gcps_crs.to_epsg()
                  if epsg:
                      info["gcps"]["crs"] = "EPSG:{}".format(epsg)
                  else:
                      info["gcps"]["crs"] = src.crs.to_string()
              else:
                  info["gcps"]["crs"] = None
  
              info["gcps"]["transform"] = from_gcps(gcps)
  
          if verbose:
              stats = [
                  asdict(src.statistics(bidx)) for bidx in src.indexes
              ]
              info["stats"] = stats
              info["checksum"] = [src.checksum(i) for i in src.indexes]
  
          if aspect == "meta":
              if meta_member == "subdatasets":
                  for name in src.subdatasets:
                      click.echo(name)
              elif meta_member == "stats":
                  st = src.statistics(bidx)
                  click.echo(
                      "{st.min} {st.max} {st.mean} {st.std}".format(
                          st=st
                      )
                  )
              elif meta_member == "checksum":
                  click.echo(str(src.checksum(bidx)))
              elif meta_member:
                  if isinstance(info[meta_member], (list, tuple)):
                      click.echo(" ".join(map(str, info[meta_member])))
                  else:
                      click.echo(info[meta_member])
              else:
                  click.echo(
                      json.dumps(info, sort_keys=True, indent=indent)
                  )
  
          elif aspect == "tags":
              click.echo(
                  json.dumps(src.tags(ns=namespace), indent=indent)
              )
  
imports: import json
  from attr import asdict
  import click
  import rasterio
  from rasterio.rio import options
  from rasterio.transform import from_gcps
label_desc: Use image node_id 1 for calling a global function with example usage: info(ctx, input, aspect, indent, namespace, meta_member, verbose, bidx, masked) without return types