|
@@ -1,76 +1,48 @@
|
|
|
-<H2>DESCRIPTION</H2>
|
|
|
+<h2>DESCRIPTION</h2>
|
|
|
|
|
|
-<EM>g.findfile</EM> is designed for Bourne shell scripts that need to search
|
|
|
-for mapset <em>elements</em>, including: raster, vector maps, region
|
|
|
-definitions and <em><a HREF="i.group.html">imagery</a></em> groups.
|
|
|
+<em>g.findfile</em> is designed for Bourne shell or Python scripts
|
|
|
+that need to search for mapset <em>elements</em>, including: raster,
|
|
|
+vector maps, region definitions
|
|
|
+and <em><a href="i.group.html">imagery</a></em> groups.
|
|
|
<p>
|
|
|
-The list of <em>element</em> names to search for is not fixed; any
|
|
|
-subdirectory of the mapset directory is a valid <em>element</em> name.
|
|
|
+The list of <b>element</b> names to search for is not fixed; any
|
|
|
+subdirectory of the mapset directory is a valid <b>element</b> name.
|
|
|
<p>
|
|
|
-However, the user can find the list of standard GRASS <em>element</em> names in
|
|
|
-the file $GISBASE/etc/element_list. This is the file which
|
|
|
-g.remove/g.rename/g.copy use to determine which files need to be
|
|
|
-deleted/renamed/copied for a given entity type.
|
|
|
+However, the user can find the list of standard GRASS <b>element</b>
|
|
|
+names in the file <tt>$GISBASE/etc/element_list</tt>. This is the file
|
|
|
+which <em><a href="g.remove.html">g.remove</a></em>, <em><a href="g.rename.html">g.rename</a></em>
|
|
|
+and <em><a href="g.copy.html">g.copy</a></em> use to determine which files
|
|
|
+need to be deleted/renamed/copied for a given entity type.
|
|
|
|
|
|
-<!-- unused
|
|
|
-<H2>OPTIONS</H2>
|
|
|
+<h2>NOTES</h2>
|
|
|
|
|
|
-<H3>Parameters:</H3>
|
|
|
-
|
|
|
-<DL>
|
|
|
-
|
|
|
-<DT><B>element=</B><EM>name</EM>
|
|
|
-
|
|
|
-<DD>The data base element (i.e., directory within a GRASS
|
|
|
-mapset) to be searched.
|
|
|
-
|
|
|
-<DT><B>mapset=</B><EM>name</EM>
|
|
|
-
|
|
|
-<DD>The mapset in which to search for the specified file
|
|
|
-<EM>name</EM>. If not specified, all mapsets in the user's
|
|
|
-GRASS search path are searched. Otherwise, the specified
|
|
|
-mapset is searched. As a convenience, if specified as a
|
|
|
-single dot (.) only the current mapset is searched.
|
|
|
-
|
|
|
-<DT><B>file=</B><EM>name</EM>
|
|
|
-
|
|
|
-<DD>The name of a GRASS data file (of the stated
|
|
|
-<EM>element</EM> type) for which to search.
|
|
|
-
|
|
|
-</DL>
|
|
|
--->
|
|
|
-
|
|
|
-<H2>OUTPUT</H2>
|
|
|
-
|
|
|
-<EM>g.findfile</EM> writes four lines to standard output:
|
|
|
+<em>g.findfile</em> writes four lines to standard output:
|
|
|
|
|
|
<div class="code"><pre>
|
|
|
-name='<EM>file_name</EM>'
|
|
|
-mapset='<EM>mapset_name</EM>'
|
|
|
-file='<EM>unix_filename</EM>'
|
|
|
-fullname='<EM>grass_fullname</EM>'
|
|
|
+name='<em>file_name</em>'
|
|
|
+mapset='<em>mapset_name</em>'
|
|
|
+file='<em>unix_filename</em>'
|
|
|
+fullname='<em>grass_fullname</em>'
|
|
|
</pre></div>
|
|
|
|
|
|
-
|
|
|
-The output is <EM>/bin/sh</EM> commands to set the variable
|
|
|
-<EM>name</EM> to the GRASS data base file name,
|
|
|
-<EM>mapset</EM> to the mapset in which the file resides,
|
|
|
-and <EM>file</EM> to the full UNIX path name for the named
|
|
|
-file. These variables may be set in the <EM>/bin/sh</EM>
|
|
|
+The output is <em>Bash</em> commands to set the variable
|
|
|
+<em>name</em> to the GRASS data base file name,
|
|
|
+<em>mapset</em> to the mapset in which the file resides,
|
|
|
+and <em>file</em> to the full UNIX path name for the named
|
|
|
+file. These variables may be set in the <em>Bash</em>
|
|
|
as follows:
|
|
|
|
|
|
<div class="code"><pre>
|
|
|
eval `g.findfile element=name mapset=name file=name`
|
|
|
</pre></div>
|
|
|
-<P>
|
|
|
+<p>
|
|
|
For example (raster map):
|
|
|
<div class="code"><pre>
|
|
|
-eval `g.findfile element=cell file=mymap`
|
|
|
+eval `g.findfile element=cell file=elevation`
|
|
|
</pre></div>
|
|
|
|
|
|
-<H2>NOTES</H2>
|
|
|
-
|
|
|
-If the specified file does not exist, the variables will be set as follows:
|
|
|
+If the specified file does not exist, the variables will be set as
|
|
|
+follows:
|
|
|
|
|
|
<div class="code"><pre>
|
|
|
name=
|
|
@@ -79,30 +51,40 @@ fullname=
|
|
|
file=
|
|
|
</pre></div>
|
|
|
|
|
|
-
|
|
|
The following is a way to test for this case:
|
|
|
-<div class="code">
|
|
|
-<PRE>
|
|
|
+<div class="code"><pre>
|
|
|
if [ ! "$file" ]
|
|
|
then
|
|
|
exit
|
|
|
fi
|
|
|
-</PRE>
|
|
|
-</DIV>
|
|
|
+</pre></div>
|
|
|
|
|
|
Note that region files are searched as <em>element=windows</em>.
|
|
|
|
|
|
-<H2>SEE ALSO</H2>
|
|
|
+<h2>PYTHON</h2>
|
|
|
|
|
|
-<EM><A HREF="g.ask.html">g.ask</A></EM><br>
|
|
|
-<EM><A HREF="g.filename.html">g.filename</A></EM><br>
|
|
|
-<EM><A HREF="g.gisenv.html">g.gisenv</A></EM><br>
|
|
|
-<EM><A HREF="g.mapsets.html">g.mapsets</A></EM><br>
|
|
|
-<EM><A HREF="parser.html">parser</A></EM>
|
|
|
+See <em><a href="http://grass.osgeo.org/programming7/pythonlib.html">Python
|
|
|
+Scripting Library</a></em> for more info.
|
|
|
|
|
|
-<H2>AUTHOR</H2>
|
|
|
+<div class="code"><pre>
|
|
|
+import grass.script as grass
|
|
|
+
|
|
|
+grass.find_file('elevation', element = 'cell')
|
|
|
+</pre></div>
|
|
|
+
|
|
|
+<h2>SEE ALSO</h2>
|
|
|
+
|
|
|
+<em>
|
|
|
+ <a href="g.filename.html">g.filename</a>,
|
|
|
+ <a href="g.gisenv.html">g.gisenv</a>,
|
|
|
+ <a href="g.mapsets.html">g.mapsets</a>,
|
|
|
+ <a href="g.parser.html">g.parser</a>
|
|
|
+</em>
|
|
|
+
|
|
|
+<h2>AUTHOR</h2>
|
|
|
|
|
|
Michael Shapiro,
|
|
|
U.S.Army Construction Engineering Research Laboratory
|
|
|
|
|
|
-<p><i>Last changed: $Date$</i>
|
|
|
+<p>
|
|
|
+<i>Last changed: $Date$</i>
|