Opened 16 years ago
Closed 16 years ago
#326 closed enhancement (invalid)
g.findfile element=colr2
Reported by: | martinl | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.4.0 |
Component: | Default | Version: | svn-develbranch6 |
Keywords: | colr2, color table | Cc: | |
CPU: | All | Platform: | All |
Description
Module g.findfile doesn't support 'colr2' element. The attached patch adds this support. 'colr2' element can be searched only in the current mapset and file needs to be given as fully qualified, e.g.
g.findfile element=colr2 file=tm1@PERMANENT name='tm1@PERMANENT' mapset='landa' fullname='tm1@PERMANENT' file='/home/martin/grassdata/zod/landa/colr2/PERMANENT/tm1'
Martin
Attachments (1)
Change History (3)
by , 16 years ago
Attachment: | g-findfile-colr2.diff added |
---|
follow-up: 2 comment:1 by , 16 years ago
Type: | defect → enhancement |
---|
Replying to martinl:
Module g.findfile doesn't support 'colr2' element. The attached patch adds this support. 'colr2' element can be searched only in the current mapset and file needs to be given as fully qualified, e.g.
The suggested fix is bogus. G__file_name() does not need and should not have a hard-coded hack for the colr2 directory.
The correct way to handle colr2 is to first determine the mapset of the map in question, then specify the "element" parameter as "colr2/<mapset>". This correctly handles the case where the mapset search path isn't just the current mapset plus PERMANENT, i.e. it will find a colr2 file for the map in any mapset in the search path, not just the current mapset.
While an extension to g.findfile might be useful, it isn't strictly necessary. You can perform the lookup described above using g.findfile:
$ eval `g.findfile element=cell file=elevation.dem` $ eval `g.findfile element=colr2/$mapset file=elevation.dem` $ echo "$file" /opt/grass-data/spearfish57/glynn/colr2/PERMANENT/elevation.dem
What would be useful is a misc= option to allow the use of G_find_file2_misc(), so that you can find cell_misc elements, subgroup elements, etc.
BTW, why would you be using g.findfile to locate colour tables in the first place? You shouldn't normally need to know whether a map gets its colour table from colr, colr2, or uses the default rainbow table.
comment:2 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Replying to glynn:
$ eval `g.findfile element=cell file=elevation.dem` $ eval `g.findfile element=colr2/$mapset file=elevation.dem` $ echo "$file" /opt/grass-data/spearfish57/glynn/colr2/PERMANENT/elevation.dem
Ops, I have overlooked this possibility... Thanks for pointing it out.
BTW, why would you be using g.findfile to locate colour tables in the first place? You shouldn't normally need to know whether a map gets its colour table from colr, colr2, or uses the default rainbow table.
It's used in wxGUI colorrules.py module for "replace current color table" check.
Martin
g.findfile element=colr2