[GRASSLIST:1939] Re: Export Raster - followup

Daniel Victoria daniel_victoria at yahoo.com
Tue Dec 2 12:21:29 EST 2003


Hi all,

Just to finish the topic.

I made 2 shell scripts, one that will tar/bzip2 all
maps with a specific name to a tar.bz2 file and the
other that will unpack it. The unpacking is not
necessary since it can be done by simply using the
command
tar -jxPvf file_name
the P is to keep the original file path

Hope it can be usefull to anyone. Feel free to change
it as you see fit

Cheers
Daniel

------export script------
#/bin/sh
#Export script for grass... 
#gets all files and dirs that matches the pattern
entered by the user
#tars and bzip2 all files
#created by Daniel de Castro Victoria on 12/02/2003
#daniel_victoria at yahoo.com

echo Enter export file name:
read outfile
echo Enter name pattern:
read pattern

tar -jcPvf $outfile
$GISDBASE/$LOCATION_NAME/$MAPSET/*/$pattern


-----Import script-----------
#/bin/sh
#Import script for files created using the export
script 
#unpacks the export file inside the user
gisdbase/location/mapset
#can be substitude by just tar -jcPvf export.file.name
#created by Daniel de Castro Victoria on 12/02/2003
#daniel_victoria at yahoo.com

echo Enter export file name:
read outfile

tar -jxPvf $outfile 




--- Daniel Victoria <daniel_victoria at yahoo.com> wrote:
> Hi all,
> 
> Thanks Glynn for the help.
> 
> But imagine this, you have 300 rasters and want to
> erase half, but keep a backup. Wouldn't it be
> easier/better to have a way to backup just those
> rasters and not the entire dataset? Then, if later
> on,
> I want to restore just 10 of those 150 backup
> rasters,
> It would be very easy o do. Maybe some sort of
> export
> program designed to export from Grass to a
> interchange
> file and back to Grass, like the export program in
> ARC...
> 
> Of course, since it's just a matter of getting all
> the
> files and directories with the same name as the
> raster, a simple shell script will do the trick...
> I'll try to work on that and if successful, post it
> to
> the list, but keep in mind that I'm a newbie at
> programing... If anyone beats me to the task, feel
> free to contribute :)
> 
> Daniel
> 
> --- Glynn Clements <glynn.clements at virgin.net>
> wrote:
> > 
> > Daniel Victoria wrote:
> > 
> > > I need to remove some grass rasters from my HD
> > since
> > > it's almost filled up, but I don't want to loose
> > the
> > > files. What would be the best way to do this? Is
> > there
> > > such a command like export, so I can do a safe
> > backup
> > > of the files? Should I use r.out.ascii,
> r.out.bin?
> > Or
> > > just copy the entire directory?
> > 
> > Backing-up an entire mapset is simple enough; just
> > use tar/zip/etc on
> > the mapset directory. Similarly for entire
> > locations.
> > 
> > Backing-up individual maps is a bit more involved;
> > however, all files
> > pertaining to a given map have the same name as
> the
> > map, except for
> > those in the cell_misc directory, which reside in
> a
> > subdirectory with
> > the same name as the map. In both cases, the
> > file/directory in
> > question will exist in a subdirectory of the
> mapset
> > directory. So you
> > could use e.g.:
> > 
> > 	cd <database>/<location>/<mapset>
> > 	tar cf <mapname>.tar */<mapname>
> > 
> > Using r.out.* will discard the category labels,
> > colour table, history
> > etc, so it isn't a particularly good mechanism for
> > creating backups.
> > 
> > -- 
> > Glynn Clements <glynn.clements at virgin.net>
> > 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/




More information about the grass-user mailing list