Following the example on the r.patch manual page for aggregating multiple
raster maps into one large one I wrote this script:
#!/usr/bin/bash
# get the list of DEM raster files
MAPS = `g.list type=raster sep=newline pat="45123*"`
# set the region larger than the watershed boundary
g.region vect=dem_display_area
# create the mosaic
r.patch in=$MAPS out=basin_topo --o
-------
When I run the script, grass rejects the environmental variable MAPS and I
don't see how my script differs in format from the example:
$HOME/projects/oregon/mohler_sand/analyses/scripts/rpatch-input.sh
: line 7: MAPS: command not found
ERROR: The minimum number of input raster maps is two
Pointers appreciated,
Rich
On 2019-10-01 at 18:55 -04, Rich Shepard <rshepard@appl-ecosys.com> wrote...
# get the list of DEM raster files
MAPS = `g.list type=raster sep=newline pat="45123*"`
MAPS=$(g.list type=raster sep=comma pat="45123*")
I think $() is preferred over `` and you need a comma separated list for r.patch.
-k.
Rich Shepard <rshepard@appl-ecosys.com> schrieb am Mi., 2. Okt. 2019, 00:55:
Following the example on the r.patch manual page for aggregating multiple
raster maps into one large one I wrote this script:
#!/usr/bin/bash
get the list of DEM raster files
MAPS = g.list type=raster sep=newline pat="45123*"
The must be no white space after the =
in the variable assignment.
Markus
On Tue, 1 Oct 2019, Ken Mankoff wrote:
MAPS=$(g.list type=raster sep=comma pat="45123*")
I think $() is preferred over `` and you need a comma separated list for r.patch.
Ken,
If $ works while `` doesn't I'll modify the example.
About the separator: g.list prints each map on a separate line which is why
I specified 'newline'. So specifying 'comma' will result in a
comma-separated list instead? Interesting. That, too, will be added to the
manual page.
Thanks,
Rich
On Wed, 2 Oct 2019, Markus Neteler wrote:
The must be no white space after the = in the variable assignment.
Markus,
Nor before, also. I spaced that out (pun intended) because I know that
key/value pairs in commands should have no spaces between them. My mistake
and I appreciate your reminder.
Thank you,
Rich
On Tue, 1 Oct 2019, Rich Shepard wrote:
Pointers appreciated,
Don't leave spaces around equal sign between key and value.
Rich