[GRASS-user] d.slide.show

I have a quick question about the usage of d.slide.show. Right now I am able to create a slide show for my raster files. Two problems I am having so far is that my rasters are out of order. I know that when I bring them in they are bringing them in in alphabetical order. Example. raster.1,raster.10,raster100,raster1000,raster.1001. But this is not the way I want them presented in my show. I need the raters just to move from 1-1560. Is there a tool that will order my rasters in this format for presentation in the show. Second, between my raster files a white screen pops up and has lettering from the file extension of my raster files. Is there a way for the slideshow to simply just run through the rasters without this interuption.
Thanks you,
Aaron

goldneaa@onid orst edu <goldneaa@onid.orst.edu> writes:

> I have a quick question about the usage of d.slide.show. Right now I
> am able to create a slide show for my raster files. Two problems I
> am having so far is that my rasters are out of order. I know that
> when I bring them in they are bringing them in in alphabetical order.
> Example. raster.1,raster.10,raster100,raster1000,raster.1001. But
> this is not the way I want them presented in my show. I need the
> raters just to move from 1-1560. Is there a tool that will order my
> rasters in this format for presentation in the show.

        One solution would be to rename the rasters from raster.1
        .. raster.1000 ... to raster.00001 .. raster.01000 ...,
        e. g. (in Sh):

GRASS> g.mlist type=rast pattern=raster.\* \
           | sed -e 's/\([0-9]\+\)$/ \1/' \
           | (while read pfx num ; do \
                  padded="$(printf %5d "$num")" \
                  g.rename rast="${pfx}${num}","${pfx}${padded}" \
              done)

        (The script is probably worth wrapping in a Sh script file.)

[...]

goldneaa wrote:

I have a quick question about the usage of d.slide.show. Right now I
am able to create a slide show for my raster files. Two problems I am
having so far is that my rasters are out of order. I know that when I
bring them in they are bringing them in in alphabetical order.
Example. raster.1,raster.10,raster100,raster1000,raster.1001. But
this is not the way I want them presented in my show. I need the
raters just to move from 1-1560. Is there a tool that will order my
rasters in this format for presentation in the show.

try this patch:

  sort -n -k2 -t.
(sorts numerically instead of alphabetically, sorts on the second field
[delimited by a "."])

Index: d.slide.show

RCS file:
/home/grass/grassrepository/grass6/scripts/d.slide.show/d.slide.show,v
retrieving revision 1.13
diff -u -r1.13 d.slide.show
--- d.slide.show 17 Jun 2007 10:18:08 -0000 1.13
+++ d.slide.show 17 Jul 2007 05:42:49 -0000
@@ -175,7 +175,8 @@
        then
                continue
        fi
- for i in MASK `ls cell/$PREFIX* 2> /dev/null`
+# for i in MASK `ls cell/$PREFIX* 2> /dev/null`
+ for i in MASK `ls cell/$PREFIX* | sort -n -k2 -t.`
        do
                i=`echo $i | sed 's/cell\///'`
                if [ ! $i = "MASK" ]

but maybe that hits the max command line buffer of 4096 chars recently
seen in the csh thread??

The typical solution to this problem is to name the files (maps) as
raster.0001, raster.0002, ..., raster.1560.

e.g., to rename maps using awk + printf("%04d"):

#!/bin/sh
for MAP in `g.mlist pattern="raster.*"` ; do
  NEW_NAME=`echo "$MAP" | awk -F. '{printf("%s.%04d", $1, $2)}'`
  #echo "[$MAP] -> [$NEW_NAME]"
  g.rename "$MAP,$NEW_NAME"
done

Second, between my raster files a white screen pops up and has
lettering from the file extension of my raster files. Is there a way
for the slideshow to simply just run through the rasters without
this interuption.

? No idea. What's the command line you are using? across=1 and down=1?
It writes "$MAPNAME in $MAPSET" text in a caption at the bottom..?

You might also try xganim for the slideshow. (didn't Glynn write a
tcl replacement for this a while back?)

Also r.out.mpeg is there and http://grass.gdf-hannover.de/wiki/Movies

Hamish

Hamish <hamish_nospam@yahoo.com> writes:

[...]

> - for i in MASK `ls cell/$PREFIX* 2> /dev/null`
> +# for i in MASK `ls cell/$PREFIX* 2> /dev/null`
> + for i in MASK `ls cell/$PREFIX* | sort -n -k2 -t.`
> do
> i=`echo $i | sed 's/cell\///'`
> if [ ! $i = "MASK" ]

[...]

> The typical solution to this problem is to name the files (maps) as
> raster.0001, raster.0002, ..., raster.1560.

> e.g., to rename maps using awk + printf("%04d"):

> #!/bin/sh
> for MAP in `g.mlist pattern="raster.*"` ; do
> NEW_NAME=`echo "$MAP" | awk -F. '{printf("%s.%04d", $1, $2)}'`
> #echo "[$MAP] -> [$NEW_NAME]"
> g.rename "$MAP,$NEW_NAME"
> done

        The sed and gawk are mostly interchangeable for the small tasks.
        What I'd really like to suggest is to use

COMMAND | while read VARIABLE ; do ... done

        loop instead of the currently used

for VARIABLE in `COMMAND` ; do ... done

        one, since the former isn't subject to any command line length
        limits and, besides, makes the code look better (especially if
        one is to have a long pipeline as the COMMAND.)