grass.script: Add nprocs to raster.mapcalc function #6580
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change, callers of gs.mapcalc can now use nprocs to set number of processes for the underlying r.mapcalc. This makes it available to a number of Python tools which use gs.mapcalc to call r.mapcalc (as well as to user scripts).
The default is set to 1. Specifically, the parameter default is None which is translated to 1 as opposed to using r.mapcalc's default. As a result, r.mapcalc's default is now independent from the default of gs.mapcalc. At this point, it makes all the Python calls using gs.mapcalc behave as before, i.e., one core only, while direct usage of r.mapcalc uses the all-cores default as do the other C tools now.
See also #6564 (discussion on default for r.mapcalc), #5731 (default for nprocs in C), and #5742 (r.mapcalc OpenMP version).