PyGRASS equivalent of piping results from one function to another

When using GRASS commands on the command line, one very neat little trick is to ‘pipe’ results from one function directly to another. An example I used in an earlier post is:

r.category My_map | r.category My_map rules=-

So, how does that works in python using pygrass?
Continue reading “PyGRASS equivalent of piping results from one function to another”

Counting number of layers returned by g.list in GRASS GIS

I am running a script that is producing a very large number of layers. As it takes a while, I wanted to find out how many layers were already created using the command line. Trivial thing perhaps, but I wasn’t really sure how to do it. After a bit of search, one way I found uses the versatile awk command line tool. Continue reading “Counting number of layers returned by g.list in GRASS GIS”

GRASS GIS categorical maps and legends

Did you ever add a legend to your categorical raster map in GRASS GIS that displayed many more categories than your map actually has? It can happen if that map was ‘cut out’ from a larger region using r.mapcalc. For example, if I have a vegetation map of eastern Africa, and I need one for Rwanda only. I would do something like: Continue reading “GRASS GIS categorical maps and legends”

Another stab at creating a Tanaka-style contour map

In a recent post Anita Graser (aka underdark) showed how to create illuminated or Tanaka contours in QGIS using various functions available in the toolbox and some custom functions.

Here I want to explore a slightly different way to achieve the same, using GRASS GIS to compute the azimuth, brightness and line width. I’ll use the command line, but you can do the same using the menu in GRASS, or the corresponding GRASS functions in the QGIS processing toolbox.

Continue reading “Another stab at creating a Tanaka-style contour map”

GRASS 7.0 is out, but the development continues unabated

Just a thumbs-up for the developers of GRASS GIS, who evidently do not rest on their laurels since their release of GRASS GIS 7.0. Below one of those more visible new features in the GRASS GIS development version which make live just that much easier.

nice new feature
A really welcome addition to the drop-down menu for selection of raster or vector layers. It now shows the open maps under a separate header.

Importing GLCF MODIS woody plant cover

The data set

The Global Land Cover Facility offers, amongst many other data sets, the MODIS Vegetation Continuous Fields data set for download. These are layers that contain proportional estimates for vegetative cover types (woody vegetation, herbaceous vegetation, and bare ground). As such they are very suitable depict areas of heterogeneous land cover.

Their MODIS products differ from DAAC editions by coming in GeoTIFF format, geographic coordinates, WGS84 datum, and a tiling system designed to fit well with Landsat imagery. Currently the collection 5 is available, which contains proportional estimates for woody cover vegetation for the years 2000 to 2010. It can be downloaded as tiles (195 in total) via a ftp server.

Below I’ll provide an example Continue reading “Importing GLCF MODIS woody plant cover”