0

I imported a raster file (tif) into the GRASS GIS program using r.import and later r.in.gdal (every time the same problem).

Raster map statistics showed:

(Wed May 20 20:11:59 2020)                                                    
r.univar map=rasterData                                                   
total null and non-null cells: 1
total null cells: 1
Of the non-null cells:
----------------------
n: 0
minimum: nan
maximum: nan
range: nan
mean: nan
mean of absolute values: nan
standard deviation: nan
variance: nan
variation coefficient: nan %
sum: nan
(Wed May 20 20:11:59 2020) Polecenie zakończone (0 sec)

Below is my tiff file

https://www.dropbox.com/s/og6vujxsh508zz2/data.tif?dl=0

There is no problem with importing the file to ArcGIS and performing operations on it, but I want to use GRASS because of the mcda plugins e.g r.mcda.topsis.
https://github.com/OSGeo/grass-addons/tree/master/grass7/raster/r.mcda.topsis

When I run plugins with such imported layers I get an error:

Niewłaściwa mapa nan 
Parse error 
ERROR: parse error 
ERROR: An error occurred while running r.mapcalc with expression: _rasterData=(rasterData/sqrt(nan))*0.6

I guess it's related to nan values ​​in statistics. Error is connected with standardizedNormalizedMatrix method of plugin. Source code is in the link above.

After importing to GRASS GIS, the raster is displayed correctly. Has anyone encountered such or similar problem or could look what is wrong with these tif files? Maybe some additional transformations are needed?

1

You skipped the crucial stage of setting the computational region. Always precede every raster operation with g.region...

Here's my result:

# Import raster
micha@tp480:Downloads$ r.import rasterData.tif output=r
Importing raster map <r>...
 100%

# Always begin by setting region
micha@tp480:Downloads$ g.region -ap rast=r
projection: 99 (ETRS_1989_Poland_CS92)
zone:       0
datum:      etrs89
ellipsoid:  grs80
north:      775166.73
south:      138666.73
west:       171778.59
east:       851278.59
nsres:      500
ewres:      500
rows:       1273
cols:       1359
cells:      1730007

# Univariate stats
micha@tp480:Downloads$ r.univar r
 100%
total null and non-null cells: 1730007
total null cells: 0

Of the non-null cells:
----------------------
n: 1730007
minimum: 0
maximum: 255
range: 255
mean: 15.3758
mean of absolute values: 15.3758
standard deviation: 60.6995
variance: 3684.42
variation coefficient: 394.771 %
sum: 26600325
1

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.