Skip to content

Comments

docs: Show grass.tools with arrays before grass.script.array#6313

Merged
echoix merged 5 commits intoOSGeo:mainfrom
wenzeslaus:grass.tools-arrays-to-doc
Sep 13, 2025
Merged

docs: Show grass.tools with arrays before grass.script.array#6313
echoix merged 5 commits intoOSGeo:mainfrom
wenzeslaus:grass.tools-arrays-to-doc

Conversation

@wenzeslaus
Copy link
Member

The main interface doc for Python now shows how GRASS tools are used with arrays through grass.tools before showing direct conversions between GRASS rasters and NumPy arrays with grass.script.array.

@github-actions github-actions bot added docs markdown Related to markdown, markdown files labels Sep 5, 2025
The main interface doc for Python now shows how GRASS tools are used with arrays through grass.tools before showing direct conversions between GRASS rasters and NumPy arrays with grass.script.array.
@wenzeslaus wenzeslaus force-pushed the grass.tools-arrays-to-doc branch from 7563388 to 51898a5 Compare September 5, 2025 13:40
@wenzeslaus wenzeslaus marked this pull request as ready for review September 5, 2025 14:07
@wenzeslaus
Copy link
Member Author

With #5878 merged, this is ready for review. The code now runs (unlike the original which missed few things including showing the plot in an interactive console).

The examples are shorter, both thanks to the usage of grass.tools and to shorter variable names. While the second code block says as is, the original first code block is now broken in two. The first block is now simply a grass.tools call with arrays, and the explicit conversion part is moved to a new, third block. The text and code examples cover the same usages as before, but feeding arrays to and getting arrays from tools is now covered first and as a separate subject from the data conversions.

Co-authored-by: Anna Petrasova <[email protected]>
@wenzeslaus
Copy link
Member Author

Here is a before and after comparison of the first part of the NumPy section. The first example focuses on how to run a tool with NumPy arrays, cutting out the ...garray.array()... map2d[:]...map2d.write... part and benefiting from further simplification thanks to removing the need for names and thus also for a need to distinguish between array variable name and a map name.

before after
image image

@echoix echoix merged commit eddf187 into OSGeo:main Sep 13, 2025
22 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Sep 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs markdown Related to markdown, markdown files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants