[GRASS-SVN] r44324 - in grass-addons/raster: . r.pack r.unpack
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 15 07:43:31 EST 2010
Author: martinl
Date: 2010-11-15 04:43:31 -0800 (Mon, 15 Nov 2010)
New Revision: 44324
Added:
grass-addons/raster/r.unpack/
grass-addons/raster/r.unpack/Makefile
grass-addons/raster/r.unpack/r.unpack
grass-addons/raster/r.unpack/r.unpack.mat
Removed:
grass-addons/raster/r.pack/r.unpack
grass-addons/raster/r.pack/r.unpack.mat
Log:
r.unpack moved to raster/r.unpack
Deleted: grass-addons/raster/r.pack/r.unpack
===================================================================
--- grass-addons/raster/r.pack/r.unpack 2010-11-15 12:40:39 UTC (rev 44323)
+++ grass-addons/raster/r.pack/r.unpack 2010-11-15 12:43:31 UTC (rev 44324)
@@ -1,162 +0,0 @@
-#!/bin/sh
-# r.unpack -- unpack up a raster map packed with r.pack:
-# tar+gzip'd map elements => GRASS 6 mapset structure
-#
-# (c) 2004-2008 GRASS Development Team
-# AUTHOR: Hamish Bowman, Otago University, New Zealand
-#
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-
-#%Module
-#% description: UnPacks a raster map packed with r.pack
-#%End
-#%option
-#% key: input
-#% type: string
-#% gisprompt: old_file,file,input
-#% description: Name of an existing pack file
-#% required : yes
-#%end
-#%option
-#% key: output
-#% type: string
-#% gisprompt: new,cell,raster
-#% description: Output raster map (default: taken from input file internals)
-#% required : no
-#%end
-#%flag
-#% key: o
-#% description: Override projection check (use current location's projection)
-#%end
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." >&2
- exit 1
-fi
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# check for tar,gzip
-for PRGM in tar gzip ; do
- if [ -z "`which $PRGM`" ] ; then
- g.message -e "$PRGM must be installed to use this program."
- exit 1
- fi
-done
-
-
-if [ -z "$GRASS_OVERWRITE" ] ; then
- GRASS_OVERWRITE=0
-fi
-
-
-if [ ! -e "$GIS_OPT_INPUT" ] ; then
- g.message -e "File not found <$GIS_OPT_INPUT>"
- exit 1
-fi
-
-eval `g.gisenv`
-MSET_DIR="$GISDBASE/$LOCATION_NAME/$MAPSET"
-
-# create temporary directory to hold bits
-TMP_DIR="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP_DIR" ] ; then
- g.message -e "Unable to create temporary files"
- exit 1
-fi
-rm -f "$TMP_DIR"
-mkdir "$TMP_DIR"
-if [ ! -d "$TMP_DIR" ] ; then
- g.message -e "Unable to create temporary directory"
- exit 1
-fi
-
-
-cleanup()
-{
- g.message -v "Cleaning up ..."
- cd "$MSET_DIR"
- rm -rf "$TMP_DIR"
-}
-#### trap ctrl-c so that we can clean up tmp
-trap 'cleanup' 2 3 15
-
-
-cp "$GIS_OPT_INPUT" "$TMP_DIR"/
-cd "$TMP_DIR"/
-
-# remove .pack and path from $GIS_OPT_INPUT
-#MAP_NAME="`basename "$GIS_OPT_INPUT" | sed -e 's/\.pack$//'`"
-
-INPUT_BASE=`basename $GIS_OPT_INPUT`
-DATA_NAME=`tar tzf "$INPUT_BASE" | head -n 1 | cut -f1 -d'/'`
-if [ -z "$DATA_NAME" ] ; then
- g.message -e "Pack file unreadable"
- cleanup
- exit 1
-fi
-
-if [ -z "$GIS_OPT_OUTPUT" ] ; then
- MAP_NAME="$DATA_NAME"
-else
- MAP_NAME="$GIS_OPT_OUTPUT"
-fi
-
-eval `g.findfile element=cell file="$MAP_NAME" mapset=.`
-if [ ! -z "$file" ] && [ "$GRASS_OVERWRITE" -ne 1 ] ; then
- g.message -e "Raster map <$MAP_NAME> already exists"
- cleanup
- exit 1
-fi
-
-
-# extract data
-tar xzf "$INPUT_BASE"
-if [ $? -ne 0 ] ; then
- g.message -e "Pack file unreadable"
- cleanup
- exit 1
-fi
-
-
-cd "$DATA_NAME"/
-
-# check projection compatibility in a rather crappy way
-if [ ! -z `diff PROJ_INFO "$MSET_DIR"/../PERMANENT/PROJ_INFO` ] ; then
- if [ $GIS_FLAG_O -eq 1 ] ; then
- g.message -w "Projection information does not match. Proceeding.."
- else
- g.message -e "Projection information does not match. Aborting."
- cleanup
- exit 1
- fi
-fi
-
-
-# install in $MAPSET
-for ELEMENT in cats cell cellhd colr fcell grid3 hist ; do
- if [ -e "$ELEMENT" ] ; then
- if [ ! -d "$MSET_DIR/$ELEMENT/" ] ; then
- mkdir "$MSET_DIR/$ELEMENT/"
- fi
- cp "$ELEMENT" "$MSET_DIR/$ELEMENT/$MAP_NAME"
- fi
-done
-
-if [ -d "cell_misc" ] ; then
- if [ ! -d "$MSET_DIR/cell_misc" ] ; then
- mkdir "$MSET_DIR/cell_misc"
- fi
- cp -r "cell_misc"/ "$MSET_DIR/cell_misc/$MAP_NAME"
-fi
-
-
-cleanup
-
-g.message -v "Done. Map saved to <$MAP_NAME>"
-exit 0
Deleted: grass-addons/raster/r.pack/r.unpack.mat
===================================================================
--- grass-addons/raster/r.pack/r.unpack.mat 2010-11-15 12:40:39 UTC (rev 44323)
+++ grass-addons/raster/r.pack/r.unpack.mat 2010-11-15 12:43:31 UTC (rev 44324)
@@ -1,116 +0,0 @@
-#!/bin/sh
-# r.unpack -- unpack up a raster map packed with r.pack:
-# tar+gzip => r.in.mat + support files
-#
-# (c) 2004 GRASS Development Team
-# AUTHOR: Hamish Bowman, Otago University, New Zealand
-#
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-
-#%Module
-#% description: UnPacks a raster map packed with r.pack
-#%End
-#%option
-#% key: input
-#% type: string
-#% gisprompt: file,file,file
-#% description: Name of an existing pack file
-#% required : yes
-#%end
-#%flag
-#% key: o
-#% description: Override projection (use location's projection)
-#%end
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." >&2
- exit 1
-fi
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# check for tar (is there a better way?)
-if [ -z "`which tar`" ] ; then
- echo "ERROR: tar must be installed to use this program."
- exit 1
-fi
-# check for gzip
-if [ -z "`which gzip`" ] ; then
- echo "ERROR: gzip must be installed to use this program."
- exit 1
-fi
-
-
-eval `g.gisenv`
-MSET_DIR="$GISDBASE/$LOCATION_NAME/$MAPSET"
-
-
-if [ ! -e "$GIS_OPT_INPUT" ] ; then
- echo "ERROR: file not found [$GIS_OPT_INPUT]"
- exit 1
-fi
-
-# remove .pack and path from $GIS_OPT_INPUT
-MAP_NAME="`basename "$GIS_OPT_INPUT" | sed -e 's/\.pack$//'`"
-echo "The imported map will be named [$MAP_NAME]."
-
-eval `g.findfile element=cell file="$MAP_NAME"`
-if [ ! -z "$file" ] ; then
- echo "ERROR: '$MAP_NAME' already exists."
- exit 1
-fi
-
-
-# create temporary directory to hold bits
-TMP_DIR="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "$TMP_DIR" ] ; then
- echo "ERROR: unable to create temporary files" 1>&2
- exit 1
-fi
-rm -f "$TMP_DIR"
-mkdir "$TMP_DIR"
-if [ ! -d "$TMP_DIR" ] ; then
- echo "ERROR: unable to create temporary directory" 1>&2
- exit 1
-fi
-
-
-cp "$GIS_OPT_INPUT" "$TMP_DIR"/
-cd "$TMP_DIR"/
-tar xzf "`basename $GIS_OPT_INPUT`"
-
-
-# check projection compatibility in a rather crappy way
-if [ ! -z "`diff proj_info "$MSET_DIR"/../PERMANENT/PROJ_INFO`" ] ; then
- if [ $GIS_FLAG_O -eq 1 ] ; then
- echo "WARNING: Projection information does not match. Proceeding.."
- else
- echo "ERROR: Projection information does not match. Aborting."
- # clean up
- cd "$MSET_DIR"
- rm -rf "$TMP_DIR"
- exit 1
- fi
-fi
-
-
-r.in.mat input=map.mat output="$MAP_NAME"
-
-for SUPPORT in colr hist cats ; do
- if [ -e $SUPPORT ] ; then
- cp $SUPPORT "$MSET_DIR"/$SUPPORT/"$MAP_NAME"
- fi
-done
-
-
-# clean up
-cd "$MSET_DIR"
-rm -rf "$TMP_DIR"
-
-echo Finished.
-exit 0
Added: grass-addons/raster/r.unpack/Makefile
===================================================================
--- grass-addons/raster/r.unpack/Makefile (rev 0)
+++ grass-addons/raster/r.unpack/Makefile 2010-11-15 12:43:31 UTC (rev 44324)
@@ -0,0 +1,7 @@
+MODULE_TOPDIR = ../..
+
+PGM = r.unpack
+
+include $(MODULE_TOPDIR)/include/Make/Script.make
+
+default: script
Property changes on: grass-addons/raster/r.unpack/Makefile
___________________________________________________________________
Added: svn:mime-type
+ text/x-makefile
Added: svn:eol-style
+ native
Copied: grass-addons/raster/r.unpack/r.unpack (from rev 44033, grass-addons/raster/r.pack/r.unpack)
===================================================================
--- grass-addons/raster/r.unpack/r.unpack (rev 0)
+++ grass-addons/raster/r.unpack/r.unpack 2010-11-15 12:43:31 UTC (rev 44324)
@@ -0,0 +1,162 @@
+#!/bin/sh
+# r.unpack -- unpack up a raster map packed with r.pack:
+# tar+gzip'd map elements => GRASS 6 mapset structure
+#
+# (c) 2004-2008 GRASS Development Team
+# AUTHOR: Hamish Bowman, Otago University, New Zealand
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+
+#%Module
+#% description: UnPacks a raster map packed with r.pack
+#%End
+#%option
+#% key: input
+#% type: string
+#% gisprompt: old_file,file,input
+#% description: Name of an existing pack file
+#% required : yes
+#%end
+#%option
+#% key: output
+#% type: string
+#% gisprompt: new,cell,raster
+#% description: Output raster map (default: taken from input file internals)
+#% required : no
+#%end
+#%flag
+#% key: o
+#% description: Override projection check (use current location's projection)
+#%end
+
+
+if [ -z "$GISBASE" ] ; then
+ echo "You must be in GRASS GIS to run this program." >&2
+ exit 1
+fi
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+ exec g.parser "$0" "$@"
+fi
+
+# check for tar,gzip
+for PRGM in tar gzip ; do
+ if [ -z "`which $PRGM`" ] ; then
+ g.message -e "$PRGM must be installed to use this program."
+ exit 1
+ fi
+done
+
+
+if [ -z "$GRASS_OVERWRITE" ] ; then
+ GRASS_OVERWRITE=0
+fi
+
+
+if [ ! -e "$GIS_OPT_INPUT" ] ; then
+ g.message -e "File not found <$GIS_OPT_INPUT>"
+ exit 1
+fi
+
+eval `g.gisenv`
+MSET_DIR="$GISDBASE/$LOCATION_NAME/$MAPSET"
+
+# create temporary directory to hold bits
+TMP_DIR="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMP_DIR" ] ; then
+ g.message -e "Unable to create temporary files"
+ exit 1
+fi
+rm -f "$TMP_DIR"
+mkdir "$TMP_DIR"
+if [ ! -d "$TMP_DIR" ] ; then
+ g.message -e "Unable to create temporary directory"
+ exit 1
+fi
+
+
+cleanup()
+{
+ g.message -v "Cleaning up ..."
+ cd "$MSET_DIR"
+ rm -rf "$TMP_DIR"
+}
+#### trap ctrl-c so that we can clean up tmp
+trap 'cleanup' 2 3 15
+
+
+cp "$GIS_OPT_INPUT" "$TMP_DIR"/
+cd "$TMP_DIR"/
+
+# remove .pack and path from $GIS_OPT_INPUT
+#MAP_NAME="`basename "$GIS_OPT_INPUT" | sed -e 's/\.pack$//'`"
+
+INPUT_BASE=`basename $GIS_OPT_INPUT`
+DATA_NAME=`tar tzf "$INPUT_BASE" | head -n 1 | cut -f1 -d'/'`
+if [ -z "$DATA_NAME" ] ; then
+ g.message -e "Pack file unreadable"
+ cleanup
+ exit 1
+fi
+
+if [ -z "$GIS_OPT_OUTPUT" ] ; then
+ MAP_NAME="$DATA_NAME"
+else
+ MAP_NAME="$GIS_OPT_OUTPUT"
+fi
+
+eval `g.findfile element=cell file="$MAP_NAME" mapset=.`
+if [ ! -z "$file" ] && [ "$GRASS_OVERWRITE" -ne 1 ] ; then
+ g.message -e "Raster map <$MAP_NAME> already exists"
+ cleanup
+ exit 1
+fi
+
+
+# extract data
+tar xzf "$INPUT_BASE"
+if [ $? -ne 0 ] ; then
+ g.message -e "Pack file unreadable"
+ cleanup
+ exit 1
+fi
+
+
+cd "$DATA_NAME"/
+
+# check projection compatibility in a rather crappy way
+if [ ! -z `diff PROJ_INFO "$MSET_DIR"/../PERMANENT/PROJ_INFO` ] ; then
+ if [ $GIS_FLAG_O -eq 1 ] ; then
+ g.message -w "Projection information does not match. Proceeding.."
+ else
+ g.message -e "Projection information does not match. Aborting."
+ cleanup
+ exit 1
+ fi
+fi
+
+
+# install in $MAPSET
+for ELEMENT in cats cell cellhd colr fcell grid3 hist ; do
+ if [ -e "$ELEMENT" ] ; then
+ if [ ! -d "$MSET_DIR/$ELEMENT/" ] ; then
+ mkdir "$MSET_DIR/$ELEMENT/"
+ fi
+ cp "$ELEMENT" "$MSET_DIR/$ELEMENT/$MAP_NAME"
+ fi
+done
+
+if [ -d "cell_misc" ] ; then
+ if [ ! -d "$MSET_DIR/cell_misc" ] ; then
+ mkdir "$MSET_DIR/cell_misc"
+ fi
+ cp -r "cell_misc"/ "$MSET_DIR/cell_misc/$MAP_NAME"
+fi
+
+
+cleanup
+
+g.message -v "Done. Map saved to <$MAP_NAME>"
+exit 0
Copied: grass-addons/raster/r.unpack/r.unpack.mat (from rev 44033, grass-addons/raster/r.pack/r.unpack.mat)
===================================================================
--- grass-addons/raster/r.unpack/r.unpack.mat (rev 0)
+++ grass-addons/raster/r.unpack/r.unpack.mat 2010-11-15 12:43:31 UTC (rev 44324)
@@ -0,0 +1,116 @@
+#!/bin/sh
+# r.unpack -- unpack up a raster map packed with r.pack:
+# tar+gzip => r.in.mat + support files
+#
+# (c) 2004 GRASS Development Team
+# AUTHOR: Hamish Bowman, Otago University, New Zealand
+#
+# This program is free software under the GNU General Public
+# License (>=v2). Read the file COPYING that comes with GRASS
+# for details.
+#
+
+#%Module
+#% description: UnPacks a raster map packed with r.pack
+#%End
+#%option
+#% key: input
+#% type: string
+#% gisprompt: file,file,file
+#% description: Name of an existing pack file
+#% required : yes
+#%end
+#%flag
+#% key: o
+#% description: Override projection (use location's projection)
+#%end
+
+
+if [ -z "$GISBASE" ] ; then
+ echo "You must be in GRASS GIS to run this program." >&2
+ exit 1
+fi
+if [ "$1" != "@ARGS_PARSED@" ] ; then
+ exec g.parser "$0" "$@"
+fi
+
+# check for tar (is there a better way?)
+if [ -z "`which tar`" ] ; then
+ echo "ERROR: tar must be installed to use this program."
+ exit 1
+fi
+# check for gzip
+if [ -z "`which gzip`" ] ; then
+ echo "ERROR: gzip must be installed to use this program."
+ exit 1
+fi
+
+
+eval `g.gisenv`
+MSET_DIR="$GISDBASE/$LOCATION_NAME/$MAPSET"
+
+
+if [ ! -e "$GIS_OPT_INPUT" ] ; then
+ echo "ERROR: file not found [$GIS_OPT_INPUT]"
+ exit 1
+fi
+
+# remove .pack and path from $GIS_OPT_INPUT
+MAP_NAME="`basename "$GIS_OPT_INPUT" | sed -e 's/\.pack$//'`"
+echo "The imported map will be named [$MAP_NAME]."
+
+eval `g.findfile element=cell file="$MAP_NAME"`
+if [ ! -z "$file" ] ; then
+ echo "ERROR: '$MAP_NAME' already exists."
+ exit 1
+fi
+
+
+# create temporary directory to hold bits
+TMP_DIR="`g.tempfile pid=$$`"
+if [ $? -ne 0 ] || [ -z "$TMP_DIR" ] ; then
+ echo "ERROR: unable to create temporary files" 1>&2
+ exit 1
+fi
+rm -f "$TMP_DIR"
+mkdir "$TMP_DIR"
+if [ ! -d "$TMP_DIR" ] ; then
+ echo "ERROR: unable to create temporary directory" 1>&2
+ exit 1
+fi
+
+
+cp "$GIS_OPT_INPUT" "$TMP_DIR"/
+cd "$TMP_DIR"/
+tar xzf "`basename $GIS_OPT_INPUT`"
+
+
+# check projection compatibility in a rather crappy way
+if [ ! -z "`diff proj_info "$MSET_DIR"/../PERMANENT/PROJ_INFO`" ] ; then
+ if [ $GIS_FLAG_O -eq 1 ] ; then
+ echo "WARNING: Projection information does not match. Proceeding.."
+ else
+ echo "ERROR: Projection information does not match. Aborting."
+ # clean up
+ cd "$MSET_DIR"
+ rm -rf "$TMP_DIR"
+ exit 1
+ fi
+fi
+
+
+r.in.mat input=map.mat output="$MAP_NAME"
+
+for SUPPORT in colr hist cats ; do
+ if [ -e $SUPPORT ] ; then
+ cp $SUPPORT "$MSET_DIR"/$SUPPORT/"$MAP_NAME"
+ fi
+done
+
+
+# clean up
+cd "$MSET_DIR"
+rm -rf "$TMP_DIR"
+
+echo Finished.
+exit 0
More information about the grass-commit
mailing list