variables.html 16 KB

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