code: def test_positional_calculation_byindex(tmpdir, runner):
      # See Issue 947: https://github.com/rasterio/rasterio/issues/947
      # Prior to fix, 'shade.tif' reliably is read as 2nd input and
      # we should expect this to fail due to array shape error
      # ("operands could not be broadcast together")
      outfile = str(tmpdir.join("out.tif"))
      result = runner.invoke(
          main_group,
          ["calc"]
          + [
              "(- (read 1 1) (read 2 2))",
              "tests/data/RGB.byte.tif",
              "tests/data/RGB.byte.tif",
              "tests/data/shade.tif",
              outfile,
          ],
          catch_exceptions=False,
      )
      assert result.exit_code == 0
  
      window = ((0, 1), (0, 1))
      with rasterio.open("tests/data/RGB.byte.tif") as rgb:
          answer = rgb.read(1, window=window) - rgb.read(
              1, window=window
          )
  
      with rasterio.open(outfile) as src:
          assert src.read(1, window=window) == answer
  
file_path: rasterio/tests/test_rio_calc.py
imports: import pytest
  import rasterio
  from rasterio.rio.calc import _chunk_output
  from rasterio.rio.main import main_group
label_desc: Use image node_id 12 for calling a global function with example usage: test_positional_calculation_byindex(tmpdir, runner) without return types