The Python scripting library for GRASS

learn more… | top users | synonyms

1
vote
2answers
48 views

GRASS 7 environment setup for Python

I would like to use some GRASS functionality from a Python programme. With GRASS 6 this required the set up of various environment variables, as detailed in the GRASS Wiki. I am trying a similar ...
1
vote
1answer
10 views

Problem with numeric variable in i.topo.corr

I have a script to do topographic correction on landsat images. Following the manual, I first have to create the illumination model. I do it with the following line: i.topo.corr -i --overwrite ...
2
votes
0answers
34 views

GRASS GIS: how to run g.run_command(“v.extract”) in Python with sqlite, smooth-spline in GRASS GIS?

I would like to solve several problems by using a python script in GRASS GIS: I already uploaded collected GPS-waypoints and tracks ("v.in.org"), patched several GPS-vector data ("v.patch") and ...
1
vote
1answer
34 views

Pygrass reading raster issue

I'm tring to read a raster map from my grassData. I'm using this code import os import grass.script.setup as gsetup from grass.pygrass import raster gisbase = os.environ['GISBASE'] gisdbase = os....
4
votes
1answer
67 views

GRASS GIS temporal raster individual layer statistical summary

I have created a temporal raster in GRASS GIS which has 90 layers. I would like to extract the mean of each raster layer and export it as text file. Right now I have to export the rasters as GeoTiffs ...
1
vote
1answer
59 views

Solar radiation flux at 5 minute interval using GRASS GIS r.sun

I have been trying to estimate instantaneous total solar irradiance(w/m2) at five minute interval for a day (eg. 21 sept). I can do this in SAGA GIS by using "moment, mode 1" and running the solar ...
2
votes
1answer
122 views

Capturing Output Messages from GRASS when Running Python Scripts

Thanks to the excellent documentation here: https://grasswiki.osgeo.org/wiki/Working_with_GRASS_without_starting_it_explicitly#Python:_GRASS_GIS_7 I've figured out how to access GRASS modules in ...
1
vote
0answers
69 views

Making GRASS GIS 7 Ubuntu bash file work on Windows 7

I have created this bash file (.sh) while working on watershed analysis stochastic simulation in GRASS GIS 7.0.2RC1, which is running on Ubuntu. It worked perfectly and I received the correct results. ...
2
votes
2answers
112 views

Missing v.in.ogr module of GRASS in QGIS Processing toolbox?

I am a new user to QGIS/GRASS and I am having a problem utilizing GRASS. I have several files that I generated in QGIS that I want to import into GRASS so I can use some of the Grass modules. ...
1
vote
1answer
25 views

Set region with rounded values/coordinates

How do I set a region update with rounded coordinates. I usually set my region from a puffer around my points of interest and round up the north and east coordinates and round down the south and west ...
2
votes
1answer
43 views

Return variable with GRASS GIS on a Windows machine

How do I return a variable in GRASS GIS on a Windows machine? For example I set a list of files to define my region. I already figured out that I can't use the bash command export, I need to use set ...
2
votes
1answer
316 views

Using Spyder IDE to develop python for Grass GIS, get 'ImportError: No module named grass.script'

I am trying to use Spyder IDE to develop a python script using python library from grass-6.4.3. I run the script below, and get 'ImportError: No module named grass.script' I am using python 2.7, ...
0
votes
0answers
21 views

GRASS7. Parallel import shapefiles failed

I am trying to import a 8 ShapeFile to GRASS V7.0.0. Each shapefile's size is between 80 Mb and 300 Mb. For this purpose, I've used multiprocessing in python. I run 4 parallel processes, each one ...
0
votes
2answers
747 views

Extract Elevation of Points from DEM using Python QGIS or GRASS

I am utterly new to GIS, so please bear with me if I am providing incomplete information here. I have a DEM file (.dt2). What I am looking to do is as follows: take a series of points specified as ...
0
votes
0answers
17 views

r.watershed outputs different depending on use of console and toolbox

I am returned two different outputs despite same input parameters from r.watershed depending on whether I run it from the console or from the GRASS toolbox. The threshold for both is 5000. They both ...
3
votes
0answers
116 views

Extract representative slope profiles from hillslope polygons

With the help of the Whitebox Geospatial Analysis Tools I was able to easily extract hillslopes from a river network in combination with a flow direction map. Now I would like to extract ...
1
vote
1answer
82 views

How to fix this “Sorry <1> is not a valid option” in GRASS-Ubuntu using r.water.outlet?

