[GRASS-user] Re: Conversion of multiple rasters to PNG files

Mortsde alex.mortsde at gmail.com
Wed Apr 13 13:28:31 EDT 2011


Hamish,

Thanks for the advice but I'm still having some hangups with your code. Are
these commands meant for a unique script, entry into  the terminal itself,
other...? The "my @maps" is confusing, what is the my representing? I
understand that @maps is referring to the map-file locations. The rest of
the code has me lost as well...

Thanks again!

> I'm relatively new to GRASS/unix style commands and was
> wondering if anyone
> had a quick PERL script that could convert LOTS of raster maps to PNG
> files without the repetition of going through one by one. I'm not much
> of a programmer otherwise I'd write some kind of loop and have a go. 
> The general form of my rasters is already in a "Name_$Date" style
> format so I think this
> should be pretty easy? I'm attempting to make video files that illustrate
> soil saturation with time. I have about 10 years (daily) of soil moisture
> that I'm looking to animate so it's a digestible amount of information.

some shell script loop scripts here:
  http://grass.osgeo.org/wiki/Movies


but none of those really strike me as beginner-friendly. (mea culpa)


the general idea is:

# set up region
g.region rast=

# use g.mlist to list all relevant maps
g.mlist rast pattern=

# eg throw those map names into a loop
my @maps = system(g.mlist rast pat=soils.*);
my @maps = `g.mlist rast pat=soils.*`;

for my $m (@maps) {
  print $m;
  `d.erase`;
  `d.rast $m`;
   ...
  `d.out.file $png_name`
   ...
}

probably it is good to first run through a loop of all the maps with
'r.info -r' and get the overall range, then create color rules covering
that entire range and in a loop apply it to all maps with r.colors.
that way the color scale stats the same.


Hamish

_______________________________________________
grass-user mailing list
grass-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user



--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Conversion-of-multiple-rasters-to-PNG-files-tp6263692p6269898.html
Sent from the Grass - Users mailing list archive at Nabble.com.


More information about the grass-user mailing list