I have some rasters in a grass data directory on a different mounted
drive in unix that i want to copy into a different data directory +
mapset -- i can't seem to figure out how to do this with g.copy, which
AFAIK only copies from mapsets within a given data directory.
Thoughts?
--j
Jonathan Greenberg wrote:
I have some rasters in a grass data directory on a different mounted
drive in unix that i want to copy into a different data directory +
mapset -- i can't seem to figure out how to do this with g.copy, which
AFAIK only copies from mapsets within a given data directory.
Indeed, g.copy only works on maps within the same location. For good
reason: maps in different locations typically have different
projections, so you can't simply copy the data.
The only supported ways of "copying" a map in a different location
are:
1. Use r.proj or v.proj, which will re-project the data based upon the
projections of the source location and the current location.
2. Use e.g. r.out.gdal/v.out.ogr to export the data and
r.in.gdal/v.in.ogr to re-import it. The latter will check that the
projection is correct.
--
Glynn Clements <glynn@gclements.plus.com>
So assuming that we have duplicated the projection info from one
filesystem to the next (the case I'm dealing with is running out of
space on one filesystem, and we needed to continue work on another but
using the same projection info) -- if I create mapset on one of the
two filesystems, and then symlink it within the identical location on
the other filesystem, would this work to allow me to g.copy (or,
indeed, allow me to reference the files using @ from both
filesystems?)
--j
On Fri, May 14, 2010 at 11:05 AM, Glynn Clements
<glynn@gclements.plus.com> wrote:
Jonathan Greenberg wrote:
I have some rasters in a grass data directory on a different mounted
drive in unix that i want to copy into a different data directory +
mapset -- i can't seem to figure out how to do this with g.copy, which
AFAIK only copies from mapsets within a given data directory.
Indeed, g.copy only works on maps within the same location. For good
reason: maps in different locations typically have different
projections, so you can't simply copy the data.
The only supported ways of "copying" a map in a different location
are:
1. Use r.proj or v.proj, which will re-project the data based upon the
projections of the source location and the current location.
2. Use e.g. r.out.gdal/v.out.ogr to export the data and
r.in.gdal/v.in.ogr to re-import it. The latter will check that the
projection is correct.
--
Glynn Clements <glynn@gclements.plus.com>
Jonathan Greenberg wrote:
So assuming that we have duplicated the projection info from one
filesystem to the next (the case I'm dealing with is running out of
space on one filesystem, and we needed to continue work on another but
using the same projection info) -- if I create mapset on one of the
two filesystems, and then symlink it within the identical location on
the other filesystem, would this work to allow me to g.copy (or,
indeed, allow me to reference the files using @ from both
filesystems?)
Probably.
Accessing it shouldn't be a problem, although selecting the symlink as
the current mapset *might* have issues with something expecting the
mapset directory to actually be a directory. In the event that this
does happen, on Linux you can use a "bind mount" to effectively move a
directory to a different location on the file system.
--
Glynn Clements <glynn@gclements.plus.com>
Excellent -- symlinking is working properly -- now on to my next
question -- is there a way to do some level of "batch" g.copy using a
wildcard, e.g.:
g.copy rast=ned_ca_masked_epsg3310_*@comet
Or do I have to specific each raster individually, along with its
target file name?
--j
On Wed, May 19, 2010 at 8:30 PM, Glynn Clements
<glynn@gclements.plus.com> wrote:
Jonathan Greenberg wrote:
So assuming that we have duplicated the projection info from one
filesystem to the next (the case I'm dealing with is running out of
space on one filesystem, and we needed to continue work on another but
using the same projection info) -- if I create mapset on one of the
two filesystems, and then symlink it within the identical location on
the other filesystem, would this work to allow me to g.copy (or,
indeed, allow me to reference the files using @ from both
filesystems?)
Probably.
Accessing it shouldn't be a problem, although selecting the symlink as
the current mapset *might* have issues with something expecting the
mapset directory to actually be a directory. In the event that this
does happen, on Linux you can use a "bind mount" to effectively move a
directory to a different location on the file system.
--
Glynn Clements <glynn@gclements.plus.com>
Jonathan Greenberg wrote:
Excellent -- symlinking is working properly -- now on to my next
question -- is there a way to do some level of "batch" g.copy using a
wildcard, e.g.:
g.copy rast=ned_ca_masked_epsg3310_*@comet
Or do I have to specific each raster individually, along with its
target file name?
Jonathan, would a for loop + g.mlist + g.copy get the job done? For example:
for X in `g.mlist rast pat=ned_ca_masked_epsg3310_* mapset=comet` ; do
g.copy rast="${X}","${X}" ; done
Nikos
[...]
This ALMOST works, except "from" needs to take the form
rastername@mapset and "to" needs the form rastername. I can get the
"from" setup properly by appending "-m" to the gmlist call, but how do
I subsequently strip the @comet part for the "to" statement? Thanks!
Incidentally, this would be a good feature to add to g.copy.
--j
On Mon, May 24, 2010 at 8:40 PM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:
Jonathan Greenberg wrote:
Excellent -- symlinking is working properly -- now on to my next
question -- is there a way to do some level of "batch" g.copy using a
wildcard, e.g.:
g.copy rast=ned_ca_masked_epsg3310_*@comet
Or do I have to specific each raster individually, along with its
target file name?
Jonathan, would a for loop + g.mlist + g.copy get the job done? For example:
for X in `g.mlist rast pat=ned_ca_masked_epsg3310_* mapset=comet` ; do
g.copy rast="${X}","${X}" ; done
Nikos
[...]
Jonathan Greenberg wrote:
This ALMOST works, except "from" needs to take the form
rastername@mapset and "to" needs the form rastername. I can get the
"from" setup properly by appending "-m" to the gmlist call, but how do
I subsequently strip the @comet part for the "to" statement?
With the following (untested though):
for X in `g.mlist rast pat=ned_ca_masked_epsg3310_* mapset=comet -m` ; do
g.copy rast="${X}",`echo "${X}"|cut -d "@" -f1`
done
Nikos
Thanks!
Incidentally, this would be a good feature to add to g.copy.
--j
-----
On Mon, May 24, 2010 at 8:40 PM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:
> Jonathan Greenberg wrote:
>> Excellent -- symlinking is working properly -- now on to my next
>> question -- is there a way to do some level of "batch" g.copy using a
>> wildcard, e.g.:
>>
>> g.copy rast=ned_ca_masked_epsg3310_*@comet
>>
>> Or do I have to specific each raster individually, along with its
>> target file name?
>
> Jonathan, would a for loop + g.mlist + g.copy get the job done? For
> example:
>
> for X in `g.mlist rast pat=ned_ca_masked_epsg3310_* mapset=comet` ; do
> g.copy rast="${X}","${X}" ; done
>
> Nikos
>
> [...]
Jonathan wrote:
Incidentally, this would be a good feature to add to g.copy.
I wouldn't mind to review a g.mcopy prototype in addons svn, but
probably the reason this hasn't happened already is that usally
you can use g.mapsets to add the other mapset to the search path
so the "don't want to type @ all the time" need is avoided.
(that doesn't help if you are trying to compile a release mapset
from a bunch or working ones of course)
Hamish