[GRASS-dev] Re: [GRASS-user] mask in PERMANENT affect on other mapsets during reprojection

Hamish hamish_b at yahoo.com
Mon Jun 30 02:33:59 EDT 2008


Hamish:
> > side-suggestion: before running r.proj run v.in.region
> > in the source location then v.proj from the taget location.

Jarekj wrote:
> I always do as you suggest (in general other methods (with
> cs2cs)  in grass are to complicated),

sorry, I don't understand. is that to say that GRASS is easier or harder
than other methods? (ie, if harder, what areas need improving and what is
a clearer (proj4/gdal) method to use?)


> Script must additionally check if no mask is present in PERMANENT or
> it is a bug and will be removed in the feature
....
> So as I understand the problem will heppen when I have mask in mapset in
> source which is named as my target mapset in target location: ussually
> it will concern PERMANENT?


* Maps are searched for in the current mapset search path. (g.mapsets)

* PERMANENT is, by default, in the map search path. (hence the name)

* If you like you can use g.mapsets to remove PERMANENT from the (source
  mapset's) search path, then later re-add it, but that may leave you
  with a damaged mapset if the script exits before the path is restored.

* You can switch between mapsets/locations within your script using the
  g.mapset (without an "s" at the end) module.

* When raster maps are read, the mapset search path is searched for a map
  called MASK. If a map by that name is found in the search path then it
  is applied as the map of interest is read from the disk.

* As Glynn noted, the module internally switches the current mapset, and
  so the for the time when the source mapset becomes the current mapset
  if there is a MASK map in the (source) search path, it will be used.
  (AFAIU)

work arounds include -

o temporarily switching into the source mapset with g.mapset (no "s"),
  removing everything but the current mapset from the source mapset's
  search path with g.mapsets (with an "s"), then switching back to the
  target mapset before running r.proj, then after r.proj is done going
  back and adding PERMANENT+any others removed back into the search path.
  As hinted above I think this solution to be rather poor.

o temporarily switching into the source mapset with g.mapset (no "s"),
  and then run "g.findfile element=cell file=MASK". The result (and exit
  code) will tell you if there is a map called MASK in the search path.
  What you do then is up to you. Maybe switch back to the original
  mapset/location and exit with an error or proceed with a warning.

o change the method used by the r.proj code. (as suggested by Glynn)


hope that makes the "why" a bit clearer.


Hamish



      



More information about the grass-user mailing list