variables.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>GRASS variables and environment variables</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </head>
  8. <body bgcolor="white">
  9. <!-- file source: lib/init/variables.html -->
  10. <img src="grass_logo.png" alt="_\|/_ GRASS logo"><hr align=center size=6 noshade>
  11. <!-- meta page description: GRASS variables and environment variables -->
  12. <h2>GRASS variables and environment variables</h2>
  13. There are two types of variables:
  14. <ul>
  15. <li><a href="#enviro">shell environment</a> variables,</li>
  16. <li><a href="#gisenv">GRASS gisenv</a> variables.</li>
  17. </ul>
  18. There are a number of <i>shell</i> environment variable groups:
  19. <ul>
  20. <li><a href="#rendering">variables for rendering</a></li>
  21. <li><a href="#internal">variables for internal use</a></li>
  22. </ul>
  23. <i>Note:</i> Any setting which needs to be modifiable by a GRASS module
  24. (e.g. MONITOR by <em><a href="d.mon.html">d.mon</a></em>) has to be a GRASS
  25. gisenv variable.
  26. <h2>Setting shell environment variables</h2>
  27. Setting shell environment variables depends on the shell being used:
  28. <br><br>
  29. Bash:
  30. <div class="code"><pre>
  31. export VARIABLE=value
  32. </pre></div>
  33. Csh:
  34. <div class="code"><pre>
  35. setenv VARIABLE value
  36. </pre></div>
  37. Cmd.exe (Windows):
  38. <div class="code"><pre>
  39. set VARIABLE=value
  40. </pre></div>
  41. To set up shell environment variables permanently:
  42. <ul>
  43. <li>
  44. To get personal BASH shell definitions (aliases, color listing option, ...)
  45. into GRASS, store them in:<br>
  46. <tt>$HOME/.grass.bashrc</tt></li>
  47. <li>
  48. To get personal CSH shell definitions (aliases, color listing option, ...)
  49. into GRASS, store them in:<br>
  50. <tt>$HOME/.grass.cshrc</tt></li>
  51. </ul>
  52. <h2>Setting GRASS gisenv variables</h2>
  53. Use <em><a href="g.gisenv.html">g.gisenv</a></em> within GRASS. This permanently
  54. predefines GRASS variables in the <tt>.grass7/rc</tt> file.
  55. <br><br>
  56. Usage:
  57. <div class="code"><pre>
  58. g.gisenv set="VARIABLE=VALUE"
  59. </pre></div>
  60. It looks unusual with two equals signs, but <em>g.gisenv</em> serves dual duty for
  61. getting and setting GRASS variables.
  62. <p>If the user just specifies a variable name, it defaults to <b>get</b> mode.
  63. For example:
  64. <div class="code"><pre>
  65. g.gisenv MAPSET
  66. PERMANENT
  67. </pre></div>
  68. <a name="enviro"></a>
  69. <h2>List of selected (GRASS related) shell environment variables</h2>
  70. <blockquote>
  71. [ To be set from the terminal shell or startup scripts ]
  72. </blockquote>
  73. <dl>
  74. <dt>GISBASE</dt>
  75. <dd>directory where GRASS lives. This is set automatically by the
  76. startup script.</dd>
  77. <dt>GISRC</dt>
  78. <dd>name of <tt>.grass7/rc</tt> file. Defines the system wide value
  79. while in a GRASS session.</dd>
  80. <dt>GRASS_ADDON_PATH</dt>
  81. <dd>[grass startup script]<br> allows to specify additional paths to
  82. local GRASS modules extra to standard distribution. The default on
  83. GNU/Linux is <tt>$HOME/.grass7/addons</tt>.</dd>
  84. <dt>GRASS_ADDON_ETC</dt>
  85. <dd>[libgis, g.findetc]<br>
  86. specify paths where support files (etc/) may be found external to
  87. standard distribution.</dd>
  88. <dt>GRASS_BATCH_JOB</dt>
  89. <dd>defines the name (path) of a shell script to be processed as
  90. batch job.</dd>
  91. <dt>GIS_ERROR_LOG</dt>
  92. <dd>If set, GIS_ERROR_LOG should be the absolute path to the log
  93. file (a relative path will be interpreted relative to the process'
  94. cwd, not the cwd at the point the user set the variable). If not
  95. set, <tt>$HOME/GIS_ERROR_LOG</tt> is used instead. The file will
  96. only be used if it already exists.</dd>
  97. <dt>GRASS_ERROR_MAIL</dt>
  98. <dd>set to any value to send user mail on an error or warning that
  99. happens while stderr is being redirected.</dd>
  100. <dt>GRASS_FONT</dt>
  101. <dd>[display drivers]<br>
  102. specifies the font as either the name of a font from
  103. <tt>$GISBASE/etc/fontcap</tt> (or alternative fontcap file
  104. specified by GRASS_FONT_CAP), or alternatively the full path to a
  105. FreeType font file.</dd>
  106. <dt>GRASS_ENCODING</dt>
  107. <dd>[display drivers]<br>
  108. the encoding to be assumed for text which is drawn using a
  109. freetype font; may be any encoding know to <em>iconv</em>.</dd>
  110. <dt>GRASS_FONT_CAP</dt>
  111. <dd>[g.mkfontcap, d.font, display drivers]<br>
  112. specifies an alternative location (to <tt>$GISBASE/etc/fontcap</tt>) for
  113. the font configuration file.</dd>
  114. <dt>GRASS_GNUPLOT</dt>
  115. <dd>[<!-- m.svfit, s.probplt, s.sv -->i.spectral]<br>
  116. program to use for plotting <em>gnuplot</em> data.</dd>
  117. <dt>GRASS_GUI</dt>
  118. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  119. <br><br> Can also specify the name of the GUI to use,
  120. e.g. <tt>wxpython</tt>
  121. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a GRASS
  122. gisenv variable (see below). If this shell variable exists at
  123. GRASS startup, it will determine the GUI used. If it is not
  124. defined startup will default to the last GUI used.</dd>
  125. <dt>GRASS_HTML_BROWSER</dt>
  126. <dd>[init.sh, wxgui]<br> defines name of HTML browser. For most
  127. platforms this should be an executable in your PATH, or the full
  128. path to an executable.<br> Mac OS X runs applications differently
  129. from the CLI. Therefore, GRASS_HTML_BROWSER should be the
  130. application's signature, which is a domain-like name, just
  131. reversed, i.e. com.apple.Safari. To find an application's
  132. signature, type the following in a Terminal (fill in the path to
  133. the application you are interested in, for example:
  134. /Applications/Safari.app):<br> &nbsp; &nbsp; <code>grep -A 1
  135. &quot;CFBundleIdentifier&quot;</code> <i>/path/to/application.app</i><code>/Contents/Info.plist</code><br>
  136. &nbsp; The signature is the &lt;string&gt; following the
  137. &lt;key&gt;, without the bracketing &lt;string&gt; tags.</dd>
  138. <dt>GRASS_INT_ZLIB</dt>
  139. <dd>[libgis]<br> if the environment variable GRASS_INT_ZLIB exists,
  140. new compressed <i>integer</i> (CELL type) raster maps will be compressed
  141. using zlib instead of RLE compression. Such rasters will have a <tt>compressed</tt>
  142. value of 2 in the cellhd file.
  143. <br><br>
  144. Obviously, decompression is controlled by the
  145. raster's <tt>compressed</tt> value, not the environment variable.</dd>
  146. <dt>GRASS_MESSAGE_FORMAT</dt>
  147. <dd>[various modules, wxGUI]<br> maybe set to either
  148. <ul>
  149. <li><tt>standard</tt> - sets percentage output and message
  150. formatting style to standard formatting,</li>
  151. <li><tt>gui</tt> - sets percentage output and message formatting
  152. style to GUI formatting,</li>
  153. <li><tt>silent</tt> - disables percentage output and error
  154. messages,</li>
  155. <li><tt>plain</tt> - sets percentage output and message
  156. formatting style to ASCII output without rewinding control
  157. characters.</li>
  158. </ul></dd>
  159. <dt>GRASS_MOUSE_BUTTON</dt>
  160. <dd>[various modules]<br> swaps mouse buttons for two-button or
  161. left-handed mice. Its value has three digits 1, 2, and 3, which
  162. represent default left, middle, and right buttons
  163. respectively. Setting to <tt>132</tt> will swap middle and right
  164. buttons. Note that this variable should be set before a display
  165. driver is initialized (e.g.,
  166. <tt>d.mon x0</tt>).</dd>
  167. <dt>GRASS_PAGER</dt>
  168. <dd>[various modules]<br>
  169. maybe set to either <tt>less</tt> or <tt>more</tt>.</dd>
  170. <dt>GRASS_PERL</dt>
  171. <dd>[used during install process for generating man pages]<br>
  172. set Perl with path.</dd>
  173. <dt>GRASS_RND_SEED</dt>
  174. <dd>set random seed
  175. for <em><a href="r.mapcalc.html">r.mapcalc</a></em> rand()
  176. function.</dd>
  177. <!-- HB Sept 2005: I don't think this exists anymore:
  178. <p>GRASS_STDERR
  179. <br>&nbsp; set to any value to prevent user mail on error
  180. -->
  181. <dt>GRASS_SH</dt>
  182. <dd>[shell scripts on Windows]<br>
  183. path to bourne shell interpreter used to run shell scripts.</dd>
  184. <dt>GRASS_SIGSEGV_ON_ERROR</dt>
  185. <dd>Raise SIGSEGV if an error occures]<br>
  186. This variable can be set for debugging purpose. The call
  187. of G_fatal_error() will end in a segmentation violation. GDB can be used
  188. to trace the source of the error.</dd>
  189. <dt>GRASS_PYTHON</dt>
  190. <dd>[wxGUI, Python Ctypes]<br>
  191. set to override Python executable.<br>
  192. On Mac OS X this should be the pythonw executable for the wxGUI to work.</dd>
  193. <dt>GRASS_VECTOR_LOWMEM</dt>
  194. <dd>[vectorlib]<br>
  195. If the environment variable GRASS_VECTOR_LOWMEM exists, memory
  196. consumption will be reduced when building vector topology
  197. support structures. Recommended for creating large vectors.</dd>
  198. <dt>GRASS_WXBUNDLED</dt>
  199. <dd>[wxGUI]<br>
  200. set to tell wxGUI that a bundled wxPython will be used.<br>
  201. When set, the wxGUI will not check the wxPython version, as this
  202. function is incompatible with a bundled wxPython. It is up to the
  203. packager to make sure that a compatible wxPython version is bundled.</dd>
  204. <dt>GRASS_XTERM</dt>
  205. <dd>[lib/init/grass-xterm-wrapper, lib/init/grass-xterm-mac]<br>
  206. set to any value (e.g. rxvt, aterm, gnome-terminal, konsole) to
  207. substitute 'x-terminal-emulator' or 'xterm'. The Mac OS X app
  208. startup defaults to an internal '$GISBASE/etc/grass-xterm-mac',
  209. which emulates the necessary xterm functionality in
  210. Terminal.app.</dd>
  211. <dt>GRASS_UI_TERM</dt>
  212. <dd>set to any value to use the terminal based parser.</dd>
  213. <dt>GRASS_VERSION</dt>
  214. <dd>reports the current version number (used by R-stats interface etc);
  215. should not be changed by user.</dd>
  216. <dt>GRASS_NO_GLX_PBUFFERS</dt>
  217. <dd>[nviz]<br>
  218. set to any value to disable the use of GLX Pbuffers.</dd>
  219. <dt>GRASS_NO_GLX_PIXMAPS</dt>
  220. <dd>[nviz]<br>
  221. Set to any value to disable the use of GLX Pixmaps.</dd>
  222. <dt>OMP_NUM_THREADS</dt>
  223. <dd>[OpenMP]<br>
  224. If OpenMP support is enabled this limits the number of threads.
  225. The default is set to the number of CPUs on the system.
  226. Setting to '1' effectively disables parallel processing.</dd>
  227. </dl>
  228. <a name="rendering"></a>
  229. <h3>List of selected GRASS environment variables for rendering</h3>
  230. <blockquote>
  231. [ In addition to those which are understood by specific <em>GRASS display
  232. drivers</em>, the following variables affect rendering. ]
  233. </blockquote>
  234. <dl>
  235. <dt>GRASS_RENDER_IMMEDIATE</dt>
  236. <dd>tells the display library which driver to use; possible
  237. values: <em><a href="cairodriver.html">cairo</a></em>, <em><a href="pngdriver.html">png</a></em>, <em><a href="psdriver.html">ps</a></em>
  238. or <em><a href="htmldriver.html">html</a></em></dd>
  239. <dt>GRASS_WIDTH</dt>
  240. <dd>defines the width of output image (default is 640).</dd>
  241. <dt>GRASS_HEIGHT</dt>
  242. <dd>defines the height of output image (default is 480).</dd>
  243. <dt>GRASS_FRAME</dt>
  244. <dd>contains 4 coordinates, <em>top,bottom,left,right</em>, defining the initial frame.</dd>
  245. <dt>GRASS_LINE_WIDTH</dt>
  246. <dd>defines default line width.</dd>
  247. <dt>GRASS_TEXT_SIZE</dt>
  248. <dd>defines default text size.</dd>
  249. </dl>
  250. For specific driver-related variables see:
  251. <ul>
  252. <li><em><a href="cairodriver.html">Cairo driver</a></em></li>
  253. <li><em><a href="pngdriver.html">PNG driver</a></em></li>
  254. <li><em><a href="psdriver.html">PS (Postscript) driver</a></em></li>
  255. <li><em><a href="htmldriver.html">HTML driver</a></em></li>
  256. </ul>
  257. <a name="internal"></a>
  258. <h3>List of selected internal GRASS environment variables</h3>
  259. <blockquote>
  260. [ These variables are intended <b>for internal use only</b> by the GRASS
  261. software to facilitate communication between the GIS engine, GRASS scripts,
  262. and the GUI.
  263. The user should not set these in a GRASS session. They are meant to be set
  264. locally for specific commands. ]
  265. </blockquote>
  266. <dl>
  267. <dt>GRASS_OVERWRITE</dt>
  268. <dd>[all modules]<br>
  269. toggles map overwrite.
  270. <ul>
  271. <li>0 - maps are protected (default),</li>
  272. <li>1 - maps with identical names will be overwritten.</li>
  273. </ul>
  274. This variable is automatically created
  275. by <em><a href="g.parser.html">g.parser</a></em> so that the
  276. <tt>--overwrite</tt> option will
  277. be inherited by dependent modules as the script runs. Setting either the
  278. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  279. below will cause maps with identical names to be overwritten.</dd>
  280. <dt>GRASS_VERBOSE</dt>
  281. <dd>[all modules]<br>
  282. toggles verbosity level
  283. <ul>
  284. <li>0 - only errors and warnings are printed</li>
  285. <li>1 - progress messages are printed (percent complete)</li>
  286. <li>2 - all module messages are printed</li>
  287. <li>3 - additional verbose messages are printed</li>
  288. </ul>
  289. This variable is automatically created by <em><a href="g.parser.html">g.parser</a></em>
  290. so that the <tt>--verbose</tt> or <tt>--quiet</tt> flags will be inherited
  291. by dependent modules as the script runs.</dd>
  292. <dt>GRASS_REGION</dt>
  293. <dd>[libgis]<br>
  294. override region settings, separate parameters with a ";". Format
  295. is the same as in the WIND region settings file. Otherwise use is the same as
  296. WIND_OVERRIDE.</dd>
  297. <dt>WIND_OVERRIDE</dt>
  298. <dd>[libgis]<br>
  299. it causes programs to use the specified named region (created with
  300. e.g. <tt>g.region save=...</tt>) to be used as the current region, instead of
  301. the region from the WIND file.<br><br>
  302. This allows programs such as the GUI to run external commands on an
  303. alternate region without having to modify the WIND file then change it
  304. back afterwards.</dd>
  305. </dl>
  306. <a name="gisenv"></a>
  307. <h2>List of selected GRASS gisenv variables</h2>
  308. <blockquote>
  309. [ Use <em><a href="g.gisenv.html">g.gisenv</a></em> to get/set/unset/change them ]
  310. </blockquote>
  311. <dl>
  312. <dt>DEBUG</dt>
  313. <dd>[entire GRASS]<br>
  314. sets level of debug message output (0: no debug messages)
  315. <div class="code"><pre>
  316. g.gisenv set=DEBUG=0
  317. </pre></div>
  318. <dt>WX_DEBUG</dt>
  319. <dd>[wxGUI]<br>
  320. sets level of debug message output for <em><a href="wxGUI.html">wxGUI</a></em> (0: no debug messages, 1-5 debug levels)
  321. <dt>GISDBASE</dt>
  322. <dd>initial database</dd>
  323. <dt>GIS_LOCK</dt>
  324. <dd>lock ID to prevent parallel GRASS use,
  325. <br>process id of the start-up shell script</dd>
  326. <dt>GRASS_DB_ENCODING</dt>
  327. <dd>[d.what.vect/forms library]<br>
  328. encoding of query form (utf-8, ascii, iso8859-1, koi8-r)</dd>
  329. <dt>GUI</dt>
  330. <dd>either <tt>text</tt> or <tt>gui</tt> to define non-/graphical startup.
  331. <br><br> Can also specify the name of the GUI to use,
  332. e.g. <tt>wxpython</tt>
  333. (<em><a href="wxGUI.html">wxGUI</a></em>). Also exists as a shell
  334. environment variable. If this shell variable exists at GRASS
  335. startup, it will determine the GUI used. If it is not defined
  336. startup will default to the last GUI used.</dd>
  337. <dt>LOCATION</dt>
  338. <dd>full path to location directory</dd>
  339. <dt>LOCATION_NAME</dt>
  340. <dd>initial location name</dd>
  341. <dt>MAPSET</dt>
  342. <dd>initial mapset</dd>
  343. <dt>OVERWRITE</dt>
  344. <dd>[all modules]<br>
  345. toggles map overwrite.
  346. <ul>
  347. <li>0 - maps are protected (default),</li>
  348. <li>1 - maps with identical names will be overwritten.</li>
  349. </ul>
  350. This variable is automatically created
  351. by <em><a href="g.parser.html">g.parser</a></em> so that the
  352. <tt>--overwrite</tt> option will
  353. be inherited by dependent modules as the script runs. Setting either the
  354. GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
  355. below will cause maps with identical names to be overwritten.</dd>
  356. </dl>
  357. <h2>GRASS-related Files</h2>
  358. <dl>
  359. <dt><tt>$HOME/.grass7/rc</tt></dt>
  360. <dd>stores the GRASS gisenv variables (not shell environment variables)</dd>
  361. <dt><tt>$HOME/.grass7/login</tt></dt>
  362. <dd>stores the DBMI passwords in this hidden file.
  363. Only the file owner can access this file.</dd>
  364. <dt><tt>$HOME/GIS_ERROR_LOG</tt></dt>
  365. <dd>if this file exists then all GRASS error and warning messages are
  366. logged here. Applies to current user. To generate the file, use:
  367. <tt>touch $HOME/GIS_ERROR_LOG</tt><br>
  368. See also GIS_ERROR_LOG variable.</dd>
  369. </dl>
  370. <h2>SEE ALSO</h2>
  371. <em>
  372. <a href="g.gisenv.html">g.gisenv</a>,
  373. <a href="g.parser.html">g.parser</a>
  374. </em>
  375. <p><i>Last changed: $Date$</i>
  376. <hr>
  377. <p><a href=index.html>Help Index</a>
  378. <p>&copy; 2008-2011 <a href="http://grass.osgeo.org">GRASS Development Team</a>
  379. </body>
  380. </html>