I do have a raster which shows 13 rows and 16 columns when viewing it with Windows Viewer and also when using imread for loading it into python.

I want to work with my dataset in GRASS. My steps:

    r.import input=RGI60-11.00083.tif output=RGI60 --overwrite
    g.region --overwrite raster=RGI60

However, when I now look at the raster in the Map Display, the raster has 12 rows and 22 columns. It seems that every third column is repeated. I loaded the tiff file to ArcMap, and it displayed correctly. I therefore think I might be having a problem with my grass configuration, but I am unable to find any configuration variable that might be causing this.

Sample data can be downloaded from here:
Folder to download: composite_thickness_RGI60-18.zip
And then the first image: RGI60-18.00001_thickness.tif

How could I fix this problem?

enter image description here


I downloaded a zipfile and checked one of the rasters with gdalinfo:

micha@RMS RGI60-18 $ gdalinfo RGI60-18.00001_thickness.tif 
Driver: GTiff/GeoTIFF
Files: RGI60-18.00001_thickness.tif
Size is 13, 13
Coordinate System is:
PROJCS["WGS 84 / UTM zone 60S",

The raster size is reported as 13x13 and the coordinate system is UTM60S, So I created a new GRASS location using the Geotiff as follows:

grass -c RGI60-18.00001_thickness.tif ./UTM60S/

The -c says "create a location based on the georeferenced file RGI60-18.00001.tif", and place the GRASS database and location in the ./UTM60S directory.

Now I imported the Geotiff and set the computation region to match:

r.in.gdal RGI60-18.00001_thickness.tif output=RGI6018
micha@RMS RGI60-18 $ g.region -ap rast=RGI6018
projection: 1 (UTM)
zone:       -60
datum:      wgs84
ellipsoid:  wgs84
north:      5651812.5
south:      5651487.5
west:       374637.5
east:       374962.5
nsres:      25
ewres:      25
rows:       13
cols:       13
cells:      169

Note the -a flag ("align") to g.region. Again 13x13 pixels

One further check:

micha@RMS RGI60-18 $ r.info RGI6018
 | Map:      RGI6018                        Date: Tue Jul  9 10:13:28 2019    |
 | Mapset:   PERMANENT                      Login of Creator: micha           |
 | Location: test                                                             |
 | DataBase: /home/micha/work/tmp/RGI60-18/UTM60S                             |
 | Title:                                                                     |
 | Timestamp: none                                                            |
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 0               |
 |   Data Type:    FCELL                                                      |
 |   Rows:         13                                                         |
 |   Columns:      13                                                         |
 |   Total Cells:  169                                                        |
 |        Projection: UTM (zone -60)                                          |
 |            N:  5651812.5    S:  5651487.5   Res:    25                     |
 |            E:   374962.5    W:   374637.5   Res:    25                     |
 |   Range of data:    min = 0  max = 35.92583                                |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.in.gdal                                                  |
 |                                                                            |
 |   Comments:                                                                |
 |    r.in.gdal input="RGI60-18.00001_thickness.tif" output="RGI6018" memo\   |
 |    ry=300 offset=0 num_digits=0                                            |
 |                                                                            |

Again 13x13 pixels, with values from 0 to 35.9. As far as I can see, everything is fine. The pixels that are colored purple have value 0. (I would note that what you see in the Windows Viewer is irrelevant here)

  • Creating a new location with the tiff coordinates solved my problem. – Iced_ Jul 9 '19 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.