[GRASS-git] [OSGeo/grass] 008527: grass.script.array: Auto-detect dtype from raster ...

Anna Petrasova noreply at github.com
Fri Feb 20 19:21:07 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 0085272592de81c1485228fa6647b60a4185f655
      https://github.com/OSGeo/grass/commit/0085272592de81c1485228fa6647b60a4185f655
  Author: Anna Petrasova <kratochanna at gmail.com>
  Date:   2026-02-20 (Fri, 20 Feb 2026)

  Changed paths:
    M python/grass/script/array.py
    A python/grass/script/tests/grass_script_array_test.py

  Log Message:
  -----------
  grass.script.array: Auto-detect dtype from raster map type (#7105)

When reading a raster map into garray.array() or garray.array3d() without specifying dtype, the array now automatically matches the map's native type (CELL→int32, FCELL→float32, DCELL→float64) by querying r.info/r3.info with format="json". Previously, the default was always np.double, so reading an integer map would silently give you a float64 array. The default for empty arrays (no mapname) remains np.double.

Additionally, 64-bit integers are now rejected early with actionable error messages in both read and write paths, since
GRASS raster maps only support 32-bit integers.

Tests added, they revealed missing env in array3d.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list