code: def blocks(
      ctx,
      input,
      output,
      precision,
      indent,
      compact,
      projection,
      sequence,
      use_rs,
      bidx,
  ):
      """Write dataset blocks as GeoJSON features.
  
      This command prints features describing a raster's internal blocks,
      which are used directly for raster I/O.  These features can be used
      to visualize how a windowed operation would operate using those
      blocks.
  
      Output features have two JSON encoded properties: block and window.
      Block is a two element array like [0, 0] describing the window's
      position in the input band's window layout. Window is a JSON
      serialization of rasterio's Window class like {"col_off": 0,
      "height": 3, "row_off": 705, "width": 791}.
  
      Block windows are extracted from the dataset (all bands must have
      matching block windows) by default, or from the band specified using
      the --bidx option:
      \b
  
          rio blocks --bidx 3 tests/data/RGB.byte.tif
  
      By default a GeoJSON FeatureCollection is written, but the
      --sequence option produces a GeoJSON feature stream instead.
      \b
  
          rio blocks tests/data/RGB.byte.tif --sequence
  
      Output features are reprojected to OGC:CRS84 (WGS 84) unless the
      --projected flag is provided, which causes the output to be kept in
      the input datasource's coordinate reference system.
  
      For more information on exactly what blocks and windows represent,
      see block_windows().
  
      """
      dump_kwds = {"sort_keys": True}
  
      if indent:
          dump_kwds["indent"] = indent
      if compact:
          dump_kwds["separators"] = (",", ":")
  
      stdout = (
          click.open_file(output, "w")
          if output
          else click.get_text_stream("stdout")
      )
  
      with ctx.obj["env"], rasterio.open(input) as src:
          if bidx and bidx not in src.indexes:
              raise click.BadParameter("Not a valid band index")
  
          collection = _Collection(
              dataset=src,
              bidx=bidx,
              precision=precision,
              geographic=projection != "projected",
          )
          write_features(
              stdout,
              collection,
              sequence=sequence,
              geojson_type="feature" if sequence else "collection",
              use_rs=use_rs,
              **dump_kwds,
          )
  
file_path: rasterio/rasterio/rio/blocks.py
imports: import json
  import logging
  import os.path
  import click
  import cligj
  import rasterio
  from rasterio.rio import options
  from rasterio.rio.helpers import write_features
  from rasterio.warp import transform_bounds
label_desc: Use image node_id 1 for calling a global function with example usage: blocks(ctx, input, output, precision, indent, compact, projection, sequence, use_rs, bidx) without return types