I am working with this .sh code (a while loop, extracted from: http://www.surfaces.co.il/) to create watersheds from drainage raster and outlet point of every watershed, but I obtain this error: "...
1
vote
0answers
60 views

Python script split up

I have a python script which works with Grass 6.4. At some point during the project I decided to split this big python script into several scripts. I have made all necessary variables global, created ...
1
vote
1answer
242 views

GRASS scripting for producing multi-band raster

I am trying to loop the r.sun function within a Python script. Anyway, I seem not to understand how I can stack the raster maps each loop would produce into a single multi-band raster (preferably in ...
0
votes
2answers
262 views

Problem with Bash loop in GRASS GIS

I'm new to GRASS GIS and programming and I'm running into a lot of what I imagine are beginners problems and something similar to this has been asked before, but not In a way that I understand. I'm ...
4
votes
1answer
189 views

How to use grass.script in MacOS

I have installed Python and Grass6.4 using Macports. When I tried to use "import grass.script" in python environment, it gives "no module found" error. I'd spend much time to fixed it but could not ...
1
vote
1answer
218 views

How to batch-process attribute tables in QGIS (or GRASS)?

I'm using GRASS 6.4.3 in Linuxmint 16. I have a bash script for GRASS which I use to process almost 300 raster files. The script first imports some raster files (r.in.gdal), then does some ...
1
vote
1answer
24 views

Is my code for changing the resolution correct?

I have a raster files of daily minimum temperature (tmin) for the period 1962-2011 at a resolution of 1.125. I need to convert each single day raster file into 0.5 using inverse distance interpolation....
1
vote
0answers
151 views

GRASS and r.viewshed

I'm trying to run the r.viewshed command using co-ordinates held in a .csv file I imported using v.in.ascii. It has over 200 rows and I'm looking to run viewsheds from each line, without doing it ...
0
votes
1answer
614 views

How to use python to set a variable to a value from a vector attribute table for GRASS

I'm adding to a python script for GRASS v.transects.py. I want to set a variable to equal a value from a field in the vector's attribute table using a for loop to cycle through each row. This is one ...
0
votes
0answers
326 views

How to process multiple images in Grass GIS

first of all, I have to mention that I'm almost new working with Grass and I'm using Grass 6.4.3 on Linuxmint 16. I need to process a large number (~300) of Landsat images. I have downloaded the ...
0
votes
1answer
33 views

Problems installing r.roughness

I am trying to install r.roughness in GRASS 6.4.3. It starts compiling but at the end I get this error: ERROR: Module did not install properly I cannot identify the problem. Can somebody that has ...
1
vote
3answers
1k views

Problem with python script to control GRASS GIS from outside - How to import grass.script under Win 8.1?

I am working with GRASS 6.4.3 and python 2.7.6 under WIN 8.1. I am a novice with computer science and coding, and I have seen many posts including those:Is it possible to use GRASS GIS in Python ...
1
vote
1answer
252 views

Can one batch-automate the creation of QGIS heatmaps?

I have 4k point shapefiles, from which I would like to generate heatmap TIFFs using the QGIS heatmap plugin (or a functional equivalent featuring triweigth, radius and cell size selection). Is there ...
2
votes
2answers
418 views

How to do the loop when using GRASS module r.water.outlet?

I have seen this post:Watershed Analysis with GRASS, and I have a .txt file which contains coordinates of many points, and I want to use r.water.outlet to get basin area of each point. I type the ...
1
vote
0answers
133 views

Is there any GRASS command to measure the distance between a point in rastermap and another in vector map?

I have a question about WinGRASS 6.4.3. Is there any GRASS script command to measure the distance between a point in rastermap and another in vector map? I have a raster map and a vector map. Raster ...
0
votes
1answer
588 views

d.rast problem in GRASS command line

Update#1: @gene, thank you for your reply and I type d.mon in command line, getting a popout GUI look like this: I choose the top three flags(-l, -L, -p), and I got this: And I don't know what to ...
1
vote
1answer
162 views

g.list problem in GRASS command line

I am using GRASS 6.4.3 (installed with osGeo4w), and I have this question: As I type g.list, a function window will pop out, and all functions and results are fine. But when I type g.list rast, I got ...
1
vote
1answer
267 views

libfreetype-6.dll lost when using GRASS command line

Update#1: Following the instruction of Sorin Călinică, I have installed libfreetype-6.dll using the OSGeo4W Network Installer, and the command d.rast can launch successfully. I am using GRASS 6.4....
2
votes
1answer
353 views

How to iterate GRASS region definition?

I am using GRASS r.skyview command (v.7, Windows) to determine "urban canyon effect" on pollution due to the presence of buildings. The command nicely works, unfortunately I need to process a very ...
1
vote
0answers
35 views

GRASS 6.4.2 define Geographic boundaries using MSYS

I am working with daily gridded rainfall data of 50 years. The initial data had the extension .nc.gz.tar which I have unzipped using MSYS in GRASS 6.4.2. Now I have 365*50 days of daily data. My ...
1
vote
1answer
283 views

Set Grass Region in Python grass.script

How can I set the Grass Region in Python without already having a map in the Mapset? Basically I am looking for the equivalent to this window Currently I am only able to extent an existing region, ...