[GRASS-git] [OSGeo/grass] 8d7440: grass.script.array: Auto-detect dtype from raster ...
Anna Petrasova
noreply at github.com
Fri Feb 20 19:22:13 PST 2026
Branch: refs/heads/releasebranch_8_5
Home: https://github.com/OSGeo/grass
Commit: 8d74401279d0d3c494673c5d5baf53c8bef42fd0
https://github.com/OSGeo/grass/commit/8d74401279d0d3c494673c5d5baf53c8bef42fd0
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