Skip to content

Using "isin" as rio calc command fails with expression error in rasterio 1.4.3 #3287

@tobijjah

Description

@tobijjah

Expected behavior and actual behavior.

Hey, rasterio maintainers and contributors, with rasterio 1.4.3 installed, the following rio calc command,

rio -vvv calc \
  --overwrite \
  "(isin (read 1) 11)" \
  input.tif \
  output.tif

throws the following expression error:

Expression Error:
  (isin (read 1) 11)
     ^
name 'in' is not defined

This works without any errors with rasterio 1.3.10 installed. I did not check any other versions between 1.3.10 and 1.4.3. I guess the command parser eats the "is".

Happy bug fixing, and have a nice day!

Steps to reproduce the problem.

Run with rasterio 1.4.3 installed the following rio calc command.

rio -vvv calc \
  --overwrite \
  "(isin (read 1) 11)" \
  input.tif \
  output.tif

Environment Information

rasterio info:
  rasterio: 1.4.3
      GDAL: 3.10.0
      PROJ: 9.5.1
      GEOS: 3.13.0
 PROJ DATA: /Users/USER/Library/Application Support/proj:/opt/homebrew/Cellar/proj/9.5.1/share/proj:/opt/homebrew/Cellar/proj/9.5.1/share/proj
 GDAL DATA: None

System:
    python: 3.12.2 (main, Apr 23 2024, 15:24:25) [Clang 15.0.0 (clang-1500.3.9.4)]
executable: /Users/USER/.pyenv/versions/3.12.2/bin/python3.12
   machine: macOS-15.2-arm64-arm-64bit

Python deps:
    affine: 2.4.0
     attrs: 24.2.0
   certifi: 2024.07.04
     click: 8.1.7
     cligj: 0.7.2
    cython: None
     numpy: 2.2.1
click-plugins: None
setuptools: 70.0.0

Installation Method

pip install --no-binary rasterio rasterio

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions